tree-sitter/spec/runtime/languages/javascript/operators.txt

32 lines
No EOL
910 B
Text

==========================================
parses ternary expressions
==========================================
print(isDone() ? stuff : otherStuff);
---
(program (expression_statement
(function_call
(identifier)
(ternary (function_call (identifier)) (identifier) (identifier)))))
==========================================
parses mathematical operators
==========================================
a + b * c - d / e
---
(program (expression_statement
(math_op
(identifier)
(math_op
(math_op (identifier) (identifier))
(math_op (identifier) (identifier))))))
==========================================
parses boolean operators
=========================================
!a || !(b && c)
---
(program (expression_statement
(bool_op
(bool_op (identifier))
(bool_op
(expression (bool_op (identifier) (identifier)))))))