first draft of parsing and printing along comments -- unfortunately, not yet working within objects and arrays

This commit is contained in:
Jeremy Ashkenas
2009-12-22 11:27:19 -05:00
parent d45643c527
commit 65809d08f6
8 changed files with 61 additions and 23 deletions

View File

@@ -13,6 +13,7 @@ token SWITCH CASE
token EXTENDS SUPER
token DELETE
token NEWLINE
token COMMENT
token JS
# Declare order of operations.
@@ -81,6 +82,7 @@ rule
| While
| For
| Switch
| Comment
;
# All tokens that can terminate an expression.
@@ -123,6 +125,11 @@ rule
RETURN Expression { result = ReturnNode.new(val[1]) }
;
# A comment.
Comment:
COMMENT { result = CommentNode.new(val[0]) }
;
# Arithmetic and logical operators
# For Ruby's Operator precedence, see:
# https://www.cs.auckland.ac.nz/references/ruby/ProgrammingRuby/language.html