[Mumps2Py:] [167] tweaked some regular expressions to handle tabs as whitespace and semi-colon (begin-comment) as a command/expression delimiter |
[ Thread Index |
Date Index
| More lists.mumps2py.org/discuss Archives
]
- To: discuss@xxxxxxxxxxxxxxxxxx
- Subject: [Mumps2Py:] [167] tweaked some regular expressions to handle tabs as whitespace and semi-colon (begin-comment) as a command/expression delimiter
- From: subversion@xxxxxxxxxxxxx
- Date: Tue, 11 Mar 2008 14:37:12 +0100
Revision: 167
Author: pgallot
Date: 2008-03-11 13:37:12 +0000 (Tue, 11 Mar 2008)
Log Message:
-----------
tweaked some regular expressions to handle tabs as whitespace and semi-colon (begin-comment) as a command/expression delimiter
Modified Paths:
--------------
trunk/mumps2py/mumps2tok.py
Modified: trunk/mumps2py/mumps2tok.py
===================================================================
--- trunk/mumps2py/mumps2tok.py 2008-03-10 19:29:25 UTC (rev 166)
+++ trunk/mumps2py/mumps2tok.py 2008-03-11 13:37:12 UTC (rev 167)
@@ -61,10 +61,10 @@
"subexpr":re.compile(r"[(]"),
"command":re.compile(r"(?P<indents>(\s|[.])*)(?P<cmd>[A-Za-z]+)"),
"label":re.compile(r"^(\^)?[%a-zA-Z0-9][A-Za-z0-9]*"),
- "comment":re.compile(r"[ ]*?[ .]*?(?P<comment>[;]+.*)"),
+ "comment":re.compile(r"\s*?[ .]*?(?P<comment>[;]+.*)"),
"emptyline":re.compile(r"[ .]*\s*$"),
- "cmd":re.compile(r"(\s|[.])*([A-Za-z]+\w*?(?:[ :]|\s*$))"),
- "cmdEnd":re.compile(r"[ ;]|\s*$")
+ "cmd":re.compile(r"(\s|[.])*([A-Za-z]+\w*?(?:[:]|\s+|$))"),
+ "cmdEnd":re.compile(r"\s|[;]|\s*$")
}
def consume_actuallist(line, pos):
@@ -463,15 +463,15 @@
pos += 1
elif line[pos] == '?':
sub_token = Token(FCC_MOV, pos)
- offset = parse_expr(line, pos + 1, r"([, ]|\s*$)")
+ offset = parse_expr(line, pos + 1, r"([;, ]|\s*$)")
sub_token.offset = offset
pos = offset.end
elif line[pos] == '*':
sub_token = Token(FCC_CHARVAL, pos)
- val = sub_token.val = parse_expr(line, pos + 1, r"([, ]|\s*$)")
+ val = sub_token.val = parse_expr(line, pos + 1, r"([;, ]|\s*$)")
pos = val.end
else:
- sub_token = parse_expr(line, pos, r"([, ]|\s*$)")
+ sub_token = parse_expr(line, pos, r"([;, ]|\s*$)")
pos = sub_token.end
if line[pos] == ',':
pos += 1
@@ -1077,9 +1077,8 @@
try:
#mods = parse_for_routines("../testfiles/vista.m2p", "./out")
#mods = parse_for_routines("../testfiles/fm22.m2p", "./out")
- #mods = parse_for_routines("c:/temp/famo.mrt", "./out")
mods = parse_for_routines("../testfiles/famo.m2p", "./out")
- #parsemodule(mods,"ZTMB")
+ #parsemodule(mods,"%YGE4")
for the_module in mods:
print the_module.mod_name
parse_routine(the_module)