From 400ba83e59ef77b68c5a415daadcd1548f2e58f6 Mon Sep 17 00:00:00 2001 From: Pearu Peterson Date: Mon, 23 Oct 2006 11:42:09 +0000 Subject: F2PY G3: Cont. implementing Fortran expression parser and unittests. --- numpy/f2py/lib/parser/pattern_tools.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'numpy/f2py/lib/parser/pattern_tools.py') diff --git a/numpy/f2py/lib/parser/pattern_tools.py b/numpy/f2py/lib/parser/pattern_tools.py index 4f6d8b990..0c08eab95 100644 --- a/numpy/f2py/lib/parser/pattern_tools.py +++ b/numpy/f2py/lib/parser/pattern_tools.py @@ -26,8 +26,8 @@ class Pattern: p1.named(name) -> match of has name p1.match(string) -> return string match with p1.flags() - p1.rsplit(..) - p1.lsplit(..) + p1.rsplit(..) -> split a string from the rightmost p1 occurrence + p1.lsplit(..) -> split a string from the leftmost p1 occurrence """ _special_symbol_map = {'.': '[.]', '*': '[*]', @@ -253,6 +253,7 @@ not_op = Pattern('','[.]NOT[.]',flags=re.I) and_op = Pattern('','[.]AND[.]',flags=re.I) or_op = Pattern('','[.]OR[.]',flags=re.I) equiv_op = Pattern('','[.](EQV|NEQV)[.]',flags=re.I) +percent_op = Pattern('',r'%',flags=re.I) intrinsic_operator = power_op | mult_op | add_op | concat_op | rel_op | not_op | and_op | or_op | equiv_op extended_intrinsic_operator = intrinsic_operator @@ -283,6 +284,9 @@ abs_binary_constant = abs(binary_constant) abs_octal_constant = abs(octal_constant) abs_hex_constant = abs(hex_constant) +intrinsic_type_name = Pattern('',r'(INTEGER|REAL|COMPLEX|LOGICAL|CHARACTER|DOUBLE\s*COMPLEX|DOUBLE\s*PRECISION|BYTE)',flags=re.I) +abs_intrinsic_type_name = abs(intrinsic_type_name) + def _test(): assert name.match('a1_a') assert abs(name).match('a1_a') -- cgit v1.2.1