Fix bug in javascript automatic semicolon insertion rule
parent
d58a085598
commit
d5e5e47944
|
@ -35,3 +35,14 @@ function foldl(f, initial, seq) {
|
|||
}
|
||||
"> tokenizer ast>> javascript remaining>> length zero?
|
||||
] unit-test
|
||||
|
||||
{ t } [
|
||||
<"
|
||||
ParseState.prototype.from = function(index) {
|
||||
var r = new ParseState(this.input, this.index + index);
|
||||
r.cache = this.cache;
|
||||
r.length = this.length - index;
|
||||
return r;
|
||||
}
|
||||
"> tokenizer ast>> javascript remaining>> length zero?
|
||||
] unit-test
|
||||
|
|
|
@ -7,6 +7,7 @@ IN: peg.javascript.parser
|
|||
#! http://jarrett.cs.ucla.edu/ometa-js/#JavaScript_Compiler
|
||||
|
||||
EBNF: javascript
|
||||
End = !(.)
|
||||
Space = " " | "\t" | "\n"
|
||||
Spaces = Space* => [[ ignore ]]
|
||||
Name = . ?[ ast-name? ]? => [[ value>> ]]
|
||||
|
@ -78,7 +79,7 @@ JsonPropName = Name | Number | String
|
|||
Formal = Spaces Name
|
||||
Formals = (Formal ("," Formal => [[ second ]])* => [[ first2 swap prefix ]])?
|
||||
FuncRest = "(" Formals:fs ")" "{" SrcElems:body "}" => [[ fs body ast-func boa ]]
|
||||
Sc = SpacesNoNl ("\n" | &("}"))| ";"
|
||||
Sc = SpacesNoNl ("\n" | &("}") | End)| ";"
|
||||
Binding = Name:n "=" Expr:v => [[ n v ast-var boa ]]
|
||||
| Name:n => [[ n "undefined" ast-get boa ast-var boa ]]
|
||||
Block = "{" SrcElems:ss "}" => [[ ss ]]
|
||||
|
|
Loading…
Reference in New Issue