Rework javascript fixture grammar
This commit is contained in:
parent
8134b64d00
commit
91cf35b72c
7 changed files with 55530 additions and 90492 deletions
|
|
@ -7,8 +7,8 @@ x.theMethod(5, 6);
|
|||
---
|
||||
|
||||
(expression_statement (function_call
|
||||
(property_access (identifier) (identifier))
|
||||
(number) (number)))
|
||||
(member_access (identifier) (identifier))
|
||||
(arguments (number) (number))))
|
||||
|
||||
==========================================
|
||||
constructor calls
|
||||
|
|
@ -20,9 +20,9 @@ var x = new Node(5, new Node(3, null));
|
|||
|
||||
(var_declaration (var_assignment
|
||||
(identifier)
|
||||
(constructor_call (function_call (identifier)
|
||||
(constructor_call (identifier) (arguments
|
||||
(number)
|
||||
(constructor_call (function_call (identifier)
|
||||
(constructor_call (identifier) (arguments
|
||||
(number)
|
||||
(null)))))))
|
||||
|
||||
|
|
@ -37,11 +37,11 @@ print(object.property);
|
|||
|
||||
(program
|
||||
(expression_statement (assignment
|
||||
(property_access (identifier) (identifier))
|
||||
(member_access (identifier) (identifier))
|
||||
(string)))
|
||||
(expression_statement (function_call
|
||||
(identifier)
|
||||
(property_access (identifier) (identifier)))))
|
||||
(member_access (identifier) (identifier)))))
|
||||
|
||||
==========================================
|
||||
property access across lines
|
||||
|
|
@ -54,8 +54,8 @@ object
|
|||
---
|
||||
|
||||
(expression_statement
|
||||
(property_access
|
||||
(property_access (identifier) (identifier))
|
||||
(member_access
|
||||
(member_access (identifier) (identifier))
|
||||
(identifier)))
|
||||
|
||||
===========================================
|
||||
|
|
@ -68,11 +68,11 @@ print(object[propertyName()]);
|
|||
---
|
||||
(program
|
||||
(expression_statement (assignment
|
||||
(property_access (identifier) (function_call (identifier)))
|
||||
(subscript_access (identifier) (function_call (identifier)))
|
||||
(function_call (identifier))))
|
||||
(expression_statement (function_call
|
||||
(identifier)
|
||||
(property_access (identifier) (function_call (identifier))))))
|
||||
(subscript_access (identifier) (function_call (identifier))))))
|
||||
|
||||
==========================================
|
||||
ternary expressions
|
||||
|
|
@ -91,7 +91,7 @@ print(isDone() ? stuff : otherStuff);
|
|||
mathematical operators
|
||||
==========================================
|
||||
|
||||
-a + b * c - d / +e
|
||||
a++ + b * c - d / e--
|
||||
|
||||
---
|
||||
(expression_statement
|
||||
|
|
@ -119,14 +119,14 @@ boolean operators
|
|||
type operators
|
||||
===========================================
|
||||
|
||||
print((x instanceof Array) || (typeof x == "string"))
|
||||
print((x instanceof Array) || (typeof x === "string"))
|
||||
|
||||
---
|
||||
|
||||
(expression_statement (function_call (identifier)
|
||||
(bool_op
|
||||
(expression (instanceof_expression (identifier) (identifier)))
|
||||
(expression (typeof_expression (bool_op (identifier) (string)))))))
|
||||
(expression (type_op (identifier) (identifier)))
|
||||
(expression (rel_op (type_op (identifier)) (string))))))
|
||||
|
||||
============================================
|
||||
the 'in' operator
|
||||
|
|
@ -137,7 +137,7 @@ print(x in y)
|
|||
---
|
||||
(expression_statement (function_call
|
||||
(identifier)
|
||||
(in_expression (identifier) (identifier))))
|
||||
(type_op (identifier) (identifier))))
|
||||
|
||||
============================================
|
||||
assignment operators
|
||||
|
|
@ -151,10 +151,10 @@ x /= 2;
|
|||
---
|
||||
|
||||
(program
|
||||
(expression_statement (assignment (identifier) (number)))
|
||||
(expression_statement (assignment (identifier) (number)))
|
||||
(expression_statement (assignment (identifier) (number)))
|
||||
(expression_statement (assignment (identifier) (number))))
|
||||
(expression_statement (math_assignment (identifier) (number)))
|
||||
(expression_statement (math_assignment (identifier) (number)))
|
||||
(expression_statement (math_assignment (identifier) (number)))
|
||||
(expression_statement (math_assignment (identifier) (number))))
|
||||
|
||||
============================================
|
||||
property access and operators
|
||||
|
|
@ -166,5 +166,5 @@ print(x.y.z && a.b.c)
|
|||
|
||||
(expression_statement (function_call (identifier)
|
||||
(bool_op
|
||||
(property_access (property_access (identifier) (identifier)) (identifier))
|
||||
(property_access (property_access (identifier) (identifier)) (identifier)))))
|
||||
(member_access (member_access (identifier) (identifier)) (identifier))
|
||||
(member_access (member_access (identifier) (identifier)) (identifier)))))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue