Parse more valid JavaScript
parent
87bbe8cae1
commit
8f718fa41e
|
@ -40,6 +40,12 @@ Expr = OrExpr:e "?" Expr:t ":" Expr:f => [[ e t f ast-cond-exp
|
||||||
| OrExpr:e "%=" Expr:rhs => [[ e rhs "%" ast-mset boa ]]
|
| OrExpr:e "%=" Expr:rhs => [[ e rhs "%" ast-mset boa ]]
|
||||||
| OrExpr:e "&&=" Expr:rhs => [[ e rhs "&&" ast-mset boa ]]
|
| OrExpr:e "&&=" Expr:rhs => [[ e rhs "&&" ast-mset boa ]]
|
||||||
| OrExpr:e "||=" Expr:rhs => [[ e rhs "||" ast-mset boa ]]
|
| OrExpr:e "||=" Expr:rhs => [[ e rhs "||" ast-mset boa ]]
|
||||||
|
| OrExpr:e "^=" Expr:rhs => [[ e rhs "^" ast-mset boa ]]
|
||||||
|
| OrExpr:e "&=" Expr:rhs => [[ e rhs "&" ast-mset boa ]]
|
||||||
|
| OrExpr:e "|=" Expr:rhs => [[ e rhs "|" ast-mset boa ]]
|
||||||
|
| OrExpr:e "<<=" Expr:rhs => [[ e rhs "<<" ast-mset boa ]]
|
||||||
|
| OrExpr:e ">>=" Expr:rhs => [[ e rhs ">>" ast-mset boa ]]
|
||||||
|
| OrExpr:e ">>>=" Expr:rhs => [[ e rhs ">>>" ast-mset boa ]]
|
||||||
| OrExpr:e => [[ e ]]
|
| OrExpr:e => [[ e ]]
|
||||||
|
|
||||||
ExprNoIn = OrExprNoIn:e "?" ExprNoIn:t ":" ExprNoIn:f => [[ e t f ast-cond-expr boa ]]
|
ExprNoIn = OrExprNoIn:e "?" ExprNoIn:t ":" ExprNoIn:f => [[ e t f ast-cond-expr boa ]]
|
||||||
|
@ -51,15 +57,33 @@ ExprNoIn = OrExprNoIn:e "?" ExprNoIn:t ":" ExprNoIn:f => [[ e t f as
|
||||||
| OrExprNoIn:e "%=" ExprNoIn:rhs => [[ e rhs "%" ast-mset boa ]]
|
| OrExprNoIn:e "%=" ExprNoIn:rhs => [[ e rhs "%" ast-mset boa ]]
|
||||||
| OrExprNoIn:e "&&=" ExprNoIn:rhs => [[ e rhs "&&" ast-mset boa ]]
|
| OrExprNoIn:e "&&=" ExprNoIn:rhs => [[ e rhs "&&" ast-mset boa ]]
|
||||||
| OrExprNoIn:e "||=" ExprNoIn:rhs => [[ e rhs "||" ast-mset boa ]]
|
| OrExprNoIn:e "||=" ExprNoIn:rhs => [[ e rhs "||" ast-mset boa ]]
|
||||||
|
| OrExprNoIn:e "^=" ExprNoIn:rhs => [[ e rhs "^" ast-mset boa ]]
|
||||||
|
| OrExprNoIn:e "&=" ExprNoIn:rhs => [[ e rhs "&" ast-mset boa ]]
|
||||||
|
| OrExprNoIn:e "|=" ExprNoIn:rhs => [[ e rhs "|" ast-mset boa ]]
|
||||||
|
| OrExprNoIn:e "<<=" ExprNoIn:rhs => [[ e rhs "<<" ast-mset boa ]]
|
||||||
|
| OrExprNoIn:e ">>=" ExprNoIn:rhs => [[ e rhs ">>" ast-mset boa ]]
|
||||||
|
| OrExprNoIn:e ">>>=" ExprNoIn:rhs => [[ e rhs ">>>" ast-mset boa ]]
|
||||||
| OrExprNoIn:e => [[ e ]]
|
| OrExprNoIn:e => [[ e ]]
|
||||||
|
|
||||||
OrExpr = OrExpr:x "||" AndExpr:y => [[ x y "||" ast-binop boa ]]
|
OrExpr = OrExpr:x "||" AndExpr:y => [[ x y "||" ast-binop boa ]]
|
||||||
| AndExpr
|
| AndExpr
|
||||||
OrExprNoIn = OrExprNoIn:x "||" AndExprNoIn:y => [[ x y "||" ast-binop boa ]]
|
OrExprNoIn = OrExprNoIn:x "||" AndExprNoIn:y => [[ x y "||" ast-binop boa ]]
|
||||||
| AndExprNoIn
|
| AndExprNoIn
|
||||||
AndExpr = AndExpr:x "&&" EqExpr:y => [[ x y "&&" ast-binop boa ]]
|
AndExpr = AndExpr:x "&&" BitOrExpr:y => [[ x y "&&" ast-binop boa ]]
|
||||||
|
| BitOrExpr
|
||||||
|
AndExprNoIn = AndExprNoIn:x "&&" BitOrExprNoIn:y => [[ x y "&&" ast-binop boa ]]
|
||||||
|
| BitOrExprNoIn
|
||||||
|
BitOrExpr = BitOrExpr:x "|" BitXORExpr:y => [[ x y "|" ast-binop boa ]]
|
||||||
|
| BitXORExpr
|
||||||
|
BitOrExprNoIn = BitOrExprNoIn:x "|" BitXORExprNoIn:y => [[ x y "|" ast-binop boa ]]
|
||||||
|
| BitXORExprNoIn
|
||||||
|
BitXORExpr = BitXORExpr:x "^" BitANDExpr:y => [[ x y "^" ast-binop boa ]]
|
||||||
|
| BitANDExpr
|
||||||
|
BitXORExprNoIn = BitXORExprNoIn:x "^" BitANDExprNoIn:y => [[ x y "^" ast-binop boa ]]
|
||||||
|
| BitANDExprNoIn
|
||||||
|
BitANDExpr = BitANDExpr:x "&" EqExpr:y => [[ x y "&" ast-binop boa ]]
|
||||||
| EqExpr
|
| EqExpr
|
||||||
AndExprNoIn = AndExprNoIn:x "&&" EqExprNoIn:y => [[ x y "&&" ast-binop boa ]]
|
BitANDExprNoIn = BitANDExprNoIn:x "&" EqExprNoIn:y => [[ x y "&" ast-binop boa ]]
|
||||||
| EqExprNoIn
|
| EqExprNoIn
|
||||||
EqExpr = EqExpr:x "==" RelExpr:y => [[ x y "==" ast-binop boa ]]
|
EqExpr = EqExpr:x "==" RelExpr:y => [[ x y "==" ast-binop boa ]]
|
||||||
| EqExpr:x "!=" RelExpr:y => [[ x y "!=" ast-binop boa ]]
|
| EqExpr:x "!=" RelExpr:y => [[ x y "!=" ast-binop boa ]]
|
||||||
|
|
|
@ -67,11 +67,13 @@ RegExpChar = !("\\" | "/") NonTerminator
|
||||||
RegExpChars = RegExpChar*
|
RegExpChars = RegExpChar*
|
||||||
RegExpBody = RegExpFirstChar RegExpChars => [[ first2 swap prefix >string ]]
|
RegExpBody = RegExpFirstChar RegExpChars => [[ first2 swap prefix >string ]]
|
||||||
RegExp = "/" RegExpBody:b "/" RegExpFlags:fl => [[ b fl ast-regexp boa ]]
|
RegExp = "/" RegExpBody:b "/" RegExpFlags:fl => [[ b fl ast-regexp boa ]]
|
||||||
Special = "(" | ")" | "{" | "}" | "[" | "]" | "," | ";"
|
Special = "(" | ")" | "{" | "}" | "[" | "]" | "," | ";"
|
||||||
| "?" | ":" | "!==" | "!=" | "===" | "==" | "=" | ">="
|
| "?" | ":" | "!==" | "!=" | "===" | "==" | "=" | ">="
|
||||||
| ">>>" | ">>" | ">" | "<=" | "<<" | "<" | "++" | "+="
|
| ">>>=" | ">>>" | ">>=" | ">>" | ">" | "<=" | "<<=" | "<<"
|
||||||
| "+" | "--" | "-=" | "-" | "*=" | "*" | "/=" | "/"
|
| "<" | "++" | "+=" | "+" | "--" | "-=" | "-" | "*="
|
||||||
| "%=" | "%" | "&&=" | "&&" | "||=" | "||" | "." | "!"
|
| "*" | "/=" | "/" | "%=" | "%" | "&&=" | "&&" | "||="
|
||||||
|
| "||" | "." | "!" | "&=" | "&" | "|=" | "|" | "^="
|
||||||
|
| "^"
|
||||||
Tok = Spaces (Name | Keyword | Number | Str | RegExp | Special )
|
Tok = Spaces (Name | Keyword | Number | Str | RegExp | Special )
|
||||||
Toks = Tok* Spaces
|
Toks = Tok* Spaces
|
||||||
;EBNF
|
;EBNF
|
||||||
|
|
Loading…
Reference in New Issue