0001 
0002 /*
0003  *  Descripter 1.0 - Java Script Engines
0004  *  Copyright (C) 2010-2015  Jianjun Liu (J.J.Liu)
0005  *  
0006  *  This program is free software: you can redistribute it and/or modify
0007  *  it under the terms of the GNU Affero General Public License as published by
0008  *  the Free Software Foundation, either version 3 of the License, or
0009  *  (at your option) any later version.
0010  *  
0011  *  This program is distributed in the hope that it will be useful,
0012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
0013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0014  *  GNU Affero General Public License for more details.
0015  *  
0016  *  You should have received a copy of the GNU Affero General Public License
0017  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
0018  */
0019 
0020 options {
0021     BUILD_NODE_FILES = true;
0022     FORCE_LA_CHECK = false;
0023     JDK_VERSION = "1.6";
0024     JAVA_UNICODE_ESCAPE = true;
0025     UNICODE_INPUT = true;
0026     MULTI = true;
0027     NODE_CLASS = "AbstractNode";
0028     NODE_DEFAULT_VOID = true;
0029     NODE_PACKAGE = "org.descripter.js.parse";
0030     NODE_PREFIX = "ECMA";
0031     NODE_SCOPE_HOOK = true;
0032     NODE_USES_PARSER = true;
0033     STATIC = false;
0034     VISITOR = true;
0035     VISITOR_DATA_TYPE = "Object";
0036     VISITOR_RETURN_TYPE = "Object";
0037     VISITOR_EXCEPTION = "";
0038 }
0039 
0040 PARSER_BEGIN(JSParser)
0041 
0042 package org.descripter.js.parse;
0043 
0044 public class JSParser
0045 {
0046     void jjtreeOpenNodeScope(Node n) {
0047         ((AbstractNode)n).firstToken = getToken(1);
0048     }
0049 
0050     void jjtreeCloseNodeScope(Node n) {
0051         ((AbstractNode)n).lastToken = getToken(0);
0052     }
0053 }
0054 PARSER_END(JSParser)
0055 
0056 /*************************************
0057  * ECMAScript Language Specification *
0058  *************************************/
0059 
0060 /* ECMA-262 5.1 Edition / June 2011 - Section 7.2 : White Space */
0061 
0062 SPECIAL_TOKEN :
0063 {
0064     <TAB: "\u0009" | "\t" > /* TAB */
0065 |   <VT: "\u000B" >         /* Vertical Tab */
0066 |   <FF: "\u000C" | "\f">   /* Form Feed */
0067 |   <SP: "\u0020" | " " >   /* Space */
0068 |   <NBSP: "\u00A0" >       /* No-break space */
0069 |   <BOM: "\uFEFF" >        /* Byte Order Mark */
0070 |   <USP:                   /* Other Unicode space seperator */
0071         ["\u1680"] 
0072     |   ["\u180E"] 
0073     |   ["\u2000"] 
0074     |   ["\u2001"] 
0075     |   ["\u2002"] 
0076     |   ["\u2003"] 
0077     |   ["\u2004"] 
0078     |   ["\u2005"] 
0079     |   ["\u2006"] 
0080     |   ["\u2007"]
0081     |   ["\u2008"] 
0082     |   ["\u2009"] 
0083     |   ["\u200A"] 
0084     |   ["\u200B"]
0085     |   ["\u202F"]
0086     |   ["\u205F"]
0087     |   ["\u3000"]
0088     >
0089 }
0090 
0091 /* ECMA-262 5.1 Edition / June 2011 - Section 7.3 : Line Terminators */
0092 
0093 SPECIAL_TOKEN :
0094 {
0095     < LF: "\n" >     /* Line Feed */
0096 |   < CR: "\r" >     /* Carriage Return */
0097 |   < LS: "\u2028" > /* Line separator */
0098 |   < PS: "\u2029" > /* Paragraph separator */
0099 }
0100 
0101 /* ECMA-262 5.1 Edition / June 2011 - Section 7.4 : Comments */
0102 
0103 MORE :
0104 {
0105     "//" : IN_SINGLE_LINE_COMMENT
0106 |   "/*" : IN_MULTI_LINE_COMMENT
0107 }
0108 
0109 <IN_SINGLE_LINE_COMMENT> SPECIAL_TOKEN :
0110 {
0111     <SINGLE_LINE_COMMENT:
0112         (~["\n","\r","\u2028","\u2029"])* ("\n" | "\r" | "\r\n" | "\u2028" | "\u2029")?
0113     > : DEFAULT
0114 }
0115 
0116 <IN_MULTI_LINE_COMMENT> SPECIAL_TOKEN :
0117 {
0118     <MULTI_LINE_COMMENT: "*/" > : DEFAULT
0119 }
0120 
0121 <IN_SINGLE_LINE_COMMENT,IN_MULTI_LINE_COMMENT> MORE :
0122 {
0123     < ~[] >
0124 }
0125 
0126 /* ECMA-262 5.1 Edition / June 2011 - Section 7.6.1.1: Keywords */
0127 
0128 TOKEN :
0129 {
0130   < BREAK: "break" >       | < DO: "do" >             | < INSTANCEOF: "instanceof" > | < TYPEOF: "typeof" >
0131 | < CASE: "case" >         | < ELSE: "else" >         | < NEW: "new" >               | < VAR: "var" >
0132 | < CATCH: "catch" >       | < FINALLY: "finally" >   | < RETURN: "return" >         | < VOID: "void" >
0133 | < CONTINUE: "continue" > | < FOR: "for" >           | < SWITCH: "switch" >         | < WHILE: "while" >
0134 | < DEBUGGER: "debugger" > | < FUNCTION: "function" > | < THIS: "this" >             | < WITH: "with" >
0135 | < DEFAULT_: "default" >  | < IF: "if" >             | < THROW: "throw" >
0136 | < DELETE: "delete" >     | < IN: "in" >             | < TRY: "try" >
0137 }
0138 
0139 /* ECMA-262 5.1 Edition / June 2011 - Section 7.7: Punctuators */
0140 
0141 TOKEN :
0142 {
0143   < LBRACE: "{" > | < RBRACE: "}" >    | < LPAREN: "(" > | < RPAREN: ")" > | < LBRACKET: "[" > | < RBRACKET: "]" >
0144 | < DOT: "." >    | < SEMICOLON: ";" > | < COMMA: "," >  | < LT: "<" >     | < GT: ">" >       | < LTE: "<=" >
0145 | < GTE: ">=" >   | < EQ: "==" >       | < NE: "!=" >    | < EQS: "===" >  | < NEQS: "!==" >
0146 | < PLUS: "+" >   | < MINUS: "-" >     | < MUL: "*" >    | < MOD: "%" >    | < INC: "++" >     | < DEC: "--" >
0147 | < SHL: "<<" >   | < SHR: ">>" >      | < SHRU: ">>>" > | < AND: "&" >    | < OR: "|" >       | < XOR: "^" >
0148 | < BNOT: "!" >   | < NOT: "~" >       | < BAND: "&&" >  | < BOR: "||" >   | < QUEST: "?" >    | < COLON: ":" >
0149 | < ASSIGN: "=" > | < AADD: "+=" >     | < ASUB: "-=" >  | < AMUL: "*=" >  | < AMOD: "%=" >    | < ASHL: "<<=" >
0150 | < ASHR: ">>=" > | < ASHRU: ">>>=" >  | < AAND: "&=" >  | < AOR: "|=" >   | < AXOR: "^=" >
0151 | < DIV: "/" >    | < ADIV: "/=" >
0152 }
0153 
0154 /* ECMA-262 5.1 Edition / June 2011 - Section 7.8: Literals */
0155 
0156 void Literal() #Literal :
0157 {
0158     Token t;
0159 }
0160 {
0161 (
0162     t = <DECIMAL_LITERAL>
0163 |   t = <HEX_INTEGER_LITERAL>
0164 |   t = <STRING_LITERAL>
0165 |   t = <BOOLEAN_LITERAL>
0166 |   t = <NULL_LITERAL>
0167 |   t = <REGULAR_EXPRESSION_LITERAL>
0168 )   {
0169         jjtThis.jjtSetValue(t.image);
0170     }
0171 }
0172 
0173 /* ECMA-262 5.1 Edition / June 2011 - Section 7.8.1: NULL Literals */
0174 
0175 TOKEN:
0176 { 
0177     < NULL_LITERAL: "null" >
0178 }
0179 
0180 /* ECMA-262 5.1 Edition / June 2011 - Section 7.8.2: Boolean Literals */
0181 
0182 TOKEN:
0183 { 
0184     < BOOLEAN_LITERAL: "true" | "false" >
0185 }
0186 
0187 /* ECMA-262 5.1 Edition / June 2011 - Section 7.8.3: Numeric Literals */
0188 
0189 TOKEN:
0190 { 
0191     < DECIMAL_LITERAL :
0192         < DECIMAL_INTEGER_LITERAL > "." (< DECIMAL_DIGITS >)? (< EXPONENT_PART >)?
0193     |   "." < DECIMAL_DIGITS > (< EXPONENT_PART >)?
0194     |       < DECIMAL_INTEGER_LITERAL > (< EXPONENT_PART >)? 
0195     > 
0196 |   < DECIMAL_INTEGER_LITERAL: "0" | < NON_ZERO_DIGIT > (< DECIMAL_DIGITS >)?>
0197 |   < DECIMAL_DIGITS: (< DECIMAL_DIGIT >)+ >
0198 |   < DECIMAL_DIGIT: ["0"-"9"] >
0199 |   < #NON_ZERO_DIGIT: ["1"-"9"] >
0200 |   < #EXPONENT_PART: < EXPONENT_INDICATOR > < SIGNED_INTEGER > >
0201 |   < #EXPONENT_INDICATOR: ["e", "E"] >
0202 |   < #SIGNED_INTEGER: (["+", "-"])? < DECIMAL_DIGITS > >
0203 |   < HEX_INTEGER_LITERAL: "0" ["x","X"] (< HEX_DIGIT >)+ >
0204 }
0205 
0206 /* ECMA-262 5.1 Edition / June 2011 - Section 7.8.4: String Literals */
0207 
0208 TOKEN:
0209 {
0210     < STRING_LITERAL:
0211         "\"" (< DOUBLE_STRING_CHARACTERS >)? "\""
0212     |   "'"  (< SINGLE_STRING_CHARACTERS >)? "'"
0213     >
0214 |   < #DOUBLE_STRING_CHARACTERS: (<DOUBLE_STRING_CHARACTER>)* >
0215 |   < #SINGLE_STRING_CHARACTERS: (<SINGLE_STRING_CHARACTER>)* >
0216 |   < #DOUBLE_STRING_CHARACTER:
0217         (~["\"","\\","\n","\r","\u2028","\u2029"])*
0218     |   "\\" < ESCAPE_SEQUENCE >
0219     |   < LINE_CONTINUATION >
0220     >
0221 |   < #SINGLE_STRING_CHARACTER:
0222         (~["'","\\","\n","\r","\u2028","\u2029"])
0223     |   "\\" <ESCAPE_SEQUENCE>
0224     |   < LINE_CONTINUATION >
0225     > 
0226 |   < #LINE_CONTINUATION: "\\" ("\n" | "\r" | "\r\n" | "\u2028" | "\u2029") >
0227 |   < #ESCAPE_SEQUENCE:
0228         <CHARACTER_ESCAPE_SEQUENCE>
0229     |   "0" 
0230     |   <HEX_ESCAPE_SEQUENCE>
0231     |   <UNICODE_ESCAPE_SEQUENCE>
0232     >
0233 |   < #CHARACTER_ESCAPE_SEQUENCE:
0234         <SINGLE_ESCAPE_CHARACTER> | <NON_ESCAPE_CHARACTER>
0235     >
0236 |   < #SINGLE_ESCAPE_CHARACTER: ["'", "\"", "\\", "b", "f", "n", "r", "t", "v"] >
0237 |   < #NON_ESCAPE_CHARACTER: 
0238         ~["'", "\"", "\\", "b", "f", "n", "r", "t", "v"]
0239     |   ~["\n", "\r", "\u2028", "\u2029"]
0240     |   ~["0"-"9"]
0241     |   ~["x", "u"]
0242     >
0243 |   < HEX_ESCAPE_SEQUENCE: "x" < HEX_DIGIT > < HEX_DIGIT > >
0244 }
0245 
0246 /* ECMA-262 5.1 Edition / June 2011 - Section 11.1: Primary Expressions */
0247 
0248 void PrimaryExpression() #void :
0249 {}
0250 {
0251     LOOKAHEAD("this") "this" #ThisReference
0252 |   LOOKAHEAD("{") ObjectLiteral()
0253 |   LOOKAHEAD("(") ( "(" Expression() ")" ) #Group
0254 |   LOOKAHEAD(Identifier()) Identifier()
0255 |   LOOKAHEAD("[") ArrayLiteral()
0256 |   LOOKAHEAD(2) Literal() 
0257 }
0258 
0259 /* ECMA-262 5.1 Edition / June 2011 - Section 11.1.4: Array Initialiser */
0260 
0261 void ArrayLiteral() #ArrayLiteral : 
0262 {}
0263 {
0264     "[" (
0265         LOOKAHEAD(2) ( Elision() )? "]" 
0266     |   LOOKAHEAD(ElementList() Elision()) ElementList() Elision() "]" 
0267     |   ( ElementList() )? "]" 
0268     )
0269 }        
0270 
0271 void ElementList() #void :
0272 {}
0273 {
0274     ( Elision() )? AssignmentExpression() (
0275         LOOKAHEAD(Elision() AssignmentExpression()) Elision()  AssignmentExpression()
0276     )*
0277 }
0278 
0279 void Elision() #void :
0280 {}
0281 {
0282     (",")+
0283 }
0284 
0285 /* ECMA-262 5.1 Edition / June 2011 - Section 11.1.5: Object Initialiser */
0286 
0287 void ObjectLiteral() #ObjectLiteral :
0288 {}
0289 {
0290     "{" ( PropertyNameAndValueList() )? "}"
0291 }
0292 
0293 void PropertyNameAndValueList() #void :
0294 {}
0295 {
0296     PropertyAssignment() ( LOOKAHEAD( "," PropertyAssignment()) "," PropertyAssignment() | "," )* 
0297 }
0298 
0299 void PropertyAssignment() #PropertyAssignment :
0300 {}
0301 {
0302     PropertyName() ":" AssignmentExpression() 
0303 }
0304 
0305 void PropertyName() #void :
0306 {}
0307 {
0308     Identifier() 
0309 |   <STRING_LITERAL> #Literal
0310 |   <DECIMAL_LITERAL> #Literal
0311 }
0312 
0313 /* ECMA-262 5.1 Edition / June 2011 - Section 11.2: Left-Hand-Side Expressions */
0314 
0315 void MemberExpression() #void :
0316 {}
0317 {
0318     (   (   PrimaryExpression()  
0319         |   FunctionExpression()
0320         |   ( "new" MemberExpression() Arguments() ) #NewOperation
0321         ) (LOOKAHEAD(1) PropertyAccessor())*
0322     ) #Access(>1)
0323 }
0324 
0325 void NewExpression() #void :
0326 {}
0327 {
0328     LOOKAHEAD(MemberExpression()) MemberExpression()
0329 |   ( "new" NewExpression() ) #Allocation
0330 }
0331 
0332 void PropertyAccessor() #void :
0333 {}
0334 {
0335     ( "[" Expression() "]" ) #ArrayAccessor
0336 |   ( "." Identifier() ) #MemberAccessor
0337 }
0338 
0339 void CallExpression() #Access(>1) : 
0340 {}
0341 {
0342     MemberExpression() Arguments() ( LOOKAHEAD(2) ( Arguments() | PropertyAccessor() ) )*
0343 }
0344 
0345 void Arguments() #Arguments :
0346 {}
0347 {
0348     "(" (ArgumentList())? ")"
0349 }
0350 
0351 void ArgumentList() #void :
0352 {}
0353 {
0354     AssignmentExpression() ("," AssignmentExpression())*
0355 }
0356 
0357 void LeftHandSideExpression() #void : 
0358 {}
0359 {
0360     LOOKAHEAD(MemberExpression() "(") CallExpression() | NewExpression() 
0361 }
0362 
0363 /* ECMA-262 5.1 Edition / June 2011 - Section 11.3 Postfix Expressions */
0364 
0365 void PostfixExpression() #PostfixExpression(>1) :
0366 {}
0367 {
0368     LeftHandSideExpression() [ LOOKAHEAD(1) ( "++" | "--" ) #Operator ]
0369 }
0370 
0371 /* ECMA-262 5.1 Edition / June 2011 - Section 11.4 Unary Operators */
0372 
0373 void UnaryExpression() #UnaryExpression(>1) :
0374 {}
0375 { 
0376     PostfixExpression()
0377 |   (
0378         (
0379             "delete"
0380         |   "void"
0381         |   "typeof"
0382         |   "++"
0383         |   "--"
0384         |   "+"
0385         |   "-"
0386         |   "~"
0387         |   "!"
0388         ) #Operator UnaryExpression()
0389     )
0390 }
0391 
0392 /* ECMA-262 5.1 Edition / June 2011 - Section 11.5: Multiplicative Operators */
0393 
0394 void MultiplicativeExpression() #BinaryOperation(>1) :
0395 {}
0396 { 
0397     UnaryExpression() ( ( "*" | "/" | "%" ) #Operator UnaryExpression() )*
0398 }
0399 
0400 /* ECMA-262 5.1 Edition / June 2011 - Section 11.6: Additive Operators */
0401 
0402 void AdditiveExpression() #BinaryOperation(>1) : 
0403 {}
0404 {
0405     MultiplicativeExpression() ( LOOKAHEAD(1) ( "+" | "-" ) #Operator MultiplicativeExpression())*
0406 }
0407 
0408 /* ECMA-262 5.1 Edition / June 2011 - Section 11.7: Bitwise Shift Operators */
0409 
0410 void ShiftExpression() #BinaryOperation(>1) :
0411 {}
0412 {
0413     AdditiveExpression() ( ( "<<" | ">>" | ">>>" ) #Operator AdditiveExpression() )*
0414 }
0415 
0416 /* ECMA-262 5.1 Edition / June 2011 - Section 11.8: Relational Operators */
0417 
0418 void RelationalExpression() #BinaryOperation(>1) :
0419 {}
0420 {
0421     ShiftExpression() ( ( RelationalOperatorNoIn() | "in" ) #Operator ShiftExpression() )*
0422 }
0423 
0424 void RelationalExpressionNoIn() #BinaryOperation(>1) :
0425 {}
0426 {
0427     ShiftExpression() ( RelationalOperatorNoIn() #Operator ShiftExpression() )*
0428 }
0429 
0430 void RelationalOperatorNoIn() #void :
0431 {}
0432 {
0433     "<" | ">" | "<=" | ">=" | "instanceof"
0434 }
0435 
0436 /* ECMA-262 5.1 Edition / June 2011 - Section 11.9: Equality Operators */
0437 
0438 void EqualityExpression() #BinaryOperation(>1) :
0439 {}
0440 {
0441     RelationalExpression() ( EqualityOperator() RelationalExpression() )*
0442 }
0443 
0444 void EqualityExpressionNoIn() #BinaryOperation(>1) :
0445 {}
0446 {
0447     RelationalExpressionNoIn() ( EqualityOperator() RelationalExpressionNoIn())*
0448 }
0449 
0450 void EqualityOperator() #Operator :
0451 {}
0452 {
0453     "==" | "!=" | "===" | "!=="
0454 }
0455 
0456 /* ECMA-262 5.1 Edition / June 2011 - Section 11.10: Binary Bitwise Operators */
0457 
0458 void BitwiseANDExpression() #BinaryOperation(>1) :
0459 {}
0460 {
0461     EqualityExpression() ( BitwiseANDOperator() EqualityExpression())*
0462 }
0463 
0464 void BitwiseANDExpressionNoIn() #BinaryOperation(>1) :
0465 {}
0466 {
0467     EqualityExpressionNoIn() (BitwiseANDOperator() EqualityExpressionNoIn())*
0468 }
0469 
0470 void BitwiseANDOperator() #Operator :
0471 {}
0472 {
0473     "&"
0474 }
0475 
0476 void BitwiseXORExpression() #BinaryOperation(>1) :
0477 {}
0478 {
0479     BitwiseANDExpression() (BitwiseXOROperator() BitwiseANDExpression())*
0480 }
0481 
0482 void BitwiseXORExpressionNoIn() #BinaryOperation(>1) :
0483 {}
0484 {
0485     BitwiseANDExpressionNoIn() (BitwiseXOROperator() BitwiseANDExpressionNoIn())*
0486 }
0487 
0488 void BitwiseXOROperator() #Operator :
0489 {}
0490 {
0491     "^"
0492 }
0493 
0494 void BitwiseORExpression() #BinaryOperation(>1) :
0495 {}
0496 {
0497     BitwiseXORExpression() (BitwiseOROperator() BitwiseXORExpression())*
0498 }
0499 
0500 void BitwiseORExpressionNoIn() #BinaryOperation(>1) :
0501 {}
0502 {
0503     BitwiseXORExpressionNoIn() (BitwiseOROperator() BitwiseXORExpressionNoIn())*
0504 }
0505 
0506 void BitwiseOROperator() #Operator :
0507 {}
0508 {
0509     "|"
0510 }
0511 
0512 /* ECMA-262 5.1 Edition / June 2011 - Section 11.11: Binary Logical Operators */
0513 
0514 void LogicalANDExpression() #AndOperation(>1) :
0515 {}
0516 {
0517     BitwiseORExpression() (LogicalANDOperator() BitwiseORExpression())*
0518 }
0519 
0520 void LogicalANDExpressionNoIn() #AndOperation(>1) :
0521 {}
0522 { 
0523     BitwiseORExpressionNoIn() (LogicalANDOperator() BitwiseORExpressionNoIn())*
0524 }
0525 
0526 void LogicalANDOperator() #Operator :
0527 {}
0528 {
0529     "&&"
0530 }
0531 
0532 void LogicalORExpression() #OrOperation(>1) :
0533 {}
0534 {
0535     LogicalANDExpression() (LogicalOROperator() LogicalANDExpression())*
0536 }
0537 
0538 void LogicalORExpressionNoIn() #OrOperation(>1) :
0539 {}
0540 {
0541     LogicalANDExpressionNoIn() (LogicalOROperator() LogicalANDExpressionNoIn())*
0542 }
0543 
0544 void LogicalOROperator() #Operator :
0545 {}
0546 {
0547     "||"
0548 }
0549 
0550 /* ECMA-262 5.1 Edition / June 2011 - Section 11.12: Conditional Operator */
0551 
0552 void ConditionalExpression() #ConditionalExpression(>1) :
0553 {}
0554 {
0555     LogicalORExpression() [ "?" AssignmentExpression() ":" AssignmentExpression() ]
0556 }
0557 
0558 void ConditionalExpressionNoIn() #ConditionalExpression(>1) :
0559 {}
0560 {
0561     LogicalORExpressionNoIn() [ "?" AssignmentExpression() ":" AssignmentExpressionNoIn() ]
0562 }
0563 
0564 /* ECMA-262 5.1 Edition / June 2011 - Section 11.13: Assignment Operators */
0565 
0566 void AssignmentExpression() #AssignmentExpression(>1) :
0567 {}
0568 {
0569     LOOKAHEAD(LeftHandSideExpression() AssignmentOperator()) LeftHandSideExpression() AssignmentOperator() AssignmentExpression() 
0570 |   ConditionalExpression() 
0571 }
0572 
0573 void AssignmentExpressionNoIn() #AssignmentExpression(>1) : 
0574 {}
0575 {
0576     LOOKAHEAD(LeftHandSideExpression() AssignmentOperator()) LeftHandSideExpression() AssignmentOperator() AssignmentExpressionNoIn()
0577 |   ConditionalExpressionNoIn() 
0578 }
0579 
0580 void AssignmentOperator() #Operator :
0581 {}
0582 {
0583     "=" | "*=" | "/=" | "%=" | "+=" | "-=" | "<<=" | ">>=" | ">>>=" | "&=" | "^=" | "|="
0584 }
0585 
0586 /* ECMA-262 5.1 Edition / June 2011 - Section 11.14: Comma Operator */
0587 
0588 void Expression() #CommaExpression(>1) :
0589 {}
0590 {
0591     AssignmentExpression() ( "," AssignmentExpression() )*
0592 }
0593 
0594 void ExpressionNoIn() #CommaExpression(>1) :
0595 {}
0596 {
0597     AssignmentExpressionNoIn() ( "," AssignmentExpressionNoIn() )*
0598 }
0599 
0600 /* ECMA-262 5.1 Edition / June 2011 - Section 12: STATEMENTS */
0601 
0602 void Statement() #void :
0603 {}
0604 {
0605     < JAVA_STATEMENT > #JavaStatement
0606 |   LOOKAHEAD(Block()) Block()    
0607 |   LOOKAHEAD("var" Identifier()) VariableStatement()
0608 |   DebuggerStatement()
0609 |   EmptyStatement()
0610 |   LOOKAHEAD(Identifier() ":") LabelledStatement()
0611 |   LOOKAHEAD(ExpressionStatement())  ExpressionStatement()
0612 |   LOOKAHEAD("if" "(") IfStatement()
0613 |   IterationStatement()
0614 |   LOOKAHEAD("continue") ContinueStatement()
0615 |   LOOKAHEAD("break") BreakStatement()
0616 |   ReturnStatement()
0617 |   WithStatement()
0618 |   SwitchStatement()
0619 |   ThrowStatement()
0620 |   TryStatement()
0621 }
0622 
0623 /* ECMA-262 5.1 Edition / June 2011 - Section 12.1 Block Statement */
0624 
0625 void Block() #Block :
0626 {}
0627 {
0628     "{" ( StatementList() )? "}"
0629 }
0630 
0631 void StatementList() #StatementList(>1) : 
0632 {}
0633 {
0634     ( Statement() )+
0635 }
0636 
0637 /* ECMA-262 5.1 Edition / June 2011 - Section 12.2: Variable statement */
0638 
0639 void VariableStatement() #VariableStatement :
0640 {}
0641 {
0642     "var" VariableDeclarationList() (LOOKAHEAD(2) ";")?
0643 }
0644 
0645 void VariableDeclarationList() #VariableDeclarationList(>1) :
0646 {}
0647 {
0648     VariableDeclaration() ( "," VariableDeclaration() )*
0649 }
0650 
0651 void VariableDeclarationListNoIn() #VariableDeclarationList(>1) :
0652 {}
0653 {
0654     VariableDeclarationNoIn() ( "," VariableDeclarationNoIn() )*
0655 }
0656 
0657 void VariableDeclaration() #VariableDeclaration :
0658 {}
0659 {
0660     Identifier() ( Initialiser() )?
0661 }
0662 
0663 void VariableDeclarationNoIn() #VariableDeclaration :
0664 {}
0665 {
0666     Identifier() ( InitialiserNoIn() )? #EmptyExpression(jjtree.nodeArity()==0)
0667 }
0668 
0669 void Initialiser() #void :
0670 {}
0671 {
0672     "=" AssignmentExpression()
0673 }
0674 
0675 void InitialiserNoIn() #void :
0676 {}
0677 {
0678     "=" AssignmentExpressionNoIn()
0679 }
0680 
0681 /* ECMA-262 5.1 Edition / June 2011 - Section 12.3: Empty Statement */
0682 
0683 void EmptyStatement() #void :
0684 {}
0685 {
0686     ";"
0687 }
0688 
0689 /* ECMA-262 5.1 Edition / June 2011 - Section 12.4: Expression Statement */
0690 
0691 void ExpressionStatement() #ExpressionStatement :
0692 {}
0693 {
0694     Expression() (LOOKAHEAD(2) ";")?
0695 }
0696 
0697 /* ECMA-262 5.1 Edition / June 2011 - Section 12.5: The if Statement */
0698 
0699 void IfStatement() #IfStatement :
0700 {}
0701 {
0702     "if" "(" Expression() ")" Statement() [ LOOKAHEAD(1) "else" Statement() ]
0703 }
0704 
0705 /* ECMA-262 5.1 Edition / June 2011 - Section 12.6: Iteration Statements */
0706 
0707 void IterationStatement() #void :
0708 {}
0709 {
0710     ( "do" Statement() "while" "(" Expression() ")" (LOOKAHEAD(2) ";")? ) #DoWhileStatement
0711 |   ( "while" "(" Expression() ")" Statement() ) #WhileStatement
0712 |   LOOKAHEAD("for" "(" (ExpressionNoIn())? ";") ( "for" "(" ( ExpressionNoIn() )? #EmptyExpression(jjtree.nodeArity()==0) ";" ( Expression() )? #EmptyExpression(jjtree.nodeArity()==0) ";" ( Expression() )? #EmptyExpression(jjtree.nodeArity()==0) ")" Statement() ) #ForStatement 
0713 |   LOOKAHEAD("for" "(" "var" VariableDeclarationList() ";") ( "for" "(" "var" VariableDeclarationList() ";" ( Expression() )? #EmptyExpression(jjtree.nodeArity()==0) ";" ( Expression() )? #EmptyExpression(jjtree.nodeArity()==0) ")" Statement() ) #ForVarStatement
0714 |   LOOKAHEAD("for" "(" "var" VariableDeclarationNoIn() "in") ( "for" "(" "var" VariableDeclarationNoIn() "in" Expression() ")" Statement() ) #ForVarInStatement
0715 |   ( "for" "(" LeftHandSideExpression() "in" Expression() ")" Statement() ) #ForInStatement
0716 }
0717 
0718 /* ECMA-262 5.1 Edition / June 2011 - Section 12.7: The continue Statement */
0719 
0720 void ContinueStatement() #ContinueStatement :
0721 {}
0722 {
0723     "continue" ( LOOKAHEAD(Identifier()) Identifier() )? (LOOKAHEAD(";") ";")?
0724 }
0725 
0726 /* ECMA-262 5.1 Edition / June 2011 - Section 12.8: The break Statement */
0727 
0728 void BreakStatement() #BreakStatement :
0729 {}
0730 {
0731     "break" ( LOOKAHEAD(Identifier()) Identifier() )? (LOOKAHEAD(";") ";")?
0732 }
0733 
0734 /* ECMA-262 5.1 Edition / June 2011 - Section 12.9 The return Statement */
0735 
0736 void ReturnStatement() #ReturnStatement :
0737 {}
0738 {
0739     "return" ( LOOKAHEAD(Expression()) Expression() )? (LOOKAHEAD(";") ";")?
0740 }
0741 
0742 /* ECMA-262 5.1 Edition / June 2011 - Section 12.10: The with Statement */
0743 
0744 void WithStatement() #WithStatement :
0745 {}
0746 {
0747     "with" "(" Expression() ")" Statement()
0748 }
0749 
0750 /* ECMA-262 5.1 Edition / June 2011 - 12.11 The switch Statement */
0751 
0752 void SwitchStatement() #SwitchStatement :
0753 {}
0754 {
0755     "switch" "(" Expression() ")" CaseBlock()
0756 }
0757 
0758 void CaseBlock() #CaseBlock :
0759 {}
0760 {
0761     "{" ( CaseClauses() )? ( "}" | DefaultClause() ( CaseClauses() )? "}" )
0762 }
0763 
0764 void CaseClauses() #void :
0765 {}
0766 {
0767     ( CaseClause() )+
0768 }
0769 
0770 void CaseClause()  #CaseClause :
0771 {}
0772 {
0773     ( ( "case" Expression() ":" ) #Case ) ( StatementList() )?
0774 }
0775 
0776 void DefaultClause() #CaseClause :
0777 {}
0778 {
0779     ( ( "default" ":" ) #Case ) ( StatementList() )?
0780 }
0781 
0782 /* ECMA-262 5.1 Edition / June 2011 - Section 12.12: Labelled Statements */
0783 
0784 void LabelledStatement() #LabelledStatement:
0785 {}
0786 {
0787     Identifier() ":" Statement()
0788 }
0789 
0790 void ThrowStatement() #ThrowStatement :
0791 {}
0792 {
0793     "throw" Expression() (LOOKAHEAD(";") ";")?
0794 }
0795 
0796 void TryStatement() #TryStatement : 
0797 {}
0798 {
0799     "try" Block() ( ( Finally() | Catch() [Finally()] ) )
0800 }  
0801 
0802 void Catch() #Catch :
0803 {}
0804 {
0805     "catch" "(" Identifier() ")" Block()
0806 }
0807 
0808 void Finally() #Finally :
0809 {}
0810 {
0811     "finally" Block()
0812 }
0813 
0814 /* ECMA-262 5.1 Edition / June 2011 - Section 12.15 The debugger Statement */
0815 
0816 void DebuggerStatement() #DebuggerStatement :
0817 {}
0818 {
0819     "debugger" (LOOKAHEAD(";") ";")?
0820 }
0821 
0822 /* ECMA-262 5.1 Edition / June 2011 - Section 13: Function Definition */
0823 
0824 void FunctionDeclaration() #FunctionDeclaration :
0825 {}
0826 {
0827     "function" Identifier() ( "(" ( FormalParameterList() )? ")" ) #FormalParameterList FunctionBody()  
0828 }
0829 
0830 void FunctionExpression() #FunctionExpression :
0831 {}
0832 {
0833     "function" ( Identifier() )? ( "(" ( FormalParameterList() )? ")" ) #FormalParameterList FunctionBody()
0834 }
0835 
0836 void FormalParameterList() #void :
0837 {}
0838 {
0839     Identifier() ( "," Identifier() )*
0840 }
0841 
0842 void FunctionBody() #Block :
0843 {}
0844 {
0845     "{" (SourceElements())? "}" 
0846 }
0847 
0848 /* ECMA-262 5.1 Edition / June 2011 - Section 14: Script */
0849 
0850 ECMAProgram Program() #Program :
0851 {}
0852 {  
0853     (SourceElements())? <EOF>
0854     {
0855         return jjtThis;
0856     }
0857 }
0858 
0859 void SourceElements() #void :
0860 {}
0861 {
0862     (SourceElement())+ 
0863 }
0864 
0865 void SourceElement() #void :
0866 {}
0867 {
0868     LOOKAHEAD(FunctionDeclaration()) FunctionDeclaration()
0869 |   Statement()
0870 }
0871 
0872 /* ECMA-262 5.1 Edition / June 2011 - Section 7.6: Identifiers */
0873 
0874 void Identifier() #Identifier :
0875 {
0876     Token t;
0877 }
0878 {
0879     t = < IDENTIFIER_NAME >
0880     {
0881         jjtThis.jjtSetValue(t.image);
0882     }
0883 }
0884 
0885 TOKEN:
0886 {
0887     < IDENTIFIER_NAME: <IDENTIFIER_START> (<IDENTIFIER_PART>)* >
0888 |
0889     < #IDENTIFIER_START:
0890         <UNICODE_LETTER>
0891     | 
0892         <DOLLAR_SIGN>
0893     | 
0894         <UNDER_SCORE>
0895     | 
0896         <UNICODE_ESCAPE_SEQUENCE>
0897     >
0898 |
0899     < #IDENTIFIER_PART: 
0900         <IDENTIFIER_START>
0901     | 
0902         <UNICODE_COMBINING_MARK>
0903     | 
0904         <UNICODE_DIGIT>
0905     | 
0906         <UNICODE_CONNECTOR_PUNCTUATION>
0907     | 
0908         <UNICODE_ESCAPE_SEQUENCE>
0909     >
0910 |
0911     < #DOLLAR_SIGN: "$" >
0912 |  
0913     < #UNDER_SCORE: "_" >
0914 |
0915     < #UNICODE_LETTER: 
0916         ["A"-"Z"]
0917     |   ["a"-"z"]
0918     |   ["\u0041"-"\u005A"] 
0919     |   ["\u0061"-"\u007A"] 
0920     |   ["\u00AA"] 
0921     |   ["\u00B5"]
0922     |   ["\u00BA"] 
0923     |   ["\u00C0"-"\u00D6"] 
0924     |   ["\u00D8"-"\u00F6"] 
0925     |   ["\u00F8"-"\u021F"]
0926     |   ["\u0222"-"\u0233"] 
0927     |   ["\u0250"-"\u02AD"] 
0928     |   ["\u02B0"-"\u02B8"] 
0929     |   ["\u02BB"-"\u02C1"]
0930     |   ["\u02D0"-"\u02D1"] 
0931     |   ["\u02E0"-"\u02E4"] 
0932     |   ["\u02EE"] 
0933     |   ["\u037A"]
0934     |   ["\u0386"] 
0935     |   ["\u0388"-"\u038A"]
0936     |   ["\u038C"]
0937     |   ["\u038E"-"\u03A1"]
0938     |   ["\u03A3"-"\u03CE"] 
0939     |   ["\u03D0"-"\u03D7"] 
0940     |   ["\u03DA"-"\u03F3"]
0941     |   ["\u0400"-"\u0481"]
0942     |   ["\u048C"-"\u04C4"]
0943     |   ["\u04C7"-"\u04C8"]
0944     |   ["\u04CB"-"\u04CC"] 
0945     |   ["\u04D0"-"\u04F5"]
0946     |   ["\u04F8"-"\u04F9"]
0947     |   ["\u0531"-"\u0556"]
0948     |   ["\u0559"]
0949     |   ["\u0561"-"\u0587"]
0950     |   ["\u05D0"-"\u05EA"]
0951     |   ["\u05F0"-"\u05F2"] 
0952     |   ["\u0621"-"\u063A"] 
0953     |   ["\u0640"-"\u064A"]
0954     |   ["\u0671"-"\u06D3"]
0955     |   ["\u06D5"] 
0956     |   ["\u06E5"-"\u06E6"] 
0957     |   ["\u06FA"-"\u06FC"]
0958     |   ["\u0710"] 
0959     |   ["\u0712"-"\u072C"] 
0960     |   ["\u0780"-"\u07A5"] 
0961     |   ["\u0905"-"\u0939"]
0962     |   ["\u093D"] 
0963     |   ["\u0950"] 
0964     |   ["\u0958"-"\u0961"] 
0965     |   ["\u0985"-"\u098C"]
0966     |   ["\u098F"-"\u0990"] 
0967     |   ["\u0993"-"\u09A8"] 
0968     |   ["\u09AA"-"\u09B0"] 
0969     |   ["\u09B2"]
0970     |   ["\u09B6"-"\u09B9"] 
0971     |   ["\u09DC"-"\u09DD"] 
0972     |   ["\u09DF"-"\u09E1"] 
0973     |   ["\u09F0"-"\u09F1"]
0974     |   ["\u0A05"-"\u0A0A"] 
0975     |   ["\u0A0F"-"\u0A10"] 
0976     |   ["\u0A13"-"\u0A28"] 
0977     |   ["\u0A2A"-"\u0A30"]
0978     |   ["\u0A32"-"\u0A33"] 
0979     |   ["\u0A35"-"\u0A36"] 
0980     |   ["\u0A38"-"\u0A39"] 
0981     |   ["\u0A59"-"\u0A5C"]
0982     |   ["\u0A5E"] 
0983     |   ["\u0A72"-"\u0A74"] 
0984     |   ["\u0A85"-"\u0A8B"] 
0985     |   ["\u0A8D"]
0986     |   ["\u0A8F"-"\u0A91"] 
0987     |   ["\u0A93"-"\u0AA8"] 
0988     |   ["\u0AAA"-"\u0AB0"] 
0989     |   ["\u0AB2"-"\u0AB3"]
0990     |   ["\u0AB5"-"\u0AB9"] 
0991     |   ["\u0ABD"] 
0992     |   ["\u0AD0"] 
0993     |   ["\u0AE0"]
0994     |   ["\u0B05"-"\u0B0C"] 
0995     |   ["\u0B0F"-"\u0B10"] 
0996     |   ["\u0B13"-"\u0B28"] 
0997     |   ["\u0B2A"-"\u0B30"]
0998     |   ["\u0B32"-"\u0B33"] 
0999     |   ["\u0B36"-"\u0B39"] 
1000     |   ["\u0B3D"] 
1001     |   ["\u0B5C"-"\u0B5D"]
1002     |   ["\u0B5F"-"\u0B61"] 
1003     |   ["\u0B85"-"\u0B8A"]
1004     |   ["\u0B8E"-"\u0B90"] 
1005     |   ["\u0B92"-"\u0B95"]
1006     |   ["\u0B99"-"\u0B9A"] 
1007     |   ["\u0B9C"] 
1008     |   ["\u0B9E"-"\u0B9F"] 
1009     |   ["\u0BA3"-"\u0BA4"]
1010     |   ["\u0BA8"-"\u0BAA"] 
1011     |   ["\u0BAE"-"\u0BB5"] 
1012     |   ["\u0BB7"-"\u0BB9"] 
1013     |   ["\u0C05"-"\u0C0C"]
1014     |   ["\u0C0E"-"\u0C10"] 
1015     |   ["\u0C12"-"\u0C28"]
1016     |   ["\u0C2A"-"\u0C33"]
1017     |   ["\u0C35"-"\u0C39"]
1018     |   ["\u0C60"-"\u0C61"]
1019     |   ["\u0C85"-"\u0C8C"]
1020     |   ["\u0C8E"-"\u0C90"]
1021     |   ["\u0C92"-"\u0CA8"]
1022     |   ["\u0CAA"-"\u0CB3"]
1023     |   ["\u0CB5"-"\u0CB9"]
1024     |   ["\u0CDE"]
1025     |   ["\u0CE0"-"\u0CE1"]
1026     |   ["\u0D05"-"\u0D0C"]
1027     |   ["\u0D0E"-"\u0D10"]
1028     |   ["\u0D12"-"\u0D28"]
1029     |   ["\u0D2A"-"\u0D39"]
1030     |   ["\u0D60"-"\u0D61"]
1031     |   ["\u0D85"-"\u0D96"]
1032     |   ["\u0D9A"-"\u0DB1"]
1033     |   ["\u0DB3"-"\u0DBB"]
1034     |   ["\u0DBD"]
1035     |   ["\u0DC0"-"\u0DC6"]
1036     |   ["\u0E01"-"\u0E30"]
1037     |   ["\u0E32"-"\u0E33"]
1038     |   ["\u0E40"-"\u0E46"]
1039     |   ["\u0E81"-"\u0E82"]
1040     |   ["\u0E84"]
1041     |   ["\u0E87"-"\u0E88"]
1042     |   ["\u0E8A"]
1043     |   ["\u0E8D"]
1044     |   ["\u0E94"-"\u0E97"]
1045     |   ["\u0E99"-"\u0E9F"]
1046     |   ["\u0EA1"-"\u0EA3"]
1047     |   ["\u0EA5"]
1048     |   ["\u0EA7"]
1049     |   ["\u0EAA"-"\u0EAB"]
1050     |   ["\u0EAD"-"\u0EB0"]
1051     |   ["\u0EB2"-"\u0EB3"]
1052     |   ["\u0EBD"-"\u0EC4"]
1053     |   ["\u0EC6"]
1054     |   ["\u0EDC"-"\u0EDD"]
1055     |   ["\u0F00"]
1056     |   ["\u0F40"-"\u0F6A"]
1057     |   ["\u0F88"-"\u0F8B"]
1058     |   ["\u1000"-"\u1021"]
1059     |   ["\u1023"-"\u1027"]
1060     |   ["\u1029"-"\u102A"]
1061     |   ["\u1050"-"\u1055"]
1062     |   ["\u10A0"-"\u10C5"]
1063     |   ["\u10D0"-"\u10F6"]
1064     |   ["\u1100"-"\u1159"]
1065     |   ["\u115F"-"\u11A2"]
1066     |   ["\u11A8"-"\u11F9"]
1067     |   ["\u1200"-"\u1206"]
1068     |   ["\u1208"-"\u1246"]
1069     |   ["\u1248"]
1070     |   ["\u124A"-"\u124D"]
1071     |   ["\u1250"-"\u1256"]
1072     |   ["\u1258"]
1073     |   ["\u125A"-"\u125D"]
1074     |   ["\u1260"-"\u1286"]
1075     |   ["\u1288"]
1076     |   ["\u128A"-"\u128D"]
1077     |   ["\u1290"-"\u12AE"]
1078     |   ["\u12B0"]
1079     |   ["\u12B2"-"\u12B5"]
1080     |   ["\u12B8"-"\u12BE"]
1081     |   ["\u12C0"]
1082     |   ["\u12C2"-"\u12C5"]
1083     |   ["\u12C8"-"\u12CE"]
1084     |   ["\u12D0"-"\u12D6"]
1085     |   ["\u12D8"-"\u12EE"]
1086     |   ["\u12F0"-"\u130E"]
1087     |   ["\u1310"]
1088     |   ["\u1312"-"\u1315"]
1089     |   ["\u1318"-"\u131E"]
1090     |   ["\u1320"-"\u1346"]
1091     |   ["\u1348"-"\u135A"]
1092     |   ["\u13A0"-"\u13B0"]
1093     |   ["\u13B1"-"\u13F4"]
1094     |   ["\u1401"-"\u1676"]
1095     |   ["\u1681"-"\u169A"]
1096     |   ["\u16A0"-"\u16EA"]
1097     |   ["\u1780"-"\u17B3"]
1098     |   ["\u1820"-"\u1877"]
1099     |   ["\u1880"-"\u18A8"]
1100     |   ["\u1E00"-"\u1E9B"]
1101     |   ["\u1EA0"-"\u1EE0"]
1102     |   ["\u1EE1"-"\u1EF9"]
1103     |   ["\u1F00"-"\u1F15"]
1104     |   ["\u1F18"-"\u1F1D"]
1105     |   ["\u1F20"-"\u1F39"]
1106     |   ["\u1F3A"-"\u1F45"]
1107     |   ["\u1F48"-"\u1F4D"]
1108     |   ["\u1F50"-"\u1F57"]
1109     |   ["\u1F59"]
1110     |   ["\u1F5B"]
1111     |   ["\u1F5D"]
1112     |   ["\u1F5F"-"\u1F7D"]
1113     |   ["\u1F80"-"\u1FB4"]
1114     |   ["\u1FB6"-"\u1FBC"]
1115     |   ["\u1FBE"]
1116     |   ["\u1FC2"-"\u1FC4"]
1117     |   ["\u1FC6"-"\u1FCC"]
1118     |   ["\u1FD0"-"\u1FD3"]
1119     |   ["\u1FD6"-"\u1FDB"]
1120     |   ["\u1FE0"-"\u1FEC"]
1121     |   ["\u1FF2"-"\u1FF4"]
1122     |   ["\u1FF6"-"\u1FFC"]
1123     |   ["\u207F"]
1124     |   ["\u2102"]
1125     |   ["\u2107"]
1126     |   ["\u210A"-"\u2113"]
1127     |   ["\u2115"]
1128     |   ["\u2119"-"\u211D"]
1129     |   ["\u2124"]
1130     |   ["\u2126"]
1131     |   ["\u2128"]
1132     |   ["\u212A"-"\u212D"]
1133     |   ["\u212F"-"\u2131"]
1134     |   ["\u2133"-"\u2139"]
1135     |   ["\u2160"-"\u2183"]
1136     |   ["\u3005"-"\u3007"]
1137     |   ["\u3021"-"\u3029"]
1138     |   ["\u3031"-"\u3035"]
1139     |   ["\u3038"-"\u303A"]
1140     |   ["\u3041"-"\u3094"]
1141     |   ["\u309D"-"\u309E"]
1142     |   ["\u30A1"-"\u30FA"]
1143     |   ["\u30FC"-"\u30FE"]
1144     |   ["\u3105"-"\u312C"]
1145     |   ["\u3131"-"\u318E"]
1146     |   ["\u31A0"-"\u31B7"]
1147     |   ["\u3400"]
1148     |   ["\u4DB5"]
1149     |   ["\u4E00"]
1150     |   ["\u9FA5"]
1151     |   ["\uA000"-"\uA48C"]
1152     |   ["\uAC00"]
1153     |   ["\uD7A3"]
1154     |   ["\uF900"-"\uFA2D"]
1155     |   ["\uFB00"-"\uFB06"]
1156     |   ["\uFB13"-"\uFB17"]
1157     |   ["\uFB1D"]
1158     |   ["\uFB1F"-"\uFB28"]
1159     |   ["\uFB2A"-"\uFB36"]
1160     |   ["\uFB38"-"\uFB3C"]
1161     |   ["\uFB3E"]
1162     |   ["\uFB40"-"\uFB41"]
1163     |   ["\uFB43"-"\uFB44"]
1164     |   ["\uFB46"-"\uFBB1"]
1165     |   ["\uFBD3"-"\uFD3D"]
1166     |   ["\uFD50"-"\uFD8F"]
1167     |   ["\uFD92"-"\uFDC7"]
1168     |   ["\uFDF0"-"\uFDFB"]
1169     |   ["\uFE70"-"\uFE72"]
1170     |   ["\uFE74"]
1171     |   ["\uFE76"-"\uFEFC"]
1172     |   ["\uFF21"-"\uFF3A"]
1173     |   ["\uFF41"-"\uFF5A"]
1174     |   ["\uFF66"-"\uFFBE"]
1175     |   ["\uFFC2"-"\uFFC7"]
1176     |   ["\uFFCA"-"\uFFCF"]
1177     |   ["\uFFD2"-"\uFFD7"]
1178     |   ["\uFFDA"-"\uFFDC"]
1179     >
1180 } 
1181 
1182 /*
1183  * Unicode categories Non-spacing mark (MN) OR Combining spacing mark (MC)
1184  */
1185 MORE:
1186 {
1187     < UNICODE_COMBINING_MARK: <MN> | <MC> >
1188 }
1189 
1190 
1191 TOKEN:
1192 {
1193     < MC: 
1194         ["\u0903"]
1195     |   ["\u093E"]
1196     |   ["\u093F"]
1197     |   ["\u0940"]
1198     |   ["\u0949"]
1199     |   ["\u094A"]
1200     |   ["\u094B"]
1201     |   ["\u094C"]
1202     |   ["\u0982"]
1203     |   ["\u0983"]
1204     |   ["\u09BE"]
1205     |   ["\u09BF"]
1206     |   ["\u09C0"]
1207     |   ["\u09C7"]
1208     |   ["\u09C8"]
1209     |   ["\u09CB"]
1210     |   ["\u09CC"]
1211     |   ["\u09D7"]
1212     |   ["\u0A03"]
1213     |   ["\u0A3E"]
1214     |   ["\u0A3F"]
1215     |   ["\u0A40"]
1216     |   ["\u0A83"]
1217     |   ["\u0ABE"]
1218     |   ["\u0ABF"]
1219     |   ["\u0AC0"]
1220     |   ["\u0AC9"]
1221     |   ["\u0ACB"]
1222     |   ["\u0ACC"]
1223     |   ["\u0B02"]
1224     |   ["\u0B03"]
1225     |   ["\u0B3E"]
1226     |   ["\u0B40"]
1227     |   ["\u0B47"]
1228     |   ["\u0B48"]
1229     |   ["\u0B4B"]
1230     |   ["\u0B4C"]
1231     |   ["\u0B57"]
1232     |   ["\u0BBE"]
1233     |   ["\u0BBF"]
1234     |   ["\u0BC1"]
1235     |   ["\u0BC2"]
1236     |   ["\u0BC6"]
1237     |   ["\u0BC7"]
1238     |   ["\u0BC8"]
1239     |   ["\u0BCA"]
1240     |   ["\u0BCB"]
1241     |   ["\u0BCC"]
1242     |   ["\u0BD7"]
1243     |   ["\u0C01"]
1244     |   ["\u0C02"]
1245     |   ["\u0C03"]
1246     |   ["\u0C41"]
1247     |   ["\u0C42"]
1248     |   ["\u0C43"]
1249     |   ["\u0C44"]
1250     |   ["\u0C82"]
1251     |   ["\u0C83"]
1252     |   ["\u0CBE"]
1253     |   ["\u0CC0"]
1254     |   ["\u0CC1"]
1255     |   ["\u0CC2"]
1256     |   ["\u0CC3"]
1257     |   ["\u0CC4"]
1258     |   ["\u0CC7"]
1259     |   ["\u0CC8"]
1260     |   ["\u0CCA"]
1261     |   ["\u0CCB"]
1262     |   ["\u0CD5"]
1263     |   ["\u0CD6"]
1264     |   ["\u0D02"]
1265     |   ["\u0D03"]
1266     |   ["\u0D3E"]
1267     |   ["\u0D3F"]
1268     |   ["\u0D40"]
1269     |   ["\u0D46"]
1270     |   ["\u0D47"]
1271     |   ["\u0D48"]
1272     |   ["\u0D4A"]
1273     |   ["\u0D4B"]
1274     |   ["\u0D4C"]
1275     |   ["\u0D57"]
1276     |   ["\u0D82"]
1277     |   ["\u0D83"]
1278     |   ["\u0DCF"]
1279     |   ["\u0DD0"]
1280     |   ["\u0DD1"]
1281     |   ["\u0DD8"]
1282     |   ["\u0DD9"]
1283     |   ["\u0DDA"]
1284     |   ["\u0DDB"]
1285     |   ["\u0DDC"]
1286     |   ["\u0DDD"]
1287     |   ["\u0DDE"]
1288     |   ["\u0DDF"]
1289     |   ["\u0DF2"]
1290     |   ["\u0DF3"]
1291     |   ["\u0F3E"]
1292     |   ["\u0F3F"]
1293     |   ["\u0F7F"]
1294     |   ["\u102C"]
1295     |   ["\u1031"]
1296     |   ["\u1038"]
1297     |   ["\u1056"]
1298     |   ["\u1057"]
1299     |   ["\u17B6"]
1300     |   ["\u17BE"]
1301     |   ["\u17BF"]
1302     |   ["\u17C0"]
1303     |   ["\u17C1"]
1304     |   ["\u17C2"]
1305     |   ["\u17C3"]
1306     |   ["\u17C4"]
1307     |   ["\u17C5"]
1308     |   ["\u17C7"]
1309     |   ["\u17C8"]
1310     |   ["\u1923"]
1311     |   ["\u1924"]
1312     |   ["\u1925"]
1313     |   ["\u1926"]
1314     |   ["\u1929"]
1315     |   ["\u192A"]
1316     |   ["\u192B"]
1317     |   ["\u1930"]
1318     |   ["\u1931"]
1319     |   ["\u1933"]
1320     |   ["\u1934"]
1321     |   ["\u1935"]
1322     |   ["\u1936"]
1323     |   ["\u1937"]
1324     |   ["\u1938"]
1325     |   ["\u19B0"]
1326     |   ["\u19B1"]
1327     |   ["\u19B2"]
1328     |   ["\u19B3"]
1329     |   ["\u19B4"]
1330     |   ["\u19B5"]
1331     |   ["\u19B6"]
1332     |   ["\u19B7"]
1333     |   ["\u19B8"]
1334     |   ["\u19B9"]
1335     |   ["\u19BA"]
1336     |   ["\u19BB"]
1337     |   ["\u19BC"]
1338     |   ["\u19BD"]
1339     |   ["\u19BE"]
1340     |   ["\u19BF"]
1341     |   ["\u19C0"]
1342     |   ["\u19C8"]
1343     |   ["\u19C9"]
1344     |   ["\u1A19"]
1345     |   ["\u1A1A"]
1346     |   ["\u1A1B"]
1347     |   ["\uA802"]
1348     |   ["\uA823"]
1349     |   ["\uA824"]
1350     |   ["\uA827"]
1351     |   ["\u1D16"]
1352     |   ["\u1D16"]
1353     |   ["\u1D16"]
1354     |   ["\u1D16"]
1355     |   ["\u1D16"]
1356     |   ["\u1D17"]
1357     |   ["\u1D17"]
1358     |   ["\u1D17"] 
1359     >
1360 |   < MN: 
1361         ["\u0300"-"\u034E"] 
1362     |   ["\u0360"-"\u0362"] 
1363     |   ["\u0483"-"\u0486"] 
1364     |   ["\u0591"-"\u05A1"]
1365     |   ["\u05A3"-"\u05B9"] 
1366     |   ["\u05BB"-"\u05BD"] 
1367     |   ["\u05BF"]
1368     |   ["\u05C1"-"\u05C2"]
1369     |   ["\u05C4"]
1370     |   ["\u064B"-"\u0655"] 
1371     |   ["\u0670"]
1372     |   ["\u06D6"-"\u06DC"]
1373     |   ["\u06DF"-"\u06E4"] 
1374     |   ["\u06E7"-"\u06E8"] 
1375     |   ["\u06EA"-"\u06ED"] 
1376     |   ["\u0711"]
1377     |   ["\u0730"-"\u074A"] 
1378     |   ["\u07A6"-"\u07B0"] 
1379     |   ["\u0901"-"\u0903"] 
1380     |   ["\u093C"]
1381     |   ["\u093E"-"\u094D"] 
1382     |   ["\u0951"-"\u0954"] 
1383     |   ["\u0962"-"\u0963"] 
1384     |   ["\u0981"-"\u0983"]
1385     |   ["\u09BC"-"\u09C4"] 
1386     |   ["\u09C7"-"\u09C8"] 
1387     |   ["\u09CB"-"\u09CD"] 
1388     |   ["\u09D7"]
1389     |   ["\u09E2"-"\u09E3"] 
1390     |   ["\u0A02"]
1391     |   ["\u0A3C"]
1392     |   ["\u0A3E"-"\u0A42"]
1393     |   ["\u0A47"-"\u0A48"] 
1394     |   ["\u0A4B"-"\u0A4D"] 
1395     |   ["\u0A70"-"\u0A71"] 
1396     |   ["\u0A81"-"\u0A83"]
1397     |   ["\u0ABC"]
1398     |   ["\u0ABE"-"\u0AC5"] 
1399     |   ["\u0AC7"-"\u0AC9"] 
1400     |   ["\u0ACB"-"\u0ACD"]
1401     |   ["\u0B01"-"\u0B03"] 
1402     |   ["\u0B3C"]
1403     |   ["\u0B3E"-"\u0B43"] 
1404     |   ["\u0B47"-"\u0B48"]
1405     |   ["\u0B4B"-"\u0B4D"] 
1406     |   ["\u0B56"-"\u0B57"] 
1407     |   ["\u0B82"-"\u0B83"] 
1408     |   ["\u0BBE"-"\u0BC2"]
1409     |   ["\u0BC6"-"\u0BC8"] 
1410     |   ["\u0BCA"-"\u0BCD"] 
1411     |   ["\u0BD7"]
1412     |   ["\u0C01"-"\u0C03"]
1413     |   ["\u0C3E"-"\u0C44"] 
1414     |   ["\u0C46"-"\u0C48"] 
1415     |   ["\u0C4A"-"\u0C4D"] 
1416     |   ["\u0C55"-"\u0C56"]
1417     |   ["\u0C82"-"\u0C83"] 
1418     |   ["\u0CBE"-"\u0CC4"] 
1419     |   ["\u0CC6"-"\u0CC8"] 
1420     |   ["\u0CCA"-"\u0CCD"]
1421     |   ["\u0CD5"-"\u0CD6"] 
1422     |   ["\u0D02"-"\u0D03"] 
1423     |   ["\u0D3E"-"\u0D43"] 
1424     |   ["\u0D46"-"\u0D48"]
1425     |   ["\u0D4A"-"\u0D4D"] 
1426     |   ["\u0D57"]
1427     |   ["\u0D82"-"\u0D83"] 
1428     |   ["\u0DCA"]
1429     |   ["\u0DCF"-"\u0DD4"] 
1430     |   ["\u0DD6"]
1431     |   ["\u0DD8"-"\u0DDF"] 
1432     |   ["\u0DF2"-"\u0DF3"]
1433     |   ["\u0E31"]
1434     |   ["\u0E34"-"\u0E3A"] 
1435     |   ["\u0E47"-"\u0E4E"] 
1436     |   ["\u0EB1"]
1437     |   ["\u0EB4"-"\u0EB9"] 
1438     |   ["\u0EBB"-"\u0EBC"] 
1439     |   ["\u0EC8"-"\u0ECD"] 
1440     |   ["\u0F18"-"\u0F19"]
1441     |   ["\u0F35"]
1442     |   ["\u0F37"]
1443     |   ["\u0F39"]
1444     |   ["\u0F3E"-"\u0F3F"]
1445     |   ["\u0F71"-"\u0F84"] 
1446     |   ["\u0F86"-"\u0F87"] 
1447     |   ["\u0F90"-"\u0F97"] 
1448     |   ["\u0F99"-"\u0FBC"]
1449     |   ["\u0FC6"]
1450     |   ["\u102C"-"\u1032"] 
1451     |   ["\u1036"-"\u1039"] 
1452     |   ["\u1056"-"\u1059"]
1453     |   ["\u17B4"-"\u17D3"] 
1454     |   ["\u18A9"]
1455     |   ["\u20D0"-"\u20DC"] 
1456     |   ["\u20E1"]
1457     |   ["\u302A"-"\u302F"] 
1458     |   ["\u3099"-"\u309A"] 
1459     |   ["\uFB1E"]
1460     |   ["\uFE20"-"\uFE23"]
1461     >
1462 |   < UNICODE_DIGIT: 
1463         ["\u0030"-"\u0039"] 
1464     |   ["\u0660"-"\u0669"] 
1465     |   ["\u06F0"-"\u06F9"] 
1466     |   ["\u0966"-"\u096F"]
1467     |   ["\u09E6"-"\u09EF"] 
1468     |   ["\u0A66"-"\u0A6F"] 
1469     |   ["\u0AE6"-"\u0AEF"] 
1470     |   ["\u0B66"-"\u0B6F"]
1471     |   ["\u0BE7"-"\u0BEF"] 
1472     |   ["\u0C66"-"\u0C6F"] 
1473     |   ["\u0CE6"-"\u0CEF"] 
1474     |   ["\u0D66"-"\u0D6F"]
1475     |   ["\u0E50"-"\u0E59"] 
1476     |   ["\u0ED0"-"\u0ED9"] 
1477     |   ["\u0F20"-"\u0F29"] 
1478     |   ["\u1040"-"\u1049"]
1479     |   ["\u1369"-"\u1371"] 
1480     |   ["\u17E0"-"\u17E9"] 
1481     |   ["\u1810"-"\u1819"] 
1482     |   ["\uFF10"-"\uFF19"] 
1483     >
1484 |   < UNICODE_CONNECTOR_PUNCTUATION: 
1485         ["\u005F"] 
1486     |   ["\u203F"-"\u2040"]
1487     |   ["\u30FB"] 
1488     |   ["\uFE33"-"\uFE34"]
1489     |   ["\uFE4D"-"\uFE4F"]
1490     |   ["\uFF3F"]
1491     |   ["\uFF65"]
1492     >
1493 }
1494 
1495 TOKEN:
1496 {
1497     < UNICODE_ESCAPE_SEQUENCE: "u" <HEX_DIGIT> <HEX_DIGIT> <HEX_DIGIT> <HEX_DIGIT> >
1498 |   < HEX_DIGIT: ["0"-"9"] | ["a"-"f"] | ["A"-"F"] >
1499 }
1500 
1501 /* ECMA-262 5.1 Edition / June 2011 - Section 7.8.5: Regular Expression Literals */
1502 
1503 TOKEN :
1504 {
1505     < REGULAR_EXPRESSION_LITERAL:
1506         "/" ( (~["\n","\r","\\","/","*"]) | <BACKSLASH_SEQUENCE> ) 
1507         ( (~["\n","\r","\\","/"]) | <BACKSLASH_SEQUENCE> )* "/" (<IDENTIFIER_PART>)*
1508     >
1509 |
1510     < #BACKSLASH_SEQUENCE:
1511         "\\" (~["\n","\r"])
1512     >
1513 }
1514 
1515 /* Java Statements For Descripters Only! */
1516 
1517 MORE :
1518 {
1519     "#" : IN_JAVA_STATEMENT
1520 }
1521 
1522 <IN_JAVA_STATEMENT> TOKEN :
1523 {
1524     <JAVA_STATEMENT:
1525         (~["#",";","\n","\r","\u2028","\u2029"])* (";" | "\n" | "\r" | "\r\n" | "\u2028" | "\u2029")?
1526     > : DEFAULT
1527 }
1528 
1529 <IN_JAVA_STATEMENT> MORE :
1530 {
1531     < ~[] >
1532 }
1533