! Copyright (C) 2008 Chris Double.
! See http://factorcode.org/license.txt for BSD license.
-USING: kernel tools.test peg.javascript peg.javascript.ast ;
+USING: accessors kernel math peg peg.ebnf peg.ebnf.private
+peg.javascript peg.javascript.private sequences tools.test ;
{
V{
End = !(.)
Space = [ \t\r\n]
Spaces = Space* => [[ ignore ]]
-Comment = "/*" [^*/]* "*/" => [[ ignore ]]
Name = . ?[ ast-name? ]? => [[ value>> ]]
Number = . ?[ ast-number? ]?
String = . ?[ ast-string? ]?
Binding = Name:n "=" Expr:v => [[ n v ast-var boa ]]
| Name:n => [[ n "undefined" ast-get boa ast-var boa ]]
Block = "{" SrcElems:ss "}" => [[ ss ]]
-Bindings = (Binding ("," Binding => [[ second ]])* => [[ first2 swap prefix ]])?
+Bindings = (Binding (","~ Binding)* => [[ first2 swap prefix ]])?
For1 = "var" Bindings => [[ second ]]
| ExprNoIn
| Spaces => [[ "undefined" ast-get boa ]]
SrcElem = "function" Name:n FuncRest:f => [[ n f ast-var boa ]]
| Stmt
SrcElems = SrcElem* => [[ ast-begin boa ]]
-TopLevel = SrcElems Spaces Comment
+TopLevel = SrcElems Spaces
]=]