parse multiline
This commit is contained in:
parent
05c6088a09
commit
d4a3328f24
1 changed files with 4 additions and 5 deletions
|
|
@ -15,7 +15,9 @@ except NameError:
|
|||
calc_grammar = """
|
||||
?varlist: "[" [NAME ("," NAME)*] "]"
|
||||
|
||||
?start: NAME "=" sum -> assign_var
|
||||
?start: statement*
|
||||
|
||||
?statement: NAME "=" sum -> assign_var
|
||||
| NAME "=" avg -> assign_avg_var
|
||||
| varlist
|
||||
|
||||
|
|
@ -314,10 +316,7 @@ def test():
|
|||
mod_form = template_file.read()
|
||||
|
||||
with open("terms.input") as inputfile:
|
||||
for line in inputfile:
|
||||
if len(line.strip()) > 0:
|
||||
(calc(line))
|
||||
|
||||
(calc(inputfile.read()))
|
||||
|
||||
print mod_form.format(tf.module_dict())
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue