Advertisement
logicmoo

Inform6.jjt

Feb 23rd, 2014
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 60.84 KB | None | 0 0
  1. /**
  2.  * Added support for Java 8 language constructs.
  3.  *
  4.  * Andreas Dangel 01/2014
  5.  * ===================================================================
  6.  * Fix ForStatement to allow Annotations within the initializer.
  7.  *
  8.  * Andreas Dangel 01/2013
  9.  * ===================================================================
  10.  * Fix wrong consumption of modifiers (e.g. "final") in a for-each loop.
  11.  * Check for wrong java usage when catching multiple exceptions.
  12.  *
  13.  * Andreas Dangel 12/2012
  14.  * ===================================================================
  15.  * Enhance grammar to use LocalVariableDeclaration in a for-each loop.
  16.  * This enhances the symbol table to recognize variables declared in such
  17.  * a for-each loop.
  18.  *
  19.  * Andreas Dangel 10/2012
  20.  * ===================================================================
  21.  * Fix parser problem #3530124 with generics
  22.  *
  23.  * Modified the grammar, so that the different usages of generics work.
  24.  * Adjusted the rules, that use "super", as super is no longer a PrimarySuffix.
  25.  * It's now either a ExplicitConstructorInvocation or a PrimaryPrefix.
  26.  * See also test case ParserCornersTest/testParsersCases
  27.  *
  28.  * Andreas Dangel 05/2012
  29.  * ===================================================================
  30.  * Added support for Java 7 language constructs
  31.  *
  32.  * Dinesh Bolkensteyn (SonarSource), 10/2011
  33.  * ===================================================================
  34.  * Changed the CastLookahead production to use 3 lookaheads for primitive types as suggested by Andreas Dangel
  35.  *
  36.  * Brian Remedios 07/2011
  37.  * ===================================================================
  38.  * Added in support for assert as a name using lookaheads
  39.  *
  40.  * Tom Copeland, 09/03
  41.  * ===================================================================
  42.  * Copied over the changes made by Andrea Gini and Marco Savard to
  43.  * support JDK 1.4 language constructs, i.e., asserts.
  44.  * See the java1_4c.jj distributed in the javacc2.1/examples/JavaGrammers directory.
  45.  * Made numerous other modifications to support PMD.
  46.  *
  47.  * Tom Copeland, 6/02
  48.  * ===================================================================
  49.  * This file is a modified version of one originally found in the
  50.  * VTransformer Examples directory of JavaCC1_1. It has been
  51.  * modified to accept Java source code for Java 1.2. Basically,
  52.  * this means a new key word was added, 'strictfp', and that keyword
  53.  * added to the appropriate productions and LOOKAHEADs (where other,
  54.  * similar keywords are listed as possible choices). This involved
  55.  * changing 11 lines.
  56.  *
  57.  * Some other minor changes were made, which can be found by doing
  58.  * a search on 'DW, 7/99'.
  59.  *
  60.  * The goal of this effort was for the grammar to be able to parse
  61.  * any legal Java 1.2 source code. It does not reject all illegal
  62.  * cases, but neither did the original. Plus, when it comes to
  63.  * the new 'strictfp' keyword, the Java Compiler from Sun (JDK1.2.1)
  64.  * also does not reject all illegal cases, as defined by the
  65.  * "Updates" document found at
  66.  *       http://java.sun.com/docs/books/jls/strictfp-changes.pdf
  67.  * (see the testcases.txt file for details).
  68.  *
  69.  * David Williams, 7/99
  70.  * ===================================================================
  71.  *
  72.  *
  73.  * Copyright (C) 1996, 1997 Sun Microsystems Inc.
  74.  *
  75.  * Use of this file and the system it is part of is constrained by the
  76.  * file COPYRIGHT in the root directory of this system.  You may, however,
  77.  * make any modifications you wish to this file.
  78.  *
  79.  * Java files generated by running JavaCC on this file (or modified versions
  80.  * of this file) may be used in exactly the same manner as Java files
  81.  * generated from any grammar developed by you.
  82.  *
  83.  * Author: Sriram Sankar
  84.  * Date: 3/5/97
  85.  *
  86.  * This file contains a Java grammar and actions that implement a front-end.
  87.  */
  88.  
  89. options {
  90.   JAVA_UNICODE_ESCAPE = true;
  91.   CACHE_TOKENS = true;
  92.   STATIC = false;
  93.   USER_CHAR_STREAM = true;
  94.   JDK_VERSION = "1.5";
  95.  
  96.   MULTI = true;
  97.   VISITOR = true;
  98.   NODE_USES_PARSER = true;
  99.   NODE_PACKAGE="net.sourceforge.pmd.lang.java.ast";
  100.  
  101.   DEBUG_PARSER = true;
  102.   DEBUG_LOOKAHEAD = true;
  103. }
  104. PARSER_BEGIN(JavaParser)
  105. package net.sourceforge.pmd.lang.java.ast;
  106. import java.util.ArrayList;
  107. import java.util.List;
  108. import java.util.Map;
  109. //extends net.sourceforge.pmd.lang.ast.AbstractTokenManager
  110. import net.sourceforge.pmd.lang.ast.AbstractTokenManager;
  111. import net.sourceforge.pmd.lang.ast.CharStream;
  112. import net.sourceforge.pmd.lang.ast.TokenMgrError;
  113. import net.sourceforge.pmd.lang.ast.Node;
  114.  
  115. public class JavaParser {
  116.  
  117.   private int jdkVersion = 0;
  118.  
  119.   public void setJdkVersion(int jdkVersion) {
  120.    this.jdkVersion = jdkVersion;
  121.   }
  122.  
  123.   private void throwParseException(String message) {
  124.     int line = -1;
  125.     int col = -1;
  126.     if (jj_lastpos != null) {
  127.       line = jj_lastpos.beginLine;
  128.       col = jj_lastpos.beginColumn;
  129.     }
  130.     throw new ParseException("Line " + line + ", Column " + col + ": " + message);
  131.   }
  132.  
  133.   private void checkForBadAssertUsage(String in, String usage) {
  134.     if (jdkVersion > 3 && in.equals("assert")) {
  135.       throwParseException("Can't use 'assert' as " + usage + " when running in JDK 1.4 mode!");
  136.     }
  137.   }
  138.  
  139.   private void checkForBadStaticImportUsage() {
  140.     if (jdkVersion < 5) {
  141.       throwParseException("Can't use static imports when running in JDK 1.4 mode!");
  142.     }
  143.   }
  144.  
  145.   private void checkForBadAnnotationUsage() {
  146.     if (jdkVersion < 5) {
  147.       throwParseException("Can't use annotations when running in JDK 1.4 mode!");
  148.     }
  149.   }
  150.  
  151.   private void checkForBadGenericsUsage() {
  152.     if (jdkVersion < 5) {
  153.       throwParseException("Can't use generics unless running in JDK 1.5 mode!");
  154.     }
  155.   }
  156.  
  157.   private void checkForBadVariableArgumentsUsage() {
  158.     if (jdkVersion < 5) {
  159.       throwParseException("Can't use variable arguments (varargs) when running in JDK 1.4 mode!");
  160.     }
  161.   }
  162.  
  163.   private void checkForBadJDK15ForLoopSyntaxArgumentsUsage() {
  164.     if (jdkVersion < 5) {
  165.       throwParseException("Can't use JDK 1.5 for loop syntax when running in JDK 1.4 mode!");
  166.     }
  167.   }
  168.  
  169.   private void checkForBadEnumUsage(String in, String usage) {
  170.     if (jdkVersion >= 5 && in.equals("enum")) {
  171.       throwParseException("Can't use 'enum' as " + usage + " when running in JDK 1.5 mode!");
  172.     }
  173.   }
  174.  
  175.   private void checkForBadHexFloatingPointLiteral() {
  176.     if (jdkVersion < 5) {
  177.       throwParseException("Can't use hexadecimal floating point literals in pre-JDK 1.5 target");
  178.     }
  179.   }
  180.  
  181.   private void checkForBadNumericalLiteralslUsage(Token token) {
  182.     if (jdkVersion < 7) {
  183.       if (token.image.contains("_")) {
  184.         throwParseException("Can't use underscores in numerical literals when running in JDK inferior to 1.7 mode!");
  185.       }
  186.        
  187.       if (token.image.startsWith("0b") || token.image.startsWith("0B")) {
  188.         throwParseException("Can't use binary numerical literals when running in JDK inferior to 1.7 mode!");  
  189.       }
  190.     }
  191.   }
  192.  
  193.   private void checkForBadDiamondUsage() {
  194.     if (jdkVersion < 7) {
  195.       throwParseException("Cannot use the diamond generic notation when running in JDK inferior to 1.7 mode!");
  196.     }
  197.   }
  198.  
  199.   private void checkForBadTryWithResourcesUsage() {
  200.     if (jdkVersion < 7) {
  201.       throwParseException("Cannot use the try-with-resources notation when running in JDK inferior to 1.7 mode!");
  202.     }
  203.   }
  204.  
  205.   private void checkForBadMultipleExceptionsCatching() {
  206.     if (jdkVersion < 7) {
  207.       throwParseException("Cannot catch multiple exceptions when running in JDK inferior to 1.7 mode!");
  208.     }
  209.   }
  210.  
  211.   private void checkForBadLambdaUsage() {
  212.     if (jdkVersion < 8) {
  213.       throwParseException("Cannot use lambda expressions when running in JDK inferior to 1.8 mode!");
  214.     }
  215.   }
  216.   private void checkForBadMethodReferenceUsage() {
  217.     if (jdkVersion < 8) {
  218.       throwParseException("Cannot use method references when running in JDK inferior to 1.8 mode!");
  219.     }
  220.   }
  221.   private void checkForBadDefaultImplementationUsage() {
  222.     if (jdkVersion < 8) {
  223.       throwParseException("Cannot use default implementations in interfaces when running in JDK inferior to 1.8 mode!");
  224.     }
  225.   }
  226.   private void checkForBadIntersectionTypesInCasts() {
  227.     if (jdkVersion < 8) {
  228.       throwParseException("Cannot use intersection types in casts when running in JDK inferior to 1.8 mode!");
  229.     }
  230.   }
  231.   private void checkForBadTypeAnnotations() {
  232.     if (jdkVersion < 8) {
  233.       throwParseException("Cannot use type annotations when running in JDK inferior to 1.8 mode!");
  234.     }
  235.   }
  236.  
  237.   // This is a semantic LOOKAHEAD to determine if we're dealing with an assert
  238.   // Note that this can't be replaced with a syntactic lookahead
  239.   // since "assert" isn't a string literal token
  240.   private boolean isNextTokenAnAssert() {
  241.     boolean res = getToken(1).image.equals("assert");
  242.     if (res && jdkVersion <= 3 && getToken(2).image.equals("(")) {
  243.      res = false;
  244.     }
  245.     return res;
  246.   }
  247.  
  248.   private boolean isPrecededByComment(Token tok) {
  249.       boolean res = false;
  250.       while (!res && tok.specialToken != null) {
  251.           tok = tok.specialToken;
  252.           res = tok.kind == SINGLE_LINE_COMMENT ||
  253.                 tok.kind == FORMAL_COMMENT ||
  254.                 tok.kind == MULTI_LINE_COMMENT;
  255.       }
  256.       return res;
  257.   }
  258.  
  259.   public Map<Integer, String> getSuppressMap() {
  260.     return token_source.getSuppressMap();
  261.   }
  262.  
  263.   public void setSuppressMarker(String marker) {
  264.     token_source.setSuppressMarker(marker);
  265.   }
  266.  
  267.  
  268. }
  269. PARSER_END(JavaParser)
  270.  
  271. TOKEN_MGR_DECLS :
  272. {
  273.  
  274.      
  275.    // public class JavaParserTokenManager extends net.sourceforge.pmd.lang.ast.AbstractTokenManager implements JavaParserConstants {
  276.    
  277.     protected List<Comment> comments = new ArrayList<Comment>();
  278.  
  279. }
  280.  
  281. /* WHITE SPACE */
  282.  
  283. SPECIAL_TOKEN :
  284. {
  285.   " " | "\t" | "\n" | "\r" | "\f"
  286. }
  287.  
  288. SPECIAL_TOKEN :  /* ! = inform6   #! = beanshell  */
  289. {
  290. < SINGLE_LINE_COMMENT: ("//"|"! "|"#!")(~["\n","\r"])* ("\n"|"\r"|"\r\n")? >
  291.     {
  292.         int startOfNOPMD = matchedToken.image.indexOf(suppressMarker);
  293.         if (startOfNOPMD != -1) {
  294.             suppressMap.put(matchedToken.beginLine, matchedToken.image.substring(startOfNOPMD + suppressMarker.length()));
  295.         }
  296.         comments.add(new SingleLineComment(matchedToken));
  297.     }
  298. }
  299.  
  300. /* COMMENTS */
  301.  
  302. MORE :
  303. {
  304.   <"/**" ~["/"]> { input_stream.backup(1); } : IN_FORMAL_COMMENT
  305. |
  306.   "/*" : IN_MULTI_LINE_COMMENT
  307. }
  308.  
  309. <IN_FORMAL_COMMENT>
  310. SPECIAL_TOKEN :
  311. {
  312.   <FORMAL_COMMENT: "*/" > { comments.add(new FormalComment(matchedToken)); } : DEFAULT
  313. }
  314.  
  315. <IN_MULTI_LINE_COMMENT>
  316. SPECIAL_TOKEN :
  317. {
  318.   <MULTI_LINE_COMMENT: "*/" > { comments.add(new MultiLineComment(matchedToken)); } : DEFAULT
  319. }
  320.  
  321. <IN_FORMAL_COMMENT,IN_MULTI_LINE_COMMENT>
  322. MORE :
  323. {
  324.   < ~[] >
  325. }
  326.  
  327.  
  328. SKIP :
  329. {
  330.   "\r\n"
  331. |
  332.   "#" : PREPROCESSOR_OUTPUT
  333. }
  334.  
  335. <IN_LINE_COMMENT> SKIP:
  336. {
  337.    "\n" : DEFAULT
  338. }
  339.  
  340. <IN_LINE_COMMENT> MORE:
  341. {
  342.   < ~[] >
  343. }
  344.  
  345. <IN_COMMENT> SKIP:
  346. { "*/" : DEFAULT }
  347.  
  348. <IN_COMMENT,IN_PREPROCESSOR_OUTPUT_COMMENT> MORE:
  349. { < ~[] > }
  350.  
  351. <IN_PREPROCESSOR_OUTPUT_COMMENT> SKIP:
  352. { "*/" : PREPROCESSOR_OUTPUT }
  353.  
  354. <PREPROCESSOR_OUTPUT> SKIP:
  355. {
  356.    "\n" : DEFAULT
  357.    | "/*" : IN_PREPROCESSOR_OUTPUT_COMMENT
  358. }
  359.  
  360. <PREPROCESSOR_OUTPUT> MORE:
  361. {
  362.   "\\\n"
  363.   |
  364.   "\\\r\n"
  365.   |
  366.   < ~[] >
  367. }
  368.  
  369.  
  370. /* RESERVED WORDS AND LITERALS */
  371.  
  372. TOKEN :
  373. {
  374.   < ABSTRACT: "abstract" >
  375. | < OR: "or" >  
  376. | < PRINT: "print" >
  377. | < PRINT_RET: "print_ret" >
  378. | < H_INCLUDE: "#include" >
  379. | < H_INCLUDE_PC: "#Include" >
  380. | < INCLUDE: "include" >
  381. | < INCLUDE_PC: "Include" >
  382. | < SWITCHES: "switches" >
  383. | < SWITCHES_PC: "Switches" >
  384. | < RELEASE: "release" >
  385. | < RELEASE_PC: "Release" >
  386. | < VERSION: "version" >
  387. | < VERSION_PC: "Verson" >
  388. | < ARRAY_PC: "Array" >
  389. | < ARRAY: "array" >
  390. | < CONSTANT: "constant" >
  391. | < GLOBAL: "global" >
  392. | < GLOBAL_PC: "Global" >
  393. | < CONSTANT_PC: "Constant" >
  394. | < RTRUE: "rtrue" >
  395. | < RFALSE: "rfalse" >
  396. | < BOOLEAN: "boolean" >
  397. | < BREAK: "break" >
  398. | < BYTE: "byte" >
  399. | < CASE: "case" >
  400. | < CATCH: "catch" >
  401. | < CHAR: "char" >
  402. | < CLASS: "class" >
  403. | < CONST: "const" >
  404. | < CONTINUE: "continue" >
  405. | < _DEFAULT: "default" >
  406. | < DO: "do" >
  407. | < DOUBLE: "double" >
  408. | < ELSE: "else" >
  409. | < EXTENDS: "extends" >
  410. | < FALSE: "false" >
  411. | < FINAL: "final" >
  412. | < FINALLY: "finally" >
  413. | < FLOAT: "float" >
  414. | < FOR: "for" >
  415. | < GOTO: "goto" >
  416. | < IF: "if" >
  417. | < IMPLEMENTS: "implements" >
  418. | < IMPORT: "import" >
  419. | < INSTANCEOF: "instanceof" >
  420. | < INT: "int" >
  421. | < INTERFACE: "interface" >
  422. | < LONG: "long" >
  423. | < NATIVE: "native" >
  424. | < NEW: "new" >
  425. | < NULL: "null" >
  426. | < PACKAGE: "package">
  427. | < PRIVATE: "private" >
  428. | < PROTECTED: "protected" >
  429. | < PUBLIC: "public" >
  430. | < RETURN: "return" >
  431. | < SHORT: "short" >
  432. | < STATIC: "static" >
  433. | < SUPER: "super" >
  434. | < SWITCH: "switch" >
  435. | < SYNCHRONIZED: "synchronized" >
  436. | < THIS: "this" >
  437. | < THROW: "throw" >
  438. | < THROWS: "throws" >
  439. | < TRANSIENT: "transient" >
  440. | < TRUE: "true" >
  441. | < TRY: "try" >
  442. | < VOID: "void" >
  443. | < VOLATILE: "volatile" >
  444. | < WHILE: "while" >
  445. | < STRICTFP: "strictfp" >
  446. }
  447.  
  448. /* LITERALS */
  449.  
  450. TOKEN :
  451. {
  452.   < INTEGER_LITERAL:
  453.         <DECIMAL_LITERAL> (["l","L"])?
  454.       | <HEX_LITERAL> (["l","L"])?
  455.       | <BINARY_LITERAL> (["l","L"])?
  456.       | <OCTAL_LITERAL> (["l","L"])?
  457.   >
  458. |
  459.   < #DECIMAL_LITERAL: (["0"-"9"]((["0"-"9","_"])*["0"-"9"])?) >
  460. |
  461.   < #HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"]((["0"-"9","a"-"f","A"-"F","_"])*["0"-"9","a"-"f","A"-"F"])?) >
  462. |
  463.   < #BINARY_LITERAL: "0" ["b","B"] (["0","1"]((["0","1","_"])*["0","1"])?) >
  464. |
  465.   < #OCTAL_LITERAL: "0" (["0"-"7"]((["0"-"7","_"])*["0"-"7"])?) >
  466. |
  467.   < FLOATING_POINT_LITERAL:
  468.         (["0"-"9"]((["0"-"9","_"])*["0"-"9"])?) "." (["0"-"9"]((["0"-"9","_"])*["0"-"9"])?)? (<EXPONENT>)? (["f","F","d","D"])?
  469.       | "." (["0"-"9"]((["0"-"9","_"])*["0"-"9"])?) (<EXPONENT>)? (["f","F","d","D"])?
  470.       | (["0"-"9"]((["0"-"9","_"])*["0"-"9"])?) <EXPONENT> (["f","F","d","D"])?
  471.       | (["0"-"9"]((["0"-"9","_"])*["0"-"9"])?) (<EXPONENT>)? ["f","F","d","D"]
  472.   >
  473. |
  474.   < HEX_FLOATING_POINT_LITERAL:
  475.       (<HEX_LITERAL> (".")? | "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"]((["0"-"9","a"-"f","A"-"F","_"])*["0"-"9","a"-"f","A"-"F"])?)? "." (["0"-"9","a"-"f","A"-"F"]((["0"-"9","a"-"f","A"-"F","_"])*["0"-"9","a"-"f","A"-"F"])?)) ["p","P"] (["+","-"])? (["0"-"9"]((["0"-"9","_"])*["0"-"9"])?) (["f","F","d","D"])?
  476.   >
  477. |
  478.   < #EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"]((["0"-"9","_"])*["0"-"9"])?) >
  479. |
  480.   < CHARACTER_LITERAL:
  481.       "'"
  482.       (   (~["'","\\","\n","\r"])
  483.         | ("\\"
  484.             ( ["n","t","b","r","f","\\","'","\""]
  485.             | ["0"-"7"] ( ["0"-"7"] )?
  486.             | ["0"-"3"] ["0"-"7"] ["0"-"7"]
  487.             )
  488.           )
  489.       )
  490.       "'"
  491.   >
  492. |
  493.   < STRING_LITERAL:
  494.       "\""
  495.       (   (~["\"","\\","\n","\r"])
  496.         | ("\\"
  497.             ( ["n","t","b","r","f","\\","'","\""]
  498.             | ["0"-"7"] ( ["0"-"7"] )?
  499.             | ["0"-"3"] ["0"-"7"] ["0"-"7"]
  500.             )
  501.           )
  502.       )*
  503.       "\""
  504.   >
  505. |
  506.   < STRING_LITERAL_SQ:
  507.       "'"
  508.       (   (~["'","\\","\n","\r"])
  509.         | ("\\"
  510.             ( ["n","t","b","r","f","\\","'","\""]
  511.             | ["0"-"7"] ( ["0"-"7"] )?
  512.             | ["0"-"3"] ["0"-"7"] ["0"-"7"]
  513.             )
  514.           )
  515.       )*
  516.       "'"
  517.   >
  518. }
  519.  
  520. /* IDENTIFIERS */
  521.  
  522.  
  523. TOKEN :
  524. {
  525.   < ULXCODE: "@" <LETTER> (<PART_LETTER>)* >
  526. |
  527.   < IDENTIFIER: <LETTER> (<PART_LETTER>)* >
  528. |
  529.   < #LETTER:
  530.       [  // all chars for which Character.isIdentifierStart is true
  531.          "$",
  532.          "A"-"Z",
  533.          "_",
  534.          "a"-"z",
  535.          "\u00a2"-"\u00a5",
  536.          "\u00aa",
  537.          "\u00b5",
  538.          "\u00ba",
  539.          "\u00c0"-"\u00d6",
  540.          "\u00d8"-"\u00f6",
  541.          "\u00f8"-"\u021f",
  542.          "\u0222"-"\u0233",
  543.          "\u0250"-"\u02ad",
  544.          "\u02b0"-"\u02b8",
  545.          "\u02bb"-"\u02c1",
  546.          "\u02d0"-"\u02d1",
  547.          "\u02e0"-"\u02e4",
  548.          "\u02ee",
  549.          "\u037a",
  550.          "\u0386",
  551.          "\u0388"-"\u038a",
  552.          "\u038c",
  553.          "\u038e"-"\u03a1",
  554.          "\u03a3"-"\u03ce",
  555.          "\u03d0"-"\u03d7",
  556.          "\u03da"-"\u03f3",
  557.          "\u0400"-"\u0481",
  558.          "\u048c"-"\u04c4",
  559.          "\u04c7"-"\u04c8",
  560.          "\u04cb"-"\u04cc",
  561.          "\u04d0"-"\u04f5",
  562.          "\u04f8"-"\u04f9",
  563.          "\u0531"-"\u0556",
  564.          "\u0559",
  565.          "\u0561"-"\u0587",
  566.          "\u05d0"-"\u05ea",
  567.          "\u05f0"-"\u05f2",
  568.          "\u0621"-"\u063a",
  569.          "\u0640"-"\u064a",
  570.          "\u0671"-"\u06d3",
  571.          "\u06d5",
  572.          "\u06e5"-"\u06e6",
  573.          "\u06fa"-"\u06fc",
  574.          "\u0710",
  575.          "\u0712"-"\u072c",
  576.          "\u0780"-"\u07a5",
  577.          "\u0905"-"\u0939",
  578.          "\u093d",
  579.          "\u0950",
  580.          "\u0958"-"\u0961",
  581.          "\u0985"-"\u098c",
  582.          "\u098f"-"\u0990",
  583.          "\u0993"-"\u09a8",
  584.          "\u09aa"-"\u09b0",
  585.          "\u09b2",
  586.          "\u09b6"-"\u09b9",
  587.          "\u09dc"-"\u09dd",
  588.          "\u09df"-"\u09e1",
  589.          "\u09f0"-"\u09f3",
  590.          "\u0a05"-"\u0a0a",
  591.          "\u0a0f"-"\u0a10",
  592.          "\u0a13"-"\u0a28",
  593.          "\u0a2a"-"\u0a30",
  594.          "\u0a32"-"\u0a33",
  595.          "\u0a35"-"\u0a36",
  596.          "\u0a38"-"\u0a39",
  597.          "\u0a59"-"\u0a5c",
  598.          "\u0a5e",
  599.          "\u0a72"-"\u0a74",
  600.          "\u0a85"-"\u0a8b",
  601.          "\u0a8d",
  602.          "\u0a8f"-"\u0a91",
  603.          "\u0a93"-"\u0aa8",
  604.          "\u0aaa"-"\u0ab0",
  605.          "\u0ab2"-"\u0ab3",
  606.          "\u0ab5"-"\u0ab9",
  607.          "\u0abd",
  608.          "\u0ad0",
  609.          "\u0ae0",
  610.          "\u0b05"-"\u0b0c",
  611.          "\u0b0f"-"\u0b10",
  612.          "\u0b13"-"\u0b28",
  613.          "\u0b2a"-"\u0b30",
  614.          "\u0b32"-"\u0b33",
  615.          "\u0b36"-"\u0b39",
  616.          "\u0b3d",
  617.          "\u0b5c"-"\u0b5d",
  618.          "\u0b5f"-"\u0b61",
  619.          "\u0b85"-"\u0b8a",
  620.          "\u0b8e"-"\u0b90",
  621.          "\u0b92"-"\u0b95",
  622.          "\u0b99"-"\u0b9a",
  623.          "\u0b9c",
  624.          "\u0b9e"-"\u0b9f",
  625.          "\u0ba3"-"\u0ba4",
  626.          "\u0ba8"-"\u0baa",
  627.          "\u0bae"-"\u0bb5",
  628.          "\u0bb7"-"\u0bb9",
  629.          "\u0c05"-"\u0c0c",
  630.          "\u0c0e"-"\u0c10",
  631.          "\u0c12"-"\u0c28",
  632.          "\u0c2a"-"\u0c33",
  633.          "\u0c35"-"\u0c39",
  634.          "\u0c60"-"\u0c61",
  635.          "\u0c85"-"\u0c8c",
  636.          "\u0c8e"-"\u0c90",
  637.          "\u0c92"-"\u0ca8",
  638.          "\u0caa"-"\u0cb3",
  639.          "\u0cb5"-"\u0cb9",
  640.          "\u0cde",
  641.          "\u0ce0"-"\u0ce1",
  642.          "\u0d05"-"\u0d0c",
  643.          "\u0d0e"-"\u0d10",
  644.          "\u0d12"-"\u0d28",
  645.          "\u0d2a"-"\u0d39",
  646.          "\u0d60"-"\u0d61",
  647.          "\u0d85"-"\u0d96",
  648.          "\u0d9a"-"\u0db1",
  649.          "\u0db3"-"\u0dbb",
  650.          "\u0dbd",
  651.          "\u0dc0"-"\u0dc6",
  652.          "\u0e01"-"\u0e30",
  653.          "\u0e32"-"\u0e33",
  654.          "\u0e3f"-"\u0e46",
  655.          "\u0e81"-"\u0e82",
  656.          "\u0e84",
  657.          "\u0e87"-"\u0e88",
  658.          "\u0e8a",
  659.          "\u0e8d",
  660.          "\u0e94"-"\u0e97",
  661.          "\u0e99"-"\u0e9f",
  662.          "\u0ea1"-"\u0ea3",
  663.          "\u0ea5",
  664.          "\u0ea7",
  665.          "\u0eaa"-"\u0eab",
  666.          "\u0ead"-"\u0eb0",
  667.          "\u0eb2"-"\u0eb3",
  668.          "\u0ebd",
  669.          "\u0ec0"-"\u0ec4",
  670.          "\u0ec6",
  671.          "\u0edc"-"\u0edd",
  672.          "\u0f00",
  673.          "\u0f40"-"\u0f47",
  674.          "\u0f49"-"\u0f6a",
  675.          "\u0f88"-"\u0f8b",
  676.          "\u1000"-"\u1021",
  677.          "\u1023"-"\u1027",
  678.          "\u1029"-"\u102a",
  679.          "\u1050"-"\u1055",
  680.          "\u10a0"-"\u10c5",
  681.          "\u10d0"-"\u10f6",
  682.          "\u1100"-"\u1159",
  683.          "\u115f"-"\u11a2",
  684.          "\u11a8"-"\u11f9",
  685.          "\u1200"-"\u1206",
  686.          "\u1208"-"\u1246",
  687.          "\u1248",
  688.          "\u124a"-"\u124d",
  689.          "\u1250"-"\u1256",
  690.          "\u1258",
  691.          "\u125a"-"\u125d",
  692.          "\u1260"-"\u1286",
  693.          "\u1288",
  694.          "\u128a"-"\u128d",
  695.          "\u1290"-"\u12ae",
  696.          "\u12b0",
  697.          "\u12b2"-"\u12b5",
  698.          "\u12b8"-"\u12be",
  699.          "\u12c0",
  700.          "\u12c2"-"\u12c5",
  701.          "\u12c8"-"\u12ce",
  702.          "\u12d0"-"\u12d6",
  703.          "\u12d8"-"\u12ee",
  704.          "\u12f0"-"\u130e",
  705.          "\u1310",
  706.          "\u1312"-"\u1315",
  707.          "\u1318"-"\u131e",
  708.          "\u1320"-"\u1346",
  709.          "\u1348"-"\u135a",
  710.          "\u13a0"-"\u13f4",
  711.          "\u1401"-"\u166c",
  712.          "\u166f"-"\u1676",
  713.          "\u1681"-"\u169a",
  714.          "\u16a0"-"\u16ea",
  715.          "\u1780"-"\u17b3",
  716.          "\u17db",
  717.          "\u1820"-"\u1877",
  718.          "\u1880"-"\u18a8",
  719.          "\u1e00"-"\u1e9b",
  720.          "\u1ea0"-"\u1ef9",
  721.          "\u1f00"-"\u1f15",
  722.          "\u1f18"-"\u1f1d",
  723.          "\u1f20"-"\u1f45",
  724.          "\u1f48"-"\u1f4d",
  725.          "\u1f50"-"\u1f57",
  726.          "\u1f59",
  727.          "\u1f5b",
  728.          "\u1f5d",
  729.          "\u1f5f"-"\u1f7d",
  730.          "\u1f80"-"\u1fb4",
  731.          "\u1fb6"-"\u1fbc",
  732.          "\u1fbe",
  733.          "\u1fc2"-"\u1fc4",
  734.          "\u1fc6"-"\u1fcc",
  735.          "\u1fd0"-"\u1fd3",
  736.          "\u1fd6"-"\u1fdb",
  737.          "\u1fe0"-"\u1fec",
  738.          "\u1ff2"-"\u1ff4",
  739.          "\u1ff6"-"\u1ffc",
  740.          "\u203f"-"\u2040",
  741.          "\u207f",
  742.          "\u20a0"-"\u20af",
  743.          "\u2102",
  744.          "\u2107",
  745.          "\u210a"-"\u2113",
  746.          "\u2115",
  747.          "\u2119"-"\u211d",
  748.          "\u2124",
  749.          "\u2126",
  750.          "\u2128",
  751.          "\u212a"-"\u212d",
  752.          "\u212f"-"\u2131",
  753.          "\u2133"-"\u2139",
  754.          "\u2160"-"\u2183",
  755.          "\u3005"-"\u3007",
  756.          "\u3021"-"\u3029",
  757.          "\u3031"-"\u3035",
  758.          "\u3038"-"\u303a",
  759.          "\u3041"-"\u3094",
  760.          "\u309d"-"\u309e",
  761.          "\u30a1"-"\u30fe",
  762.          "\u3105"-"\u312c",
  763.          "\u3131"-"\u318e",
  764.          "\u31a0"-"\u31b7",
  765.          "\u3400"-"\u4db5",
  766.          "\u4e00"-"\u9fa5",
  767.          "\ua000"-"\ua48c",
  768.          "\uac00"-"\ud7a3",
  769.          "\uf900"-"\ufa2d",
  770.          "\ufb00"-"\ufb06",
  771.          "\ufb13"-"\ufb17",
  772.          "\ufb1d",
  773.          "\ufb1f"-"\ufb28",
  774.          "\ufb2a"-"\ufb36",
  775.          "\ufb38"-"\ufb3c",
  776.          "\ufb3e",
  777.          "\ufb40"-"\ufb41",
  778.          "\ufb43"-"\ufb44",
  779.          "\ufb46"-"\ufbb1",
  780.          "\ufbd3"-"\ufd3d",
  781.          "\ufd50"-"\ufd8f",
  782.          "\ufd92"-"\ufdc7",
  783.          "\ufdf0"-"\ufdfb",
  784.          "\ufe33"-"\ufe34",
  785.          "\ufe4d"-"\ufe4f",
  786.          "\ufe69",
  787.          "\ufe70"-"\ufe72",
  788.          "\ufe74",
  789.          "\ufe76"-"\ufefc",
  790.          "\uff04",
  791.          "\uff21"-"\uff3a",
  792.          "\uff3f",
  793.          "\uff41"-"\uff5a",
  794.          "\uff65"-"\uffbe",
  795.          "\uffc2"-"\uffc7",
  796.          "\uffca"-"\uffcf",
  797.          "\uffd2"-"\uffd7",
  798.          "\uffda"-"\uffdc",
  799.          "\uffe0"-"\uffe1",
  800.          "\uffe5"-"\uffe6"
  801.       ]
  802.   >
  803. |
  804.   < #PART_LETTER:
  805.       [  // all chars for which Character.isIdentifierPart is true
  806.          "\u0000"-"\u0008",
  807.          "\u000e"-"\u001b",
  808.          "$",
  809.          "0"-"9",
  810.          "A"-"Z",
  811.          "_",
  812.          "a"-"z",
  813.          "\u007f"-"\u009f",
  814.          "\u00a2"-"\u00a5",
  815.          "\u00aa",
  816.          "\u00b5",
  817.          "\u00ba",
  818.          "\u00c0"-"\u00d6",
  819.          "\u00d8"-"\u00f6",
  820.          "\u00f8"-"\u021f",
  821.          "\u0222"-"\u0233",
  822.          "\u0250"-"\u02ad",
  823.          "\u02b0"-"\u02b8",
  824.          "\u02bb"-"\u02c1",
  825.          "\u02d0"-"\u02d1",
  826.          "\u02e0"-"\u02e4",
  827.          "\u02ee",
  828.          "\u0300"-"\u034e",
  829.          "\u0360"-"\u0362",
  830.          "\u037a",
  831.          "\u0386",
  832.          "\u0388"-"\u038a",
  833.          "\u038c",
  834.          "\u038e"-"\u03a1",
  835.          "\u03a3"-"\u03ce",
  836.          "\u03d0"-"\u03d7",
  837.          "\u03da"-"\u03f3",
  838.          "\u0400"-"\u0481",
  839.          "\u0483"-"\u0486",
  840.          "\u048c"-"\u04c4",
  841.          "\u04c7"-"\u04c8",
  842.          "\u04cb"-"\u04cc",
  843.          "\u04d0"-"\u04f5",
  844.          "\u04f8"-"\u04f9",
  845.          "\u0531"-"\u0556",
  846.          "\u0559",
  847.          "\u0561"-"\u0587",
  848.          "\u0591"-"\u05a1",
  849.          "\u05a3"-"\u05b9",
  850.          "\u05bb"-"\u05bd",
  851.          "\u05bf",
  852.          "\u05c1"-"\u05c2",
  853.          "\u05c4",
  854.          "\u05d0"-"\u05ea",
  855.          "\u05f0"-"\u05f2",
  856.          "\u0621"-"\u063a",
  857.          "\u0640"-"\u0655",
  858.          "\u0660"-"\u0669",
  859.          "\u0670"-"\u06d3",
  860.          "\u06d5"-"\u06dc",
  861.          "\u06df"-"\u06e8",
  862.          "\u06ea"-"\u06ed",
  863.          "\u06f0"-"\u06fc",
  864.          "\u070f"-"\u072c",
  865.          "\u0730"-"\u074a",
  866.          "\u0780"-"\u07b0",
  867.          "\u0901"-"\u0903",
  868.          "\u0905"-"\u0939",
  869.          "\u093c"-"\u094d",
  870.          "\u0950"-"\u0954",
  871.          "\u0958"-"\u0963",
  872.          "\u0966"-"\u096f",
  873.          "\u0981"-"\u0983",
  874.          "\u0985"-"\u098c",
  875.          "\u098f"-"\u0990",
  876.          "\u0993"-"\u09a8",
  877.          "\u09aa"-"\u09b0",
  878.          "\u09b2",
  879.          "\u09b6"-"\u09b9",
  880.          "\u09bc",
  881.          "\u09be"-"\u09c4",
  882.          "\u09c7"-"\u09c8",
  883.          "\u09cb"-"\u09cd",
  884.          "\u09d7",
  885.          "\u09dc"-"\u09dd",
  886.          "\u09df"-"\u09e3",
  887.          "\u09e6"-"\u09f3",
  888.          "\u0a02",
  889.          "\u0a05"-"\u0a0a",
  890.          "\u0a0f"-"\u0a10",
  891.          "\u0a13"-"\u0a28",
  892.          "\u0a2a"-"\u0a30",
  893.          "\u0a32"-"\u0a33",
  894.          "\u0a35"-"\u0a36",
  895.          "\u0a38"-"\u0a39",
  896.          "\u0a3c",
  897.          "\u0a3e"-"\u0a42",
  898.          "\u0a47"-"\u0a48",
  899.          "\u0a4b"-"\u0a4d",
  900.          "\u0a59"-"\u0a5c",
  901.          "\u0a5e",
  902.          "\u0a66"-"\u0a74",
  903.          "\u0a81"-"\u0a83",
  904.          "\u0a85"-"\u0a8b",
  905.          "\u0a8d",
  906.          "\u0a8f"-"\u0a91",
  907.          "\u0a93"-"\u0aa8",
  908.          "\u0aaa"-"\u0ab0",
  909.          "\u0ab2"-"\u0ab3",
  910.          "\u0ab5"-"\u0ab9",
  911.          "\u0abc"-"\u0ac5",
  912.          "\u0ac7"-"\u0ac9",
  913.          "\u0acb"-"\u0acd",
  914.          "\u0ad0",
  915.          "\u0ae0",
  916.          "\u0ae6"-"\u0aef",
  917.          "\u0b01"-"\u0b03",
  918.          "\u0b05"-"\u0b0c",
  919.          "\u0b0f"-"\u0b10",
  920.          "\u0b13"-"\u0b28",
  921.          "\u0b2a"-"\u0b30",
  922.          "\u0b32"-"\u0b33",
  923.          "\u0b36"-"\u0b39",
  924.          "\u0b3c"-"\u0b43",
  925.          "\u0b47"-"\u0b48",
  926.          "\u0b4b"-"\u0b4d",
  927.          "\u0b56"-"\u0b57",
  928.          "\u0b5c"-"\u0b5d",
  929.          "\u0b5f"-"\u0b61",
  930.          "\u0b66"-"\u0b6f",
  931.          "\u0b82"-"\u0b83",
  932.          "\u0b85"-"\u0b8a",
  933.          "\u0b8e"-"\u0b90",
  934.          "\u0b92"-"\u0b95",
  935.          "\u0b99"-"\u0b9a",
  936.          "\u0b9c",
  937.          "\u0b9e"-"\u0b9f",
  938.          "\u0ba3"-"\u0ba4",
  939.          "\u0ba8"-"\u0baa",
  940.          "\u0bae"-"\u0bb5",
  941.          "\u0bb7"-"\u0bb9",
  942.          "\u0bbe"-"\u0bc2",
  943.          "\u0bc6"-"\u0bc8",
  944.          "\u0bca"-"\u0bcd",
  945.          "\u0bd7",
  946.          "\u0be7"-"\u0bef",
  947.          "\u0c01"-"\u0c03",
  948.          "\u0c05"-"\u0c0c",
  949.          "\u0c0e"-"\u0c10",
  950.          "\u0c12"-"\u0c28",
  951.          "\u0c2a"-"\u0c33",
  952.          "\u0c35"-"\u0c39",
  953.          "\u0c3e"-"\u0c44",
  954.          "\u0c46"-"\u0c48",
  955.          "\u0c4a"-"\u0c4d",
  956.          "\u0c55"-"\u0c56",
  957.          "\u0c60"-"\u0c61",
  958.          "\u0c66"-"\u0c6f",
  959.          "\u0c82"-"\u0c83",
  960.          "\u0c85"-"\u0c8c",
  961.          "\u0c8e"-"\u0c90",
  962.          "\u0c92"-"\u0ca8",
  963.          "\u0caa"-"\u0cb3",
  964.          "\u0cb5"-"\u0cb9",
  965.          "\u0cbe"-"\u0cc4",
  966.          "\u0cc6"-"\u0cc8",
  967.          "\u0cca"-"\u0ccd",
  968.          "\u0cd5"-"\u0cd6",
  969.          "\u0cde",
  970.          "\u0ce0"-"\u0ce1",
  971.          "\u0ce6"-"\u0cef",
  972.          "\u0d02"-"\u0d03",
  973.          "\u0d05"-"\u0d0c",
  974.          "\u0d0e"-"\u0d10",
  975.          "\u0d12"-"\u0d28",
  976.          "\u0d2a"-"\u0d39",
  977.          "\u0d3e"-"\u0d43",
  978.          "\u0d46"-"\u0d48",
  979.          "\u0d4a"-"\u0d4d",
  980.          "\u0d57",
  981.          "\u0d60"-"\u0d61",
  982.          "\u0d66"-"\u0d6f",
  983.          "\u0d82"-"\u0d83",
  984.          "\u0d85"-"\u0d96",
  985.          "\u0d9a"-"\u0db1",
  986.          "\u0db3"-"\u0dbb",
  987.          "\u0dbd",
  988.          "\u0dc0"-"\u0dc6",
  989.          "\u0dca",
  990.          "\u0dcf"-"\u0dd4",
  991.          "\u0dd6",
  992.          "\u0dd8"-"\u0ddf",
  993.          "\u0df2"-"\u0df3",
  994.          "\u0e01"-"\u0e3a",
  995.          "\u0e3f"-"\u0e4e",
  996.          "\u0e50"-"\u0e59",
  997.          "\u0e81"-"\u0e82",
  998.          "\u0e84",
  999.          "\u0e87"-"\u0e88",
  1000.          "\u0e8a",
  1001.          "\u0e8d",
  1002.          "\u0e94"-"\u0e97",
  1003.          "\u0e99"-"\u0e9f",
  1004.          "\u0ea1"-"\u0ea3",
  1005.          "\u0ea5",
  1006.          "\u0ea7",
  1007.          "\u0eaa"-"\u0eab",
  1008.          "\u0ead"-"\u0eb9",
  1009.          "\u0ebb"-"\u0ebd",
  1010.          "\u0ec0"-"\u0ec4",
  1011.          "\u0ec6",
  1012.          "\u0ec8"-"\u0ecd",
  1013.          "\u0ed0"-"\u0ed9",
  1014.          "\u0edc"-"\u0edd",
  1015.          "\u0f00",
  1016.          "\u0f18"-"\u0f19",
  1017.          "\u0f20"-"\u0f29",
  1018.          "\u0f35",
  1019.          "\u0f37",
  1020.          "\u0f39",
  1021.          "\u0f3e"-"\u0f47",
  1022.          "\u0f49"-"\u0f6a",
  1023.          "\u0f71"-"\u0f84",
  1024.          "\u0f86"-"\u0f8b",
  1025.          "\u0f90"-"\u0f97",
  1026.          "\u0f99"-"\u0fbc",
  1027.          "\u0fc6",
  1028.          "\u1000"-"\u1021",
  1029.          "\u1023"-"\u1027",
  1030.          "\u1029"-"\u102a",
  1031.          "\u102c"-"\u1032",
  1032.          "\u1036"-"\u1039",
  1033.          "\u1040"-"\u1049",
  1034.          "\u1050"-"\u1059",
  1035.          "\u10a0"-"\u10c5",
  1036.          "\u10d0"-"\u10f6",
  1037.          "\u1100"-"\u1159",
  1038.          "\u115f"-"\u11a2",
  1039.          "\u11a8"-"\u11f9",
  1040.          "\u1200"-"\u1206",
  1041.          "\u1208"-"\u1246",
  1042.          "\u1248",
  1043.          "\u124a"-"\u124d",
  1044.          "\u1250"-"\u1256",
  1045.          "\u1258",
  1046.          "\u125a"-"\u125d",
  1047.          "\u1260"-"\u1286",
  1048.          "\u1288",
  1049.          "\u128a"-"\u128d",
  1050.          "\u1290"-"\u12ae",
  1051.          "\u12b0",
  1052.          "\u12b2"-"\u12b5",
  1053.          "\u12b8"-"\u12be",
  1054.          "\u12c0",
  1055.          "\u12c2"-"\u12c5",
  1056.          "\u12c8"-"\u12ce",
  1057.          "\u12d0"-"\u12d6",
  1058.          "\u12d8"-"\u12ee",
  1059.          "\u12f0"-"\u130e",
  1060.          "\u1310",
  1061.          "\u1312"-"\u1315",
  1062.          "\u1318"-"\u131e",
  1063.          "\u1320"-"\u1346",
  1064.          "\u1348"-"\u135a",
  1065.          "\u1369"-"\u1371",
  1066.          "\u13a0"-"\u13f4",
  1067.          "\u1401"-"\u166c",
  1068.          "\u166f"-"\u1676",
  1069.          "\u1681"-"\u169a",
  1070.          "\u16a0"-"\u16ea",
  1071.          "\u1780"-"\u17d3",
  1072.          "\u17db",
  1073.          "\u17e0"-"\u17e9",
  1074.          "\u180b"-"\u180e",
  1075.          "\u1810"-"\u1819",
  1076.          "\u1820"-"\u1877",
  1077.          "\u1880"-"\u18a9",
  1078.          "\u1e00"-"\u1e9b",
  1079.          "\u1ea0"-"\u1ef9",
  1080.          "\u1f00"-"\u1f15",
  1081.          "\u1f18"-"\u1f1d",
  1082.          "\u1f20"-"\u1f45",
  1083.          "\u1f48"-"\u1f4d",
  1084.          "\u1f50"-"\u1f57",
  1085.          "\u1f59",
  1086.          "\u1f5b",
  1087.          "\u1f5d",
  1088.          "\u1f5f"-"\u1f7d",
  1089.          "\u1f80"-"\u1fb4",
  1090.          "\u1fb6"-"\u1fbc",
  1091.          "\u1fbe",
  1092.          "\u1fc2"-"\u1fc4",
  1093.          "\u1fc6"-"\u1fcc",
  1094.          "\u1fd0"-"\u1fd3",
  1095.          "\u1fd6"-"\u1fdb",
  1096.          "\u1fe0"-"\u1fec",
  1097.          "\u1ff2"-"\u1ff4",
  1098.          "\u1ff6"-"\u1ffc",
  1099.          "\u200c"-"\u200f",
  1100.          "\u202a"-"\u202e",
  1101.          "\u203f"-"\u2040",
  1102.          "\u206a"-"\u206f",
  1103.          "\u207f",
  1104.          "\u20a0"-"\u20af",
  1105.          "\u20d0"-"\u20dc",
  1106.          "\u20e1",
  1107.          "\u2102",
  1108.          "\u2107",
  1109.          "\u210a"-"\u2113",
  1110.          "\u2115",
  1111.          "\u2119"-"\u211d",
  1112.          "\u2124",
  1113.          "\u2126",
  1114.          "\u2128",
  1115.          "\u212a"-"\u212d",
  1116.          "\u212f"-"\u2131",
  1117.          "\u2133"-"\u2139",
  1118.          "\u2160"-"\u2183",
  1119.          "\u3005"-"\u3007",
  1120.          "\u3021"-"\u302f",
  1121.          "\u3031"-"\u3035",
  1122.          "\u3038"-"\u303a",
  1123.          "\u3041"-"\u3094",
  1124.          "\u3099"-"\u309a",
  1125.          "\u309d"-"\u309e",
  1126.          "\u30a1"-"\u30fe",
  1127.          "\u3105"-"\u312c",
  1128.          "\u3131"-"\u318e",
  1129.          "\u31a0"-"\u31b7",
  1130.          "\u3400"-"\u4db5",
  1131.          "\u4e00"-"\u9fa5",
  1132.          "\ua000"-"\ua48c",
  1133.          "\uac00"-"\ud7a3",
  1134.          "\uf900"-"\ufa2d",
  1135.          "\ufb00"-"\ufb06",
  1136.          "\ufb13"-"\ufb17",
  1137.          "\ufb1d"-"\ufb28",
  1138.          "\ufb2a"-"\ufb36",
  1139.          "\ufb38"-"\ufb3c",
  1140.          "\ufb3e",
  1141.          "\ufb40"-"\ufb41",
  1142.          "\ufb43"-"\ufb44",
  1143.          "\ufb46"-"\ufbb1",
  1144.          "\ufbd3"-"\ufd3d",
  1145.          "\ufd50"-"\ufd8f",
  1146.          "\ufd92"-"\ufdc7",
  1147.          "\ufdf0"-"\ufdfb",
  1148.          "\ufe20"-"\ufe23",
  1149.          "\ufe33"-"\ufe34",
  1150.          "\ufe4d"-"\ufe4f",
  1151.          "\ufe69",
  1152.          "\ufe70"-"\ufe72",
  1153.          "\ufe74",
  1154.          "\ufe76"-"\ufefc",
  1155.          "\ufeff",
  1156.          "\uff04",
  1157.          "\uff10"-"\uff19",
  1158.          "\uff21"-"\uff3a",
  1159.          "\uff3f",
  1160.          "\uff41"-"\uff5a",
  1161.          "\uff65"-"\uffbe",
  1162.          "\uffc2"-"\uffc7",
  1163.          "\uffca"-"\uffcf",
  1164.          "\uffd2"-"\uffd7",
  1165.          "\uffda"-"\uffdc",
  1166.          "\uffe0"-"\uffe1",
  1167.          "\uffe5"-"\uffe6",
  1168.          "\ufff9"-"\ufffb"
  1169.       ]
  1170.   >
  1171. }
  1172.  
  1173. /* SEPARATORS */
  1174.  
  1175. TOKEN :
  1176. {
  1177.   < LPAREN: "(" >
  1178. | < RPAREN: ")" >
  1179. | < LBRACE: "{" >
  1180. | < RBRACE: "}" >
  1181. | < LBRACKET: "[" >
  1182. | < RBRACKET: "]" >
  1183. | < SEMICOLON: ";" >
  1184. | < COMMA: "," >
  1185. | < DOT: "." >
  1186. | < AT: "@" >
  1187. }
  1188.  
  1189. /* OPERATORS */
  1190.  
  1191. TOKEN :
  1192. {
  1193.   < ASSIGN: "=" >
  1194. | < LT: "<" >
  1195. | < BANG: "!" >
  1196. | < TILDE: "~" >
  1197. | < HOOK: "?" >
  1198. | < COLON: ":" >
  1199. | < EQ: "==" >
  1200. | < LE: "<=" >
  1201. | < GE: ">=" >
  1202. | < NE: "!=" >
  1203. | < SC_OR: "||" >
  1204. | < SC_AND: "&&" >
  1205. | < INCR: "++" >
  1206. | < DECR: "--" >
  1207. | < PLUS: "+" >
  1208. | < MINUS: "-" >
  1209. | < STAR: "*" >
  1210. | < SLASH: "/" >
  1211. | < BIT_AND: "&" >
  1212. | < BIT_OR: "|" >
  1213. | < XOR: "^" >
  1214. | < REM: "%" >
  1215. | < LSHIFT: "<<" >
  1216. | < PLUSASSIGN: "+=" >
  1217. | < MINUSASSIGN: "-=" >
  1218. | < NOTASSIGN: "~=" >
  1219. | < STARASSIGN: "*=" >
  1220. | < SLASHASSIGN: "/=" >
  1221. | < ANDASSIGN: "&=" >
  1222. | < ORASSIGN: "|=" >
  1223. | < XORASSIGN: "^=" >
  1224. | < REMASSIGN: "%=" >
  1225. | < LSHIFTASSIGN: "<<=" >
  1226. | < RSIGNEDSHIFTASSIGN: ">>=" >
  1227. | < RUNSIGNEDSHIFTASSIGN: ">>>=" >
  1228. | < ELLIPSIS: "..." >
  1229. | < LAMBDA: "->" >
  1230. | < ARRAY_IDX: "-->" >
  1231. | < METHOD_REF: "::" >
  1232. }
  1233.  
  1234. /* >'s need special attention due to generics syntax. */
  1235. TOKEN :
  1236. {
  1237.   < RUNSIGNEDSHIFT: ">>>" >
  1238.   {
  1239.      matchedToken.kind = GT;
  1240.      ((Token.GTToken)matchedToken).realKind = RUNSIGNEDSHIFT;
  1241.      input_stream.backup(2);
  1242.      matchedToken.image = ">";
  1243.   }
  1244. | < RSIGNEDSHIFT: ">>" >
  1245.   {
  1246.      matchedToken.kind = GT;
  1247.      ((Token.GTToken)matchedToken).realKind = RSIGNEDSHIFT;
  1248.      input_stream.backup(1);
  1249.      matchedToken.image = ">";
  1250.   }
  1251. | < GT: ">" >
  1252. }
  1253.  
  1254. /*****************************************
  1255.  * THE JAVA LANGUAGE GRAMMAR STARTS HERE *
  1256.  *****************************************/
  1257.  
  1258. /*
  1259.  * Program structuring syntax follows.
  1260.  */
  1261.  
  1262. ASTCompilationUnit CompilationUnit() :
  1263. {}
  1264. {
  1265.   [ LOOKAHEAD( ( Annotation() )* "package" ) PackageDeclaration() ]
  1266.   ( ImportDeclaration() )*
  1267.   ( TypeDeclaration() )*
  1268.   ( < "\u001a" > )?
  1269.   ( < "~[]" > )?
  1270.   <EOF>
  1271. {
  1272.  jjtThis.setComments(token_source.comments);
  1273.  return jjtThis;
  1274. }
  1275. }
  1276.  
  1277. void PackageDeclaration() :
  1278. {}
  1279. {
  1280.   ( Annotation() )* "package" Name() ";"
  1281. }
  1282.  
  1283. void ImportDeclaration() :
  1284. {}
  1285. {
  1286.   "import" [ "static" {checkForBadStaticImportUsage();jjtThis.setStatic();} ] Name() [ "." "*" {jjtThis.setImportOnDemand();} ] ";"
  1287. }
  1288.  
  1289. /*
  1290.  * Modifiers. We match all modifiers in a single rule to reduce the chances of
  1291.  * syntax errors for simple modifier mistakes. It will also enable us to give
  1292.  * better error messages.
  1293.  */
  1294. int Modifiers() #void:
  1295. {
  1296.    int modifiers = 0;
  1297. }
  1298. {
  1299.  (
  1300.   LOOKAHEAD(2)
  1301.   (
  1302.    "public" { modifiers |= AccessNode.PUBLIC; }
  1303.   | "static" { modifiers |= AccessNode.STATIC; }
  1304.   | "protected" { modifiers |= AccessNode.PROTECTED; }
  1305.   | "private" { modifiers |= AccessNode.PRIVATE; }
  1306.   | "final" { modifiers |= AccessNode.FINAL; }
  1307.   | "abstract" { modifiers |= AccessNode.ABSTRACT; }
  1308.   | "synchronized" { modifiers |= AccessNode.SYNCHRONIZED; }
  1309.   | "native" { modifiers |= AccessNode.NATIVE; }
  1310.   | "transient" { modifiers |= AccessNode.TRANSIENT; }
  1311.   | "volatile" { modifiers |= AccessNode.VOLATILE; }
  1312.   | "strictfp" { modifiers |= AccessNode.STRICTFP; }
  1313.   | "default" { modifiers |= AccessNode.DEFAULT; checkForBadDefaultImplementationUsage(); }
  1314.   | Annotation()
  1315.   )
  1316.  )*
  1317.  {
  1318.     return modifiers;
  1319.  }
  1320. }
  1321.  
  1322. /*
  1323.  * Declaration syntax follows.
  1324.  */
  1325. void TypeDeclaration():
  1326. {
  1327.    int modifiers;
  1328. }
  1329. {
  1330.   ";"
  1331. |
  1332.   modifiers = Modifiers()
  1333.   (
  1334.      ClassOrInterfaceDeclaration(modifiers)
  1335.    |
  1336.      EnumDeclaration(modifiers)
  1337.    |
  1338.      AnnotationTypeDeclaration(modifiers)
  1339.   )
  1340. }
  1341.  
  1342. void ClassOrInterfaceDeclaration(int modifiers):
  1343. {
  1344. Token t = null;
  1345. jjtThis.setModifiers(modifiers);
  1346. }
  1347. {
  1348.  
  1349.   ( /* See note about this optional final modifier in BlockStatement */ ["final"|"abstract"] "class" | "interface" { jjtThis.setInterface(); } )
  1350.   t=<IDENTIFIER> { jjtThis.setImage(t.image); }
  1351.   [ TypeParameters() ]
  1352.   [ ExtendsList() ]
  1353.   [ ImplementsList() ]
  1354.   ClassOrInterfaceBody()
  1355. }
  1356.  
  1357. void ExtendsList():
  1358. {
  1359.    boolean extendsMoreThanOne = false;
  1360. }
  1361. {
  1362.    "extends" (Annotation() {checkForBadTypeAnnotations();})* ClassOrInterfaceType()
  1363.    ( "," (Annotation() {checkForBadTypeAnnotations();})* ClassOrInterfaceType() { extendsMoreThanOne = true; } )*
  1364. }
  1365.  
  1366. void ImplementsList():
  1367. {}
  1368. {
  1369.    "implements" (Annotation() {checkForBadTypeAnnotations();})* ClassOrInterfaceType()
  1370.    ( "," (Annotation() {checkForBadTypeAnnotations();})* ClassOrInterfaceType() )*
  1371. }
  1372.  
  1373. void EnumDeclaration(int modifiers):
  1374. {
  1375.  
  1376. Token t;
  1377. jjtThis.setModifiers(modifiers);
  1378. }
  1379. {
  1380.   t = <IDENTIFIER> {
  1381.     if (!t.image.equals("enum")) {
  1382.       throw new ParseException("ERROR: expecting enum");
  1383.     }
  1384.  
  1385.     if (jdkVersion < 5) {
  1386.       throw new ParseException("ERROR: Can't use enum as a keyword in pre-JDK 1.5 target");
  1387.     }
  1388.   }
  1389.   t=<IDENTIFIER> {jjtThis.setImage(t.image);}
  1390.   [ ImplementsList() ]
  1391.   EnumBody()
  1392. }
  1393.  
  1394. void EnumBody():
  1395. {}
  1396. {
  1397.    "{"
  1398.    [( Annotation() )* EnumConstant() ( LOOKAHEAD(2) "," ( Annotation() )* EnumConstant() )* ]
  1399.     [ "," ]
  1400.    [ ";" ( ClassOrInterfaceBodyDeclaration() )* ]
  1401.    "}"
  1402. }
  1403.  
  1404. void EnumConstant():
  1405. {Token t;}
  1406. {
  1407.   t=<IDENTIFIER> {jjtThis.setImage(t.image);} [ Arguments() ] [ ClassOrInterfaceBody() ]
  1408. }
  1409.  
  1410. void TypeParameters():
  1411. {}
  1412. {
  1413.    "<" {checkForBadGenericsUsage();} TypeParameter() ( "," TypeParameter() )* ">"
  1414. }
  1415.  
  1416. void TypeParameter():
  1417. {Token t;}
  1418. {
  1419.    (Annotation() {checkForBadTypeAnnotations();})*
  1420.    t=<IDENTIFIER> {jjtThis.setImage(t.image);} [ TypeBound() ]
  1421. }
  1422.  
  1423. void TypeBound():
  1424. {}
  1425. {
  1426.    "extends" ClassOrInterfaceType() ( "&" ClassOrInterfaceType() )*
  1427. }
  1428.  
  1429. void ClassOrInterfaceBody():
  1430. {}
  1431. {
  1432.   "{" ( ClassOrInterfaceBodyDeclaration() )* "}"
  1433. }
  1434.  
  1435. void ClassOrInterfaceBodyDeclaration():
  1436. {
  1437.    int modifiers;
  1438. }
  1439. { LOOKAHEAD(["static"] "{" ) Initializer()
  1440. |  modifiers = Modifiers()
  1441.   ( LOOKAHEAD(3) ClassOrInterfaceDeclaration(modifiers)
  1442.     | LOOKAHEAD(3) EnumDeclaration(modifiers)
  1443.     | LOOKAHEAD( [ TypeParameters() ] <IDENTIFIER> "(" ) ConstructorDeclaration(modifiers)
  1444.     | LOOKAHEAD( Type() <IDENTIFIER> ( "[" "]" )* ( "," | "=" | ";" | "->" | "-->" ) )  FieldDeclaration(modifiers)
  1445.     | MethodDeclaration(modifiers)
  1446.     | AnnotationTypeDeclaration(modifiers)    
  1447.   )
  1448. |
  1449.   ";"
  1450. }
  1451.  
  1452. void FieldDeclaration(int modifiers) :
  1453. {jjtThis.setModifiers(modifiers);}
  1454. {
  1455.   Type() VariableDeclarator() ( "," VariableDeclarator() )* ";"
  1456. }
  1457.  
  1458. void VariableDeclarator() :
  1459. {}
  1460. {
  1461.   VariableDeclaratorId() [ ( "=" | "-->" | "->" ) VariableInitializer() ]
  1462. }
  1463.  
  1464. void VariableDeclaratorId() :
  1465. {Token t;}
  1466. {
  1467.   t=<IDENTIFIER>
  1468.   ( "[" "]"  { jjtThis.bumpArrayDepth(); })*
  1469.   {
  1470.     checkForBadAssertUsage(t.image, "a variable name");
  1471.     checkForBadEnumUsage(t.image, "a variable name");
  1472.     jjtThis.setImage( t.image );
  1473.   }
  1474. }
  1475.  
  1476. void VariableInitializer() :
  1477. {}
  1478. {
  1479.   ArrayInitializer()
  1480. | Expression()
  1481. }
  1482.  
  1483. void ArrayInitializer() :
  1484. {}
  1485. {
  1486.   "{" [ VariableInitializer() ( LOOKAHEAD(2) "," VariableInitializer() )* ] [ "," ] "}"
  1487. }
  1488.  
  1489. void MethodDeclaration(int modifiers) :
  1490. {jjtThis.setModifiers(modifiers);}
  1491. {
  1492.   [ TypeParameters() ]
  1493.   ResultType() MethodDeclarator() [ "throws" NameList() ]
  1494.   ( Block() | ";" )
  1495. }
  1496.  
  1497. void MethodDeclarator() :
  1498. {Token t;}
  1499. {
  1500.   t=<IDENTIFIER>
  1501.   {
  1502.     checkForBadAssertUsage(t.image, "a method name");
  1503.     checkForBadEnumUsage(t.image, "a method name");
  1504.     jjtThis.setImage( t.image );
  1505.   }
  1506.   FormalParameters() ( "[" "]" )*
  1507. }
  1508.  
  1509.  
  1510. void FormalParameters() :
  1511. {}
  1512. {
  1513.   "(" [ FormalParameter() ( "," FormalParameter() )* ] ")"
  1514. }
  1515.  
  1516. void FormalParameter() :
  1517. {
  1518. }
  1519. {
  1520.    ( "final" {jjtThis.setFinal(true);} | Annotation() )*
  1521.    Type() ("|" {checkForBadMultipleExceptionsCatching();} Type())*
  1522.    [ "..." {checkForBadVariableArgumentsUsage();} {jjtThis.setVarargs();} ]
  1523.    VariableDeclaratorId()
  1524. }
  1525.  
  1526. void ConstructorDeclaration(int modifiers) :
  1527. {jjtThis.setModifiers(modifiers);
  1528. Token t;}
  1529. {
  1530.     [ TypeParameters() ]
  1531.   <IDENTIFIER> FormalParameters() [ "throws" NameList() ]
  1532.   "{"
  1533.     [ LOOKAHEAD(ExplicitConstructorInvocation()) ExplicitConstructorInvocation() ]
  1534.     ( BlockStatement() )*
  1535.   t = "}" { if (isPrecededByComment(t)) { jjtThis.setContainsComment(); } }
  1536. }
  1537.  
  1538. void ExplicitConstructorInvocation() :
  1539. {}
  1540. {
  1541.   LOOKAHEAD("this" Arguments() ";") "this" {jjtThis.setIsThis();} Arguments() ";"
  1542. |
  1543.   LOOKAHEAD(TypeArguments() "this" Arguments() ";") TypeArguments() "this" {jjtThis.setIsThis();} Arguments() ";"
  1544. |
  1545.   [ LOOKAHEAD(PrimaryExpression() ".") PrimaryExpression() "." ] [ TypeArguments() ] "super" {jjtThis.setIsSuper();} Arguments() ";"
  1546. }
  1547.  
  1548. void Initializer() :
  1549. {}
  1550. {
  1551.   [ "static" {jjtThis.setStatic();} ] Block()
  1552. }
  1553.  
  1554.  
  1555. /*
  1556.  * Type, name and expression syntax follows.
  1557.  */
  1558. void Type():
  1559. {}
  1560. {
  1561.    LOOKAHEAD(2) ReferenceType()
  1562.  |
  1563.    PrimitiveType()
  1564. }
  1565.  
  1566. void ReferenceType():
  1567. {}
  1568. {
  1569.    PrimitiveType() ( LOOKAHEAD(2) "[" "]" { jjtThis.bumpArrayDepth(); })+
  1570.   |
  1571.    ( ClassOrInterfaceType() ) ( LOOKAHEAD(2) "[" "]" { jjtThis.bumpArrayDepth(); })*
  1572. }
  1573.  
  1574. void ClassOrInterfaceType():
  1575. {
  1576.   StringBuffer s = new StringBuffer();
  1577.   Token t;
  1578. }
  1579. {
  1580.   t=<IDENTIFIER> {s.append(t.image);}
  1581.   [ LOOKAHEAD(2) TypeArguments() ]
  1582.   ( LOOKAHEAD(2) "." t=<IDENTIFIER> {s.append('.').append(t.image);} [ LOOKAHEAD(2) TypeArguments() ] )*
  1583.   {jjtThis.setImage(s.toString());}
  1584. }
  1585.  
  1586. void TypeArguments():
  1587. {}
  1588. {
  1589.    LOOKAHEAD(2)
  1590.    "<" {checkForBadGenericsUsage();} TypeArgument() ( "," TypeArgument() )* ">"
  1591.  |
  1592.    "<" {checkForBadDiamondUsage();} ">"
  1593. }
  1594.  
  1595. void TypeArgument():
  1596. {}
  1597. {
  1598.    (Annotation() {checkForBadTypeAnnotations();})* ReferenceType()
  1599.  |
  1600.    "?" [ WildcardBounds() ]
  1601. }
  1602.  
  1603. void WildcardBounds():
  1604. {}
  1605. {
  1606.    "extends" (Annotation() {checkForBadTypeAnnotations();})* ReferenceType()
  1607.  |
  1608.    "super" (Annotation() {checkForBadTypeAnnotations();})* ReferenceType()
  1609. }
  1610.  
  1611. void PrimitiveType() :
  1612. {}
  1613. {
  1614.   "boolean" {jjtThis.setImage("boolean");}
  1615. | "char" {jjtThis.setImage("char");}
  1616. | "byte" {jjtThis.setImage("byte");}
  1617. | "short" {jjtThis.setImage("short");}
  1618. | "int" {jjtThis.setImage("int");}
  1619. | "long" {jjtThis.setImage("long");}
  1620. | "float" {jjtThis.setImage("float");}
  1621. | "double" {jjtThis.setImage("double");}
  1622. }
  1623.  
  1624.  
  1625. void ResultType() :
  1626. {}
  1627. {
  1628.   "void" | Type()
  1629. }
  1630.  
  1631. void Name() :
  1632. /*
  1633.  * A lookahead of 2 is required below since "Name" can be followed
  1634.  * by a ".*" when used in the context of an "ImportDeclaration".
  1635.  */
  1636. {
  1637.   StringBuffer s = new StringBuffer();
  1638.   Token t;
  1639. }
  1640. {
  1641.   t=<IDENTIFIER>
  1642.   {
  1643.     jjtThis.testingOnly__setBeginLine( t.beginLine);
  1644.     jjtThis.testingOnly__setBeginColumn( t.beginColumn);
  1645.     s.append(t.image);
  1646.   }
  1647.   ( LOOKAHEAD(2) "." t=<IDENTIFIER>
  1648.     {s.append('.').append(t.image);}
  1649.   )*
  1650.   {jjtThis.setImage(s.toString());}
  1651. }
  1652.  
  1653. void NameList() :
  1654. {}
  1655. {
  1656.   (Annotation() {checkForBadTypeAnnotations();})* Name()
  1657.   ( "," (Annotation() {checkForBadTypeAnnotations();})* Name()
  1658.   )*
  1659. }
  1660.  
  1661.  
  1662. /*
  1663.  * Expression syntax follows.
  1664.  */
  1665.  
  1666. void Expression() :
  1667. /*
  1668.  * This expansion has been written this way instead of:
  1669.  *   Assignment() | ConditionalExpression()
  1670.  * for performance reasons.
  1671.  * However, it is a weakening of the grammar for it allows the LHS of
  1672.  * assignments to be any conditional expression whereas it can only be
  1673.  * a primary expression.  Consider adding a semantic predicate to work
  1674.  * around this.
  1675.  */
  1676. {}
  1677. {
  1678.   ConditionalExpression()
  1679.   [
  1680.     LOOKAHEAD(2) AssignmentOperator() Expression()
  1681.   ]
  1682. }
  1683.  
  1684. void AssignmentOperator() :
  1685. {}
  1686. {
  1687.       "="     {jjtThis.setImage("=");}
  1688.     | "*="    {jjtThis.setImage("*="); jjtThis.setCompound();}
  1689.     | "/="    {jjtThis.setImage("/="); jjtThis.setCompound();}
  1690.     | "%="    {jjtThis.setImage("%="); jjtThis.setCompound();}
  1691.     | "+="    {jjtThis.setImage("+="); jjtThis.setCompound();}
  1692.     | "-="    {jjtThis.setImage("-="); jjtThis.setCompound();}
  1693.     | "~="    {jjtThis.setImage("-="); jjtThis.setCompound();}
  1694.     | "<<="   {jjtThis.setImage("<<="); jjtThis.setCompound();}
  1695.     | ">>="   {jjtThis.setImage(">>="); jjtThis.setCompound();}
  1696.     | ">>>="  {jjtThis.setImage(">>>="); jjtThis.setCompound();}
  1697.     | "&="    {jjtThis.setImage("&="); jjtThis.setCompound();}
  1698.     | "^="    {jjtThis.setImage("^="); jjtThis.setCompound();}
  1699.     | "|="    {jjtThis.setImage("|="); jjtThis.setCompound();}
  1700.     | "->"    {jjtThis.setImage("-="); jjtThis.setCompound();}
  1701.     | "-->"    {jjtThis.setImage("-="); jjtThis.setCompound();}
  1702. }
  1703.  
  1704. void ConditionalExpression() #ConditionalExpression(>1) :
  1705. {}
  1706. {
  1707.   ConditionalOrExpression() [ LOOKAHEAD(2) "?" {jjtThis.setTernary();} Expression() ":" ConditionalExpression() ]
  1708. }
  1709.  
  1710. void ConditionalOrExpression() #ConditionalOrExpression(>1):
  1711. {}
  1712. {
  1713.   ConditionalAndExpression() ( LOOKAHEAD(2) "||" ConditionalAndExpression() )*
  1714. }
  1715.  
  1716. void ConditionalAndExpression() #ConditionalAndExpression(>1):
  1717. {}
  1718. {
  1719.   InclusiveOrExpression() ( LOOKAHEAD(2) "&&" InclusiveOrExpression() )*
  1720. }
  1721.  
  1722. void InclusiveOrExpression() #InclusiveOrExpression(>1) :
  1723. {}
  1724. {
  1725.   ExclusiveOrExpression() ( LOOKAHEAD(2) "|" ExclusiveOrExpression() )*
  1726. }
  1727.  
  1728. void ExclusiveOrExpression() #ExclusiveOrExpression(>1) :
  1729. {}
  1730. {
  1731.   AndExpression()  ( LOOKAHEAD(2) "^" AndExpression() )*
  1732. }
  1733.  
  1734. void AndExpression() #AndExpression(>1):
  1735. {}
  1736. {
  1737.   EqualityExpression() ( LOOKAHEAD(2) "&" EqualityExpression() )*
  1738. }
  1739.  
  1740. void EqualityExpression() #EqualityExpression(>1):
  1741. {}
  1742. {
  1743.   InstanceOfExpression()  ( LOOKAHEAD(2) ( "==" {jjtThis.setImage("==");} | "!=" {jjtThis.setImage("!=");} ) InstanceOfExpression()  )*
  1744. }
  1745.  
  1746. void InstanceOfExpression() #InstanceOfExpression(>1):
  1747. {}
  1748. {
  1749.   RelationalExpression() [ LOOKAHEAD(2) "instanceof" Type() ]
  1750. }
  1751.  
  1752. void RelationalExpression() #RelationalExpression(>1):
  1753. {}
  1754. {
  1755.   ShiftExpression()
  1756.    ( LOOKAHEAD(2)
  1757.     ( "<" {jjtThis.setImage("<");}
  1758.      | ">" {jjtThis.setImage(">");}
  1759.      | "<=" {jjtThis.setImage("<=");}
  1760.      | ">=" {jjtThis.setImage(">=");}
  1761.     ) ShiftExpression() )*
  1762. }
  1763.  
  1764. void ShiftExpression() #ShiftExpression(>1):
  1765. {}
  1766. {
  1767.   AdditiveExpression()
  1768.    ( LOOKAHEAD(2)
  1769.     ( "<<" { jjtThis.setImage("<<");}
  1770.      | RSIGNEDSHIFT()
  1771.      | RUNSIGNEDSHIFT()
  1772.     ) AdditiveExpression() )*
  1773. }
  1774.  
  1775. void AdditiveExpression() #AdditiveExpression(>1):
  1776. {}
  1777. {
  1778.   MultiplicativeExpression() ( LOOKAHEAD(2) ( "+" {jjtThis.setImage("+");} | "or" {jjtThis.setImage("or");} | "-" {jjtThis.setImage("-");} ) MultiplicativeExpression() )*
  1779. }
  1780.  
  1781. void MultiplicativeExpression() #MultiplicativeExpression(>1):
  1782. {}
  1783. {
  1784.   UnaryExpression() ( LOOKAHEAD(2) ( "*" {jjtThis.setImage("*");} | "/" {jjtThis.setImage("/");} | "%" {jjtThis.setImage("%");}) UnaryExpression() )*
  1785. }
  1786.  
  1787. void UnaryExpression() #UnaryExpression((jjtn000.getImage() != null)):
  1788. {}
  1789. {
  1790.   ("+" {jjtThis.setImage("+");} | "-" {jjtThis.setImage("-");}) UnaryExpression()
  1791.   | PreIncrementExpression()
  1792.   | PreDecrementExpression()
  1793.   | UnaryExpressionNotPlusMinus()
  1794. }
  1795.  
  1796. void PreIncrementExpression() :
  1797. {}
  1798. {
  1799.   "++" PrimaryExpression()
  1800. }
  1801.  
  1802. void PreDecrementExpression() :
  1803. {}
  1804. {
  1805.   "--" PrimaryExpression()
  1806. }
  1807.  
  1808. void UnaryExpressionNotPlusMinus() #UnaryExpressionNotPlusMinus((jjtn000.getImage() != null)):
  1809. {}
  1810. {
  1811.  ( "~" {jjtThis.setImage("~");} | "!" {jjtThis.setImage("!");} ) UnaryExpression()
  1812. | LOOKAHEAD( CastExpression() ) CastExpression()
  1813. | PostfixExpression()
  1814. }
  1815.  
  1816. void PostfixExpression() #PostfixExpression((jjtn000.getImage() != null)):
  1817. {}
  1818. {
  1819.   PrimaryExpression() [ "++" {jjtThis.setImage("++");} | "--" {jjtThis.setImage("--");} ]
  1820. }
  1821.  
  1822. void CastExpression() #CastExpression(>1):
  1823. {}
  1824. {
  1825.   LOOKAHEAD("(" (Annotation())* Type() ")") "(" (Annotation() {checkForBadTypeAnnotations();})* Type() ")" UnaryExpression()
  1826. | LOOKAHEAD("(" (Annotation())* Type() "&") "(" (Annotation() {checkForBadTypeAnnotations();})* Type() ( "&" {checkForBadIntersectionTypesInCasts(); jjtThis.setIntersectionTypes(true);} ReferenceType() )+ ")" UnaryExpressionNotPlusMinus()
  1827. | "(" (Annotation() {checkForBadTypeAnnotations();})* Type() ")" UnaryExpressionNotPlusMinus()
  1828. }
  1829.  
  1830. void PrimaryExpression() :
  1831. {}
  1832. {
  1833.   PrimaryPrefix() ( LOOKAHEAD(2) PrimarySuffix() )*
  1834. }
  1835.  
  1836. void MemberSelector():
  1837. {
  1838. Token t;
  1839. }
  1840. {
  1841.   "." TypeArguments() t=<IDENTIFIER> {jjtThis.setImage(t.image);}
  1842. | MethodReference()
  1843. }
  1844.  
  1845. void MethodReference() :
  1846. {Token t; checkForBadMethodReferenceUsage();}
  1847. {
  1848.   "::" ("new" {jjtThis.setImage("new");} | t=<IDENTIFIER> {jjtThis.setImage(t.image);} )
  1849. }
  1850.  
  1851. void PrimaryPrefix() :
  1852. {Token t;}
  1853. {
  1854.   Literal()
  1855. | "this" {jjtThis.setUsesThisModifier();}
  1856. | "super" {jjtThis.setUsesSuperModifier();}
  1857. | LOOKAHEAD( LambdaExpression() ) LambdaExpression()
  1858. | LOOKAHEAD( <IDENTIFIER> "->" ) LambdaExpression()
  1859. | LOOKAHEAD(3) "(" Expression() ")"
  1860. | AllocationExpression()
  1861. | LOOKAHEAD( ResultType() "." "class" ) ResultType() "." "class"
  1862. | LOOKAHEAD( ReferenceType() MethodReference() ) ReferenceType() MethodReference()
  1863. | Name()
  1864. }
  1865.  
  1866. void LambdaExpression() :
  1867. { checkForBadLambdaUsage(); }
  1868. {
  1869.   VariableDeclaratorId() "->" ( Expression() | Block() )
  1870. | LOOKAHEAD(3) FormalParameters() "->" ( Expression() | Block() )
  1871. | LOOKAHEAD(3) "(" VariableDeclaratorId() ( "," VariableDeclaratorId() )* ")" "->" ( Expression() | Block() )
  1872. }
  1873.  
  1874. void PrimarySuffix() :
  1875. {Token t;}
  1876. { LOOKAHEAD(2) "." "this"
  1877. | LOOKAHEAD(2) "." "super"
  1878. | LOOKAHEAD(2) "." AllocationExpression()
  1879. | LOOKAHEAD(3) MemberSelector()
  1880. | "[" Expression() "]" {jjtThis.setIsArrayDereference();}
  1881. | "." t=<IDENTIFIER> {jjtThis.setImage(t.image);}
  1882. | Arguments() {jjtThis.setIsArguments();}
  1883. }
  1884.  
  1885. void Literal() :
  1886. {}
  1887. {
  1888. { Token t;}
  1889.   t=<INTEGER_LITERAL> { checkForBadNumericalLiteralslUsage(t); jjtThis.setImage(t.image); jjtThis.setIntLiteral();}
  1890. | t=<FLOATING_POINT_LITERAL> { checkForBadNumericalLiteralslUsage(t); jjtThis.setImage(t.image); jjtThis.setFloatLiteral();}
  1891. | t=<HEX_FLOATING_POINT_LITERAL> { checkForBadHexFloatingPointLiteral(); checkForBadNumericalLiteralslUsage(t); jjtThis.setImage(t.image); jjtThis.setFloatLiteral();}
  1892. | t=<CHARACTER_LITERAL> {jjtThis.setImage(t.image); jjtThis.setCharLiteral();}
  1893. | t=<STRING_LITERAL> {jjtThis.setImage(t.image); jjtThis.setStringLiteral();}
  1894. | t=<STRING_LITERAL_SQ> {jjtThis.setImage(t.image); jjtThis.setStringLiteral();}
  1895. | BooleanLiteral()
  1896. | NullLiteral()
  1897. }
  1898.  
  1899. void BooleanLiteral() :
  1900. {}
  1901. {
  1902.   "true" { jjtThis.setTrue(); } | "false"
  1903. }
  1904.  
  1905. void NullLiteral() :
  1906. {}
  1907. { "null" }
  1908.  
  1909. void Arguments() :
  1910. {}
  1911. {
  1912.   "(" [ ArgumentList() ] ")"
  1913. }
  1914.  
  1915. void ArgumentList() :
  1916. {}
  1917. {
  1918.   Expression() ( "," Expression() )*
  1919. }
  1920.  
  1921. void AllocationExpression():
  1922. {}
  1923. {
  1924.   "new" (Annotation() {checkForBadTypeAnnotations();})*
  1925.   (LOOKAHEAD(2)
  1926.     PrimitiveType() ArrayDimsAndInits()
  1927.   |
  1928.     ClassOrInterfaceType() [ TypeArguments() ]
  1929.      (
  1930.       ArrayDimsAndInits()
  1931.      |
  1932.       Arguments() [ ClassOrInterfaceBody() ]
  1933.      )
  1934.   )
  1935. }
  1936.  
  1937. /*
  1938.  * The second LOOKAHEAD specification below is to parse to PrimarySuffix
  1939.  * if there is an expression between the "[...]".
  1940.  */
  1941. void ArrayDimsAndInits() :
  1942. {}
  1943. {
  1944.   LOOKAHEAD(2)
  1945.   ( LOOKAHEAD(2) "[" Expression() "]" )+ ( LOOKAHEAD(2) "[" "]" )*
  1946. |
  1947.   ( "[" "]" )+ ArrayInitializer()
  1948. }
  1949.  
  1950.  
  1951. /*
  1952.  * Statement syntax follows.
  1953.  */
  1954.  
  1955. void Statement() :
  1956. {}
  1957. {
  1958.   LOOKAHEAD( { isNextTokenAnAssert() } ) AssertStatement()
  1959. | LOOKAHEAD(2) LabeledStatement()
  1960. | Block()
  1961. | EmptyStatement()
  1962. | I6ToplevelDeclaration()
  1963. | I6SpecificStatement()
  1964. | StatementExpression() ";"
  1965. | SwitchStatement()
  1966. | IfStatement()
  1967. | WhileStatement()
  1968. | DoStatement()
  1969. | ForStatement()
  1970. | BreakStatement()
  1971. | ContinueStatement()
  1972. | ReturnStatement()
  1973. | ThrowStatement()
  1974. | SynchronizedStatement()
  1975. | TryStatement()
  1976. }
  1977.  
  1978. void LabeledStatement() :
  1979. {Token t;}
  1980. {
  1981.   t=<IDENTIFIER> {jjtThis.setImage(t.image);} ":" Statement()
  1982. }
  1983.  
  1984. void Block() :
  1985. {Token t;}
  1986. {
  1987.       "{"
  1988.        
  1989.       ( BlockStatement() )* t = "}" { if (isPrecededByComment(t)) { jjtThis.setContainsComment(); } }
  1990. }
  1991.  
  1992. void BlockStatement():
  1993. {}
  1994. {
  1995.   LOOKAHEAD( { isNextTokenAnAssert() } ) AssertStatement()
  1996. |
  1997.   LOOKAHEAD(( "final" | Annotation() )* Type() <IDENTIFIER>)
  1998.   LocalVariableDeclaration() ";"
  1999. |
  2000.   Statement()
  2001. |
  2002.   /*
  2003.   TODO: Seems like we should be discarding the "final"
  2004.   after using it in the lookahead; I added a ["final|abstract"] inside
  2005.   ClassOrInterfaceDeclaration, but that seems like a hack that
  2006.   could break other things...
  2007.   */
  2008.   LOOKAHEAD( [Annotation()] ["final"|"abstract"] "class") [Annotation()] ClassOrInterfaceDeclaration(0)
  2009. }
  2010.  
  2011. void LocalVariableDeclaration() :
  2012. {}
  2013. {
  2014.   ( "final" {jjtThis.setFinal(true);} | Annotation() )*
  2015.   Type()
  2016.   VariableDeclarator()
  2017.   ( "," VariableDeclarator() )*
  2018. }
  2019.  
  2020. void EmptyStatement() :
  2021. {}
  2022. {
  2023.   ";"
  2024. }
  2025.  
  2026. void StatementExpression() :
  2027. {}
  2028. {
  2029.   PreIncrementExpression()
  2030. |
  2031.   PreDecrementExpression()
  2032. |
  2033.   LOOKAHEAD( PrimaryExpression() ("++" | "--") ) PostfixExpression()
  2034. |
  2035.   PrimaryExpression()
  2036.   [
  2037.   AssignmentOperator() Expression()
  2038.   ]
  2039. }
  2040.  
  2041. void SwitchStatement() :
  2042. {}
  2043. {
  2044.   "switch" "(" Expression() ")" "{"
  2045.     ( SwitchLabel() ( BlockStatement() )* )*
  2046.   "}"
  2047. }
  2048.  
  2049. void SwitchLabel() :
  2050. {}
  2051. {
  2052.   ["case"] Expression() ":"
  2053. |
  2054.   "default" {jjtThis.setDefault();} ":"
  2055. }
  2056.  
  2057. void IfStatement() :
  2058. /*
  2059.  * The disambiguating algorithm of JavaCC automatically binds dangling
  2060.  * else's to the innermost if statement.  The LOOKAHEAD specification
  2061.  * is to tell JavaCC that we know what we are doing.
  2062.  */
  2063. {}
  2064. {
  2065.   "if" "(" Expression() ")" Statement() [ LOOKAHEAD(1) "else" {jjtThis.setHasElse();} Statement() ]
  2066. {}
  2067. }
  2068.  
  2069. void WhileStatement() :
  2070. {}
  2071. {
  2072.   "while" "(" Expression() ")" Statement()
  2073. }
  2074.  
  2075. void DoStatement() :
  2076. {}
  2077. {
  2078.   "do" Statement() "while" "(" Expression() ")" ";"
  2079. }
  2080.  
  2081.  
  2082. void ForStatement() :
  2083. {}
  2084. { "for" "("
  2085. (  
  2086.   LOOKAHEAD(LocalVariableDeclaration() ":")   {checkForBadJDK15ForLoopSyntaxArgumentsUsage();}  LocalVariableDeclaration() ":" Expression()
  2087. |
  2088.   [ ForInit() ] (";" | ":")   [ Expression() ] (";" | ":") [ ForUpdate() ]
  2089. )
  2090.  ")" Statement()
  2091. }
  2092.  
  2093. void ForInit() :
  2094. {}
  2095. {
  2096.   LOOKAHEAD( LocalVariableDeclaration() )
  2097.   LocalVariableDeclaration()
  2098. |
  2099.   StatementExpressionList()
  2100. }
  2101.  
  2102. void StatementExpressionList() :
  2103. {}
  2104. {
  2105.   StatementExpression() ( "," StatementExpression() )*
  2106. }
  2107.  
  2108. void ForUpdate() :
  2109. {}
  2110. {
  2111.   StatementExpressionList()
  2112. }
  2113.  
  2114. void BreakStatement() :
  2115. {Token t;}
  2116. {
  2117.   "break" [ t=<IDENTIFIER> {jjtThis.setImage(t.image);} ] ";"
  2118. }
  2119.  
  2120. void ContinueStatement() :
  2121. {Token t;}
  2122. {
  2123.   "continue" [ t=<IDENTIFIER> {jjtThis.setImage(t.image);} ] ";"
  2124. }
  2125.  
  2126. void ReturnStatement() :
  2127. {}
  2128. {
  2129.   "return" [ Expression() ] ";"
  2130. }
  2131.  
  2132. void ThrowStatement() :
  2133. {}
  2134. {
  2135.   "throw" Expression() ";"
  2136. }
  2137.  
  2138. void SynchronizedStatement() :
  2139. {}
  2140. {
  2141.   "synchronized" "(" Expression() ")" Block()
  2142. }
  2143.  
  2144. void TryStatement() :
  2145. /*
  2146.  * Semantic check required here to make sure that at least one
  2147.  * resource/finally/catch is present.
  2148.  */
  2149. {}
  2150. {
  2151.   "try" (ResourceSpecification())? Block()
  2152.   ( CatchStatement() )*
  2153.   [ FinallyStatement() ]
  2154. }
  2155.  
  2156. void ResourceSpecification() :
  2157. {}
  2158. {
  2159.     {checkForBadTryWithResourcesUsage();}
  2160.     "("
  2161.     Resources()
  2162.     (LOOKAHEAD(2) ";")?
  2163.     ")"
  2164. }
  2165.  
  2166. void Resources() :
  2167. {}
  2168. {
  2169.     Resource() (LOOKAHEAD(2) ";" Resource())*
  2170. }
  2171.  
  2172. void Resource() :
  2173. {}
  2174. {
  2175.     ( "final" | Annotation() )*
  2176.     Type()
  2177.     VariableDeclaratorId()
  2178.     "="
  2179.     Expression()
  2180. }
  2181.  
  2182. void CatchStatement() :
  2183. {}
  2184. {
  2185.   "catch"
  2186.   "(" FormalParameter() ")"
  2187.   Block()
  2188. }
  2189.  
  2190. void FinallyStatement() :
  2191. {}
  2192. {
  2193.     "finally" Block()
  2194. }
  2195.  
  2196. void AssertStatement() :
  2197. {
  2198.     if (jdkVersion <= 3) {
  2199.         throw new ParseException("Can't use 'assert' as a keyword when running in JDK 1.3 mode!");
  2200.     }
  2201. }
  2202. {
  2203.   <IDENTIFIER> Expression() [ ":" Expression() ] ";"
  2204. }
  2205.  
  2206. /* We use productions to match >>>, >> and > so that we can keep the
  2207.  * type declaration syntax with generics clean
  2208.  */
  2209.  
  2210. void RUNSIGNEDSHIFT():
  2211. {}
  2212. {
  2213.   ( LOOKAHEAD({ getToken(1).kind == GT &&
  2214.                 ((Token.GTToken)getToken(1)).realKind == RUNSIGNEDSHIFT} )
  2215.    ">" ">" ">"
  2216.   )
  2217. }
  2218.  
  2219. void RSIGNEDSHIFT():
  2220. {}
  2221. {
  2222.   ( LOOKAHEAD({ getToken(1).kind == GT &&
  2223.                 ((Token.GTToken)getToken(1)).realKind == RSIGNEDSHIFT} )
  2224.   ">" ">"
  2225.   )
  2226. }
  2227.  
  2228. /* Annotation syntax follows. */
  2229.  
  2230. void Annotation():
  2231. {}
  2232. {
  2233.    LOOKAHEAD( "@" Name() "(" ( <IDENTIFIER> "=" | ")" ))
  2234.    NormalAnnotation()
  2235.  |
  2236.    LOOKAHEAD( "@" Name() "(" )
  2237.    SingleMemberAnnotation()
  2238.  |
  2239.    MarkerAnnotation()
  2240. }
  2241.  
  2242. void NormalAnnotation():
  2243. {}
  2244. {
  2245.    "@" Name() "(" [ MemberValuePairs() ] ")" {checkForBadAnnotationUsage();}
  2246. }
  2247.  
  2248. void MarkerAnnotation():
  2249. {}
  2250. {
  2251.   "@" Name() {checkForBadAnnotationUsage();}
  2252. }
  2253.  
  2254. void SingleMemberAnnotation():
  2255. {}
  2256. {
  2257.   "@" Name() "(" MemberValue() ")" {checkForBadAnnotationUsage();}
  2258. }
  2259.  
  2260. void MemberValuePairs():
  2261. {}
  2262. {
  2263.    MemberValuePair() ( "," MemberValuePair() )*
  2264. }
  2265.  
  2266. void MemberValuePair():
  2267. {Token t;}
  2268. {
  2269.     t=<IDENTIFIER> { jjtThis.setImage(t.image); } "=" MemberValue()
  2270. }
  2271.  
  2272. void MemberValue():
  2273. {}
  2274. {
  2275.    Annotation()
  2276.  |
  2277.    MemberValueArrayInitializer()
  2278.  |
  2279.    ConditionalExpression()
  2280. }
  2281.  
  2282. void  MemberValueArrayInitializer():
  2283. {}
  2284. {
  2285.   "{" (MemberValue() ( LOOKAHEAD(2) "," MemberValue() )* [ "," ])? "}"
  2286. }
  2287.  
  2288.  
  2289. /* Annotation Types. */
  2290.  
  2291. void AnnotationTypeDeclaration(int modifiers):
  2292. {
  2293. Token t;
  2294. jjtThis.setModifiers(modifiers);
  2295. }
  2296. {
  2297.   "@" "interface" t=<IDENTIFIER> {checkForBadAnnotationUsage();jjtThis.setImage(t.image);} AnnotationTypeBody()
  2298. }
  2299.  
  2300. void AnnotationTypeBody():
  2301. {}
  2302. {
  2303.   "{" ( AnnotationTypeMemberDeclaration() )* "}"
  2304. }
  2305.  
  2306. void AnnotationTypeMemberDeclaration():
  2307. {
  2308.    int modifiers;
  2309. }
  2310. {
  2311.  modifiers = Modifiers()
  2312.  (
  2313.    LOOKAHEAD(3) AnnotationMethodDeclaration(modifiers)
  2314.   |
  2315.    ClassOrInterfaceDeclaration(modifiers)
  2316.   |
  2317.    LOOKAHEAD(3) EnumDeclaration(modifiers)
  2318.   |
  2319.    AnnotationTypeDeclaration(modifiers)
  2320.   |
  2321.    FieldDeclaration(modifiers)
  2322.  )
  2323.  |
  2324.    ( ";" )
  2325. }
  2326.  
  2327. void AnnotationMethodDeclaration(int modifiers):
  2328. {
  2329.   Token t;
  2330.   jjtThis.setModifiers(modifiers);
  2331. }
  2332. {
  2333.   Type() t=<IDENTIFIER> "(" ")"  [ DefaultValue() ] ";"
  2334.   {
  2335.     jjtThis.setImage(t.image);
  2336.   }
  2337. }
  2338.  
  2339. void DefaultValue():
  2340. {}
  2341. {
  2342.   "default" MemberValue()
  2343. }
  2344.  
  2345.  
  2346. /*INFORM6 BEGIN */
  2347.  
  2348.  
  2349.  
  2350.  
  2351.  
  2352.  
  2353.  
  2354.  
  2355.  
  2356.  
  2357.  
  2358.  
  2359.  
  2360.  
  2361.  
  2362. /*
  2363.     Thanks to Sreenivasa Viswanadha for suggesting how to get rid of expensive
  2364.     lookahead here.
  2365. */
  2366. boolean Line() :
  2367. {}
  2368. {
  2369.   <EOF> {
  2370.     //Interpreter.debug("End of File!");
  2371.     return true;
  2372.   }
  2373. |
  2374.   BlockStatement() {
  2375.      
  2376.     return false;
  2377.   }
  2378. }
  2379.  
  2380.  
  2381.  
  2382.  
  2383.  
  2384.  
  2385.  
  2386.  
  2387.  
  2388.  
  2389. void  I6PrintStatement() #I6PrintStatement :
  2390. {}
  2391. {
  2392.   ( "print" | "print_ret" ) I6Expressions() ";"
  2393. }
  2394.  
  2395.  
  2396. void I6FormalParameters() #I6FormalParameters :
  2397. {}
  2398. {
  2399.     (  I6FormalParameter() )*
  2400. }
  2401.  
  2402. void I6FormalParameter() #I6FormalParameter :
  2403. { Token t; }
  2404. {
  2405.   // added [] to Type for ish.  Removed [ final ] - is that legal?
  2406.   LOOKAHEAD(2) t=<IDENTIFIER> { jjtThis.name = t.image; }
  2407. |
  2408.   t=<IDENTIFIER> { jjtThis.name = t.image; }
  2409. }
  2410.  
  2411. void I6Expressions() #I6Expressions :
  2412. {}
  2413. {
  2414.    I6Expression() ( [","] I6Expression() )*
  2415. }
  2416.  
  2417. void I6Expression() #I6Expression :
  2418. {  }
  2419. {
  2420.      Expression()
  2421.     //Arguments()
  2422. }
  2423.  
  2424. void I6MethodDeclaration() #I6MethodDeclaration :
  2425. { Token t; }
  2426. {
  2427.     "[" t=<IDENTIFIER>  I6FormalParameters() ";"  I6Block()  "]" ";"
  2428.     {
  2429.         jjtThis.name = t.image;
  2430.     }
  2431. }
  2432.  
  2433.  
  2434. void I6Block() #I6Block :
  2435. {}
  2436. {
  2437.   ( BlockStatement() )*
  2438. }
  2439.  
  2440. /*
  2441. void I6ForStatement() #I6ForStatement :
  2442. { Token t = null; }
  2443. {
  2444.   "for"
  2445.   "("
  2446.    [ I6ForInit() { jjtThis.hasForInit=true; } ]
  2447.     (":"|";") [ I6ForExpression() { jjtThis.hasExpression=true; } ]
  2448.     (":"|";") [ I6ForUpdate() { jjtThis.hasForUpdate=true; } ]
  2449.     ")"
  2450.     Statement()
  2451. }
  2452.  
  2453.  
  2454.  
  2455. void I6ForStatement() #I6ForStatement :
  2456. {  }
  2457. {
  2458.   "for"  "("    [ I6ForInit()  ]  ":" [ I6ForExpression()  ]   ":" [ I6ForUpdate() ]  ")"  Statement()
  2459. }
  2460.  
  2461.  
  2462.  
  2463. void I6ForInit() #I6ForInit :
  2464. {}
  2465. {
  2466.   ForInit()
  2467.   }
  2468. void I6ForUpdate() #I6ForUpdate :
  2469. {}{
  2470.   ForUpdate()
  2471.   }
  2472. void I6ForExpression() #I6ForExpression :
  2473. {}{
  2474.      Expression()
  2475.   }
  2476.  */
  2477.  
  2478. void RTrueStatement() #RTrueStatement(true) :
  2479. {}
  2480. {
  2481.   "rtrue" ";"
  2482. }
  2483.  
  2484. void RFalseStatement() #RFalseStatement :
  2485. {}
  2486. {
  2487.   "rfalse" ";"
  2488. }
  2489.  
  2490. void PushToLabel() #PushToLabel :
  2491. {}
  2492. {
  2493.    ["-->" <IDENTIFIER>]
  2494. }
  2495.  
  2496.  
  2497. void AsmStatement() #AsmStatement :
  2498. {}
  2499. {
  2500.   (
  2501.     <ULXCODE> I6Expressions()  ";"
  2502. |
  2503.   "@"Expression() I6Expressions() ";"
  2504. )
  2505. }
  2506.  
  2507.  
  2508.  
  2509. void I6ToplevelDeclaration() #I6TopevelDeclaration :
  2510. {}
  2511. {
  2512.     I6MethodDeclaration()
  2513.  |
  2514.     I6ClassDeclaration()
  2515. }
  2516.  
  2517.  
  2518.  
  2519. void I6ClassDeclaration() #I6ClassDeclaration :
  2520. {}
  2521. {
  2522.   "CLASS DEF"
  2523. }
  2524.  
  2525.  
  2526. void i6FileDirective() #i6FileDirective :
  2527. {}
  2528. {
  2529.   (
  2530.     "release" | "switches" | "include" | "#include"
  2531.     "Release" | "Switches" | "Include" | "#Include"
  2532.    ) Literal() ";"
  2533. }
  2534.  
  2535.  
  2536. void I6SpecificStatement() #I6SpecificStatement :
  2537. {}
  2538. {
  2539.  (
  2540.  AsmStatement()
  2541.  |
  2542.   /*LOOKAHEAD ("for" "("   [ I6ForInit() ]
  2543.     ":" [ I6ForExpression() ]
  2544.     ":" [ I6ForUpdate() ] ")" )
  2545.     I6ForStatement()
  2546.  |*/
  2547.    
  2548.   ("Array"| "array") <IDENTIFIER> [("-->" | "->" ) I6Expressions()] ";"
  2549. |
  2550.   ("Constant"| "constant") <IDENTIFIER> ["=" Expression()] ";"
  2551. |
  2552.   ("Global"| "global") <IDENTIFIER> ["=" Expression()] ";"
  2553. //|
  2554. // i6FileDirective()
  2555. |
  2556.  I6PrintStatement()
  2557. |
  2558.  RFalseStatement()
  2559.  |
  2560.  RTrueStatement()
  2561. )
  2562. }
  2563.  
  2564.  
  2565.  
  2566. /*INFORM6 END */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement