In lexer, always prefer the longest match

Only use rules' precedence to decide between two tokens
that match the same string
This commit is contained in:
Max Brunsfeld 2014-07-03 08:57:35 -07:00
parent c85841364e
commit 77df7fe511
5 changed files with 252 additions and 43 deletions

View file

@ -81,3 +81,11 @@ var thing = {
(comment)
(expression_statement (function_call (identifier)))))))))
==========================================
parses comments within expressions
==========================================
y // comment
* z;
---
(program
(expression_statement (math_op (expression (identifier) (comment)) (identifier))))