Fix operator precedence of '.' operator in js grammar

This commit is contained in:
Max Brunsfeld 2014-06-11 14:01:38 -07:00
parent 3cd031af38
commit 082560dd6e
5 changed files with 198 additions and 184 deletions

View file

@ -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))))))

View file

@ -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)))

View file

@ -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))))))