allowing terminator/comment as a block, so that you can have comment-only blocks
This commit is contained in:
parent
ccb7f63b8a
commit
2a47727641
|
@ -75,6 +75,8 @@
|
|||
return $2;
|
||||
}), o("INDENT OUTDENT", function() {
|
||||
return new Expressions();
|
||||
}), o("TERMINATOR Comment", function() {
|
||||
return Expressions.wrap([$2]);
|
||||
})
|
||||
],
|
||||
// A literal identifier, a variable name or property.
|
||||
|
|
302
lib/parser.js
302
lib/parser.js
File diff suppressed because one or more lines are too long
|
@ -98,6 +98,7 @@ grammar: {
|
|||
Block: [
|
||||
o "INDENT Expressions OUTDENT", -> $2
|
||||
o "INDENT OUTDENT", -> new Expressions()
|
||||
o "TERMINATOR Comment", -> Expressions.wrap [$2]
|
||||
]
|
||||
|
||||
# A literal identifier, a variable name or property.
|
||||
|
|
|
@ -24,3 +24,14 @@ else
|
|||
true
|
||||
|
||||
ok result
|
||||
|
||||
|
||||
# If statement with a comment-only clause.
|
||||
|
||||
|
||||
result: if false
|
||||
# comment
|
||||
else
|
||||
27
|
||||
|
||||
ok result is 27
|
||||
|
|
Loading…
Reference in New Issue