2014-04-23 22:07:44 -07:00
|
|
|
==========================================
|
|
|
|
|
parses ternary expressions
|
|
|
|
|
==========================================
|
|
|
|
|
print(isDone() ? stuff : otherStuff);
|
|
|
|
|
---
|
|
|
|
|
(program (expression_statement
|
|
|
|
|
(function_call
|
|
|
|
|
(identifier)
|
|
|
|
|
(ternary (function_call (identifier)) (identifier) (identifier)))))
|
2014-04-23 22:25:48 -07:00
|
|
|
|
|
|
|
|
==========================================
|
|
|
|
|
parses mathematical operators
|
|
|
|
|
==========================================
|
|
|
|
|
a + b * c - d / e
|
|
|
|
|
---
|
|
|
|
|
(program (expression_statement
|
|
|
|
|
(math_op
|
|
|
|
|
(identifier)
|
|
|
|
|
(math_op
|
|
|
|
|
(math_op (identifier) (identifier))
|
|
|
|
|
(math_op (identifier) (identifier))))))
|