fixed whitespace/comment parse issues

This commit is contained in:
leaf corcoran 2011-07-16 22:02:09 -07:00
parent 44b5517a54
commit 05c891a28f
2 changed files with 3 additions and 3 deletions

View File

@ -242,7 +242,7 @@ local build_grammar = wrap(function()
File,
File = Block + Ct"",
Block = Ct(Line * (Break^1 * Line)^0),
Line = Cmt(Indent, check_indent) * Statement + _Space * Comment,
Line = Cmt(Indent, check_indent) * Statement + Space * #Break,
Statement = (Import + While + With + For + ForEach + Return
+ ClassDecl + Export + BreakLoop + Ct(ExpList) / flatten_or_mark"explist" * Space) * (
@ -251,7 +251,8 @@ local build_grammar = wrap(function()
CompInner / mark"comprehension"
)^-1 / wrap_decorator,
Body = Break * InBlock + Ct(Statement),
EmptyLine = Space * Break,
Body = Break * EmptyLine^0 * InBlock + Ct(Statement),
InBlock = #Cmt(Indent, advance_indent) * Block * OutBlock,
OutBlock = Cmt("", pop_indent),

1
todo
View File

@ -6,7 +6,6 @@
- class expressions, x = class extends Hello do new: => print "hello"
* issues with whitespace on the end of lines
* multiline comments
* table slices (almost)
* add continue keyword (ouch)