Fix operator precedence of '.' operator in js grammar
This commit is contained in:
parent
3cd031af38
commit
082560dd6e
5 changed files with 198 additions and 184 deletions
|
|
@ -100,6 +100,7 @@ parses indented code after blocks
|
|||
(expression_statement
|
||||
(function_expression (identifier) (formal_parameters) (statement_block)))
|
||||
(return_statement (identifier)))
|
||||
|
||||
===========================================
|
||||
parses switch statements
|
||||
===========================================
|
||||
|
|
@ -126,3 +127,4 @@ switch(x) {
|
|||
(break_statement))
|
||||
(switch_case
|
||||
(expression_statement (function_call (identifier) (string))))))
|
||||
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ _.each = _.forEach = function(obj, iterator, context) {
|
|||
(statement_block
|
||||
(if_statement (bool_op (identifier) (null)) (return_statement (identifier)))
|
||||
(if_statement
|
||||
(property_access (bool_op (property_access (identifier) (identifier)) (identifier)) (identifier))
|
||||
(bool_op (property_access (identifier) (identifier)) (property_access (identifier) (identifier)))
|
||||
(statement_block
|
||||
(for_statement
|
||||
(var_declaration (assignment (identifier) (number)))
|
||||
|
|
|
|||
|
|
@ -46,4 +46,16 @@ parses the 'in' operator
|
|||
===========================================
|
||||
print(x in y)
|
||||
---
|
||||
(program (expression_statement (function_call (identifier) (in_expression (identifier) (identifier)))))
|
||||
(program (expression_statement (function_call
|
||||
(identifier)
|
||||
(in_expression (identifier) (identifier)))))
|
||||
|
||||
============================================
|
||||
parses property access and operators
|
||||
============================================
|
||||
print(x.y.z && a.b.c)
|
||||
---
|
||||
(program (expression_statement (function_call (identifier)
|
||||
(bool_op
|
||||
(property_access (property_access (identifier) (identifier)) (identifier))
|
||||
(property_access (property_access (identifier) (identifier)) (identifier))))))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue