Issue 34 in f2py: [patch] Fix some regular expressions

3 views
Skip to first unread message

f2...@googlecode.com

unread,
Jan 27, 2012, 9:40:13 AM1/27/12
to f2py-...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 34 by james.ke...@gmail.com: [patch] Fix some regular expressions
http://code.google.com/p/f2py/issues/detail?id=34

This patch fixes assignments to variables named "type" or "entry" for which
were misinterpreted as TypeDecl constructs and Entry statements, by adding
a negative lookahead for "=" to the regexps, and corrects a typo in
ForallConstruct ("forar" -> "forall)

diff -r 9958619dab6a -r c5b88e996b11 fparser/block_statements.py
--- a/fparser/block_statements.py Fri Jan 27 14:15:00 2012 +0000
+++ b/fparser/block_statements.py Fri Jan 27 14:26:10 2012 +0000
@@ -842,7 +842,7 @@
<forall-assignment-stmt> = <assignment-stmt> |
<pointer-assignment-stmt>
"""
end_stmt_cls = EndForall
- match = re.compile(r'forarr\s*\(.*\)\Z',re.I).match
+ match = re.compile(r'forall\s*\(.*\)\Z',re.I).match
name = ''
def process_item(self):
self.specs = self.item.get_line()[6:].lstrip()[1:-1].strip()
@@ -1035,7 +1035,7 @@
<type-attr-spec> = <access-spec> | EXTENDS ( <parent-type-name> )
| ABSTRACT | BIND(C)
"""
- match = re.compile(r'type\b\s*').match
+ match = re.compile(r'type\b(?!\s*=)').match
end_stmt_cls = EndType

a = AttributeHolder(extends = None,
diff -r 9958619dab6a -r c5b88e996b11 fparser/statements.py
--- a/fparser/statements.py Fri Jan 27 14:15:00 2012 +0000
+++ b/fparser/statements.py Fri Jan 27 14:26:10 2012 +0000
@@ -1364,7 +1364,7 @@
<language-binding-spec> = BIND ( C [ , NAME =
<scalar-char-initialization-expr> ] )
<dummy-arg> = <dummy-arg-name> | *
"""
- match = re.compile(r'entry\b', re.I).match
+ match = re.compile(r'entry\b(?!\s*[%=])', re.I).match
def process_item(self):
line = self.item.get_line()[5:].lstrip()
m = re.match(r'\w+', line)


Reply all
Reply to author
Forward
0 new messages