def testExpression
@use_around = false
ops = OperatorTable.new do |tbl|
tbl.infixl(plus, 20)
tbl.infixl(minus, 20)
tbl.infixl(mul, 40)
tbl.infixl(space_mul, 40)
tbl.infixl(div, 40)
tbl.prefix(negate, 60)
tbl.prefix(positive, 60)
tbl.postfix(increment, 50)
tbl.postfix(decrement, 50)
tbl.infixr(rdiv, 40)
end
expr = nil
term = int | char(?() >> lazy{expr} << char(?))
delim = whitespace.many_
expr = delim >> Expressions.build(term, ops, delim)
assertParser('1', 1, expr)
assertParser('1+2', 3, expr)
assertParser('(1-2)', -1, expr)
assertParser('2-3* 2', -4, expr)
assertParser("\n ((2-3 )*-+2--) ", 3, expr)
assertParser('((2-3 )*-+2--/2//2) ', 3, expr)
assertParser('((2-3 )*-+2--/2//2--) ', 1, expr)
assertParser('((2-3 )*-+2--//4//2) ', 2, expr)
assertParser('((2-3 )*-+2--/2/2) ', 0, expr)
end