Commit 52bdcae5 authored by eckhart's avatar eckhart
Browse files

- ArithmeticExample extended

parent fdfee1e6
......@@ -358,7 +358,7 @@ def grammar_unit(test_unit, parser_factory, transformer_factory, report=True, ve
# remove zombie node with error message at the end
for parent in st.select(lambda node: any(child.tag_name == ZOMBIE_TAG
for child in node.children),
include_root=True, reverse=True):
include_root=True, reverse=True):
parent.result = tuple(c for c in parent.children if c.tag_name != ZOMBIE_TAG)
break
return is_artifact
......
......@@ -31,7 +31,7 @@ sub = term "-" expression
#######################################################################
term = mul | div | factor
mul = factor ["*"] term
mul = factor "*" term
div = factor "/" term
......@@ -41,7 +41,25 @@ div = factor "/" term
#
#######################################################################
factor = [sign] ( NUMBER | VARIABLE | group )
factor = [sign] [element] tail
tail = seq | tail_elem
seq = tail_elem tail
#######################################################################
#
#: Elements
#
#######################################################################
element = pow | atom
pow = atom "^" pow
atom = NUMBER | VARIABLE | group
tail_elem = tail_pow | tail_atom
tail_pow = fragment "^" pow
tail_atom = VARIABLE | group
sign = PLUS | MINUS
group = "(" §expression ")"
......@@ -55,4 +73,4 @@ group = "(" §expression ")"
PLUS = /\+/
MINUS = /-/
NUMBER = /(?:0|(?:[1-9]\d*))(?:\.\d+)?/~
VARIABLE = /[A-Za-z]/~
VARIABLE = /[i-z]/~
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment