Source Code Cross Referenced for Parser.java in  » IDE-Eclipse » jdt » org » eclipse » jdt » internal » compiler » parser » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Eclipse » jdt » org.eclipse.jdt.internal.compiler.parser 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


00001:        /*******************************************************************************
00002:         * Copyright (c) 2000, 2007 IBM Corporation and others.
00003:         * All rights reserved. This program and the accompanying materials
00004:         * are made available under the terms of the Eclipse Public License v1.0
00005:         * which accompanies this distribution, and is available at
00006:         * http://www.eclipse.org/legal/epl-v10.html
00007:         *
00008:         * Contributors:
00009:         *     IBM Corporation - initial API and implementation
00010:         *     Tom Tromey - patch for readTable(String) as described in http://bugs.eclipse.org/bugs/show_bug.cgi?id=32196
00011:         *******************************************************************************/package org.eclipse.jdt.internal.compiler.parser;
00012:
00013:        import java.io.*;
00014:        import java.util.ArrayList;
00015:        import java.util.Collections;
00016:        import java.util.Iterator;
00017:        import java.util.List;
00018:        import java.util.Locale;
00019:        import java.util.MissingResourceException;
00020:        import java.util.ResourceBundle;
00021:
00022:        import org.eclipse.jdt.core.compiler.CharOperation;
00023:        import org.eclipse.jdt.core.compiler.InvalidInputException;
00024:        import org.eclipse.jdt.internal.compiler.ASTVisitor;
00025:        import org.eclipse.jdt.internal.compiler.CompilationResult;
00026:        import org.eclipse.jdt.internal.compiler.ast.*;
00027:        import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
00028:        import org.eclipse.jdt.internal.compiler.env.ICompilationUnit;
00029:        import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
00030:        import org.eclipse.jdt.internal.compiler.impl.ReferenceContext;
00031:        import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
00032:        import org.eclipse.jdt.internal.compiler.lookup.ClassScope;
00033:        import org.eclipse.jdt.internal.compiler.lookup.Binding;
00034:        import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers;
00035:        import org.eclipse.jdt.internal.compiler.lookup.MethodScope;
00036:        import org.eclipse.jdt.internal.compiler.lookup.TypeConstants;
00037:        import org.eclipse.jdt.internal.compiler.lookup.TypeIds;
00038:        import org.eclipse.jdt.internal.compiler.parser.diagnose.DiagnoseParser;
00039:        import org.eclipse.jdt.internal.compiler.problem.AbortCompilation;
00040:        import org.eclipse.jdt.internal.compiler.problem.AbortCompilationUnit;
00041:        import org.eclipse.jdt.internal.compiler.problem.ProblemReporter;
00042:        import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities;
00043:        import org.eclipse.jdt.internal.compiler.util.Messages;
00044:        import org.eclipse.jdt.internal.compiler.util.Util;
00045:
00046:        public class Parser implements  ParserBasicInformation, TerminalTokens,
00047:                OperatorIds, TypeIds {
00048:            protected static final int THIS_CALL = ExplicitConstructorCall.This;
00049:            protected static final int SUPER_CALL = ExplicitConstructorCall.Super;
00050:
00051:            public static char asb[] = null;
00052:            public static char asr[] = null;
00053:            //ast stack
00054:            protected final static int AstStackIncrement = 100;
00055:            public static char base_action[] = null;
00056:            public static final int BracketKinds = 3;
00057:
00058:            public static short check_table[] = null;
00059:            public static final int CurlyBracket = 2;
00060:            private static final boolean DEBUG = false;
00061:            private static final boolean DEBUG_AUTOMATON = false;
00062:            private static final String EOF_TOKEN = "$eof"; //$NON-NLS-1$
00063:            private static final String ERROR_TOKEN = "$error"; //$NON-NLS-1$
00064:            //expression stack
00065:            protected final static int ExpressionStackIncrement = 100;
00066:
00067:            protected final static int GenericsStackIncrement = 10;
00068:
00069:            private final static String FILEPREFIX = "parser"; //$NON-NLS-1$
00070:            public static char in_symb[] = null;
00071:            private static final String INVALID_CHARACTER = "Invalid Character"; //$NON-NLS-1$
00072:            public static char lhs[] = null;
00073:
00074:            public static String name[] = null;
00075:            public static char nasb[] = null;
00076:            public static char nasr[] = null;
00077:            public static char non_terminal_index[] = null;
00078:            private final static String READABLE_NAMES_FILE = "readableNames"; //$NON-NLS-1$
00079:            private final static String READABLE_NAMES_FILE_NAME = "org.eclipse.jdt.internal.compiler.parser." + READABLE_NAMES_FILE; //$NON-NLS-1$
00080:            public static String readableName[] = null;
00081:
00082:            public static byte rhs[] = null;
00083:
00084:            public static int[] reverse_index = null;
00085:            public static char[] recovery_templates_index = null;
00086:            public static char[] recovery_templates = null;
00087:            public static char[] statements_recovery_filter = null;
00088:
00089:            public static long rules_compliance[] = null;
00090:
00091:            public static final int RoundBracket = 0;
00092:
00093:            public static byte scope_la[] = null;
00094:            public static char scope_lhs[] = null;
00095:
00096:            public static char scope_prefix[] = null;
00097:            public static char scope_rhs[] = null;
00098:            public static char scope_state[] = null;
00099:
00100:            public static char scope_state_set[] = null;
00101:            public static char scope_suffix[] = null;
00102:            public static final int SquareBracket = 1;
00103:
00104:            //internal data for the automat 
00105:            protected final static int StackIncrement = 255;
00106:
00107:            public static char term_action[] = null;
00108:            public static byte term_check[] = null;
00109:
00110:            public static char terminal_index[] = null;
00111:
00112:            private static final String UNEXPECTED_EOF = "Unexpected End Of File"; //$NON-NLS-1$
00113:            public static boolean VERBOSE_RECOVERY = false;
00114:
00115:            protected int astLengthPtr;
00116:            protected int[] astLengthStack;
00117:            protected int astPtr;
00118:            protected ASTNode[] astStack = new ASTNode[AstStackIncrement];
00119:            public CompilationUnitDeclaration compilationUnit; /*the result from parse()*/
00120:            protected RecoveredElement currentElement;
00121:            public int currentToken;
00122:            protected boolean diet = false; //tells the scanner to jump over some parts of the code/expressions like method bodies
00123:            protected int dietInt = 0; // if > 0 force the none-diet-parsing mode (even if diet if requested) [field parsing with anonymous inner classes...]
00124:            protected int endPosition; //accurate only when used ! (the start position is pushed into intStack while the end the current one)
00125:            protected int endStatementPosition;
00126:            protected int expressionLengthPtr;
00127:            protected int[] expressionLengthStack;
00128:            protected int expressionPtr;
00129:            protected Expression[] expressionStack = new Expression[ExpressionStackIncrement];
00130:            public int firstToken; // handle for multiple parsing goals
00131:
00132:            // generics management
00133:            protected int genericsIdentifiersLengthPtr;
00134:            protected int[] genericsIdentifiersLengthStack = new int[GenericsStackIncrement];
00135:            protected int genericsLengthPtr;
00136:            protected int[] genericsLengthStack = new int[GenericsStackIncrement];
00137:            protected int genericsPtr;
00138:            protected ASTNode[] genericsStack = new ASTNode[GenericsStackIncrement];
00139:
00140:            protected boolean hasError;
00141:            protected boolean hasReportedError;
00142:
00143:            //identifiers stacks 
00144:            protected int identifierLengthPtr;
00145:            protected int[] identifierLengthStack;
00146:            protected long[] identifierPositionStack;
00147:            protected int identifierPtr;
00148:            protected char[][] identifierStack;
00149:
00150:            protected boolean ignoreNextOpeningBrace;
00151:            //positions , dimensions , .... (int stacks)
00152:            protected int intPtr;
00153:            protected int[] intStack;
00154:            public int lastAct; //handle for multiple parsing goals
00155:
00156:            //error recovery management
00157:            protected int lastCheckPoint;
00158:            protected int lastErrorEndPosition;
00159:            protected int lastErrorEndPositionBeforeRecovery = -1;
00160:            protected int lastIgnoredToken, nextIgnoredToken;
00161:            protected int listLength; // for recovering some incomplete list (interfaces, throws or parameters)
00162:            protected int listTypeParameterLength; // for recovering some incomplete list (type parameters)
00163:            protected int lParenPos, rParenPos; //accurate only when used !
00164:            protected int modifiers;
00165:            protected int modifiersSourceStart;
00166:            protected int[] nestedMethod; //the ptr is nestedType
00167:            protected int nestedType, dimensions;
00168:            ASTNode[] noAstNodes = new ASTNode[AstStackIncrement];
00169:            Expression[] noExpressions = new Expression[ExpressionStackIncrement];
00170:            //modifiers dimensions nestedType etc.......
00171:            protected boolean optimizeStringLiterals = true;
00172:            protected CompilerOptions options;
00173:            protected ProblemReporter problemReporter;
00174:            protected int rBraceStart, rBraceEnd, rBraceSuccessorStart; //accurate only when used !
00175:            protected int realBlockPtr;
00176:            protected int[] realBlockStack;
00177:            protected int recoveredStaticInitializerStart;
00178:            public ReferenceContext referenceContext;
00179:            public boolean reportOnlyOneSyntaxError = false;
00180:            public boolean reportSyntaxErrorIsRequired = true;
00181:            protected boolean restartRecovery;
00182:
00183:            // statement recovery
00184:            //	public boolean statementRecoveryEnabled = true;
00185:            public boolean methodRecoveryActivated = false;
00186:            protected boolean statementRecoveryActivated = false;
00187:            protected TypeDeclaration[] recoveredTypes;
00188:            protected int recoveredTypePtr;
00189:            protected int nextTypeStart;
00190:            protected TypeDeclaration pendingRecoveredType;
00191:
00192:            public RecoveryScanner recoveryScanner;
00193:
00194:            //scanner token 
00195:            public Scanner scanner;
00196:            protected int[] stack = new int[StackIncrement];
00197:            protected int stateStackTop;
00198:            protected int synchronizedBlockSourceStart;
00199:            protected int[] variablesCounter;
00200:
00201:            protected boolean checkExternalizeStrings;
00202:            protected boolean recordStringLiterals;
00203:
00204:            // javadoc
00205:            public Javadoc javadoc;
00206:            public JavadocParser javadocParser;
00207:            // used for recovery
00208:            protected int lastJavadocEnd;
00209:
00210:            static {
00211:                try {
00212:                    initTables();
00213:                } catch (java.io.IOException ex) {
00214:                    throw new ExceptionInInitializerError(ex.getMessage());
00215:                }
00216:            }
00217:
00218:            public static int asi(int state) {
00219:
00220:                return asb[original_state(state)];
00221:            }
00222:
00223:            public final static short base_check(int i) {
00224:                return check_table[i - (NUM_RULES + 1)];
00225:            }
00226:
00227:            private final static void buildFile(String filename, List listToDump) {
00228:                BufferedWriter writer = null;
00229:                try {
00230:                    writer = new BufferedWriter(new FileWriter(filename));
00231:                    for (Iterator iterator = listToDump.iterator(); iterator
00232:                            .hasNext();) {
00233:                        writer.write(String.valueOf(iterator.next()));
00234:                    }
00235:                    writer.flush();
00236:                } catch (IOException e) {
00237:                    // ignore
00238:                } finally {
00239:                    if (writer != null) {
00240:                        try {
00241:                            writer.close();
00242:                        } catch (IOException e1) {
00243:                            // ignore
00244:                        }
00245:                    }
00246:                }
00247:                System.out.println(filename + " creation complete"); //$NON-NLS-1$
00248:            }
00249:
00250:            private final static String[] buildFileForName(String filename,
00251:                    String contents) {
00252:                String[] result = new String[contents.length()];
00253:                result[0] = null;
00254:                int resultCount = 1;
00255:
00256:                StringBuffer buffer = new StringBuffer();
00257:
00258:                int start = contents.indexOf("name[]"); //$NON-NLS-1$
00259:                start = contents.indexOf('\"', start);
00260:                int end = contents.indexOf("};", start); //$NON-NLS-1$
00261:
00262:                contents = contents.substring(start, end);
00263:
00264:                boolean addLineSeparator = false;
00265:                int tokenStart = -1;
00266:                StringBuffer currentToken = new StringBuffer();
00267:                for (int i = 0; i < contents.length(); i++) {
00268:                    char c = contents.charAt(i);
00269:                    if (c == '\"') {
00270:                        if (tokenStart == -1) {
00271:                            tokenStart = i + 1;
00272:                        } else {
00273:                            if (addLineSeparator) {
00274:                                buffer.append('\n');
00275:                                result[resultCount++] = currentToken.toString();
00276:                                currentToken = new StringBuffer();
00277:                            }
00278:                            String token = contents.substring(tokenStart, i);
00279:                            if (token.equals(ERROR_TOKEN)) {
00280:                                token = INVALID_CHARACTER;
00281:                            } else if (token.equals(EOF_TOKEN)) {
00282:                                token = UNEXPECTED_EOF;
00283:                            }
00284:                            buffer.append(token);
00285:                            currentToken.append(token);
00286:                            addLineSeparator = true;
00287:                            tokenStart = -1;
00288:                        }
00289:                    }
00290:                    if (tokenStart == -1 && c == '+') {
00291:                        addLineSeparator = false;
00292:                    }
00293:                }
00294:                if (currentToken.length() > 0) {
00295:                    result[resultCount++] = currentToken.toString();
00296:                }
00297:
00298:                buildFileForTable(filename, buffer.toString().toCharArray());
00299:
00300:                System.arraycopy(result, 0, result = new String[resultCount],
00301:                        0, resultCount);
00302:                return result;
00303:            }
00304:
00305:            private static void buildFileForReadableName(String file,
00306:                    char[] newLhs, char[] newNonTerminalIndex,
00307:                    String[] newName, String[] tokens) {
00308:
00309:                ArrayList entries = new ArrayList();
00310:
00311:                boolean[] alreadyAdded = new boolean[newName.length];
00312:
00313:                for (int i = 0; i < tokens.length; i = i + 3) {
00314:                    if ("1".equals(tokens[i])) { //$NON-NLS-1$
00315:                        int index = newNonTerminalIndex[newLhs[Integer
00316:                                .parseInt(tokens[i + 1])]];
00317:                        StringBuffer buffer = new StringBuffer();
00318:                        if (!alreadyAdded[index]) {
00319:                            alreadyAdded[index] = true;
00320:                            buffer.append(newName[index]);
00321:                            buffer.append('=');
00322:                            buffer.append(tokens[i + 2].trim());
00323:                            buffer.append('\n');
00324:                            entries.add(String.valueOf(buffer));
00325:                        }
00326:                    }
00327:                }
00328:                int i = 1;
00329:                while (!INVALID_CHARACTER.equals(newName[i]))
00330:                    i++;
00331:                i++;
00332:                for (; i < alreadyAdded.length; i++) {
00333:                    if (!alreadyAdded[i]) {
00334:                        System.out
00335:                                .println(newName[i] + " has no readable name"); //$NON-NLS-1$
00336:                    }
00337:                }
00338:                Collections.sort(entries);
00339:                buildFile(file, entries);
00340:            }
00341:
00342:            private static void buildFilesForRecoveryTemplates(
00343:                    String indexFilename, String templatesFilename,
00344:                    char[] newTerminalIndex, char[] newNonTerminalIndex,
00345:                    String[] newName, char[] newLhs, String[] tokens) {
00346:
00347:                int[] newReverse = computeReverseTable(newTerminalIndex,
00348:                        newNonTerminalIndex, newName);
00349:
00350:                char[] newRecoveyTemplatesIndex = new char[newNonTerminalIndex.length];
00351:                char[] newRecoveyTemplates = new char[newNonTerminalIndex.length];
00352:                int newRecoveyTemplatesPtr = 0;
00353:
00354:                for (int i = 0; i < tokens.length; i = i + 3) {
00355:                    if ("3".equals(tokens[i])) { //$NON-NLS-1$
00356:                        int length = newRecoveyTemplates.length;
00357:                        if (length == newRecoveyTemplatesPtr + 1) {
00358:                            System.arraycopy(newRecoveyTemplates, 0,
00359:                                    newRecoveyTemplates = new char[length * 2],
00360:                                    0, length);
00361:                        }
00362:                        newRecoveyTemplates[newRecoveyTemplatesPtr++] = 0;
00363:
00364:                        int index = newLhs[Integer.parseInt(tokens[i + 1])];
00365:
00366:                        newRecoveyTemplatesIndex[index] = (char) newRecoveyTemplatesPtr;
00367:
00368:                        String token = tokens[i + 2].trim();
00369:                        java.util.StringTokenizer st = new java.util.StringTokenizer(
00370:                                new String(token), " "); //$NON-NLS-1$
00371:                        String[] terminalNames = new String[st.countTokens()];
00372:                        int t = 0;
00373:                        while (st.hasMoreTokens()) {
00374:                            terminalNames[t++] = st.nextToken();
00375:                        }
00376:
00377:                        for (int j = 0; j < terminalNames.length; j++) {
00378:                            int symbol = getSymbol(terminalNames[j], newName,
00379:                                    newReverse);
00380:                            if (symbol > -1) {
00381:                                length = newRecoveyTemplates.length;
00382:                                if (length == newRecoveyTemplatesPtr + 1) {
00383:                                    System
00384:                                            .arraycopy(
00385:                                                    newRecoveyTemplates,
00386:                                                    0,
00387:                                                    newRecoveyTemplates = new char[length * 2],
00388:                                                    0, length);
00389:                                }
00390:                                newRecoveyTemplates[newRecoveyTemplatesPtr++] = (char) symbol;
00391:                            }
00392:                        }
00393:                    }
00394:                }
00395:                newRecoveyTemplates[newRecoveyTemplatesPtr++] = 0;
00396:                System.arraycopy(newRecoveyTemplates, 0,
00397:                        newRecoveyTemplates = new char[newRecoveyTemplatesPtr],
00398:                        0, newRecoveyTemplatesPtr);
00399:
00400:                buildFileForTable(indexFilename, newRecoveyTemplatesIndex);
00401:                buildFileForTable(templatesFilename, newRecoveyTemplates);
00402:            }
00403:
00404:            private static void buildFilesForStatementsRecoveryFilter(
00405:                    String filename, char[] newNonTerminalIndex, char[] newLhs,
00406:                    String[] tokens) {
00407:
00408:                char[] newStatementsRecoveryFilter = new char[newNonTerminalIndex.length];
00409:
00410:                for (int i = 0; i < tokens.length; i = i + 3) {
00411:                    if ("4".equals(tokens[i])) { //$NON-NLS-1$
00412:                        int index = newLhs[Integer.parseInt(tokens[i + 1])];
00413:
00414:                        newStatementsRecoveryFilter[index] = 1;
00415:                    }
00416:                }
00417:                buildFileForTable(filename, newStatementsRecoveryFilter);
00418:            }
00419:
00420:            private static void buildFileForCompliance(String file, int length,
00421:                    String[] tokens) {
00422:
00423:                byte[] result = new byte[length * 8];
00424:
00425:                for (int i = 0; i < tokens.length; i = i + 3) {
00426:                    if ("2".equals(tokens[i])) { //$NON-NLS-1$
00427:                        int index = Integer.parseInt(tokens[i + 1]);
00428:                        String token = tokens[i + 2].trim();
00429:                        long compliance = 0;
00430:                        if ("1.4".equals(token)) { //$NON-NLS-1$
00431:                            compliance = ClassFileConstants.JDK1_4;
00432:                        } else if ("1.5".equals(token)) { //$NON-NLS-1$
00433:                            compliance = ClassFileConstants.JDK1_5;
00434:                        } else if ("recovery".equals(token)) { //$NON-NLS-1$
00435:                            compliance = ClassFileConstants.JDK_DEFERRED;
00436:                        }
00437:
00438:                        int j = index * 8;
00439:                        result[j] = (byte) (compliance >>> 56);
00440:                        result[j + 1] = (byte) (compliance >>> 48);
00441:                        result[j + 2] = (byte) (compliance >>> 40);
00442:                        result[j + 3] = (byte) (compliance >>> 32);
00443:                        result[j + 4] = (byte) (compliance >>> 24);
00444:                        result[j + 5] = (byte) (compliance >>> 16);
00445:                        result[j + 6] = (byte) (compliance >>> 8);
00446:                        result[j + 7] = (byte) (compliance);
00447:                    }
00448:                }
00449:
00450:                buildFileForTable(file, result);
00451:            }
00452:
00453:            private final static void buildFileForTable(String filename,
00454:                    byte[] bytes) {
00455:                java.io.FileOutputStream stream = null;
00456:                try {
00457:                    stream = new java.io.FileOutputStream(filename);
00458:                    stream.write(bytes);
00459:                } catch (IOException e) {
00460:                    // ignore
00461:                } finally {
00462:                    if (stream != null) {
00463:                        try {
00464:                            stream.close();
00465:                        } catch (IOException e) {
00466:                            // ignore
00467:                        }
00468:                    }
00469:                }
00470:                System.out.println(filename + " creation complete"); //$NON-NLS-1$
00471:            }
00472:
00473:            private final static void buildFileForTable(String filename,
00474:                    char[] chars) {
00475:                byte[] bytes = new byte[chars.length * 2];
00476:                for (int i = 0; i < chars.length; i++) {
00477:                    bytes[2 * i] = (byte) (chars[i] >>> 8);
00478:                    bytes[2 * i + 1] = (byte) (chars[i] & 0xFF);
00479:                }
00480:
00481:                java.io.FileOutputStream stream = null;
00482:                try {
00483:                    stream = new java.io.FileOutputStream(filename);
00484:                    stream.write(bytes);
00485:                } catch (IOException e) {
00486:                    // ignore
00487:                } finally {
00488:                    if (stream != null) {
00489:                        try {
00490:                            stream.close();
00491:                        } catch (IOException e) {
00492:                            // ignore
00493:                        }
00494:                    }
00495:                }
00496:                System.out.println(filename + " creation complete"); //$NON-NLS-1$
00497:            }
00498:
00499:            private final static byte[] buildFileOfByteFor(String filename,
00500:                    String tag, String[] tokens) {
00501:
00502:                //transform the String tokens into chars before dumping then into file
00503:
00504:                int i = 0;
00505:                //read upto the tag
00506:                while (!tokens[i++].equals(tag)) {/*empty*/
00507:                }
00508:                //read upto the }
00509:
00510:                byte[] bytes = new byte[tokens.length]; //can't be bigger
00511:                int ic = 0;
00512:                String token;
00513:                while (!(token = tokens[i++]).equals("}")) { //$NON-NLS-1$
00514:                    int c = Integer.parseInt(token);
00515:                    bytes[ic++] = (byte) c;
00516:                }
00517:
00518:                //resize
00519:                System.arraycopy(bytes, 0, bytes = new byte[ic], 0, ic);
00520:
00521:                buildFileForTable(filename, bytes);
00522:                return bytes;
00523:            }
00524:
00525:            private final static char[] buildFileOfIntFor(String filename,
00526:                    String tag, String[] tokens) {
00527:
00528:                //transform the String tokens into chars before dumping then into file
00529:
00530:                int i = 0;
00531:                //read upto the tag
00532:                while (!tokens[i++].equals(tag)) {/*empty*/
00533:                }
00534:                //read upto the }
00535:
00536:                char[] chars = new char[tokens.length]; //can't be bigger
00537:                int ic = 0;
00538:                String token;
00539:                while (!(token = tokens[i++]).equals("}")) { //$NON-NLS-1$
00540:                    int c = Integer.parseInt(token);
00541:                    chars[ic++] = (char) c;
00542:                }
00543:
00544:                //resize
00545:                System.arraycopy(chars, 0, chars = new char[ic], 0, ic);
00546:
00547:                buildFileForTable(filename, chars);
00548:                return chars;
00549:            }
00550:
00551:            private final static void buildFileOfShortFor(String filename,
00552:                    String tag, String[] tokens) {
00553:
00554:                //transform the String tokens into chars before dumping then into file
00555:
00556:                int i = 0;
00557:                //read upto the tag
00558:                while (!tokens[i++].equals(tag)) {/*empty*/
00559:                }
00560:                //read upto the }
00561:
00562:                char[] chars = new char[tokens.length]; //can't be bigger
00563:                int ic = 0;
00564:                String token;
00565:                while (!(token = tokens[i++]).equals("}")) { //$NON-NLS-1$
00566:                    int c = Integer.parseInt(token);
00567:                    chars[ic++] = (char) (c + 32768);
00568:                }
00569:
00570:                //resize
00571:                System.arraycopy(chars, 0, chars = new char[ic], 0, ic);
00572:
00573:                buildFileForTable(filename, chars);
00574:            }
00575:
00576:            public final static void buildFilesFromLPG(String dataFilename,
00577:                    String dataFilename2) {
00578:
00579:                //RUN THIS METHOD TO GENERATE PARSER*.RSC FILES
00580:
00581:                //build from the lpg javadcl.java files that represents the parser tables
00582:                //lhs check_table asb asr symbol_index
00583:
00584:                //[org.eclipse.jdt.internal.compiler.parser.Parser.buildFilesFromLPG("d:/leapfrog/grammar/javadcl.java")]
00585:                char[] contents = CharOperation.NO_CHAR;
00586:                try {
00587:                    contents = Util.getFileCharContent(new File(dataFilename),
00588:                            null);
00589:                } catch (IOException ex) {
00590:                    System.out.println(Messages.parser_incorrectPath);
00591:                    return;
00592:                }
00593:                java.util.StringTokenizer st = new java.util.StringTokenizer(
00594:                        new String(contents), " \t\n\r[]={,;"); //$NON-NLS-1$
00595:                String[] tokens = new String[st.countTokens()];
00596:                int j = 0;
00597:                while (st.hasMoreTokens()) {
00598:                    tokens[j++] = st.nextToken();
00599:                }
00600:                final String prefix = FILEPREFIX;
00601:                int i = 0;
00602:
00603:                char[] newLhs = buildFileOfIntFor(
00604:                        prefix + (++i) + ".rsc", "lhs", tokens); //$NON-NLS-1$ //$NON-NLS-2$
00605:                buildFileOfShortFor(
00606:                        prefix + (++i) + ".rsc", "check_table", tokens); //$NON-NLS-2$ //$NON-NLS-1$
00607:                buildFileOfIntFor(prefix + (++i) + ".rsc", "asb", tokens); //$NON-NLS-2$ //$NON-NLS-1$
00608:                buildFileOfIntFor(prefix + (++i) + ".rsc", "asr", tokens); //$NON-NLS-2$ //$NON-NLS-1$
00609:                buildFileOfIntFor(prefix + (++i) + ".rsc", "nasb", tokens); //$NON-NLS-2$ //$NON-NLS-1$
00610:                buildFileOfIntFor(prefix + (++i) + ".rsc", "nasr", tokens); //$NON-NLS-2$ //$NON-NLS-1$
00611:                char[] newTerminalIndex = buildFileOfIntFor(prefix + (++i)
00612:                        + ".rsc", "terminal_index", tokens); //$NON-NLS-2$ //$NON-NLS-1$
00613:                char[] newNonTerminalIndex = buildFileOfIntFor(prefix + (++i)
00614:                        + ".rsc", "non_terminal_index", tokens); //$NON-NLS-1$ //$NON-NLS-2$
00615:                buildFileOfIntFor(
00616:                        prefix + (++i) + ".rsc", "term_action", tokens); //$NON-NLS-2$ //$NON-NLS-1$
00617:
00618:                buildFileOfIntFor(
00619:                        prefix + (++i) + ".rsc", "scope_prefix", tokens); //$NON-NLS-2$ //$NON-NLS-1$
00620:                buildFileOfIntFor(
00621:                        prefix + (++i) + ".rsc", "scope_suffix", tokens); //$NON-NLS-2$ //$NON-NLS-1$
00622:                buildFileOfIntFor(prefix + (++i) + ".rsc", "scope_lhs", tokens); //$NON-NLS-2$ //$NON-NLS-1$
00623:                buildFileOfIntFor(
00624:                        prefix + (++i) + ".rsc", "scope_state_set", tokens); //$NON-NLS-2$ //$NON-NLS-1$
00625:                buildFileOfIntFor(prefix + (++i) + ".rsc", "scope_rhs", tokens); //$NON-NLS-2$ //$NON-NLS-1$
00626:                buildFileOfIntFor(
00627:                        prefix + (++i) + ".rsc", "scope_state", tokens); //$NON-NLS-2$ //$NON-NLS-1$
00628:                buildFileOfIntFor(prefix + (++i) + ".rsc", "in_symb", tokens); //$NON-NLS-2$ //$NON-NLS-1$
00629:
00630:                byte[] newRhs = buildFileOfByteFor(
00631:                        prefix + (++i) + ".rsc", "rhs", tokens); //$NON-NLS-2$ //$NON-NLS-1$
00632:                buildFileOfByteFor(
00633:                        prefix + (++i) + ".rsc", "term_check", tokens); //$NON-NLS-2$ //$NON-NLS-1$
00634:                buildFileOfByteFor(prefix + (++i) + ".rsc", "scope_la", tokens); //$NON-NLS-2$ //$NON-NLS-1$
00635:
00636:                String[] newName = buildFileForName(
00637:                        prefix + (++i) + ".rsc", new String(contents)); //$NON-NLS-1$
00638:
00639:                contents = CharOperation.NO_CHAR;
00640:                try {
00641:                    contents = Util.getFileCharContent(new File(dataFilename2),
00642:                            null);
00643:                } catch (IOException ex) {
00644:                    System.out.println(Messages.parser_incorrectPath);
00645:                    return;
00646:                }
00647:                st = new java.util.StringTokenizer(new String(contents),
00648:                        "\t\n\r#"); //$NON-NLS-1$
00649:                tokens = new String[st.countTokens()];
00650:                j = 0;
00651:                while (st.hasMoreTokens()) {
00652:                    tokens[j++] = st.nextToken();
00653:                }
00654:
00655:                buildFileForCompliance(
00656:                        prefix + (++i) + ".rsc", newRhs.length, tokens);//$NON-NLS-1$
00657:                buildFileForReadableName(
00658:                        READABLE_NAMES_FILE + ".properties", newLhs, newNonTerminalIndex, newName, tokens);//$NON-NLS-1$
00659:
00660:                buildFilesForRecoveryTemplates(
00661:                        prefix + (++i) + ".rsc", //$NON-NLS-1$
00662:                        prefix + (++i) + ".rsc", //$NON-NLS-1$
00663:                        newTerminalIndex, newNonTerminalIndex, newName, newLhs,
00664:                        tokens);
00665:
00666:                buildFilesForStatementsRecoveryFilter(prefix + (++i) + ".rsc", //$NON-NLS-1$
00667:                        newNonTerminalIndex, newLhs, tokens);
00668:
00669:                System.out.println(Messages.parser_moveFiles);
00670:            }
00671:
00672:            public static int in_symbol(int state) {
00673:                return in_symb[original_state(state)];
00674:            }
00675:
00676:            public final static void initTables() throws java.io.IOException {
00677:
00678:                final String prefix = FILEPREFIX;
00679:                int i = 0;
00680:                lhs = readTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
00681:                char[] chars = readTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
00682:                check_table = new short[chars.length];
00683:                for (int c = chars.length; c-- > 0;) {
00684:                    check_table[c] = (short) (chars[c] - 32768);
00685:                }
00686:                asb = readTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
00687:                asr = readTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
00688:                nasb = readTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
00689:                nasr = readTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
00690:                terminal_index = readTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
00691:                non_terminal_index = readTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
00692:                term_action = readTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
00693:
00694:                scope_prefix = readTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
00695:                scope_suffix = readTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
00696:                scope_lhs = readTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
00697:                scope_state_set = readTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
00698:                scope_rhs = readTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
00699:                scope_state = readTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
00700:                in_symb = readTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
00701:
00702:                rhs = readByteTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
00703:                term_check = readByteTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
00704:                scope_la = readByteTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
00705:
00706:                name = readNameTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
00707:
00708:                rules_compliance = readLongTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
00709:
00710:                readableName = readReadableNameTable(READABLE_NAMES_FILE_NAME);
00711:
00712:                reverse_index = computeReverseTable(terminal_index,
00713:                        non_terminal_index, name);
00714:
00715:                recovery_templates_index = readTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
00716:                recovery_templates = readTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
00717:
00718:                statements_recovery_filter = readTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
00719:
00720:                base_action = lhs;
00721:            }
00722:
00723:            public static int nasi(int state) {
00724:                return nasb[original_state(state)];
00725:            }
00726:
00727:            public static int ntAction(int state, int sym) {
00728:                return base_action[state + sym];
00729:            }
00730:
00731:            protected static int original_state(int state) {
00732:                return -base_check(state);
00733:            }
00734:
00735:            protected static int[] computeReverseTable(char[] newTerminalIndex,
00736:                    char[] newNonTerminalIndex, String[] newName) {
00737:                int[] newReverseTable = new int[newName.length];
00738:                for (int j = 0; j < newName.length; j++) {
00739:                    found: {
00740:                        for (int k = 0; k < newTerminalIndex.length; k++) {
00741:                            if (newTerminalIndex[k] == j) {
00742:                                newReverseTable[j] = k;
00743:                                break found;
00744:                            }
00745:                        }
00746:                        for (int k = 0; k < newNonTerminalIndex.length; k++) {
00747:                            if (newNonTerminalIndex[k] == j) {
00748:                                newReverseTable[j] = -k;
00749:                                break found;
00750:                            }
00751:                        }
00752:                    }
00753:                }
00754:                return newReverseTable;
00755:            }
00756:
00757:            private static int getSymbol(String terminalName, String[] newName,
00758:                    int[] newReverse) {
00759:                for (int j = 0; j < newName.length; j++) {
00760:                    if (terminalName.equals(newName[j])) {
00761:                        return newReverse[j];
00762:                    }
00763:                }
00764:                return -1;
00765:            }
00766:
00767:            protected static byte[] readByteTable(String filename)
00768:                    throws java.io.IOException {
00769:
00770:                //files are located at Parser.class directory
00771:
00772:                InputStream stream = Parser.class.getResourceAsStream(filename);
00773:                if (stream == null) {
00774:                    throw new java.io.IOException(Messages.bind(
00775:                            Messages.parser_missingFile, filename));
00776:                }
00777:                byte[] bytes = null;
00778:                try {
00779:                    stream = new BufferedInputStream(stream);
00780:                    bytes = Util.getInputStreamAsByteArray(stream, -1);
00781:                } finally {
00782:                    try {
00783:                        stream.close();
00784:                    } catch (IOException e) {
00785:                        // ignore
00786:                    }
00787:                }
00788:                return bytes;
00789:            }
00790:
00791:            protected static String[] readNameTable(String filename)
00792:                    throws java.io.IOException {
00793:                char[] contents = readTable(filename);
00794:                char[][] nameAsChar = CharOperation.splitOn('\n', contents);
00795:
00796:                String[] result = new String[nameAsChar.length + 1];
00797:                result[0] = null;
00798:                for (int i = 0; i < nameAsChar.length; i++) {
00799:                    result[i + 1] = new String(nameAsChar[i]);
00800:                }
00801:
00802:                return result;
00803:            }
00804:
00805:            protected static String[] readReadableNameTable(String filename) {
00806:                String[] result = new String[name.length];
00807:
00808:                ResourceBundle bundle;
00809:                try {
00810:                    bundle = ResourceBundle.getBundle(filename, Locale
00811:                            .getDefault());
00812:                } catch (MissingResourceException e) {
00813:                    System.out
00814:                            .println("Missing resource : " + filename.replace('.', '/') + ".properties for locale " + Locale.getDefault()); //$NON-NLS-1$//$NON-NLS-2$
00815:                    throw e;
00816:                }
00817:                for (int i = 0; i < NT_OFFSET + 1; i++) {
00818:                    result[i] = name[i];
00819:                }
00820:                for (int i = NT_OFFSET; i < name.length; i++) {
00821:                    try {
00822:                        String n = bundle.getString(name[i]);
00823:                        if (n != null && n.length() > 0) {
00824:                            result[i] = n;
00825:                        } else {
00826:                            result[i] = name[i];
00827:                        }
00828:                    } catch (MissingResourceException e) {
00829:                        result[i] = name[i];
00830:                    }
00831:                }
00832:                return result;
00833:            }
00834:
00835:            protected static char[] readTable(String filename)
00836:                    throws java.io.IOException {
00837:
00838:                //files are located at Parser.class directory
00839:
00840:                InputStream stream = Parser.class.getResourceAsStream(filename);
00841:                if (stream == null) {
00842:                    throw new java.io.IOException(Messages.bind(
00843:                            Messages.parser_missingFile, filename));
00844:                }
00845:                byte[] bytes = null;
00846:                try {
00847:                    stream = new BufferedInputStream(stream);
00848:                    bytes = Util.getInputStreamAsByteArray(stream, -1);
00849:                } finally {
00850:                    try {
00851:                        stream.close();
00852:                    } catch (IOException e) {
00853:                        // ignore
00854:                    }
00855:                }
00856:
00857:                //minimal integrity check (even size expected)
00858:                int length = bytes.length;
00859:                if ((length & 1) != 0)
00860:                    throw new java.io.IOException(Messages.bind(
00861:                            Messages.parser_corruptedFile, filename));
00862:
00863:                // convert bytes into chars
00864:                char[] chars = new char[length / 2];
00865:                int i = 0;
00866:                int charIndex = 0;
00867:
00868:                while (true) {
00869:                    chars[charIndex++] = (char) (((bytes[i++] & 0xFF) << 8) + (bytes[i++] & 0xFF));
00870:                    if (i == length)
00871:                        break;
00872:                }
00873:                return chars;
00874:            }
00875:
00876:            protected static long[] readLongTable(String filename)
00877:                    throws java.io.IOException {
00878:
00879:                //files are located at Parser.class directory
00880:
00881:                InputStream stream = Parser.class.getResourceAsStream(filename);
00882:                if (stream == null) {
00883:                    throw new java.io.IOException(Messages.bind(
00884:                            Messages.parser_missingFile, filename));
00885:                }
00886:                byte[] bytes = null;
00887:                try {
00888:                    stream = new BufferedInputStream(stream);
00889:                    bytes = Util.getInputStreamAsByteArray(stream, -1);
00890:                } finally {
00891:                    try {
00892:                        stream.close();
00893:                    } catch (IOException e) {
00894:                        // ignore
00895:                    }
00896:                }
00897:
00898:                //minimal integrity check (even size expected)
00899:                int length = bytes.length;
00900:                if (length % 8 != 0)
00901:                    throw new java.io.IOException(Messages.bind(
00902:                            Messages.parser_corruptedFile, filename));
00903:
00904:                // convert bytes into longs
00905:                long[] longs = new long[length / 8];
00906:                int i = 0;
00907:                int longIndex = 0;
00908:
00909:                while (true) {
00910:                    longs[longIndex++] = (((long) (bytes[i++] & 0xFF)) << 56)
00911:                            + (((long) (bytes[i++] & 0xFF)) << 48)
00912:                            + (((long) (bytes[i++] & 0xFF)) << 40)
00913:                            + (((long) (bytes[i++] & 0xFF)) << 32)
00914:                            + (((long) (bytes[i++] & 0xFF)) << 24)
00915:                            + (((long) (bytes[i++] & 0xFF)) << 16)
00916:                            + (((long) (bytes[i++] & 0xFF)) << 8)
00917:                            + (bytes[i++] & 0xFF);
00918:
00919:                    if (i == length)
00920:                        break;
00921:                }
00922:                return longs;
00923:            }
00924:
00925:            public static int tAction(int state, int sym) {
00926:                return term_action[term_check[base_action[state] + sym] == sym ? base_action[state]
00927:                        + sym
00928:                        : base_action[state]];
00929:            }
00930:
00931:            public Parser(ProblemReporter problemReporter,
00932:                    boolean optimizeStringLiterals) {
00933:
00934:                this .problemReporter = problemReporter;
00935:                this .options = problemReporter.options;
00936:                this .optimizeStringLiterals = optimizeStringLiterals;
00937:                this .initializeScanner();
00938:                this .astLengthStack = new int[50];
00939:                this .expressionLengthStack = new int[30];
00940:                this .intStack = new int[50];
00941:                this .identifierStack = new char[30][];
00942:                this .identifierLengthStack = new int[30];
00943:                this .nestedMethod = new int[30];
00944:                this .realBlockStack = new int[30];
00945:                this .identifierPositionStack = new long[30];
00946:                this .variablesCounter = new int[30];
00947:
00948:                // javadoc support
00949:                this .javadocParser = createJavadocParser();
00950:            }
00951:
00952:            protected void annotationRecoveryCheckPoint(int start, int end) {
00953:                if (this .lastCheckPoint > start && this .lastCheckPoint < end) {
00954:                    this .lastCheckPoint = end + 1;
00955:                }
00956:            }
00957:
00958:            public void arrayInitializer(int length) {
00959:                //length is the size of the array Initializer
00960:                //expressionPtr points on the last elt of the arrayInitializer, 
00961:                // in other words, it has not been decremented yet.
00962:
00963:                ArrayInitializer ai = new ArrayInitializer();
00964:                if (length != 0) {
00965:                    this .expressionPtr -= length;
00966:                    System.arraycopy(this .expressionStack,
00967:                            this .expressionPtr + 1,
00968:                            ai.expressions = new Expression[length], 0, length);
00969:                }
00970:                pushOnExpressionStack(ai);
00971:                //positionning
00972:                ai.sourceEnd = this .endStatementPosition;
00973:                ai.sourceStart = this .intStack[this .intPtr--];
00974:            }
00975:
00976:            protected void blockReal() {
00977:                // See consumeLocalVariableDeclarationStatement in case of change: duplicated code
00978:                // increment the amount of declared variables for this block
00979:                this .realBlockStack[this .realBlockPtr]++;
00980:            }
00981:
00982:            /*
00983:             * Build initial recovery state.
00984:             * Recovery state is inferred from the current state of the parser (reduced node stack).
00985:             */
00986:            public RecoveredElement buildInitialRecoveryState() {
00987:
00988:                /* initialize recovery by retrieving available reduced nodes 
00989:                 * also rebuild bracket balance 
00990:                 */
00991:                this .lastCheckPoint = 0;
00992:                this .lastErrorEndPositionBeforeRecovery = this .scanner.currentPosition;
00993:
00994:                RecoveredElement element = null;
00995:                if (this .referenceContext instanceof  CompilationUnitDeclaration) {
00996:                    element = new RecoveredUnit(this .compilationUnit, 0, this );
00997:
00998:                    /* ignore current stack state, since restarting from the beginnning 
00999:                       since could not trust simple brace count */
01000:                    if (true) { // experimenting restart recovery from scratch
01001:                        this .compilationUnit.currentPackage = null;
01002:                        this .compilationUnit.imports = null;
01003:                        this .compilationUnit.types = null;
01004:                        this .currentToken = 0;
01005:                        this .listLength = 0;
01006:                        this .listTypeParameterLength = 0;
01007:                        this .endPosition = 0;
01008:                        this .endStatementPosition = 0;
01009:                        return element;
01010:                    }
01011:                    if (this .compilationUnit.currentPackage != null) {
01012:                        this .lastCheckPoint = this .compilationUnit.currentPackage.declarationSourceEnd + 1;
01013:                    }
01014:                    if (this .compilationUnit.imports != null) {
01015:                        this .lastCheckPoint = this .compilationUnit.imports[this .compilationUnit.imports.length - 1].declarationSourceEnd + 1;
01016:                    }
01017:                } else {
01018:                    if (this .referenceContext instanceof  AbstractMethodDeclaration) {
01019:                        element = new RecoveredMethod(
01020:                                (AbstractMethodDeclaration) this .referenceContext,
01021:                                null, 0, this );
01022:                        this .lastCheckPoint = ((AbstractMethodDeclaration) this .referenceContext).bodyStart;
01023:                        if (this .statementRecoveryActivated) {
01024:                            element = element.add(new Block(0), 0);
01025:                        }
01026:                    } else {
01027:                        /* Initializer bodies are parsed in the context of the type declaration, we must thus search it inside */
01028:                        if (this .referenceContext instanceof  TypeDeclaration) {
01029:                            TypeDeclaration type = (TypeDeclaration) this .referenceContext;
01030:                            for (int i = 0; i < type.fields.length; i++) {
01031:                                FieldDeclaration field = type.fields[i];
01032:                                if (field != null
01033:                                        && field.getKind() == AbstractVariableDeclaration.INITIALIZER
01034:                                        && ((Initializer) field).block != null
01035:                                        && field.declarationSourceStart <= this .scanner.initialPosition
01036:                                        && this .scanner.initialPosition <= field.declarationSourceEnd
01037:                                        && this .scanner.eofPosition <= field.declarationSourceEnd + 1) {
01038:                                    element = new RecoveredInitializer(field,
01039:                                            null, 1, this );
01040:                                    this .lastCheckPoint = field.declarationSourceStart;
01041:                                    break;
01042:                                }
01043:                            }
01044:                        }
01045:                    }
01046:                }
01047:
01048:                if (element == null)
01049:                    return element;
01050:
01051:                for (int i = 0; i <= this .astPtr; i++) {
01052:                    ASTNode node = this .astStack[i];
01053:                    if (node instanceof  AbstractMethodDeclaration) {
01054:                        AbstractMethodDeclaration method = (AbstractMethodDeclaration) node;
01055:                        if (method.declarationSourceEnd == 0) {
01056:                            element = element.add(method, 0);
01057:                            this .lastCheckPoint = method.bodyStart;
01058:                        } else {
01059:                            element = element.add(method, 0);
01060:                            this .lastCheckPoint = method.declarationSourceEnd + 1;
01061:                        }
01062:                        continue;
01063:                    }
01064:                    if (node instanceof  Initializer) {
01065:                        Initializer initializer = (Initializer) node;
01066:                        // ignore initializer with no block
01067:                        if (initializer.block == null)
01068:                            continue;
01069:                        if (initializer.declarationSourceEnd == 0) {
01070:                            element = element.add(initializer, 1);
01071:                            this .lastCheckPoint = initializer.sourceStart;
01072:                        } else {
01073:                            element = element.add(initializer, 0);
01074:                            this .lastCheckPoint = initializer.declarationSourceEnd + 1;
01075:                        }
01076:                        continue;
01077:                    }
01078:                    if (node instanceof  FieldDeclaration) {
01079:                        FieldDeclaration field = (FieldDeclaration) node;
01080:                        if (field.declarationSourceEnd == 0) {
01081:                            element = element.add(field, 0);
01082:                            if (field.initialization == null) {
01083:                                this .lastCheckPoint = field.sourceEnd + 1;
01084:                            } else {
01085:                                this .lastCheckPoint = field.initialization.sourceEnd + 1;
01086:                            }
01087:                        } else {
01088:                            element = element.add(field, 0);
01089:                            this .lastCheckPoint = field.declarationSourceEnd + 1;
01090:                        }
01091:                        continue;
01092:                    }
01093:                    if (node instanceof  TypeDeclaration) {
01094:                        TypeDeclaration type = (TypeDeclaration) node;
01095:                        if (type.declarationSourceEnd == 0) {
01096:                            element = element.add(type, 0);
01097:                            this .lastCheckPoint = type.bodyStart;
01098:                        } else {
01099:                            element = element.add(type, 0);
01100:                            this .lastCheckPoint = type.declarationSourceEnd + 1;
01101:                        }
01102:                        continue;
01103:                    }
01104:                    if (node instanceof  ImportReference) {
01105:                        ImportReference importRef = (ImportReference) node;
01106:                        element = element.add(importRef, 0);
01107:                        this .lastCheckPoint = importRef.declarationSourceEnd + 1;
01108:                    }
01109:                    if (this .statementRecoveryActivated) {
01110:                        if (node instanceof  Block) {
01111:                            Block block = (Block) node;
01112:                            element = element.add(block, 0);
01113:                            this .lastCheckPoint = block.sourceEnd + 1;
01114:                        } else if (node instanceof  LocalDeclaration) {
01115:                            LocalDeclaration statement = (LocalDeclaration) node;
01116:                            element = element.add(statement, 0);
01117:                            this .lastCheckPoint = statement.sourceEnd + 1;
01118:                        } else if (node instanceof  Expression) {
01119:                            if (node instanceof  Assignment
01120:                                    || node instanceof  PrefixExpression
01121:                                    || node instanceof  PostfixExpression
01122:                                    || node instanceof  MessageSend
01123:                                    || node instanceof  AllocationExpression) {
01124:                                // recover only specific expressions
01125:                                Expression statement = (Expression) node;
01126:                                element = element.add(statement, 0);
01127:                                if (statement.statementEnd != -1) {
01128:                                    this .lastCheckPoint = statement.statementEnd + 1;
01129:                                } else {
01130:                                    this .lastCheckPoint = statement.sourceEnd + 1;
01131:                                }
01132:                            }
01133:                        } else if (node instanceof  Statement) {
01134:                            Statement statement = (Statement) node;
01135:                            element = element.add(statement, 0);
01136:                            this .lastCheckPoint = statement.sourceEnd + 1;
01137:                        }
01138:                    }
01139:                }
01140:
01141:                if (this .statementRecoveryActivated) {
01142:                    if (this .pendingRecoveredType != null
01143:                            && this .scanner.startPosition - 1 <= this .pendingRecoveredType.declarationSourceEnd) {
01144:                        // Add the pending type to the AST if this type isn't already added in the AST.
01145:                        element = element.add(this .pendingRecoveredType, 0);
01146:                        this .lastCheckPoint = this .pendingRecoveredType.declarationSourceEnd + 1;
01147:                        this .pendingRecoveredType = null;
01148:                    }
01149:                }
01150:                return element;
01151:            }
01152:
01153:            protected void checkAndSetModifiers(int flag) {
01154:                /*modify the current modifiers buffer.
01155:                When the startPosition of the modifiers is 0
01156:                it means that the modifier being parsed is the first
01157:                of a list of several modifiers. The startPosition
01158:                is zeroed when a copy of modifiers-buffer is push
01159:                onto the this.astStack. */
01160:
01161:                if ((this .modifiers & flag) != 0) { // duplicate modifier
01162:                    this .modifiers |= ExtraCompilerModifiers.AccAlternateModifierProblem;
01163:                }
01164:                this .modifiers |= flag;
01165:
01166:                if (this .modifiersSourceStart < 0)
01167:                    this .modifiersSourceStart = this .scanner.startPosition;
01168:            }
01169:
01170:            public void checkComment() {
01171:
01172:                // discard obsolete comments while inside methods or fields initializer (see bug 74369)
01173:                if (!(this .diet && this .dietInt == 0)
01174:                        && this .scanner.commentPtr >= 0) {
01175:                    flushCommentsDefinedPriorTo(this .endStatementPosition);
01176:                }
01177:
01178:                int lastComment = this .scanner.commentPtr;
01179:
01180:                if (this .modifiersSourceStart >= 0) {
01181:                    // eliminate comments located after modifierSourceStart if positionned
01182:                    while (lastComment >= 0
01183:                            && this .scanner.commentStarts[lastComment] > this .modifiersSourceStart)
01184:                        lastComment--;
01185:                }
01186:                if (lastComment >= 0) {
01187:                    // consider all remaining leading comments to be part of current declaration
01188:                    this .modifiersSourceStart = this .scanner.commentStarts[0];
01189:
01190:                    // check deprecation in last comment if javadoc (can be followed by non-javadoc comments which are simply ignored)	
01191:                    while (lastComment >= 0
01192:                            && this .scanner.commentStops[lastComment] < 0)
01193:                        lastComment--; // non javadoc comment have negative end positions
01194:                    if (lastComment >= 0 && this .javadocParser != null) {
01195:                        int commentEnd = this .scanner.commentStops[lastComment] - 1; //stop is one over,
01196:                        // do not report problem before last parsed comment while recovering code...
01197:                        this .javadocParser.reportProblems = this .currentElement == null
01198:                                || commentEnd > this .lastJavadocEnd;
01199:                        if (this .javadocParser.checkDeprecation(lastComment)) {
01200:                            checkAndSetModifiers(ClassFileConstants.AccDeprecated);
01201:                        }
01202:                        this .javadoc = this .javadocParser.docComment; // null if check javadoc is not activated
01203:                        if (currentElement == null)
01204:                            this .lastJavadocEnd = commentEnd;
01205:                    }
01206:                }
01207:            }
01208:
01209:            protected void checkNonNLSAfterBodyEnd(int declarationEnd) {
01210:                if (this .scanner.currentPosition - 1 <= declarationEnd) {
01211:                    this .scanner.eofPosition = declarationEnd < Integer.MAX_VALUE ? declarationEnd + 1
01212:                            : declarationEnd;
01213:                    try {
01214:                        while (this .scanner.getNextToken() != TokenNameEOF) {/*empty*/
01215:                        }
01216:                    } catch (InvalidInputException e) {
01217:                        // Nothing to do
01218:                    }
01219:                }
01220:            }
01221:
01222:            protected void classInstanceCreation(boolean isQualified) {
01223:                // ClassInstanceCreationExpression ::= 'new' ClassType '(' ArgumentListopt ')' ClassBodyopt
01224:
01225:                // ClassBodyopt produces a null item on the astStak if it produces NO class body
01226:                // An empty class body produces a 0 on the length stack.....
01227:
01228:                AllocationExpression alloc;
01229:                int length;
01230:                if (((length = this .astLengthStack[this .astLengthPtr--]) == 1)
01231:                        && (this .astStack[this .astPtr] == null)) {
01232:                    //NO ClassBody
01233:                    this .astPtr--;
01234:                    if (isQualified) {
01235:                        alloc = new QualifiedAllocationExpression();
01236:                    } else {
01237:                        alloc = new AllocationExpression();
01238:                    }
01239:                    alloc.sourceEnd = this .endPosition; //the position has been stored explicitly
01240:
01241:                    if ((length = this .expressionLengthStack[this .expressionLengthPtr--]) != 0) {
01242:                        this .expressionPtr -= length;
01243:                        System.arraycopy(this .expressionStack,
01244:                                this .expressionPtr + 1,
01245:                                alloc.arguments = new Expression[length], 0,
01246:                                length);
01247:                    }
01248:                    alloc.type = getTypeReference(0);
01249:
01250:                    //the default constructor with the correct number of argument
01251:                    //will be created and added by the TC (see createsInternalConstructorWithBinding)
01252:                    alloc.sourceStart = this .intStack[this .intPtr--];
01253:                    pushOnExpressionStack(alloc);
01254:                } else {
01255:                    dispatchDeclarationInto(length);
01256:                    TypeDeclaration anonymousTypeDeclaration = (TypeDeclaration) this .astStack[this .astPtr];
01257:                    anonymousTypeDeclaration.declarationSourceEnd = this .endStatementPosition;
01258:                    anonymousTypeDeclaration.bodyEnd = this .endStatementPosition;
01259:                    if (anonymousTypeDeclaration.allocation != null) {
01260:                        anonymousTypeDeclaration.allocation.sourceEnd = this .endStatementPosition;
01261:                    }
01262:                    if (length == 0
01263:                            && !containsComment(
01264:                                    anonymousTypeDeclaration.bodyStart,
01265:                                    anonymousTypeDeclaration.bodyEnd)) {
01266:                        anonymousTypeDeclaration.bits |= ASTNode.UndocumentedEmptyBlock;
01267:                    }
01268:                    this .astPtr--;
01269:                    this .astLengthPtr--;
01270:                }
01271:            }
01272:
01273:            protected void concatExpressionLists() {
01274:                this .expressionLengthStack[--this .expressionLengthPtr]++;
01275:            }
01276:
01277:            protected void concatGenericsLists() {
01278:                this .genericsLengthStack[this .genericsLengthPtr - 1] += this .genericsLengthStack[this .genericsLengthPtr--];
01279:            }
01280:
01281:            protected void concatNodeLists() {
01282:                /*
01283:                 * This is a case where you have two sublists into the this.astStack that you want
01284:                 * to merge in one list. There is no action required on the this.astStack. The only
01285:                 * thing you need to do is merge the two lengths specified on the astStackLength.
01286:                 * The top two length are for example:
01287:                 * ... p   n
01288:                 * and you want to result in a list like:
01289:                 * ... n+p 
01290:                 * This means that the p could be equals to 0 in case there is no astNode pushed
01291:                 * on the this.astStack.
01292:                 * Look at the InterfaceMemberDeclarations for an example.
01293:                 */
01294:
01295:                this .astLengthStack[this .astLengthPtr - 1] += this .astLengthStack[this .astLengthPtr--];
01296:            }
01297:
01298:            protected void consumeAdditionalBound() {
01299:                pushOnGenericsStack(getTypeReference(this .intStack[this .intPtr--]));
01300:            }
01301:
01302:            protected void consumeAdditionalBound1() {
01303:                // nothing to be done.
01304:                // The reference type1 is consumed by consumeReferenceType1 method.
01305:            }
01306:
01307:            protected void consumeAdditionalBoundList() {
01308:                concatGenericsLists();
01309:            }
01310:
01311:            protected void consumeAdditionalBoundList1() {
01312:                concatGenericsLists();
01313:            }
01314:
01315:            protected void consumeAllocationHeader() {
01316:                // ClassInstanceCreationExpression ::= 'new' ClassType '(' ArgumentListopt ')' ClassBodyopt
01317:
01318:                // ClassBodyopt produces a null item on the astStak if it produces NO class body
01319:                // An empty class body produces a 0 on the length stack.....
01320:
01321:                if (this .currentElement == null) {
01322:                    return; // should never occur, this consumeRule is only used in recovery mode
01323:                }
01324:                if (this .currentToken == TokenNameLBRACE) {
01325:                    // beginning of an anonymous type
01326:                    TypeDeclaration anonymousType = new TypeDeclaration(
01327:                            this .compilationUnit.compilationResult);
01328:                    anonymousType.name = CharOperation.NO_CHAR;
01329:                    anonymousType.bits |= (ASTNode.IsAnonymousType | ASTNode.IsLocalType);
01330:                    anonymousType.sourceStart = this .intStack[this .intPtr--];
01331:                    anonymousType.sourceEnd = this .rParenPos; // closing parenthesis
01332:                    QualifiedAllocationExpression alloc = new QualifiedAllocationExpression(
01333:                            anonymousType);
01334:                    alloc.type = getTypeReference(0);
01335:                    alloc.sourceStart = anonymousType.sourceStart;
01336:                    alloc.sourceEnd = anonymousType.sourceEnd;
01337:                    this .lastCheckPoint = anonymousType.bodyStart = this .scanner.currentPosition;
01338:                    this .currentElement = this .currentElement.add(
01339:                            anonymousType, 0);
01340:                    this .lastIgnoredToken = -1;
01341:                    this .currentToken = 0; // opening brace already taken into account
01342:                    return;
01343:                }
01344:                this .lastCheckPoint = this .scanner.startPosition; // force to restart at this exact position
01345:                this .restartRecovery = true; // request to restart from here on
01346:            }
01347:
01348:            protected void consumeAnnotationAsModifier() {
01349:                Expression expression = this .expressionStack[this .expressionPtr];
01350:                int sourceStart = expression.sourceStart;
01351:                if (this .modifiersSourceStart < 0) {
01352:                    this .modifiersSourceStart = sourceStart;
01353:                }
01354:            }
01355:
01356:            protected void consumeAnnotationName() {
01357:                if (this .currentElement != null) {
01358:                    int start = this .intStack[this .intPtr];
01359:                    int end = (int) (this .identifierPositionStack[this .identifierPtr] & 0x00000000FFFFFFFFL);
01360:                    annotationRecoveryCheckPoint(start, end);
01361:                }
01362:                this .recordStringLiterals = false;
01363:            }
01364:
01365:            protected void consumeAnnotationTypeDeclaration() {
01366:                int length;
01367:                if ((length = this .astLengthStack[this .astLengthPtr--]) != 0) {
01368:                    //there are length declarations
01369:                    //dispatch according to the type of the declarations
01370:                    dispatchDeclarationInto(length);
01371:                }
01372:
01373:                TypeDeclaration typeDecl = (TypeDeclaration) this .astStack[this .astPtr];
01374:
01375:                //convert constructor that do not have the type's name into methods
01376:                typeDecl.checkConstructors(this );
01377:
01378:                //always add <clinit> (will be remove at code gen time if empty)
01379:                if (this .scanner.containsAssertKeyword) {
01380:                    typeDecl.bits |= ASTNode.ContainsAssertion;
01381:                }
01382:                typeDecl.addClinit();
01383:                typeDecl.bodyEnd = this .endStatementPosition;
01384:                if (length == 0
01385:                        && !containsComment(typeDecl.bodyStart,
01386:                                typeDecl.bodyEnd)) {
01387:                    typeDecl.bits |= ASTNode.UndocumentedEmptyBlock;
01388:                }
01389:                typeDecl.declarationSourceEnd = flushCommentsDefinedPriorTo(this .endStatementPosition);
01390:            }
01391:
01392:            protected void consumeAnnotationTypeDeclarationHeader() {
01393:                if (this .currentElement != null) {
01394:                    this .restartRecovery = true; // used to avoid branching back into the regular automaton		
01395:                }
01396:                // flush the comments related to the annotation type header
01397:                this .scanner.commentPtr = -1;
01398:            }
01399:
01400:            protected void consumeAnnotationTypeDeclarationHeaderName() {
01401:                // consumeAnnotationTypeDeclarationHeader ::= Modifiers '@' PushModifiers interface Identifier
01402:                // consumeAnnotationTypeDeclarationHeader ::= '@' PushModifiers interface Identifier
01403:                TypeDeclaration annotationTypeDeclaration = new TypeDeclaration(
01404:                        this .compilationUnit.compilationResult);
01405:                if (this .nestedMethod[this .nestedType] == 0) {
01406:                    if (this .nestedType != 0) {
01407:                        annotationTypeDeclaration.bits |= ASTNode.IsMemberType;
01408:                    }
01409:                } else {
01410:                    // Record that the block has a declaration for local types
01411:                    annotationTypeDeclaration.bits |= ASTNode.IsLocalType;
01412:                    markEnclosingMemberWithLocalType();
01413:                    blockReal();
01414:                }
01415:
01416:                //highlight the name of the type
01417:                long pos = this .identifierPositionStack[this .identifierPtr];
01418:                annotationTypeDeclaration.sourceEnd = (int) pos;
01419:                annotationTypeDeclaration.sourceStart = (int) (pos >>> 32);
01420:                annotationTypeDeclaration.name = this .identifierStack[this .identifierPtr--];
01421:                this .identifierLengthPtr--;
01422:
01423:                //compute the declaration source too
01424:                // 'interface' push two int positions: the beginning of the class token and its end.
01425:                // we want to keep the beginning position but get rid of the end position
01426:                // it is only used for the ClassLiteralAccess positions.
01427:                this .intPtr--; // remove the start position of the interface token
01428:                this .intPtr--; // remove the end position of the interface token
01429:
01430:                annotationTypeDeclaration.modifiersSourceStart = this .intStack[this .intPtr--];
01431:                annotationTypeDeclaration.modifiers = this .intStack[this .intPtr--]
01432:                        | ClassFileConstants.AccAnnotation
01433:                        | ClassFileConstants.AccInterface;
01434:                if (annotationTypeDeclaration.modifiersSourceStart >= 0) {
01435:                    annotationTypeDeclaration.declarationSourceStart = annotationTypeDeclaration.modifiersSourceStart;
01436:                    this .intPtr--; // remove the position of the '@' token as we have modifiers
01437:                } else {
01438:                    int atPosition = this .intStack[this .intPtr--];
01439:                    // remove the position of the '@' token as we don't have modifiers
01440:                    annotationTypeDeclaration.declarationSourceStart = atPosition;
01441:                }
01442:
01443:                // Store secondary info
01444:                if ((annotationTypeDeclaration.bits & ASTNode.IsMemberType) == 0
01445:                        && (annotationTypeDeclaration.bits & ASTNode.IsLocalType) == 0) {
01446:                    if (this .compilationUnit != null
01447:                            && !CharOperation.equals(
01448:                                    annotationTypeDeclaration.name,
01449:                                    this .compilationUnit.getMainTypeName())) {
01450:                        annotationTypeDeclaration.bits |= ASTNode.IsSecondaryType;
01451:                    }
01452:                }
01453:
01454:                // consume annotations
01455:                int length;
01456:                if ((length = this .expressionLengthStack[this .expressionLengthPtr--]) != 0) {
01457:                    System
01458:                            .arraycopy(
01459:                                    this .expressionStack,
01460:                                    (this .expressionPtr -= length) + 1,
01461:                                    annotationTypeDeclaration.annotations = new Annotation[length],
01462:                                    0, length);
01463:                }
01464:                annotationTypeDeclaration.bodyStart = annotationTypeDeclaration.sourceEnd + 1;
01465:
01466:                // javadoc
01467:                annotationTypeDeclaration.javadoc = this .javadoc;
01468:                this .javadoc = null;
01469:                pushOnAstStack(annotationTypeDeclaration);
01470:                if (!this .statementRecoveryActivated
01471:                        && options.sourceLevel < ClassFileConstants.JDK1_5
01472:                        && this .lastErrorEndPositionBeforeRecovery < this .scanner.currentPosition) {
01473:                    this .problemReporter()
01474:                            .invalidUsageOfAnnotationDeclarations(
01475:                                    annotationTypeDeclaration);
01476:                }
01477:
01478:                // recovery
01479:                if (this .currentElement != null) {
01480:                    this .lastCheckPoint = annotationTypeDeclaration.bodyStart;
01481:                    this .currentElement = this .currentElement.add(
01482:                            annotationTypeDeclaration, 0);
01483:                    this .lastIgnoredToken = -1;
01484:                }
01485:            }
01486:
01487:            protected void consumeAnnotationTypeDeclarationHeaderNameWithTypeParameters() {
01488:                // consumeAnnotationTypeDeclarationHeader ::= Modifiers '@' PushModifiers interface Identifier TypeParameters
01489:                // consumeAnnotationTypeDeclarationHeader ::= '@' PushModifiers interface Identifier TypeParameters
01490:                TypeDeclaration annotationTypeDeclaration = new TypeDeclaration(
01491:                        this .compilationUnit.compilationResult);
01492:                // consume type parameters
01493:                int length = this .genericsLengthStack[this .genericsLengthPtr--];
01494:                this .genericsPtr -= length;
01495:                System
01496:                        .arraycopy(
01497:                                this .genericsStack,
01498:                                this .genericsPtr + 1,
01499:                                annotationTypeDeclaration.typeParameters = new TypeParameter[length],
01500:                                0, length);
01501:
01502:                this .problemReporter()
01503:                        .invalidUsageOfTypeParametersForAnnotationDeclaration(
01504:                                annotationTypeDeclaration);
01505:
01506:                annotationTypeDeclaration.bodyStart = annotationTypeDeclaration.typeParameters[length - 1].declarationSourceEnd + 1;
01507:
01508:                //	annotationTypeDeclaration.typeParameters = null;
01509:
01510:                this .listTypeParameterLength = 0;
01511:
01512:                if (this .nestedMethod[this .nestedType] == 0) {
01513:                    if (this .nestedType != 0) {
01514:                        annotationTypeDeclaration.bits |= ASTNode.IsMemberType;
01515:                    }
01516:                } else {
01517:                    // Record that the block has a declaration for local types
01518:                    annotationTypeDeclaration.bits |= ASTNode.IsLocalType;
01519:                    markEnclosingMemberWithLocalType();
01520:                    blockReal();
01521:                }
01522:
01523:                //highlight the name of the type
01524:                long pos = this .identifierPositionStack[this .identifierPtr];
01525:                annotationTypeDeclaration.sourceEnd = (int) pos;
01526:                annotationTypeDeclaration.sourceStart = (int) (pos >>> 32);
01527:                annotationTypeDeclaration.name = this .identifierStack[this .identifierPtr--];
01528:                this .identifierLengthPtr--;
01529:
01530:                //compute the declaration source too
01531:                // 'interface' push two int positions: the beginning of the class token and its end.
01532:                // we want to keep the beginning position but get rid of the end position
01533:                // it is only used for the ClassLiteralAccess positions.
01534:                this .intPtr--; // remove the start position of the interface token
01535:                this .intPtr--; // remove the end position of the interface token
01536:
01537:                annotationTypeDeclaration.modifiersSourceStart = this .intStack[this .intPtr--];
01538:                annotationTypeDeclaration.modifiers = this .intStack[this .intPtr--]
01539:                        | ClassFileConstants.AccAnnotation
01540:                        | ClassFileConstants.AccInterface;
01541:                if (annotationTypeDeclaration.modifiersSourceStart >= 0) {
01542:                    annotationTypeDeclaration.declarationSourceStart = annotationTypeDeclaration.modifiersSourceStart;
01543:                    this .intPtr--; // remove the position of the '@' token as we have modifiers
01544:                } else {
01545:                    int atPosition = this .intStack[this .intPtr--];
01546:                    // remove the position of the '@' token as we don't have modifiers
01547:                    annotationTypeDeclaration.declarationSourceStart = atPosition;
01548:                }
01549:
01550:                // Store secondary info
01551:                if ((annotationTypeDeclaration.bits & ASTNode.IsMemberType) == 0
01552:                        && (annotationTypeDeclaration.bits & ASTNode.IsLocalType) == 0) {
01553:                    if (this .compilationUnit != null
01554:                            && !CharOperation.equals(
01555:                                    annotationTypeDeclaration.name,
01556:                                    this .compilationUnit.getMainTypeName())) {
01557:                        annotationTypeDeclaration.bits |= ASTNode.IsSecondaryType;
01558:                    }
01559:                }
01560:
01561:                // consume annotations
01562:                if ((length = this .expressionLengthStack[this .expressionLengthPtr--]) != 0) {
01563:                    System
01564:                            .arraycopy(
01565:                                    this .expressionStack,
01566:                                    (this .expressionPtr -= length) + 1,
01567:                                    annotationTypeDeclaration.annotations = new Annotation[length],
01568:                                    0, length);
01569:                }
01570:                // javadoc
01571:                annotationTypeDeclaration.javadoc = this .javadoc;
01572:                this .javadoc = null;
01573:                pushOnAstStack(annotationTypeDeclaration);
01574:                if (!this .statementRecoveryActivated
01575:                        && options.sourceLevel < ClassFileConstants.JDK1_5
01576:                        && this .lastErrorEndPositionBeforeRecovery < this .scanner.currentPosition) {
01577:                    this .problemReporter()
01578:                            .invalidUsageOfAnnotationDeclarations(
01579:                                    annotationTypeDeclaration);
01580:                }
01581:
01582:                // recovery
01583:                if (this .currentElement != null) {
01584:                    this .lastCheckPoint = annotationTypeDeclaration.bodyStart;
01585:                    this .currentElement = this .currentElement.add(
01586:                            annotationTypeDeclaration, 0);
01587:                    this .lastIgnoredToken = -1;
01588:                }
01589:            }
01590:
01591:            protected void consumeAnnotationTypeMemberDeclaration() {
01592:                // AnnotationTypeMemberDeclaration ::= AnnotationTypeMemberDeclarationHeader AnnotationTypeMemberHeaderExtendedDims DefaultValueopt ';'
01593:                AnnotationMethodDeclaration annotationTypeMemberDeclaration = (AnnotationMethodDeclaration) this .astStack[this .astPtr];
01594:                annotationTypeMemberDeclaration.modifiers |= ExtraCompilerModifiers.AccSemicolonBody;
01595:                // store the this.endPosition (position just before the '}') in case there is
01596:                // a trailing comment behind the end of the method
01597:                int declarationEndPosition = flushCommentsDefinedPriorTo(this .endStatementPosition);
01598:                annotationTypeMemberDeclaration.bodyStart = this .endStatementPosition;
01599:                annotationTypeMemberDeclaration.bodyEnd = declarationEndPosition;
01600:                annotationTypeMemberDeclaration.declarationSourceEnd = declarationEndPosition;
01601:            }
01602:
01603:            protected void consumeAnnotationTypeMemberDeclarations() {
01604:                // AnnotationTypeMemberDeclarations ::= AnnotationTypeMemberDeclarations AnnotationTypeMemberDeclaration
01605:                concatNodeLists();
01606:            }
01607:
01608:            protected void consumeArgumentList() {
01609:                // ArgumentList ::= ArgumentList ',' Expression
01610:                concatExpressionLists();
01611:            }
01612:
01613:            protected void consumeArguments() {
01614:                // Arguments ::= '(' ArgumentListopt ')' 
01615:                // nothing to do, the expression stack is already updated
01616:                pushOnIntStack(rParenPos);
01617:            }
01618:
01619:            protected void consumeArrayAccess(boolean unspecifiedReference) {
01620:                // ArrayAccess ::= Name '[' Expression ']' ==> true
01621:                // ArrayAccess ::= PrimaryNoNewArray '[' Expression ']' ==> false
01622:
01623:                //optimize push/pop
01624:                Expression exp;
01625:                if (unspecifiedReference) {
01626:                    exp = this .expressionStack[this .expressionPtr] = new ArrayReference(
01627:                            getUnspecifiedReferenceOptimized(),
01628:                            this .expressionStack[this .expressionPtr]);
01629:                } else {
01630:                    this .expressionPtr--;
01631:                    this .expressionLengthPtr--;
01632:                    exp = this .expressionStack[this .expressionPtr] = new ArrayReference(
01633:                            this .expressionStack[this .expressionPtr],
01634:                            this .expressionStack[this .expressionPtr + 1]);
01635:                }
01636:                exp.sourceEnd = this .endStatementPosition;
01637:            }
01638:
01639:            protected void consumeArrayCreationExpressionWithInitializer() {
01640:                // ArrayCreationWithArrayInitializer ::= 'new' PrimitiveType DimWithOrWithOutExprs ArrayInitializer
01641:                // ArrayCreationWithArrayInitializer ::= 'new' ClassOrInterfaceType DimWithOrWithOutExprs ArrayInitializer
01642:
01643:                int length;
01644:                ArrayAllocationExpression arrayAllocation = new ArrayAllocationExpression();
01645:                this .expressionLengthPtr--;
01646:                arrayAllocation.initializer = (ArrayInitializer) this .expressionStack[this .expressionPtr--];
01647:
01648:                arrayAllocation.type = getTypeReference(0);
01649:                arrayAllocation.type.bits |= ASTNode.IgnoreRawTypeCheck; // no need to worry about raw type usage
01650:                length = (this .expressionLengthStack[this .expressionLengthPtr--]);
01651:                this .expressionPtr -= length;
01652:                System.arraycopy(this .expressionStack, this .expressionPtr + 1,
01653:                        arrayAllocation.dimensions = new Expression[length], 0,
01654:                        length);
01655:                arrayAllocation.sourceStart = this .intStack[this .intPtr--];
01656:                if (arrayAllocation.initializer == null) {
01657:                    arrayAllocation.sourceEnd = this .endStatementPosition;
01658:                } else {
01659:                    arrayAllocation.sourceEnd = arrayAllocation.initializer.sourceEnd;
01660:                }
01661:                pushOnExpressionStack(arrayAllocation);
01662:            }
01663:
01664:            protected void consumeArrayCreationExpressionWithoutInitializer() {
01665:                // ArrayCreationWithoutArrayInitializer ::= 'new' ClassOrInterfaceType DimWithOrWithOutExprs
01666:                // ArrayCreationWithoutArrayInitializer ::= 'new' PrimitiveType DimWithOrWithOutExprs
01667:
01668:                int length;
01669:                ArrayAllocationExpression arrayAllocation = new ArrayAllocationExpression();
01670:                arrayAllocation.type = getTypeReference(0);
01671:                arrayAllocation.type.bits |= ASTNode.IgnoreRawTypeCheck; // no need to worry about raw type usage	
01672:                length = (this .expressionLengthStack[this .expressionLengthPtr--]);
01673:                this .expressionPtr -= length;
01674:                System.arraycopy(this .expressionStack, this .expressionPtr + 1,
01675:                        arrayAllocation.dimensions = new Expression[length], 0,
01676:                        length);
01677:                arrayAllocation.sourceStart = this .intStack[this .intPtr--];
01678:                if (arrayAllocation.initializer == null) {
01679:                    arrayAllocation.sourceEnd = this .endStatementPosition;
01680:                } else {
01681:                    arrayAllocation.sourceEnd = arrayAllocation.initializer.sourceEnd;
01682:                }
01683:                pushOnExpressionStack(arrayAllocation);
01684:            }
01685:
01686:            protected void consumeArrayCreationHeader() {
01687:                // nothing to do
01688:            }
01689:
01690:            protected void consumeArrayInitializer() {
01691:                // ArrayInitializer ::= '{' VariableInitializers '}'
01692:                // ArrayInitializer ::= '{' VariableInitializers , '}'
01693:
01694:                arrayInitializer(this .expressionLengthStack[this .expressionLengthPtr--]);
01695:            }
01696:
01697:            protected void consumeArrayTypeWithTypeArgumentsName() {
01698:                this .genericsIdentifiersLengthStack[this .genericsIdentifiersLengthPtr] += this .identifierLengthStack[this .identifierLengthPtr];
01699:                pushOnGenericsLengthStack(0); // handle type arguments
01700:            }
01701:
01702:            protected void consumeAssertStatement() {
01703:                // AssertStatement ::= 'assert' Expression ':' Expression ';'
01704:                this .expressionLengthPtr -= 2;
01705:                pushOnAstStack(new AssertStatement(
01706:                        this .expressionStack[this .expressionPtr--],
01707:                        this .expressionStack[this .expressionPtr--],
01708:                        this .intStack[this .intPtr--]));
01709:            }
01710:
01711:            protected void consumeAssignment() {
01712:                // Assignment ::= LeftHandSide AssignmentOperator AssignmentExpression
01713:                //optimize the push/pop
01714:
01715:                int op = this .intStack[this .intPtr--]; //<--the encoded operator
01716:
01717:                this .expressionPtr--;
01718:                this .expressionLengthPtr--;
01719:                this .expressionStack[this .expressionPtr] = (op != EQUAL) ? new CompoundAssignment(
01720:                        this .expressionStack[this .expressionPtr],
01721:                        this .expressionStack[this .expressionPtr + 1], op,
01722:                        this .scanner.startPosition - 1)
01723:                        : new Assignment(
01724:                                this .expressionStack[this .expressionPtr],
01725:                                this .expressionStack[this .expressionPtr + 1],
01726:                                this .scanner.startPosition - 1);
01727:
01728:                if (this .pendingRecoveredType != null) {
01729:                    // Used only in statements recovery.
01730:                    // This is not a real assignment but a placeholder for an existing anonymous type.
01731:                    // The assignment must be replace by the anonymous type.
01732:                    if (this .pendingRecoveredType.allocation != null
01733:                            && this .scanner.startPosition - 1 <= this .pendingRecoveredType.declarationSourceEnd) {
01734:                        this .expressionStack[this .expressionPtr] = this .pendingRecoveredType.allocation;
01735:                        this .pendingRecoveredType = null;
01736:                        return;
01737:                    }
01738:                    this .pendingRecoveredType = null;
01739:                }
01740:            }
01741:
01742:            protected void consumeAssignmentOperator(int pos) {
01743:                // AssignmentOperator ::= '='
01744:                // AssignmentOperator ::= '*='
01745:                // AssignmentOperator ::= '/='
01746:                // AssignmentOperator ::= '%='
01747:                // AssignmentOperator ::= '+='
01748:                // AssignmentOperator ::= '-='
01749:                // AssignmentOperator ::= '<<='
01750:                // AssignmentOperator ::= '>>='
01751:                // AssignmentOperator ::= '>>>='
01752:                // AssignmentOperator ::= '&='
01753:                // AssignmentOperator ::= '^='
01754:                // AssignmentOperator ::= '|='
01755:
01756:                pushOnIntStack(pos);
01757:            }
01758:
01759:            protected void consumeBinaryExpression(int op) {
01760:                // MultiplicativeExpression ::= MultiplicativeExpression '*' UnaryExpression
01761:                // MultiplicativeExpression ::= MultiplicativeExpression '/' UnaryExpression
01762:                // MultiplicativeExpression ::= MultiplicativeExpression '%' UnaryExpression
01763:                // AdditiveExpression ::= AdditiveExpression '+' MultiplicativeExpression
01764:                // AdditiveExpression ::= AdditiveExpression '-' MultiplicativeExpression
01765:                // ShiftExpression ::= ShiftExpression '<<'  AdditiveExpression
01766:                // ShiftExpression ::= ShiftExpression '>>'  AdditiveExpression
01767:                // ShiftExpression ::= ShiftExpression '>>>' AdditiveExpression
01768:                // RelationalExpression ::= RelationalExpression '<'  ShiftExpression
01769:                // RelationalExpression ::= RelationalExpression '>'  ShiftExpression
01770:                // RelationalExpression ::= RelationalExpression '<=' ShiftExpression
01771:                // RelationalExpression ::= RelationalExpression '>=' ShiftExpression
01772:                // AndExpression ::= AndExpression '&' EqualityExpression
01773:                // ExclusiveOrExpression ::= ExclusiveOrExpression '^' AndExpression
01774:                // InclusiveOrExpression ::= InclusiveOrExpression '|' ExclusiveOrExpression
01775:                // ConditionalAndExpression ::= ConditionalAndExpression '&&' InclusiveOrExpression
01776:                // ConditionalOrExpression ::= ConditionalOrExpression '||' ConditionalAndExpression
01777:
01778:                //optimize the push/pop
01779:
01780:                this .expressionPtr--;
01781:                this .expressionLengthPtr--;
01782:                Expression expr1 = this .expressionStack[this .expressionPtr];
01783:                Expression expr2 = this .expressionStack[this .expressionPtr + 1];
01784:                switch (op) {
01785:                case OR_OR:
01786:                    this .expressionStack[this .expressionPtr] = new OR_OR_Expression(
01787:                            expr1, expr2, op);
01788:                    break;
01789:                case AND_AND:
01790:                    this .expressionStack[this .expressionPtr] = new AND_AND_Expression(
01791:                            expr1, expr2, op);
01792:                    break;
01793:                case PLUS:
01794:                    // look for "string1" + "string2"
01795:                    if (this .optimizeStringLiterals) {
01796:                        if (expr1 instanceof  StringLiteral) {
01797:                            if (((expr1.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT) == 0) {
01798:                                if (expr2 instanceof  CharLiteral) { // string+char
01799:                                    this .expressionStack[this .expressionPtr] = ((StringLiteral) expr1)
01800:                                            .extendWith((CharLiteral) expr2);
01801:                                } else if (expr2 instanceof  StringLiteral) { //string+string
01802:                                    this .expressionStack[this .expressionPtr] = ((StringLiteral) expr1)
01803:                                            .extendWith((StringLiteral) expr2);
01804:                                } else {
01805:                                    this .expressionStack[this .expressionPtr] = new BinaryExpression(
01806:                                            expr1, expr2, PLUS);
01807:                                }
01808:                            } else {
01809:                                this .expressionStack[this .expressionPtr] = new BinaryExpression(
01810:                                        expr1, expr2, PLUS);
01811:                            }
01812:                        } else if (expr1 instanceof  CombinedBinaryExpression) {
01813:                            CombinedBinaryExpression cursor;
01814:                            // left branch is comprised of PLUS BEs
01815:                            // cursor is shifted upwards, while needed BEs are added
01816:                            // on demand; past the arityMax-th
01817:                            // consecutive BE, a CBE is inserted that holds a 
01818:                            // full-fledged references table
01819:                            if ((cursor = (CombinedBinaryExpression) expr1).arity < cursor.arityMax) {
01820:                                cursor.left = new BinaryExpression(cursor.left,
01821:                                        cursor.right, PLUS);
01822:                                cursor.arity++;
01823:                            } else {
01824:                                cursor.left = new CombinedBinaryExpression(
01825:                                        cursor.left, cursor.right, PLUS,
01826:                                        cursor.arity);
01827:                                cursor.arity = 0;
01828:                                cursor.tuneArityMax();
01829:                            }
01830:                            cursor.right = expr2;
01831:                            cursor.sourceEnd = expr2.sourceEnd;
01832:                            this .expressionStack[this .expressionPtr] = cursor;
01833:                            // BE_INSTRUMENTATION: neutralized in the released code
01834:                            //					cursor.depthTracker = ((BinaryExpression)cursor.left).
01835:                            //						depthTracker + 1;					
01836:                        } else if (expr1 instanceof  BinaryExpression &&
01837:                        // single out the a + b case, which is a BE 
01838:                                // instead of a CBE (slightly more than a half of 
01839:                                // strings concatenation are one-deep binary 
01840:                                // expressions)
01841:                                ((expr1.bits & ASTNode.OperatorMASK) >> ASTNode.OperatorSHIFT) == OperatorIds.PLUS) {
01842:                            this .expressionStack[this .expressionPtr] = new CombinedBinaryExpression(
01843:                                    expr1, expr2, PLUS, 1);
01844:                        } else {
01845:                            this .expressionStack[this .expressionPtr] = new BinaryExpression(
01846:                                    expr1, expr2, PLUS);
01847:                        }
01848:                    } else if (expr1 instanceof  StringLiteral) {
01849:                        if (expr2 instanceof  StringLiteral
01850:                                && ((expr1.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT) == 0) {
01851:                            // string + string
01852:                            this .expressionStack[this .expressionPtr] = ((StringLiteral) expr1)
01853:                                    .extendsWith((StringLiteral) expr2);
01854:                        } else {
01855:                            // single out the a + b case
01856:                            this .expressionStack[this .expressionPtr] = new BinaryExpression(
01857:                                    expr1, expr2, PLUS);
01858:                        }
01859:                    } else if (expr1 instanceof  CombinedBinaryExpression) {
01860:                        CombinedBinaryExpression cursor;
01861:                        int numberOfParens = (expr1.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT;
01862:                        // shift cursor; create BE/CBE as needed
01863:                        if ((cursor = (CombinedBinaryExpression) expr1).arity < cursor.arityMax) {
01864:                            cursor.left = new BinaryExpression(cursor.left,
01865:                                    cursor.right, PLUS);
01866:                            if (numberOfParens != 0) {
01867:                                // clear the bits on cursor and put them back on cursor.left
01868:                                cursor.bits &= ~ASTNode.ParenthesizedMASK;
01869:                                cursor.left.bits &= ~ASTNode.ParenthesizedMASK;
01870:                                cursor.left.bits |= numberOfParens << ASTNode.ParenthesizedSHIFT;
01871:                            }
01872:                            cursor.arity++;
01873:                        } else {
01874:                            cursor.left = new CombinedBinaryExpression(
01875:                                    cursor.left, cursor.right, PLUS,
01876:                                    cursor.arity);
01877:                            if (numberOfParens != 0) {
01878:                                // clear the bits on cursor and put them back on cursor.left
01879:                                cursor.bits &= ~ASTNode.ParenthesizedMASK;
01880:                                cursor.left.bits &= ~ASTNode.ParenthesizedMASK;
01881:                                cursor.left.bits |= numberOfParens << ASTNode.ParenthesizedSHIFT;
01882:                            }
01883:                            cursor.arity = 0;
01884:                            cursor.tuneArityMax();
01885:                        }
01886:                        cursor.right = expr2;
01887:                        cursor.sourceEnd = expr2.sourceEnd;
01888:                        // BE_INSTRUMENTATION: neutralized in the released code
01889:                        //					cursor.depthTracker = ((BinaryExpression)cursor.left).
01890:                        //						depthTracker + 1;
01891:                        this .expressionStack[this .expressionPtr] = cursor;
01892:                    } else if (expr1 instanceof  BinaryExpression
01893:                            && ((expr1.bits & ASTNode.OperatorMASK) >> ASTNode.OperatorSHIFT) == OperatorIds.PLUS) {
01894:                        // single out the a + b case
01895:                        this .expressionStack[this .expressionPtr] = new CombinedBinaryExpression(
01896:                                expr1, expr2, PLUS, 1);
01897:                    } else {
01898:                        this .expressionStack[this .expressionPtr] = new BinaryExpression(
01899:                                expr1, expr2, PLUS);
01900:                    }
01901:                    break;
01902:                case LESS:
01903:                    this .intPtr--;
01904:                    this .expressionStack[this .expressionPtr] = new BinaryExpression(
01905:                            expr1, expr2, op);
01906:                    break;
01907:                default:
01908:                    this .expressionStack[this .expressionPtr] = new BinaryExpression(
01909:                            expr1, expr2, op);
01910:                }
01911:            }
01912:
01913:            /**
01914:             * @param op binary operator
01915:             */
01916:            protected void consumeBinaryExpressionWithName(int op) {
01917:                pushOnExpressionStack(getUnspecifiedReferenceOptimized());
01918:                this .expressionPtr--;
01919:                this .expressionLengthPtr--;
01920:                /*
01921:                if (op == OR_OR) {
01922:                	this.expressionStack[this.expressionPtr] = 
01923:                		new OR_OR_Expression(
01924:                			this.expressionStack[this.expressionPtr + 1], 
01925:                			this.expressionStack[this.expressionPtr], 
01926:                			op); 
01927:                } else {
01928:                	if (op == AND_AND) {
01929:                		this.expressionStack[this.expressionPtr] = 
01930:                			new AND_AND_Expression(
01931:                				this.expressionStack[this.expressionPtr + 1], 
01932:                				this.expressionStack[this.expressionPtr], 
01933:                				op);
01934:                	} else {
01935:                		// look for "string1" + "string2"
01936:                		if ((op == PLUS) && this.optimizeStringLiterals) {
01937:                			Expression expr1, expr2;
01938:                			expr1 = this.expressionStack[this.expressionPtr + 1];
01939:                			expr2 = this.expressionStack[this.expressionPtr];
01940:                			if (expr1 instanceof StringLiteral) {
01941:                				if (expr2 instanceof CharLiteral) { // string+char
01942:                					this.expressionStack[this.expressionPtr] = 
01943:                						((StringLiteral) expr1).extendWith((CharLiteral) expr2); 
01944:                				} else if (expr2 instanceof StringLiteral) { //string+string
01945:                					this.expressionStack[this.expressionPtr] = 
01946:                						((StringLiteral) expr1).extendWith((StringLiteral) expr2); 
01947:                				} else {
01948:                					this.expressionStack[this.expressionPtr] = new BinaryExpression(expr1, expr2, PLUS);
01949:                				}
01950:                			} else {
01951:                				this.expressionStack[this.expressionPtr] = new BinaryExpression(expr1, expr2, PLUS);
01952:                			}
01953:                		} else {
01954:                			this.expressionStack[this.expressionPtr] = 
01955:                				new BinaryExpression(
01956:                					this.expressionStack[this.expressionPtr + 1], 
01957:                					this.expressionStack[this.expressionPtr], 
01958:                					op);
01959:                		}
01960:                	}
01961:                }
01962:                 */
01963:                Expression expr1 = this .expressionStack[this .expressionPtr + 1];
01964:                Expression expr2 = this .expressionStack[this .expressionPtr];
01965:                // Note: we do not attempt to promote BinaryExpression-s to 
01966:                //       IndexedBinaryExpression-s here since expr1 always holds a name
01967:                switch (op) {
01968:                case OR_OR:
01969:                    this .expressionStack[this .expressionPtr] = new OR_OR_Expression(
01970:                            expr1, expr2, op);
01971:                    break;
01972:                case AND_AND:
01973:                    this .expressionStack[this .expressionPtr] = new AND_AND_Expression(
01974:                            expr1, expr2, op);
01975:                    break;
01976:                case PLUS:
01977:                    // look for "string1" + "string2"
01978:                    if (this .optimizeStringLiterals) {
01979:                        if (expr1 instanceof  StringLiteral
01980:                                && ((expr1.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT) == 0) {
01981:                            if (expr2 instanceof  CharLiteral) { // string+char
01982:                                this .expressionStack[this .expressionPtr] = ((StringLiteral) expr1)
01983:                                        .extendWith((CharLiteral) expr2);
01984:                            } else if (expr2 instanceof  StringLiteral) { //string+string
01985:                                this .expressionStack[this .expressionPtr] = ((StringLiteral) expr1)
01986:                                        .extendWith((StringLiteral) expr2);
01987:                            } else {
01988:                                this .expressionStack[this .expressionPtr] = new BinaryExpression(
01989:                                        expr1, expr2, PLUS);
01990:                            }
01991:                        } else {
01992:                            this .expressionStack[this .expressionPtr] = new BinaryExpression(
01993:                                    expr1, expr2, PLUS);
01994:                        }
01995:                    } else if (expr1 instanceof  StringLiteral) {
01996:                        if (expr2 instanceof  StringLiteral
01997:                                && ((expr1.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT) == 0) {
01998:                            // string + string
01999:                            this .expressionStack[this .expressionPtr] = ((StringLiteral) expr1)
02000:                                    .extendsWith((StringLiteral) expr2);
02001:                        } else {
02002:                            this .expressionStack[this .expressionPtr] = new BinaryExpression(
02003:                                    expr1, expr2, op);
02004:                        }
02005:                    } else {
02006:                        this .expressionStack[this .expressionPtr] = new BinaryExpression(
02007:                                expr1, expr2, op);
02008:                    }
02009:                    break;
02010:                case LESS:
02011:                    this .intPtr--;
02012:                    this .expressionStack[this .expressionPtr] = new BinaryExpression(
02013:                            expr1, expr2, op);
02014:                    break;
02015:                default:
02016:                    this .expressionStack[this .expressionPtr] = new BinaryExpression(
02017:                            expr1, expr2, op);
02018:                }
02019:            }
02020:
02021:            protected void consumeBlock() {
02022:                // Block ::= OpenBlock '{' BlockStatementsopt '}'
02023:                // simpler action for empty blocks
02024:
02025:                int statementsLength = this .astLengthStack[this .astLengthPtr--];
02026:                Block block;
02027:                if (statementsLength == 0) { // empty block 
02028:                    block = new Block(0);
02029:                    block.sourceStart = this .intStack[this .intPtr--];
02030:                    block.sourceEnd = this .endStatementPosition;
02031:                    // check whether this block at least contains some comment in it
02032:                    if (!containsComment(block.sourceStart, block.sourceEnd)) {
02033:                        block.bits |= ASTNode.UndocumentedEmptyBlock;
02034:                    }
02035:                    this .realBlockPtr--; // still need to pop the block variable counter
02036:                } else {
02037:                    block = new Block(this .realBlockStack[this .realBlockPtr--]);
02038:                    this .astPtr -= statementsLength;
02039:                    System.arraycopy(this .astStack, this .astPtr + 1,
02040:                            block.statements = new Statement[statementsLength],
02041:                            0, statementsLength);
02042:                    block.sourceStart = this .intStack[this .intPtr--];
02043:                    block.sourceEnd = this .endStatementPosition;
02044:                }
02045:                pushOnAstStack(block);
02046:            }
02047:
02048:            protected void consumeBlockStatements() {
02049:                // BlockStatements ::= BlockStatements BlockStatement
02050:                concatNodeLists();
02051:            }
02052:
02053:            protected void consumeCaseLabel() {
02054:                // SwitchLabel ::= 'case' ConstantExpression ':'
02055:                this .expressionLengthPtr--;
02056:                Expression expression = this .expressionStack[this .expressionPtr--];
02057:                pushOnAstStack(new CaseStatement(expression,
02058:                        expression.sourceEnd, this .intStack[this .intPtr--]));
02059:            }
02060:
02061:            protected void consumeCastExpressionLL1() {
02062:                //CastExpression ::= '(' Expression ')' InsideCastExpressionLL1 UnaryExpressionNotPlusMinus
02063:                // Expression is used in order to make the grammar LL1
02064:
02065:                //optimize push/pop
02066:
02067:                Expression cast, exp;
02068:                this .expressionPtr--;
02069:                this .expressionStack[this .expressionPtr] = cast = new CastExpression(
02070:                        exp = this .expressionStack[this .expressionPtr + 1],
02071:                        getTypeReference(this .expressionStack[this .expressionPtr]));
02072:                this .expressionLengthPtr--;
02073:                updateSourcePosition(cast);
02074:                cast.sourceEnd = exp.sourceEnd;
02075:            }
02076:
02077:            protected void consumeCastExpressionWithGenericsArray() {
02078:                // CastExpression ::= PushLPAREN Name TypeArguments Dims PushRPAREN InsideCastExpression UnaryExpressionNotPlusMinus
02079:
02080:                Expression exp, cast, castType;
02081:                int end = this .intStack[this .intPtr--];
02082:
02083:                int dim = this .intStack[this .intPtr--];
02084:                pushOnGenericsIdentifiersLengthStack(this .identifierLengthStack[this .identifierLengthPtr]);
02085:
02086:                this .expressionStack[this .expressionPtr] = cast = new CastExpression(
02087:                        exp = this .expressionStack[this .expressionPtr],
02088:                        castType = getTypeReference(dim));
02089:                intPtr--;
02090:                castType.sourceEnd = end - 1;
02091:                castType.sourceStart = (cast.sourceStart = this .intStack[this .intPtr--]) + 1;
02092:                cast.sourceEnd = exp.sourceEnd;
02093:            }
02094:
02095:            protected void consumeCastExpressionWithNameArray() {
02096:                // CastExpression ::= PushLPAREN Name Dims PushRPAREN InsideCastExpression UnaryExpressionNotPlusMinus
02097:
02098:                Expression exp, cast, castType;
02099:                int end = this .intStack[this .intPtr--];
02100:
02101:                // handle type arguments
02102:                pushOnGenericsLengthStack(0);
02103:                pushOnGenericsIdentifiersLengthStack(this .identifierLengthStack[this .identifierLengthPtr]);
02104:
02105:                this .expressionStack[this .expressionPtr] = cast = new CastExpression(
02106:                        exp = this .expressionStack[this .expressionPtr],
02107:                        castType = getTypeReference(this .intStack[this .intPtr--]));
02108:                castType.sourceEnd = end - 1;
02109:                castType.sourceStart = (cast.sourceStart = this .intStack[this .intPtr--]) + 1;
02110:                cast.sourceEnd = exp.sourceEnd;
02111:            }
02112:
02113:            protected void consumeCastExpressionWithPrimitiveType() {
02114:                // CastExpression ::= PushLPAREN PrimitiveType Dimsopt PushRPAREN InsideCastExpression UnaryExpression
02115:
02116:                //this.intStack : posOfLeftParen dim posOfRightParen
02117:
02118:                //optimize the push/pop
02119:
02120:                Expression exp, cast, castType;
02121:                int end = this .intStack[this .intPtr--];
02122:                this .expressionStack[this .expressionPtr] = cast = new CastExpression(
02123:                        exp = this .expressionStack[this .expressionPtr],
02124:                        castType = getTypeReference(this .intStack[this .intPtr--]));
02125:                castType.sourceEnd = end - 1;
02126:                castType.sourceStart = (cast.sourceStart = this .intStack[this .intPtr--]) + 1;
02127:                cast.sourceEnd = exp.sourceEnd;
02128:            }
02129:
02130:            protected ParameterizedQualifiedTypeReference computeQualifiedGenericsFromRightSide(
02131:                    TypeReference rightSide, int dim) {
02132:                int nameSize = this .identifierLengthStack[this .identifierLengthPtr];
02133:                int tokensSize = nameSize;
02134:                if (rightSide instanceof  ParameterizedSingleTypeReference) {
02135:                    tokensSize++;
02136:                } else if (rightSide instanceof  SingleTypeReference) {
02137:                    tokensSize++;
02138:                } else if (rightSide instanceof  ParameterizedQualifiedTypeReference) {
02139:                    tokensSize += ((QualifiedTypeReference) rightSide).tokens.length;
02140:                } else if (rightSide instanceof  QualifiedTypeReference) {
02141:                    tokensSize += ((QualifiedTypeReference) rightSide).tokens.length;
02142:                }
02143:                TypeReference[][] typeArguments = new TypeReference[tokensSize][];
02144:                char[][] tokens = new char[tokensSize][];
02145:                long[] positions = new long[tokensSize];
02146:                if (rightSide instanceof  ParameterizedSingleTypeReference) {
02147:                    ParameterizedSingleTypeReference singleParameterizedTypeReference = (ParameterizedSingleTypeReference) rightSide;
02148:                    tokens[nameSize] = singleParameterizedTypeReference.token;
02149:                    positions[nameSize] = (((long) singleParameterizedTypeReference.sourceStart) << 32)
02150:                            + singleParameterizedTypeReference.sourceEnd;
02151:                    typeArguments[nameSize] = singleParameterizedTypeReference.typeArguments;
02152:                } else if (rightSide instanceof  SingleTypeReference) {
02153:                    SingleTypeReference singleTypeReference = (SingleTypeReference) rightSide;
02154:                    tokens[nameSize] = singleTypeReference.token;
02155:                    positions[nameSize] = (((long) singleTypeReference.sourceStart) << 32)
02156:                            + singleTypeReference.sourceEnd;
02157:                } else if (rightSide instanceof  ParameterizedQualifiedTypeReference) {
02158:                    ParameterizedQualifiedTypeReference parameterizedTypeReference = (ParameterizedQualifiedTypeReference) rightSide;
02159:                    TypeReference[][] rightSideTypeArguments = parameterizedTypeReference.typeArguments;
02160:                    System.arraycopy(rightSideTypeArguments, 0, typeArguments,
02161:                            nameSize, rightSideTypeArguments.length);
02162:                    char[][] rightSideTokens = parameterizedTypeReference.tokens;
02163:                    System.arraycopy(rightSideTokens, 0, tokens, nameSize,
02164:                            rightSideTokens.length);
02165:                    long[] rightSidePositions = parameterizedTypeReference.sourcePositions;
02166:                    System.arraycopy(rightSidePositions, 0, positions,
02167:                            nameSize, rightSidePositions.length);
02168:                } else if (rightSide instanceof  QualifiedTypeReference) {
02169:                    QualifiedTypeReference qualifiedTypeReference = (QualifiedTypeReference) rightSide;
02170:                    char[][] rightSideTokens = qualifiedTypeReference.tokens;
02171:                    System.arraycopy(rightSideTokens, 0, tokens, nameSize,
02172:                            rightSideTokens.length);
02173:                    long[] rightSidePositions = qualifiedTypeReference.sourcePositions;
02174:                    System.arraycopy(rightSidePositions, 0, positions,
02175:                            nameSize, rightSidePositions.length);
02176:                }
02177:
02178:                int currentTypeArgumentsLength = this .genericsLengthStack[this .genericsLengthPtr--];
02179:                TypeReference[] currentTypeArguments = new TypeReference[currentTypeArgumentsLength];
02180:                this .genericsPtr -= currentTypeArgumentsLength;
02181:                System.arraycopy(this .genericsStack, this .genericsPtr + 1,
02182:                        currentTypeArguments, 0, currentTypeArgumentsLength);
02183:
02184:                if (nameSize == 1) {
02185:                    tokens[0] = this .identifierStack[this .identifierPtr];
02186:                    positions[0] = this .identifierPositionStack[this .identifierPtr--];
02187:                    typeArguments[0] = currentTypeArguments;
02188:                } else {
02189:                    this .identifierPtr -= nameSize;
02190:                    System.arraycopy(this .identifierStack,
02191:                            this .identifierPtr + 1, tokens, 0, nameSize);
02192:                    System.arraycopy(this .identifierPositionStack,
02193:                            this .identifierPtr + 1, positions, 0, nameSize);
02194:                    typeArguments[nameSize - 1] = currentTypeArguments;
02195:                }
02196:                this .identifierLengthPtr--;
02197:                return new ParameterizedQualifiedTypeReference(tokens,
02198:                        typeArguments, dim, positions);
02199:            }
02200:
02201:            protected void consumeCastExpressionWithQualifiedGenericsArray() {
02202:                // CastExpression ::= PushLPAREN Name OnlyTypeArguments '.' ClassOrInterfaceType Dims PushRPAREN InsideCastExpression UnaryExpressionNotPlusMinus
02203:                Expression exp, cast, castType;
02204:                int end = this .intStack[this .intPtr--];
02205:
02206:                int dim = this .intStack[this .intPtr--];
02207:                TypeReference rightSide = getTypeReference(0);
02208:
02209:                ParameterizedQualifiedTypeReference qualifiedParameterizedTypeReference = computeQualifiedGenericsFromRightSide(
02210:                        rightSide, dim);
02211:                intPtr--;
02212:                this .expressionStack[this .expressionPtr] = cast = new CastExpression(
02213:                        exp = this .expressionStack[this .expressionPtr],
02214:                        castType = qualifiedParameterizedTypeReference);
02215:                castType.sourceEnd = end - 1;
02216:                castType.sourceStart = (cast.sourceStart = this .intStack[this .intPtr--]) + 1;
02217:                cast.sourceEnd = exp.sourceEnd;
02218:            }
02219:
02220:            protected void consumeCatches() {
02221:                // Catches ::= Catches CatchClause
02222:                optimizedConcatNodeLists();
02223:            }
02224:
02225:            protected void consumeCatchHeader() {
02226:                // CatchDeclaration ::= 'catch' '(' FormalParameter ')' '{'
02227:
02228:                if (this .currentElement == null) {
02229:                    return; // should never occur, this consumeRule is only used in recovery mode
02230:                }
02231:                // current element should be a block due to the presence of the opening brace
02232:                if (!(this .currentElement instanceof  RecoveredBlock)) {
02233:                    if (!(this .currentElement instanceof  RecoveredMethod)) {
02234:                        return;
02235:                    }
02236:                    RecoveredMethod rMethod = (RecoveredMethod) this .currentElement;
02237:                    if (!(rMethod.methodBody == null && rMethod.bracketBalance > 0)) {
02238:                        return;
02239:                    }
02240:                }
02241:
02242:                Argument arg = (Argument) this .astStack[this .astPtr--];
02243:                // convert argument to local variable
02244:                LocalDeclaration localDeclaration = new LocalDeclaration(
02245:                        arg.name, arg.sourceStart, arg.sourceEnd);
02246:                localDeclaration.type = arg.type;
02247:                localDeclaration.declarationSourceStart = arg.declarationSourceStart;
02248:                localDeclaration.declarationSourceEnd = arg.declarationSourceEnd;
02249:
02250:                this .currentElement = this .currentElement.add(localDeclaration,
02251:                        0);
02252:                this .lastCheckPoint = this .scanner.startPosition; // force to restart at this exact position
02253:                this .restartRecovery = true; // request to restart from here on
02254:                this .lastIgnoredToken = -1;
02255:            }
02256:
02257:            protected void consumeClassBodyDeclaration() {
02258:                // ClassBodyDeclaration ::= Diet NestedMethod CreateInitializer Block
02259:                //push an Initializer
02260:                //optimize the push/pop
02261:                this .nestedMethod[this .nestedType]--;
02262:                Block block = (Block) this .astStack[this .astPtr--];
02263:                this .astLengthPtr--;
02264:                if (this .diet)
02265:                    block.bits &= ~ASTNode.UndocumentedEmptyBlock; // clear bit since was diet
02266:                Initializer initializer = (Initializer) this .astStack[this .astPtr];
02267:                initializer.declarationSourceStart = initializer.sourceStart = block.sourceStart;
02268:                initializer.block = block;
02269:                this .intPtr--; // pop sourcestart left on the stack by consumeNestedMethod.
02270:                initializer.bodyStart = this .intStack[this .intPtr--];
02271:                this .realBlockPtr--; // pop the block variable counter left on the stack by consumeNestedMethod
02272:                int javadocCommentStart = this .intStack[this .intPtr--];
02273:                if (javadocCommentStart != -1) {
02274:                    initializer.declarationSourceStart = javadocCommentStart;
02275:                    initializer.javadoc = this .javadoc;
02276:                    this .javadoc = null;
02277:                }
02278:                initializer.bodyEnd = this .endPosition;
02279:                initializer.sourceEnd = this .endStatementPosition;
02280:                initializer.declarationSourceEnd = flushCommentsDefinedPriorTo(this .endStatementPosition);
02281:            }
02282:
02283:            protected void consumeClassBodyDeclarations() {
02284:                // ClassBodyDeclarations ::= ClassBodyDeclarations ClassBodyDeclaration
02285:                concatNodeLists();
02286:            }
02287:
02288:            protected void consumeClassBodyDeclarationsopt() {
02289:                // ClassBodyDeclarationsopt ::= NestedType ClassBodyDeclarations
02290:                this .nestedType--;
02291:            }
02292:
02293:            protected void consumeAnnotationTypeMemberDeclarationsopt() {
02294:                this .nestedType--;
02295:            }
02296:
02297:            protected void consumeClassBodyopt() {
02298:                // ClassBodyopt ::= $empty
02299:                pushOnAstStack(null);
02300:                this .endPosition = this .rParenPos;
02301:            }
02302:
02303:            protected void consumeClassDeclaration() {
02304:                // ClassDeclaration ::= ClassHeader ClassBody
02305:
02306:                int length;
02307:                if ((length = this .astLengthStack[this .astLengthPtr--]) != 0) {
02308:                    //there are length declarations
02309:                    //dispatch according to the type of the declarations
02310:                    dispatchDeclarationInto(length);
02311:                }
02312:
02313:                TypeDeclaration typeDecl = (TypeDeclaration) this .astStack[this .astPtr];
02314:
02315:                //convert constructor that do not have the type's name into methods
02316:                boolean hasConstructor = typeDecl.checkConstructors(this );
02317:
02318:                //add the default constructor when needed (interface don't have it)
02319:                if (!hasConstructor) {
02320:                    switch (TypeDeclaration.kind(typeDecl.modifiers)) {
02321:                    case TypeDeclaration.CLASS_DECL:
02322:                    case TypeDeclaration.ENUM_DECL:
02323:                        boolean insideFieldInitializer = false;
02324:                        if (this .diet) {
02325:                            for (int i = this .nestedType; i > 0; i--) {
02326:                                if (this .variablesCounter[i] > 0) {
02327:                                    insideFieldInitializer = true;
02328:                                    break;
02329:                                }
02330:                            }
02331:                        }
02332:                        typeDecl.createDefaultConstructor(!this .diet
02333:                                || insideFieldInitializer, true);
02334:                    }
02335:                }
02336:                //always add <clinit> (will be remove at code gen time if empty)
02337:                if (this .scanner.containsAssertKeyword) {
02338:                    typeDecl.bits |= ASTNode.ContainsAssertion;
02339:                }
02340:                typeDecl.addClinit();
02341:                typeDecl.bodyEnd = this .endStatementPosition;
02342:                if (length == 0
02343:                        && !containsComment(typeDecl.bodyStart,
02344:                                typeDecl.bodyEnd)) {
02345:                    typeDecl.bits |= ASTNode.UndocumentedEmptyBlock;
02346:                }
02347:
02348:                typeDecl.declarationSourceEnd = flushCommentsDefinedPriorTo(this .endStatementPosition);
02349:            }
02350:
02351:            protected void consumeClassHeader() {
02352:                // ClassHeader ::= ClassHeaderName ClassHeaderExtendsopt ClassHeaderImplementsopt
02353:
02354:                TypeDeclaration typeDecl = (TypeDeclaration) this .astStack[this .astPtr];
02355:                if (this .currentToken == TokenNameLBRACE) {
02356:                    typeDecl.bodyStart = this .scanner.currentPosition;
02357:                }
02358:                if (this .currentElement != null) {
02359:                    this .restartRecovery = true; // used to avoid branching back into the regular automaton		
02360:                }
02361:                // flush the comments related to the class header
02362:                this .scanner.commentPtr = -1;
02363:            }
02364:
02365:            protected void consumeClassHeaderExtends() {
02366:                // ClassHeaderExtends ::= 'extends' ClassType
02367:                //superclass
02368:                TypeReference super Class = getTypeReference(0);
02369:                // There is a class declaration on the top of stack
02370:                TypeDeclaration typeDecl = (TypeDeclaration) this .astStack[this .astPtr];
02371:                typeDecl.super class = super Class;
02372:                super Class.bits |= ASTNode.IsSuperType;
02373:                typeDecl.bodyStart = typeDecl.super class.sourceEnd + 1;
02374:                // recovery
02375:                if (this .currentElement != null) {
02376:                    this .lastCheckPoint = typeDecl.bodyStart;
02377:                }
02378:            }
02379:
02380:            protected void consumeClassHeaderImplements() {
02381:                // ClassHeaderImplements ::= 'implements' InterfaceTypeList
02382:                int length = this .astLengthStack[this .astLengthPtr--];
02383:                //super interfaces
02384:                this .astPtr -= length;
02385:                // There is a class declaration on the top of stack
02386:                TypeDeclaration typeDecl = (TypeDeclaration) this .astStack[this .astPtr];
02387:                System.arraycopy(this .astStack, this .astPtr + 1,
02388:                        typeDecl.super Interfaces = new TypeReference[length],
02389:                        0, length);
02390:                for (int i = 0, max = typeDecl.super Interfaces.length; i < max; i++) {
02391:                    typeDecl.super Interfaces[i].bits |= ASTNode.IsSuperType;
02392:                }
02393:                typeDecl.bodyStart = typeDecl.super Interfaces[length - 1].sourceEnd + 1;
02394:                this .listLength = 0; // reset after having read super-interfaces
02395:                // recovery
02396:                if (this .currentElement != null) { // is recovering
02397:                    this .lastCheckPoint = typeDecl.bodyStart;
02398:                }
02399:            }
02400:
02401:            protected void consumeClassHeaderName1() {
02402:                // ClassHeaderName1 ::= Modifiersopt 'class' 'Identifier'
02403:                TypeDeclaration typeDecl = new TypeDeclaration(
02404:                        this .compilationUnit.compilationResult);
02405:                if (this .nestedMethod[this .nestedType] == 0) {
02406:                    if (this .nestedType != 0) {
02407:                        typeDecl.bits |= ASTNode.IsMemberType;
02408:                    }
02409:                } else {
02410:                    // Record that the block has a declaration for local types
02411:                    typeDecl.bits |= ASTNode.IsLocalType;
02412:                    markEnclosingMemberWithLocalType();
02413:                    blockReal();
02414:                }
02415:
02416:                //highlight the name of the type
02417:                long pos = this .identifierPositionStack[this .identifierPtr];
02418:                typeDecl.sourceEnd = (int) pos;
02419:                typeDecl.sourceStart = (int) (pos >>> 32);
02420:                typeDecl.name = this .identifierStack[this .identifierPtr--];
02421:                this .identifierLengthPtr--;
02422:
02423:                //compute the declaration source too
02424:                // 'class' and 'interface' push two int positions: the beginning of the class token and its end.
02425:                // we want to keep the beginning position but get rid of the end position
02426:                // it is only used for the ClassLiteralAccess positions.
02427:                typeDecl.declarationSourceStart = this .intStack[this .intPtr--];
02428:                this .intPtr--; // remove the end position of the class token
02429:
02430:                typeDecl.modifiersSourceStart = this .intStack[this .intPtr--];
02431:                typeDecl.modifiers = this .intStack[this .intPtr--];
02432:                if (typeDecl.modifiersSourceStart >= 0) {
02433:                    typeDecl.declarationSourceStart = typeDecl.modifiersSourceStart;
02434:                }
02435:
02436:                // Store secondary info
02437:                if ((typeDecl.bits & ASTNode.IsMemberType) == 0
02438:                        && (typeDecl.bits & ASTNode.IsLocalType) == 0) {
02439:                    if (this .compilationUnit != null
02440:                            && !CharOperation.equals(typeDecl.name,
02441:                                    this .compilationUnit.getMainTypeName())) {
02442:                        typeDecl.bits |= ASTNode.IsSecondaryType;
02443:                    }
02444:                }
02445:
02446:                // consume annotations
02447:                int length;
02448:                if ((length = this .expressionLengthStack[this .expressionLengthPtr--]) != 0) {
02449:                    System.arraycopy(this .expressionStack,
02450:                            (this .expressionPtr -= length) + 1,
02451:                            typeDecl.annotations = new Annotation[length], 0,
02452:                            length);
02453:                }
02454:                typeDecl.bodyStart = typeDecl.sourceEnd + 1;
02455:                pushOnAstStack(typeDecl);
02456:
02457:                this .listLength = 0; // will be updated when reading super-interfaces
02458:                // recovery
02459:                if (this .currentElement != null) {
02460:                    this .lastCheckPoint = typeDecl.bodyStart;
02461:                    this .currentElement = this .currentElement.add(typeDecl, 0);
02462:                    this .lastIgnoredToken = -1;
02463:                }
02464:                // javadoc
02465:                typeDecl.javadoc = this .javadoc;
02466:                this .javadoc = null;
02467:            }
02468:
02469:            protected void consumeTypeHeaderNameWithTypeParameters() {
02470:                // ClassHeaderName ::= ClassHeaderName1 TypeParameters
02471:                // InterfaceHeaderName ::= InterfaceHeaderName1 TypeParameters
02472:                TypeDeclaration typeDecl = (TypeDeclaration) this .astStack[this .astPtr];
02473:
02474:                // consume type parameters
02475:                int length = this .genericsLengthStack[this .genericsLengthPtr--];
02476:                this .genericsPtr -= length;
02477:                System.arraycopy(this .genericsStack, this .genericsPtr + 1,
02478:                        typeDecl.typeParameters = new TypeParameter[length], 0,
02479:                        length);
02480:
02481:                typeDecl.bodyStart = typeDecl.typeParameters[length - 1].declarationSourceEnd + 1;
02482:
02483:                this .listTypeParameterLength = 0;
02484:
02485:                if (this .currentElement != null) { // is recovering
02486:                    RecoveredType recoveredType = (RecoveredType) this .currentElement;
02487:                    recoveredType.pendingTypeParameters = null;
02488:
02489:                    this .lastCheckPoint = typeDecl.bodyStart;
02490:                }
02491:            }
02492:
02493:            protected void consumeClassInstanceCreationExpression() {
02494:                // ClassInstanceCreationExpression ::= 'new' ClassType '(' ArgumentListopt ')' ClassBodyopt
02495:                classInstanceCreation(false);
02496:            }
02497:
02498:            protected void consumeClassInstanceCreationExpressionName() {
02499:                // ClassInstanceCreationExpressionName ::= Name '.'
02500:                pushOnExpressionStack(getUnspecifiedReferenceOptimized());
02501:            }
02502:
02503:            protected void consumeClassInstanceCreationExpressionQualified() {
02504:                // ClassInstanceCreationExpression ::= Primary '.' 'new' SimpleName '(' ArgumentListopt ')' ClassBodyopt
02505:                // ClassInstanceCreationExpression ::= ClassInstanceCreationExpressionName 'new' SimpleName '(' ArgumentListopt ')' ClassBodyopt
02506:                classInstanceCreation(true);
02507:
02508:                this .expressionLengthPtr--;
02509:                QualifiedAllocationExpression qae = (QualifiedAllocationExpression) this .expressionStack[this .expressionPtr--];
02510:                qae.enclosingInstance = this .expressionStack[this .expressionPtr];
02511:                this .expressionStack[this .expressionPtr] = qae;
02512:                qae.sourceStart = qae.enclosingInstance.sourceStart;
02513:            }
02514:
02515:            protected void consumeClassInstanceCreationExpressionQualifiedWithTypeArguments() {
02516:                // ClassInstanceCreationExpression ::= Primary '.' 'new' TypeArguments SimpleName '(' ArgumentListopt ')' ClassBodyopt
02517:                // ClassInstanceCreationExpression ::= ClassInstanceCreationExpressionName 'new' TypeArguments SimpleName '(' ArgumentListopt ')' ClassBodyopt
02518:
02519:                QualifiedAllocationExpression alloc;
02520:                int length;
02521:                if (((length = this .astLengthStack[this .astLengthPtr--]) == 1)
02522:                        && (this .astStack[this .astPtr] == null)) {
02523:                    //NO ClassBody
02524:                    this .astPtr--;
02525:                    alloc = new QualifiedAllocationExpression();
02526:                    alloc.sourceEnd = this .endPosition; //the position has been stored explicitly
02527:
02528:                    if ((length = this .expressionLengthStack[this .expressionLengthPtr--]) != 0) {
02529:                        this .expressionPtr -= length;
02530:                        System.arraycopy(this .expressionStack,
02531:                                this .expressionPtr + 1,
02532:                                alloc.arguments = new Expression[length], 0,
02533:                                length);
02534:                    }
02535:                    alloc.type = getTypeReference(0);
02536:
02537:                    length = this .genericsLengthStack[this .genericsLengthPtr--];
02538:                    this .genericsPtr -= length;
02539:                    System.arraycopy(this .genericsStack, this .genericsPtr + 1,
02540:                            alloc.typeArguments = new TypeReference[length], 0,
02541:                            length);
02542:                    intPtr--;
02543:
02544:                    //the default constructor with the correct number of argument
02545:                    //will be created and added by the TC (see createsInternalConstructorWithBinding)
02546:                    alloc.sourceStart = this .intStack[this .intPtr--];
02547:                    pushOnExpressionStack(alloc);
02548:                } else {
02549:                    dispatchDeclarationInto(length);
02550:                    TypeDeclaration anonymousTypeDeclaration = (TypeDeclaration) this .astStack[this .astPtr];
02551:                    anonymousTypeDeclaration.declarationSourceEnd = this .endStatementPosition;
02552:                    anonymousTypeDeclaration.bodyEnd = this .endStatementPosition;
02553:                    if (length == 0
02554:                            && !containsComment(
02555:                                    anonymousTypeDeclaration.bodyStart,
02556:                                    anonymousTypeDeclaration.bodyEnd)) {
02557:                        anonymousTypeDeclaration.bits |= ASTNode.UndocumentedEmptyBlock;
02558:                    }
02559:                    this .astPtr--;
02560:                    this .astLengthPtr--;
02561:
02562:                    QualifiedAllocationExpression allocationExpression = anonymousTypeDeclaration.allocation;
02563:                    if (allocationExpression != null) {
02564:                        allocationExpression.sourceEnd = this .endStatementPosition;
02565:                        // handle type arguments
02566:                        length = this .genericsLengthStack[this .genericsLengthPtr--];
02567:                        this .genericsPtr -= length;
02568:                        System
02569:                                .arraycopy(
02570:                                        this .genericsStack,
02571:                                        this .genericsPtr + 1,
02572:                                        allocationExpression.typeArguments = new TypeReference[length],
02573:                                        0, length);
02574:                        allocationExpression.sourceStart = intStack[intPtr--];
02575:                    }
02576:                }
02577:
02578:                this .expressionLengthPtr--;
02579:                QualifiedAllocationExpression qae = (QualifiedAllocationExpression) this .expressionStack[this .expressionPtr--];
02580:                qae.enclosingInstance = this .expressionStack[this .expressionPtr];
02581:                this .expressionStack[this .expressionPtr] = qae;
02582:                qae.sourceStart = qae.enclosingInstance.sourceStart;
02583:            }
02584:
02585:            protected void consumeClassInstanceCreationExpressionWithTypeArguments() {
02586:                // ClassInstanceCreationExpression ::= 'new' TypeArguments ClassType '(' ArgumentListopt ')' ClassBodyopt
02587:                AllocationExpression alloc;
02588:                int length;
02589:                if (((length = this .astLengthStack[this .astLengthPtr--]) == 1)
02590:                        && (this .astStack[this .astPtr] == null)) {
02591:                    //NO ClassBody
02592:                    this .astPtr--;
02593:                    alloc = new AllocationExpression();
02594:                    alloc.sourceEnd = this .endPosition; //the position has been stored explicitly
02595:
02596:                    if ((length = this .expressionLengthStack[this .expressionLengthPtr--]) != 0) {
02597:                        this .expressionPtr -= length;
02598:                        System.arraycopy(this .expressionStack,
02599:                                this .expressionPtr + 1,
02600:                                alloc.arguments = new Expression[length], 0,
02601:                                length);
02602:                    }
02603:                    alloc.type = getTypeReference(0);
02604:
02605:                    length = this .genericsLengthStack[this .genericsLengthPtr--];
02606:                    this .genericsPtr -= length;
02607:                    System.arraycopy(this .genericsStack, this .genericsPtr + 1,
02608:                            alloc.typeArguments = new TypeReference[length], 0,
02609:                            length);
02610:                    intPtr--;
02611:
02612:                    //the default constructor with the correct number of argument
02613:                    //will be created and added by the TC (see createsInternalConstructorWithBinding)
02614:                    alloc.sourceStart = this .intStack[this .intPtr--];
02615:                    pushOnExpressionStack(alloc);
02616:                } else {
02617:                    dispatchDeclarationInto(length);
02618:                    TypeDeclaration anonymousTypeDeclaration = (TypeDeclaration) this .astStack[this .astPtr];
02619:                    anonymousTypeDeclaration.declarationSourceEnd = this .endStatementPosition;
02620:                    anonymousTypeDeclaration.bodyEnd = this .endStatementPosition;
02621:                    if (length == 0
02622:                            && !containsComment(
02623:                                    anonymousTypeDeclaration.bodyStart,
02624:                                    anonymousTypeDeclaration.bodyEnd)) {
02625:                        anonymousTypeDeclaration.bits |= ASTNode.UndocumentedEmptyBlock;
02626:                    }
02627:                    this .astPtr--;
02628:                    this .astLengthPtr--;
02629:
02630:                    QualifiedAllocationExpression allocationExpression = anonymousTypeDeclaration.allocation;
02631:                    if (allocationExpression != null) {
02632:                        allocationExpression.sourceEnd = this .endStatementPosition;
02633:                        // handle type arguments
02634:                        length = this .genericsLengthStack[this .genericsLengthPtr--];
02635:                        this .genericsPtr -= length;
02636:                        System
02637:                                .arraycopy(
02638:                                        this .genericsStack,
02639:                                        this .genericsPtr + 1,
02640:                                        allocationExpression.typeArguments = new TypeReference[length],
02641:                                        0, length);
02642:                        allocationExpression.sourceStart = intStack[intPtr--];
02643:                    }
02644:                }
02645:            }
02646:
02647:            protected void consumeClassOrInterface() {
02648:                this .genericsIdentifiersLengthStack[this .genericsIdentifiersLengthPtr] += this .identifierLengthStack[this .identifierLengthPtr];
02649:                pushOnGenericsLengthStack(0); // handle type arguments
02650:            }
02651:
02652:            protected void consumeClassOrInterfaceName() {
02653:                pushOnGenericsIdentifiersLengthStack(this .identifierLengthStack[this .identifierLengthPtr]);
02654:                pushOnGenericsLengthStack(0); // handle type arguments
02655:            }
02656:
02657:            protected void consumeClassTypeElt() {
02658:                // ClassTypeElt ::= ClassType
02659:                pushOnAstStack(getTypeReference(0));
02660:                /* if incomplete thrown exception list, this.listLength counter will not have been reset,
02661:                	indicating that some items are available on the stack */
02662:                this .listLength++;
02663:            }
02664:
02665:            protected void consumeClassTypeList() {
02666:                // ClassTypeList ::= ClassTypeList ',' ClassTypeElt
02667:                optimizedConcatNodeLists();
02668:            }
02669:
02670:            protected void consumeCompilationUnit() {
02671:                // CompilationUnit ::= EnterCompilationUnit InternalCompilationUnit
02672:                // do nothing by default
02673:            }
02674:
02675:            protected void consumeConditionalExpression(int op) {
02676:                // ConditionalExpression ::= ConditionalOrExpression '?' Expression ':' ConditionalExpression
02677:                //optimize the push/pop
02678:                this .intPtr -= 2;//consume position of the question mark
02679:                this .expressionPtr -= 2;
02680:                this .expressionLengthPtr -= 2;
02681:                this .expressionStack[this .expressionPtr] = new ConditionalExpression(
02682:                        this .expressionStack[this .expressionPtr],
02683:                        this .expressionStack[this .expressionPtr + 1],
02684:                        this .expressionStack[this .expressionPtr + 2]);
02685:            }
02686:
02687:            /**
02688:             * @param op
02689:             */
02690:            protected void consumeConditionalExpressionWithName(int op) {
02691:                // ConditionalExpression ::= Name '?' Expression ':' ConditionalExpression
02692:                this .intPtr -= 2;//consume position of the question mark
02693:                pushOnExpressionStack(getUnspecifiedReferenceOptimized());
02694:                this .expressionPtr -= 2;
02695:                this .expressionLengthPtr -= 2;
02696:                this .expressionStack[this .expressionPtr] = new ConditionalExpression(
02697:                        this .expressionStack[this .expressionPtr + 2],
02698:                        this .expressionStack[this .expressionPtr],
02699:                        this .expressionStack[this .expressionPtr + 1]);
02700:            }
02701:
02702:            protected void consumeConstructorBlockStatements() {
02703:                // ConstructorBody ::= NestedMethod '{' ExplicitConstructorInvocation BlockStatements '}'
02704:                concatNodeLists(); // explictly add the first statement into the list of statements 
02705:            }
02706:
02707:            protected void consumeConstructorBody() {
02708:                // ConstructorBody ::= NestedMethod  '{' BlockStatementsopt '}'
02709:                // ConstructorBody ::= NestedMethod  '{' ExplicitConstructorInvocation '}'
02710:                this .nestedMethod[this .nestedType]--;
02711:            }
02712:
02713:            protected void consumeConstructorDeclaration() {
02714:                // ConstructorDeclaration ::= ConstructorHeader ConstructorBody
02715:
02716:                /*
02717:                this.astStack : MethodDeclaration statements
02718:                this.identifierStack : name
02719:                 ==>
02720:                this.astStack : MethodDeclaration
02721:                this.identifierStack :
02722:                 */
02723:
02724:                //must provide a default constructor call when needed
02725:                int length;
02726:
02727:                // pop the position of the {  (body of the method) pushed in block decl
02728:                this .intPtr--;
02729:                this .intPtr--;
02730:
02731:                //statements
02732:                this .realBlockPtr--;
02733:                ExplicitConstructorCall constructorCall = null;
02734:                Statement[] statements = null;
02735:                if ((length = this .astLengthStack[this .astLengthPtr--]) != 0) {
02736:                    this .astPtr -= length;
02737:                    if (this .astStack[this .astPtr + 1] instanceof  ExplicitConstructorCall) {
02738:                        //avoid a isSomeThing that would only be used here BUT what is faster between two alternatives ?
02739:                        System.arraycopy(this .astStack, this .astPtr + 2,
02740:                                statements = new Statement[length - 1], 0,
02741:                                length - 1);
02742:                        constructorCall = (ExplicitConstructorCall) this .astStack[this .astPtr + 1];
02743:                    } else { //need to add explicitly the super();
02744:                        System.arraycopy(this .astStack, this .astPtr + 1,
02745:                                statements = new Statement[length], 0, length);
02746:                        constructorCall = SuperReference
02747:                                .implicitSuperConstructorCall();
02748:                    }
02749:                } else {
02750:                    boolean insideFieldInitializer = false;
02751:                    if (this .diet) {
02752:                        for (int i = this .nestedType; i > 0; i--) {
02753:                            if (this .variablesCounter[i] > 0) {
02754:                                insideFieldInitializer = true;
02755:                                break;
02756:                            }
02757:                        }
02758:                    }
02759:
02760:                    if (!this .diet || insideFieldInitializer) {
02761:                        // add it only in non-diet mode, if diet_bodies, then constructor call will be added elsewhere.
02762:                        constructorCall = SuperReference
02763:                                .implicitSuperConstructorCall();
02764:                    }
02765:                }
02766:
02767:                // now we know that the top of stack is a constructorDeclaration
02768:                ConstructorDeclaration cd = (ConstructorDeclaration) this .astStack[this .astPtr];
02769:                cd.constructorCall = constructorCall;
02770:                cd.statements = statements;
02771:
02772:                //highlight of the implicit call on the method name
02773:                if (constructorCall != null
02774:                        && cd.constructorCall.sourceEnd == 0) {
02775:                    cd.constructorCall.sourceEnd = cd.sourceEnd;
02776:                    cd.constructorCall.sourceStart = cd.sourceStart;
02777:                }
02778:
02779:                if (!(this .diet && this .dietInt == 0)
02780:                        && statements == null
02781:                        && (constructorCall == null || constructorCall
02782:                                .isImplicitSuper())
02783:                        && !containsComment(cd.bodyStart, this .endPosition)) {
02784:                    cd.bits |= ASTNode.UndocumentedEmptyBlock;
02785:                }
02786:
02787:                //watch for } that could be given as a unicode ! ( u007D is '}' )
02788:                // store the this.endPosition (position just before the '}') in case there is
02789:                // a trailing comment behind the end of the method
02790:                cd.bodyEnd = this .endPosition;
02791:                cd.declarationSourceEnd = flushCommentsDefinedPriorTo(this .endStatementPosition);
02792:            }
02793:
02794:            protected void consumeConstructorHeader() {
02795:                // ConstructorHeader ::= ConstructorHeaderName MethodHeaderParameters MethodHeaderThrowsClauseopt
02796:
02797:                AbstractMethodDeclaration method = (AbstractMethodDeclaration) this .astStack[this .astPtr];
02798:
02799:                if (this .currentToken == TokenNameLBRACE) {
02800:                    method.bodyStart = this .scanner.currentPosition;
02801:                }
02802:                // recovery
02803:                if (this .currentElement != null) {
02804:                    if (this .currentToken == TokenNameSEMICOLON) { // for invalid constructors
02805:                        method.modifiers |= ExtraCompilerModifiers.AccSemicolonBody;
02806:                        method.declarationSourceEnd = this .scanner.currentPosition - 1;
02807:                        method.bodyEnd = this .scanner.currentPosition - 1;
02808:                        if (this .currentElement.parseTree() == method
02809:                                && this .currentElement.parent != null) {
02810:                            this .currentElement = this .currentElement.parent;
02811:                        }
02812:                    }
02813:                    this .restartRecovery = true; // used to avoid branching back into the regular automaton
02814:                }
02815:            }
02816:
02817:            protected void consumeConstructorHeaderName() {
02818:
02819:                /* recovering - might be an empty message send */
02820:                if (this .currentElement != null) {
02821:                    if (this .lastIgnoredToken == TokenNamenew) { // was an allocation expression
02822:                        this .lastCheckPoint = this .scanner.startPosition; // force to restart at this exact position				
02823:                        this .restartRecovery = true;
02824:                        return;
02825:                    }
02826:                }
02827:
02828:                // ConstructorHeaderName ::=  Modifiersopt 'Identifier' '('
02829:                ConstructorDeclaration cd = new ConstructorDeclaration(
02830:                        this .compilationUnit.compilationResult);
02831:
02832:                //name -- this is not really revelant but we do .....
02833:                cd.selector = this .identifierStack[this .identifierPtr];
02834:                long selectorSource = this .identifierPositionStack[this .identifierPtr--];
02835:                this .identifierLengthPtr--;
02836:
02837:                //modifiers
02838:                cd.declarationSourceStart = this .intStack[this .intPtr--];
02839:                cd.modifiers = this .intStack[this .intPtr--];
02840:                // consume annotations
02841:                int length;
02842:                if ((length = this .expressionLengthStack[this .expressionLengthPtr--]) != 0) {
02843:                    System.arraycopy(this .expressionStack,
02844:                            (this .expressionPtr -= length) + 1,
02845:                            cd.annotations = new Annotation[length], 0, length);
02846:                }
02847:                // javadoc
02848:                cd.javadoc = this .javadoc;
02849:                this .javadoc = null;
02850:
02851:                //highlight starts at the selector starts
02852:                cd.sourceStart = (int) (selectorSource >>> 32);
02853:                pushOnAstStack(cd);
02854:                cd.sourceEnd = this .lParenPos;
02855:                cd.bodyStart = this .lParenPos + 1;
02856:                this .listLength = 0; // initialize this.listLength before reading parameters/throws
02857:
02858:                // recovery
02859:                if (this .currentElement != null) {
02860:                    this .lastCheckPoint = cd.bodyStart;
02861:                    if ((this .currentElement instanceof  RecoveredType && this .lastIgnoredToken != TokenNameDOT)
02862:                            || cd.modifiers != 0) {
02863:                        this .currentElement = this .currentElement.add(cd, 0);
02864:                        this .lastIgnoredToken = -1;
02865:                    }
02866:                }
02867:            }
02868:
02869:            protected void consumeConstructorHeaderNameWithTypeParameters() {
02870:
02871:                /* recovering - might be an empty message send */
02872:                if (this .currentElement != null) {
02873:                    if (this .lastIgnoredToken == TokenNamenew) { // was an allocation expression
02874:                        this .lastCheckPoint = this .scanner.startPosition; // force to restart at this exact position				
02875:                        this .restartRecovery = true;
02876:                        return;
02877:                    }
02878:                }
02879:
02880:                // ConstructorHeaderName ::=  Modifiersopt TypeParameters 'Identifier' '('
02881:                ConstructorDeclaration cd = new ConstructorDeclaration(
02882:                        this .compilationUnit.compilationResult);
02883:
02884:                //name -- this is not really revelant but we do .....
02885:                cd.selector = this .identifierStack[this .identifierPtr];
02886:                long selectorSource = this .identifierPositionStack[this .identifierPtr--];
02887:                this .identifierLengthPtr--;
02888:
02889:                // consume type parameters
02890:                int length = this .genericsLengthStack[this .genericsLengthPtr--];
02891:                this .genericsPtr -= length;
02892:                System.arraycopy(this .genericsStack, this .genericsPtr + 1,
02893:                        cd.typeParameters = new TypeParameter[length], 0,
02894:                        length);
02895:
02896:                //modifiers
02897:                cd.declarationSourceStart = this .intStack[this .intPtr--];
02898:                cd.modifiers = this .intStack[this .intPtr--];
02899:                // consume annotations
02900:                if ((length = this .expressionLengthStack[this .expressionLengthPtr--]) != 0) {
02901:                    System.arraycopy(this .expressionStack,
02902:                            (this .expressionPtr -= length) + 1,
02903:                            cd.annotations = new Annotation[length], 0, length);
02904:                }
02905:                // javadoc
02906:                cd.javadoc = this .javadoc;
02907:                this .javadoc = null;
02908:
02909:                //highlight starts at the selector starts
02910:                cd.sourceStart = (int) (selectorSource >>> 32);
02911:                pushOnAstStack(cd);
02912:                cd.sourceEnd = this .lParenPos;
02913:                cd.bodyStart = this .lParenPos + 1;
02914:                this .listLength = 0; // initialize this.listLength before reading parameters/throws
02915:
02916:                // recovery
02917:                if (this .currentElement != null) {
02918:                    this .lastCheckPoint = cd.bodyStart;
02919:                    if ((this .currentElement instanceof  RecoveredType && this .lastIgnoredToken != TokenNameDOT)
02920:                            || cd.modifiers != 0) {
02921:                        this .currentElement = this .currentElement.add(cd, 0);
02922:                        this .lastIgnoredToken = -1;
02923:                    }
02924:                }
02925:            }
02926:
02927:            protected void consumeDefaultLabel() {
02928:                // SwitchLabel ::= 'default' ':'
02929:                pushOnAstStack(new CaseStatement(null,
02930:                        this .intStack[this .intPtr--],
02931:                        this .intStack[this .intPtr--]));
02932:            }
02933:
02934:            protected void consumeCreateInitializer() {
02935:                pushOnAstStack(new Initializer(null, 0));
02936:            }
02937:
02938:            protected void consumeDefaultModifiers() {
02939:                checkComment(); // might update modifiers with AccDeprecated
02940:                pushOnIntStack(this .modifiers); // modifiers
02941:                pushOnIntStack(this .modifiersSourceStart >= 0 ? this .modifiersSourceStart
02942:                        : this .scanner.startPosition);
02943:                resetModifiers();
02944:                pushOnExpressionStackLengthStack(0); // no annotation
02945:            }
02946:
02947:            protected void consumeDiet() {
02948:                // Diet ::= $empty
02949:                checkComment();
02950:                pushOnIntStack(this .modifiersSourceStart); // push the start position of a javadoc comment if there is one
02951:                resetModifiers();
02952:                jumpOverMethodBody();
02953:            }
02954:
02955:            protected void consumeDims() {
02956:                // Dims ::= DimsLoop
02957:                pushOnIntStack(this .dimensions);
02958:                this .dimensions = 0;
02959:            }
02960:
02961:            protected void consumeDimWithOrWithOutExpr() {
02962:                // DimWithOrWithOutExpr ::= '[' ']'
02963:                pushOnExpressionStack(null);
02964:
02965:                if (this .currentElement != null
02966:                        && this .currentToken == TokenNameLBRACE) {
02967:                    this .ignoreNextOpeningBrace = true;
02968:                    this .currentElement.bracketBalance++;
02969:                }
02970:            }
02971:
02972:            protected void consumeDimWithOrWithOutExprs() {
02973:                // DimWithOrWithOutExprs ::= DimWithOrWithOutExprs DimWithOrWithOutExpr
02974:                concatExpressionLists();
02975:            }
02976:
02977:            protected void consumeEmptyAnnotationTypeMemberDeclarationsopt() {
02978:                // AnnotationTypeMemberDeclarationsopt ::= $empty
02979:                pushOnAstLengthStack(0);
02980:            }
02981:
02982:            protected void consumeEmptyArgumentListopt() {
02983:                // ArgumentListopt ::= $empty
02984:                pushOnExpressionStackLengthStack(0);
02985:            }
02986:
02987:            protected void consumeEmptyArguments() {
02988:                // Argumentsopt ::= $empty
02989:                final FieldDeclaration fieldDeclaration = (FieldDeclaration) this .astStack[this .astPtr];
02990:                pushOnIntStack(fieldDeclaration.sourceEnd);
02991:                pushOnExpressionStackLengthStack(0);
02992:            }
02993:
02994:            protected void consumeEmptyArrayInitializer() {
02995:                // ArrayInitializer ::= '{' ,opt '}'
02996:                arrayInitializer(0);
02997:            }
02998:
02999:            protected void consumeEmptyArrayInitializeropt() {
03000:                // ArrayInitializeropt ::= $empty
03001:                pushOnExpressionStackLengthStack(0);
03002:            }
03003:
03004:            protected void consumeEmptyBlockStatementsopt() {
03005:                // BlockStatementsopt ::= $empty
03006:                pushOnAstLengthStack(0);
03007:            }
03008:
03009:            protected void consumeEmptyCatchesopt() {
03010:                // Catchesopt ::= $empty
03011:                pushOnAstLengthStack(0);
03012:            }
03013:
03014:            protected void consumeEmptyClassBodyDeclarationsopt() {
03015:                // ClassBodyDeclarationsopt ::= $empty
03016:                pushOnAstLengthStack(0);
03017:            }
03018:
03019:            protected void consumeEmptyMethodHeaderDefaultValue() {
03020:                // DefaultValueopt ::= $empty
03021:                AbstractMethodDeclaration method = (AbstractMethodDeclaration) this .astStack[this .astPtr];
03022:                if (method.isAnnotationMethod()) { //'method' can be a MethodDeclaration when recovery is started
03023:                    pushOnExpressionStackLengthStack(0);
03024:                }
03025:                this .recordStringLiterals = true;
03026:            }
03027:
03028:            protected void consumeEmptyDimsopt() {
03029:                // Dimsopt ::= $empty
03030:                pushOnIntStack(0);
03031:            }
03032:
03033:            protected void consumeEmptyEnumDeclarations() {
03034:                // EnumBodyDeclarationsopt ::= $empty
03035:                pushOnAstLengthStack(0);
03036:            }
03037:
03038:            protected void consumeEmptyExpression() {
03039:                // Expressionopt ::= $empty
03040:                pushOnExpressionStackLengthStack(0);
03041:            }
03042:
03043:            protected void consumeEmptyForInitopt() {
03044:                // ForInitopt ::= $empty
03045:                pushOnAstLengthStack(0);
03046:            }
03047:
03048:            protected void consumeEmptyForUpdateopt() {
03049:                // ForUpdateopt ::= $empty
03050:                pushOnExpressionStackLengthStack(0);
03051:            }
03052:
03053:            protected void consumeEmptyInterfaceMemberDeclarationsopt() {
03054:                // InterfaceMemberDeclarationsopt ::= $empty
03055:                pushOnAstLengthStack(0);
03056:            }
03057:
03058:            protected void consumeEmptyInternalCompilationUnit() {
03059:                // InternalCompilationUnit ::= $empty
03060:                // nothing to do by default
03061:                if (this .compilationUnit.isPackageInfo()) {
03062:                    this .compilationUnit.types = new TypeDeclaration[1];
03063:                    // create a fake interface declaration
03064:                    TypeDeclaration declaration = new TypeDeclaration(
03065:                            compilationUnit.compilationResult);
03066:                    declaration.name = TypeConstants.PACKAGE_INFO_NAME;
03067:                    declaration.modifiers = ClassFileConstants.AccDefault
03068:                            | ClassFileConstants.AccInterface;
03069:                    this .compilationUnit.types[0] = declaration;
03070:                    declaration.javadoc = this .compilationUnit.javadoc;
03071:                }
03072:            }
03073:
03074:            protected void consumeEmptyMemberValuePairsopt() {
03075:                // MemberValuePairsopt ::= $empty
03076:                pushOnAstLengthStack(0);
03077:            }
03078:
03079:            protected void consumeEmptyMemberValueArrayInitializer() {
03080:                // MemberValueArrayInitializer ::= '{' ',' '}'
03081:                // MemberValueArrayInitializer ::= '{' '}'
03082:                arrayInitializer(0);
03083:            }
03084:
03085:            protected void consumeEmptyStatement() {
03086:                // EmptyStatement ::= ';'
03087:                char[] source = this .scanner.source;
03088:                if (source[this .endStatementPosition] == ';') {
03089:                    pushOnAstStack(new EmptyStatement(
03090:                            this .endStatementPosition,
03091:                            this .endStatementPosition));
03092:                } else {
03093:                    if (source.length > 5) {
03094:                        int c1 = 0, c2 = 0, c3 = 0, c4 = 0;
03095:                        int pos = this .endStatementPosition - 4;
03096:                        while (source[pos] == 'u') {
03097:                            pos--;
03098:                        }
03099:                        if (source[pos] == '\\'
03100:                                && !((c1 = ScannerHelper
03101:                                        .getNumericValue(source[this .endStatementPosition - 3])) > 15
03102:                                        || c1 < 0
03103:                                        || (c2 = ScannerHelper
03104:                                                .getNumericValue(source[this .endStatementPosition - 2])) > 15
03105:                                        || c2 < 0
03106:                                        || (c3 = ScannerHelper
03107:                                                .getNumericValue(source[this .endStatementPosition - 1])) > 15
03108:                                        || c3 < 0
03109:                                        || (c4 = ScannerHelper
03110:                                                .getNumericValue(source[this .endStatementPosition])) > 15 || c4 < 0)
03111:                                && ((char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4)) == ';') {
03112:                            // we have a Unicode for the ';' (/u003B)
03113:                            pushOnAstStack(new EmptyStatement(pos,
03114:                                    this .endStatementPosition));
03115:                            return;
03116:                        }
03117:                    }
03118:                    pushOnAstStack(new EmptyStatement(
03119:                            this .endStatementPosition,
03120:                            this .endStatementPosition));
03121:                }
03122:            }
03123:
03124:            protected void consumeEmptySwitchBlock() {
03125:                // SwitchBlock ::= '{' '}'
03126:                pushOnAstLengthStack(0);
03127:            }
03128:
03129:            protected void consumeEmptyTypeDeclaration() {
03130:                // ClassMemberDeclaration ::= ';'
03131:                // InterfaceMemberDeclaration ::= ';'
03132:                // TypeDeclaration ::= ';' 
03133:                pushOnAstLengthStack(0);
03134:                if (!this .statementRecoveryActivated)
03135:                    problemReporter().super fluousSemicolon(
03136:                            this .endPosition + 1, this .endStatementPosition);
03137:                flushCommentsDefinedPriorTo(this .endStatementPosition);
03138:            }
03139:
03140:            protected void consumeEnhancedForStatementHeaderInit(
03141:                    boolean hasModifiers) {
03142:                TypeReference type;
03143:
03144:                char[] identifierName = this .identifierStack[this .identifierPtr];
03145:                long namePosition = this .identifierPositionStack[this .identifierPtr];
03146:
03147:                LocalDeclaration localDeclaration = createLocalDeclaration(
03148:                        identifierName, (int) (namePosition >>> 32),
03149:                        (int) namePosition);
03150:                localDeclaration.declarationSourceEnd = localDeclaration.declarationEnd;
03151:
03152:                int extraDims = this .intStack[this .intPtr--];
03153:                this .identifierPtr--;
03154:                this .identifierLengthPtr--;
03155:                // remove fake modifiers/modifiers start
03156:                int declarationSourceStart = 0;
03157:                int modifiersValue = 0;
03158:                if (hasModifiers) {
03159:                    declarationSourceStart = this .intStack[this .intPtr--];
03160:                    modifiersValue = this .intStack[this .intPtr--];
03161:                } else {
03162:                    this .intPtr -= 2;
03163:                }
03164:
03165:                type = getTypeReference(this .intStack[this .intPtr--]
03166:                        + extraDims); // type dimension
03167:
03168:                // consume annotations
03169:                int length;
03170:                if ((length = this .expressionLengthStack[this .expressionLengthPtr--]) != 0) {
03171:                    System
03172:                            .arraycopy(
03173:                                    this .expressionStack,
03174:                                    (this .expressionPtr -= length) + 1,
03175:                                    localDeclaration.annotations = new Annotation[length],
03176:                                    0, length);
03177:                }
03178:                if (hasModifiers) {
03179:                    localDeclaration.declarationSourceStart = declarationSourceStart;
03180:                    localDeclaration.modifiers = modifiersValue;
03181:                } else {
03182:                    localDeclaration.declarationSourceStart = type.sourceStart;
03183:                }
03184:                localDeclaration.type = type;
03185:
03186:                ForeachStatement iteratorForStatement = new ForeachStatement(
03187:                        localDeclaration, this .intStack[this .intPtr--]);
03188:                pushOnAstStack(iteratorForStatement);
03189:
03190:                iteratorForStatement.sourceEnd = localDeclaration.declarationSourceEnd;
03191:            }
03192:
03193:            protected void consumeEnhancedForStatementHeader() {
03194:                // EnhancedForStatementHeader ::= EnhancedForStatementHeaderInit ':' Expression ')'
03195:                final ForeachStatement statement = (ForeachStatement) this .astStack[this .astPtr];
03196:                //updates are on the expression stack
03197:                this .expressionLengthPtr--;
03198:                final Expression collection = this .expressionStack[this .expressionPtr--];
03199:                statement.collection = collection;
03200:                statement.sourceEnd = this .rParenPos;
03201:
03202:                if (!this .statementRecoveryActivated
03203:                        && options.sourceLevel < ClassFileConstants.JDK1_5
03204:                        && this .lastErrorEndPositionBeforeRecovery < this .scanner.currentPosition) {
03205:                    this .problemReporter().invalidUsageOfForeachStatements(
03206:                            statement.elementVariable, collection);
03207:                }
03208:            }
03209:
03210:            protected void consumeEnhancedForStatement() {
03211:                // EnhancedForStatement ::= EnhancedForStatementHeader Statement
03212:                // EnhancedForStatementNoShortIf ::= EnhancedForStatementHeader StatementNoShortIf
03213:
03214:                //statements
03215:                this .astLengthPtr--;
03216:                Statement statement = (Statement) this .astStack[this .astPtr--];
03217:
03218:                // foreach statement is on the ast stack
03219:                ForeachStatement foreachStatement = (ForeachStatement) this .astStack[this .astPtr];
03220:                foreachStatement.action = statement;
03221:                // remember useful empty statement
03222:                if (statement instanceof  EmptyStatement)
03223:                    statement.bits |= ASTNode.IsUsefulEmptyStatement;
03224:
03225:                foreachStatement.sourceEnd = this .endStatementPosition;
03226:            }
03227:
03228:            protected void consumeEnterAnonymousClassBody() {
03229:                // EnterAnonymousClassBody ::= $empty
03230:                TypeReference typeReference = getTypeReference(0);
03231:
03232:                TypeDeclaration anonymousType = new TypeDeclaration(
03233:                        this .compilationUnit.compilationResult);
03234:                anonymousType.name = CharOperation.NO_CHAR;
03235:                anonymousType.bits |= (ASTNode.IsAnonymousType | ASTNode.IsLocalType);
03236:                QualifiedAllocationExpression alloc = new QualifiedAllocationExpression(
03237:                        anonymousType);
03238:                markEnclosingMemberWithLocalType();
03239:                pushOnAstStack(anonymousType);
03240:
03241:                alloc.sourceEnd = this .rParenPos; //the position has been stored explicitly
03242:                int argumentLength;
03243:                if ((argumentLength = this .expressionLengthStack[this .expressionLengthPtr--]) != 0) {
03244:                    this .expressionPtr -= argumentLength;
03245:                    System.arraycopy(this .expressionStack,
03246:                            this .expressionPtr + 1,
03247:                            alloc.arguments = new Expression[argumentLength],
03248:                            0, argumentLength);
03249:                }
03250:                alloc.type = typeReference;
03251:
03252:                anonymousType.sourceEnd = alloc.sourceEnd;
03253:                //position at the type while it impacts the anonymous declaration
03254:                anonymousType.sourceStart = anonymousType.declarationSourceStart = alloc.type.sourceStart;
03255:                alloc.sourceStart = this .intStack[this .intPtr--];
03256:                pushOnExpressionStack(alloc);
03257:
03258:                anonymousType.bodyStart = this .scanner.currentPosition;
03259:                this .listLength = 0; // will be updated when reading super-interfaces
03260:
03261:                // flush the comments related to the anonymous
03262:                this .scanner.commentPtr = -1;
03263:
03264:                // recovery
03265:                if (this .currentElement != null) {
03266:                    this .lastCheckPoint = anonymousType.bodyStart;
03267:                    this .currentElement = this .currentElement.add(
03268:                            anonymousType, 0);
03269:                    this .currentToken = 0; // opening brace already taken into account
03270:                    this .lastIgnoredToken = -1;
03271:                }
03272:            }
03273:
03274:            protected void consumeEnterCompilationUnit() {
03275:                // EnterCompilationUnit ::= $empty
03276:                // do nothing by default
03277:            }
03278:
03279:            protected void consumeEnterMemberValue() {
03280:                // EnterMemberValue ::= $empty
03281:                // do nothing by default
03282:            }
03283:
03284:            protected void consumeEnterMemberValueArrayInitializer() {
03285:                // EnterMemberValueArrayInitializer ::= $empty
03286:                if (this .currentElement != null) {
03287:                    this .ignoreNextOpeningBrace = true;
03288:                    this .currentElement.bracketBalance++;
03289:                }
03290:            }
03291:
03292:            protected void consumeEnterVariable() {
03293:                // EnterVariable ::= $empty
03294:                // do nothing by default
03295:
03296:                char[] identifierName = this .identifierStack[this .identifierPtr];
03297:                long namePosition = this .identifierPositionStack[this .identifierPtr];
03298:                int extendedDimension = this .intStack[this .intPtr--];
03299:                AbstractVariableDeclaration declaration;
03300:                // create the ast node
03301:                boolean isLocalDeclaration = this .nestedMethod[this .nestedType] != 0;
03302:                if (isLocalDeclaration) {
03303:                    // create the local variable declarations
03304:                    declaration = this .createLocalDeclaration(identifierName,
03305:                            (int) (namePosition >>> 32), (int) namePosition);
03306:                } else {
03307:                    // create the field declaration
03308:                    declaration = this .createFieldDeclaration(identifierName,
03309:                            (int) (namePosition >>> 32), (int) namePosition);
03310:                }
03311:
03312:                this .identifierPtr--;
03313:                this .identifierLengthPtr--;
03314:                TypeReference type;
03315:                int variableIndex = this .variablesCounter[this .nestedType];
03316:                int typeDim = 0;
03317:                if (variableIndex == 0) {
03318:                    // first variable of the declaration (FieldDeclaration or LocalDeclaration)
03319:                    if (isLocalDeclaration) {
03320:                        declaration.declarationSourceStart = this .intStack[this .intPtr--];
03321:                        declaration.modifiers = this .intStack[this .intPtr--];
03322:                        // consume annotations
03323:                        int length;
03324:                        if ((length = this .expressionLengthStack[this .expressionLengthPtr--]) != 0) {
03325:                            System
03326:                                    .arraycopy(
03327:                                            this .expressionStack,
03328:                                            (this .expressionPtr -= length) + 1,
03329:                                            declaration.annotations = new Annotation[length],
03330:                                            0, length);
03331:                        }
03332:                        type = getTypeReference(typeDim = this .intStack[this .intPtr--]); // type dimension
03333:                        if (declaration.declarationSourceStart == -1) {
03334:                            // this is true if there is no modifiers for the local variable declaration
03335:                            declaration.declarationSourceStart = type.sourceStart;
03336:                        }
03337:                        pushOnAstStack(type);
03338:                    } else {
03339:                        type = getTypeReference(typeDim = this .intStack[this .intPtr--]); // type dimension
03340:                        pushOnAstStack(type);
03341:                        declaration.declarationSourceStart = this .intStack[this .intPtr--];
03342:                        declaration.modifiers = this .intStack[this .intPtr--];
03343:                        // consume annotations
03344:                        int length;
03345:                        if ((length = this .expressionLengthStack[this .expressionLengthPtr--]) != 0) {
03346:                            System
03347:                                    .arraycopy(
03348:                                            this .expressionStack,
03349:                                            (this .expressionPtr -= length) + 1,
03350:                                            declaration.annotations = new Annotation[length],
03351:                                            0, length);
03352:                        }
03353:                        // Store javadoc only on first declaration as it is the same for all ones
03354:                        FieldDeclaration fieldDeclaration = (FieldDeclaration) declaration;
03355:                        fieldDeclaration.javadoc = this .javadoc;
03356:                        this .javadoc = null;
03357:                    }
03358:                } else {
03359:                    type = (TypeReference) this .astStack[this .astPtr
03360:                            - variableIndex];
03361:                    typeDim = type.dimensions();
03362:                    AbstractVariableDeclaration previousVariable = (AbstractVariableDeclaration) this .astStack[this .astPtr];
03363:                    declaration.declarationSourceStart = previousVariable.declarationSourceStart;
03364:                    declaration.modifiers = previousVariable.modifiers;
03365:                    final Annotation[] annotations = previousVariable.annotations;
03366:                    if (annotations != null) {
03367:                        final int annotationsLength = annotations.length;
03368:                        System
03369:                                .arraycopy(
03370:                                        annotations,
03371:                                        0,
03372:                                        declaration.annotations = new Annotation[annotationsLength],
03373:                                        0, annotationsLength);
03374:                    }
03375:                }
03376:
03377:                if (extendedDimension == 0) {
03378:                    declaration.type = type;
03379:                } else {
03380:                    int dimension = typeDim + extendedDimension;
03381:                    declaration.type = this .copyDims(type, dimension);
03382:                }
03383:                this .variablesCounter[this .nestedType]++;
03384:                pushOnAstStack(declaration);
03385:                // recovery
03386:                if (this .currentElement != null) {
03387:                    if (!(this .currentElement instanceof  RecoveredType)
03388:                            && (this .currentToken == TokenNameDOT
03389:                            //|| declaration.modifiers != 0
03390:                            || (Util.getLineNumber(
03391:                                    declaration.type.sourceStart,
03392:                                    this .scanner.lineEnds, 0,
03393:                                    this .scanner.linePtr) != Util
03394:                                    .getLineNumber((int) (namePosition >>> 32),
03395:                                            this .scanner.lineEnds, 0,
03396:                                            this .scanner.linePtr)))) {
03397:                        this .lastCheckPoint = (int) (namePosition >>> 32);
03398:                        this .restartRecovery = true;
03399:                        return;
03400:                    }
03401:                    if (isLocalDeclaration) {
03402:                        LocalDeclaration localDecl = (LocalDeclaration) this .astStack[this .astPtr];
03403:                        this .lastCheckPoint = localDecl.sourceEnd + 1;
03404:                        this .currentElement = this .currentElement.add(
03405:                                localDecl, 0);
03406:                    } else {
03407:                        FieldDeclaration fieldDecl = (FieldDeclaration) this .astStack[this .astPtr];
03408:                        this .lastCheckPoint = fieldDecl.sourceEnd + 1;
03409:                        this .currentElement = this .currentElement.add(
03410:                                fieldDecl, 0);
03411:                    }
03412:                    this .lastIgnoredToken = -1;
03413:                }
03414:            }
03415:
03416:            protected void consumeEnumBodyNoConstants() {
03417:                // nothing to do
03418:                // The 0 on the astLengthStack has been pushed by EnumBodyDeclarationsopt
03419:            }
03420:
03421:            protected void consumeEnumBodyWithConstants() {
03422:                // merge the constants values with the class body
03423:                concatNodeLists();
03424:            }
03425:
03426:            protected void consumeEnumConstantHeaderName() {
03427:                if (this .currentElement != null) {
03428:                    if (!(this .currentElement instanceof  RecoveredType || (this .currentElement instanceof  RecoveredField && ((RecoveredField) currentElement).fieldDeclaration.type == null))
03429:                            || (this .lastIgnoredToken == TokenNameDOT)) {
03430:                        this .lastCheckPoint = this .scanner.startPosition;
03431:                        this .restartRecovery = true;
03432:                        return;
03433:                    }
03434:                }
03435:                long namePosition = this .identifierPositionStack[this .identifierPtr];
03436:                char[] constantName = this .identifierStack[this .identifierPtr];
03437:                final int sourceEnd = (int) namePosition;
03438:                FieldDeclaration enumConstant = createFieldDeclaration(
03439:                        constantName, (int) (namePosition >>> 32), sourceEnd);
03440:                this .identifierPtr--;
03441:                this .identifierLengthPtr--;
03442:                enumConstant.modifiersSourceStart = this .intStack[this .intPtr--];
03443:                enumConstant.modifiers = this .intStack[this .intPtr--];
03444:                enumConstant.declarationSourceStart = enumConstant.modifiersSourceStart;
03445:
03446:                // Store secondary info
03447:                if ((enumConstant.bits & ASTNode.IsMemberType) == 0
03448:                        && (enumConstant.bits & ASTNode.IsLocalType) == 0) {
03449:                    if (this .compilationUnit != null
03450:                            && !CharOperation.equals(enumConstant.name,
03451:                                    this .compilationUnit.getMainTypeName())) {
03452:                        enumConstant.bits |= ASTNode.IsSecondaryType;
03453:                    }
03454:                }
03455:
03456:                // consume annotations
03457:                int length;
03458:                if ((length = this .expressionLengthStack[this .expressionLengthPtr--]) != 0) {
03459:                    System.arraycopy(this .expressionStack,
03460:                            (this .expressionPtr -= length) + 1,
03461:                            enumConstant.annotations = new Annotation[length],
03462:                            0, length);
03463:                }
03464:                pushOnAstStack(enumConstant);
03465:                if (this .currentElement != null) {
03466:                    this .lastCheckPoint = enumConstant.sourceEnd + 1;
03467:                    this .currentElement = this .currentElement.add(enumConstant,
03468:                            0);
03469:                }
03470:                // javadoc
03471:                enumConstant.javadoc = this .javadoc;
03472:                this .javadoc = null;
03473:            }
03474:
03475:            protected void consumeEnumConstantHeader() {
03476:                FieldDeclaration enumConstant = (FieldDeclaration) this .astStack[this .astPtr];
03477:                boolean foundOpeningBrace = this .currentToken == TokenNameLBRACE;
03478:                if (foundOpeningBrace) {
03479:                    // qualified allocation expression
03480:                    TypeDeclaration anonymousType = new TypeDeclaration(
03481:                            this .compilationUnit.compilationResult);
03482:                    anonymousType.name = CharOperation.NO_CHAR;
03483:                    anonymousType.bits |= (ASTNode.IsAnonymousType | ASTNode.IsLocalType);
03484:                    final int start = this .scanner.startPosition;
03485:                    anonymousType.declarationSourceStart = start;
03486:                    anonymousType.sourceStart = start;
03487:                    anonymousType.sourceEnd = start; // closing parenthesis
03488:                    anonymousType.modifiers = 0;
03489:                    anonymousType.bodyStart = this .scanner.currentPosition;
03490:                    markEnclosingMemberWithLocalType();
03491:                    pushOnAstStack(anonymousType);
03492:                    QualifiedAllocationExpression allocationExpression = new QualifiedAllocationExpression(
03493:                            anonymousType);
03494:                    allocationExpression.enumConstant = enumConstant;
03495:
03496:                    // fill arguments if needed
03497:                    int length;
03498:                    if ((length = this .expressionLengthStack[this .expressionLengthPtr--]) != 0) {
03499:                        this .expressionPtr -= length;
03500:                        System
03501:                                .arraycopy(
03502:                                        this .expressionStack,
03503:                                        this .expressionPtr + 1,
03504:                                        allocationExpression.arguments = new Expression[length],
03505:                                        0, length);
03506:                    }
03507:                    enumConstant.initialization = allocationExpression;
03508:                } else {
03509:                    AllocationExpression allocationExpression = new AllocationExpression();
03510:                    allocationExpression.enumConstant = enumConstant;
03511:                    // fill arguments if needed
03512:                    int length;
03513:                    if ((length = this .expressionLengthStack[this .expressionLengthPtr--]) != 0) {
03514:                        this .expressionPtr -= length;
03515:                        System
03516:                                .arraycopy(
03517:                                        this .expressionStack,
03518:                                        this .expressionPtr + 1,
03519:                                        allocationExpression.arguments = new Expression[length],
03520:                                        0, length);
03521:                    }
03522:                    enumConstant.initialization = allocationExpression;
03523:                }
03524:
03525:                // recovery
03526:                if (this .currentElement != null) {
03527:                    if (foundOpeningBrace) {
03528:                        TypeDeclaration anonymousType = (TypeDeclaration) this .astStack[this .astPtr];
03529:                        this .currentElement = this .currentElement.add(
03530:                                anonymousType, 0);
03531:                        this .lastCheckPoint = anonymousType.bodyStart;
03532:                        this .lastIgnoredToken = -1;
03533:                        this .currentToken = 0; // opening brace already taken into account
03534:                    } else {
03535:                        if (this .currentToken == TokenNameSEMICOLON) {
03536:                            RecoveredType currentType = this 
03537:                                    .currentRecoveryType();
03538:                            if (currentType != null) {
03539:                                currentType.insideEnumConstantPart = false;
03540:                            }
03541:                        }
03542:                        this .lastCheckPoint = this .scanner.startPosition; // force to restart at this exact position
03543:                        this .lastIgnoredToken = -1;
03544:                        this .restartRecovery = true;
03545:                    }
03546:                }
03547:            }
03548:
03549:            protected void consumeEnumConstantNoClassBody() {
03550:                // set declarationEnd and declarationSourceEnd
03551:                int endOfEnumConstant = intStack[intPtr--];
03552:                final FieldDeclaration fieldDeclaration = (FieldDeclaration) this .astStack[this .astPtr];
03553:                fieldDeclaration.declarationEnd = endOfEnumConstant;
03554:                fieldDeclaration.declarationSourceEnd = endOfEnumConstant;
03555:            }
03556:
03557:            protected void consumeEnumConstants() {
03558:                concatNodeLists();
03559:            }
03560:
03561:            protected void consumeEnumConstantWithClassBody() {
03562:                dispatchDeclarationInto(this .astLengthStack[this .astLengthPtr--]);
03563:                TypeDeclaration anonymousType = (TypeDeclaration) this .astStack[this .astPtr--]; // pop type
03564:                this .astLengthPtr--;
03565:                anonymousType.bodyEnd = this .endPosition;
03566:                anonymousType.declarationSourceEnd = flushCommentsDefinedPriorTo(this .endStatementPosition);
03567:                final FieldDeclaration fieldDeclaration = ((FieldDeclaration) this .astStack[this .astPtr]);
03568:                fieldDeclaration.declarationEnd = this .endStatementPosition;
03569:                fieldDeclaration.declarationSourceEnd = anonymousType.declarationSourceEnd;
03570:                intPtr--; // remove end position of the arguments
03571:            }
03572:
03573:            protected void consumeEnumDeclaration() {
03574:                // EnumDeclaration ::= EnumHeader ClassHeaderImplementsopt EnumBody
03575:                int length;
03576:                if ((length = this .astLengthStack[this .astLengthPtr--]) != 0) {
03577:                    //there are length declarations
03578:                    //dispatch according to the type of the declarations
03579:                    dispatchDeclarationIntoEnumDeclaration(length);
03580:                }
03581:
03582:                TypeDeclaration enumDeclaration = (TypeDeclaration) this .astStack[this .astPtr];
03583:
03584:                //convert constructor that do not have the type's name into methods
03585:                boolean hasConstructor = enumDeclaration
03586:                        .checkConstructors(this );
03587:
03588:                //add the default constructor when needed
03589:                if (!hasConstructor) {
03590:                    boolean insideFieldInitializer = false;
03591:                    if (this .diet) {
03592:                        for (int i = this .nestedType; i > 0; i--) {
03593:                            if (this .variablesCounter[i] > 0) {
03594:                                insideFieldInitializer = true;
03595:                                break;
03596:                            }
03597:                        }
03598:                    }
03599:                    enumDeclaration.createDefaultConstructor(!this .diet
03600:                            || insideFieldInitializer, true);
03601:                }
03602:
03603:                //always add <clinit> (will be remove at code gen time if empty)
03604:                if (this .scanner.containsAssertKeyword) {
03605:                    enumDeclaration.bits |= ASTNode.ContainsAssertion;
03606:                }
03607:                enumDeclaration.addClinit();
03608:                enumDeclaration.bodyEnd = this .endStatementPosition;
03609:                if (length == 0
03610:                        && !containsComment(enumDeclaration.bodyStart,
03611:                                enumDeclaration.bodyEnd)) {
03612:                    enumDeclaration.bits |= ASTNode.UndocumentedEmptyBlock;
03613:                }
03614:
03615:                enumDeclaration.declarationSourceEnd = flushCommentsDefinedPriorTo(this .endStatementPosition);
03616:            }
03617:
03618:            protected void consumeEnumDeclarations() {
03619:                // Do nothing by default
03620:            }
03621:
03622:            protected void consumeEnumHeader() {
03623:                TypeDeclaration typeDecl = (TypeDeclaration) this .astStack[this .astPtr];
03624:                if (this .currentToken == TokenNameLBRACE) {
03625:                    typeDecl.bodyStart = this .scanner.currentPosition;
03626:                }
03627:
03628:                if (this .currentElement != null) {
03629:                    this .restartRecovery = true; // used to avoid branching back into the regular automaton		
03630:                }
03631:
03632:                // flush the comments related to the enum header
03633:                this .scanner.commentPtr = -1;
03634:            }
03635:
03636:            protected void consumeEnumHeaderName() {
03637:                // EnumHeaderName ::= Modifiersopt 'enum' Identifier
03638:                TypeDeclaration enumDeclaration = new TypeDeclaration(
03639:                        this .compilationUnit.compilationResult);
03640:                if (this .nestedMethod[this .nestedType] == 0) {
03641:                    if (this .nestedType != 0) {
03642:                        enumDeclaration.bits |= ASTNode.IsMemberType;
03643:                    }
03644:                } else {
03645:                    // Record that the block has a declaration for local types
03646:                    //		markEnclosingMemberWithLocalType();
03647:                    blockReal();
03648:                }
03649:                //highlight the name of the type
03650:                long pos = this .identifierPositionStack[this .identifierPtr];
03651:                enumDeclaration.sourceEnd = (int) pos;
03652:                enumDeclaration.sourceStart = (int) (pos >>> 32);
03653:                enumDeclaration.name = this .identifierStack[this .identifierPtr--];
03654:                this .identifierLengthPtr--;
03655:
03656:                //compute the declaration source too
03657:                // 'class' and 'interface' push two int positions: the beginning of the class token and its end.
03658:                // we want to keep the beginning position but get rid of the end position
03659:                // it is only used for the ClassLiteralAccess positions.
03660:                enumDeclaration.declarationSourceStart = this .intStack[this .intPtr--];
03661:                this .intPtr--; // remove the end position of the class token
03662:
03663:                enumDeclaration.modifiersSourceStart = this .intStack[this .intPtr--];
03664:                enumDeclaration.modifiers = this .intStack[this .intPtr--]
03665:                        | ClassFileConstants.AccEnum;
03666:                if (enumDeclaration.modifiersSourceStart >= 0) {
03667:                    enumDeclaration.declarationSourceStart = enumDeclaration.modifiersSourceStart;
03668:                }
03669:                // consume annotations
03670:                int length;
03671:                if ((length = this .expressionLengthStack[this .expressionLengthPtr--]) != 0) {
03672:                    System
03673:                            .arraycopy(
03674:                                    this .expressionStack,
03675:                                    (this .expressionPtr -= length) + 1,
03676:                                    enumDeclaration.annotations = new Annotation[length],
03677:                                    0, length);
03678:                }
03679:                //	if (this.currentToken == TokenNameLBRACE) { 
03680:                //		enumDeclaration.bodyStart = this.scanner.currentPosition;
03681:                //	}
03682:                enumDeclaration.bodyStart = enumDeclaration.sourceEnd + 1;
03683:                pushOnAstStack(enumDeclaration);
03684:
03685:                this .listLength = 0; // will be updated when reading super-interfaces
03686:
03687:                if (!this .statementRecoveryActivated
03688:                        && options.sourceLevel < ClassFileConstants.JDK1_5
03689:                        && this .lastErrorEndPositionBeforeRecovery < this .scanner.currentPosition) {
03690:                    //TODO this code will be never run while 'enum' is an identifier in 1.3 scanner 
03691:                    this .problemReporter().invalidUsageOfEnumDeclarations(
03692:                            enumDeclaration);
03693:                }
03694:
03695:                // recovery
03696:                if (this .currentElement != null) {
03697:                    this .lastCheckPoint = enumDeclaration.bodyStart;
03698:                    this .currentElement = this .currentElement.add(
03699:                            enumDeclaration, 0);
03700:                    this .lastIgnoredToken = -1;
03701:                }
03702:                // javadoc
03703:                enumDeclaration.javadoc = this .javadoc;
03704:                this .javadoc = null;
03705:            }
03706:
03707:            protected void consumeEnumHeaderNameWithTypeParameters() {
03708:                // EnumHeaderNameWithTypeParameters ::= Modifiersopt 'enum' Identifier TypeParameters
03709:                TypeDeclaration enumDeclaration = new TypeDeclaration(
03710:                        this .compilationUnit.compilationResult);
03711:                // consume type parameters
03712:                int length = this .genericsLengthStack[this .genericsLengthPtr--];
03713:                this .genericsPtr -= length;
03714:                System
03715:                        .arraycopy(
03716:                                this .genericsStack,
03717:                                this .genericsPtr + 1,
03718:                                enumDeclaration.typeParameters = new TypeParameter[length],
03719:                                0, length);
03720:
03721:                this .problemReporter()
03722:                        .invalidUsageOfTypeParametersForEnumDeclaration(
03723:                                enumDeclaration);
03724:
03725:                enumDeclaration.bodyStart = enumDeclaration.typeParameters[length - 1].declarationSourceEnd + 1;
03726:
03727:                //	enumDeclaration.typeParameters = null;
03728:
03729:                this .listTypeParameterLength = 0;
03730:
03731:                if (this .nestedMethod[this .nestedType] == 0) {
03732:                    if (this .nestedType != 0) {
03733:                        enumDeclaration.bits |= ASTNode.IsMemberType;
03734:                    }
03735:                } else {
03736:                    // Record that the block has a declaration for local types
03737:                    //		markEnclosingMemberWithLocalType();
03738:                    blockReal();
03739:                }
03740:                //highlight the name of the type
03741:                long pos = this .identifierPositionStack[this .identifierPtr];
03742:                enumDeclaration.sourceEnd = (int) pos;
03743:                enumDeclaration.sourceStart = (int) (pos >>> 32);
03744:                enumDeclaration.name = this .identifierStack[this .identifierPtr--];
03745:                this .identifierLengthPtr--;
03746:
03747:                //compute the declaration source too
03748:                // 'class' and 'interface' push two int positions: the beginning of the class token and its end.
03749:                // we want to keep the beginning position but get rid of the end position
03750:                // it is only used for the ClassLiteralAccess positions.
03751:                enumDeclaration.declarationSourceStart = this .intStack[this .intPtr--];
03752:                this .intPtr--; // remove the end position of the class token
03753:
03754:                enumDeclaration.modifiersSourceStart = this .intStack[this .intPtr--];
03755:                enumDeclaration.modifiers = this .intStack[this .intPtr--]
03756:                        | ClassFileConstants.AccEnum;
03757:                if (enumDeclaration.modifiersSourceStart >= 0) {
03758:                    enumDeclaration.declarationSourceStart = enumDeclaration.modifiersSourceStart;
03759:                }
03760:                // consume annotations
03761:                if ((length = this .expressionLengthStack[this .expressionLengthPtr--]) != 0) {
03762:                    System
03763:                            .arraycopy(
03764:                                    this .expressionStack,
03765:                                    (this .expressionPtr -= length) + 1,
03766:                                    enumDeclaration.annotations = new Annotation[length],
03767:                                    0, length);
03768:                }
03769:                //	if (this.currentToken == TokenNameLBRACE) { 
03770:                //		enumDeclaration.bodyStart = this.scanner.currentPosition;
03771:                //	}
03772:                enumDeclaration.bodyStart = enumDeclaration.sourceEnd + 1;
03773:                pushOnAstStack(enumDeclaration);
03774:
03775:                this .listLength = 0; // will be updated when reading super-interfaces
03776:
03777:                if (!this .statementRecoveryActivated
03778:                        && options.sourceLevel < ClassFileConstants.JDK1_5
03779:                        && this .lastErrorEndPositionBeforeRecovery < this .scanner.currentPosition) {
03780:                    //TODO this code will be never run while 'enum' is an identifier in 1.3 scanner 
03781:                    this .problemReporter().invalidUsageOfEnumDeclarations(
03782:                            enumDeclaration);
03783:                }
03784:
03785:                // recovery
03786:                if (this .currentElement != null) {
03787:                    this .lastCheckPoint = enumDeclaration.bodyStart;
03788:                    this .currentElement = this .currentElement.add(
03789:                            enumDeclaration, 0);
03790:                    this .lastIgnoredToken = -1;
03791:                }
03792:                // javadoc
03793:                enumDeclaration.javadoc = this .javadoc;
03794:                this .javadoc = null;
03795:            }
03796:
03797:            protected void consumeEqualityExpression(int op) {
03798:                // EqualityExpression ::= EqualityExpression '==' RelationalExpression
03799:                // EqualityExpression ::= EqualityExpression '!=' RelationalExpression
03800:
03801:                //optimize the push/pop
03802:
03803:                this .expressionPtr--;
03804:                this .expressionLengthPtr--;
03805:                this .expressionStack[this .expressionPtr] = new EqualExpression(
03806:                        this .expressionStack[this .expressionPtr],
03807:                        this .expressionStack[this .expressionPtr + 1], op);
03808:            }
03809:
03810:            /*
03811:             * @param op
03812:             */
03813:            protected void consumeEqualityExpressionWithName(int op) {
03814:                // EqualityExpression ::= Name '==' RelationalExpression
03815:                // EqualityExpression ::= Name '!=' RelationalExpression
03816:                pushOnExpressionStack(getUnspecifiedReferenceOptimized());
03817:                this .expressionPtr--;
03818:                this .expressionLengthPtr--;
03819:                this .expressionStack[this .expressionPtr] = new EqualExpression(
03820:                        this .expressionStack[this .expressionPtr + 1],
03821:                        this .expressionStack[this .expressionPtr], op);
03822:            }
03823:
03824:            protected void consumeExitMemberValue() {
03825:                // ExitMemberValue ::= $empty
03826:                // do nothing by default
03827:            }
03828:
03829:            protected void consumeExitTryBlock() {
03830:                //ExitTryBlock ::= $empty
03831:                if (this .currentElement != null) {
03832:                    this .restartRecovery = true;
03833:                }
03834:            }
03835:
03836:            protected void consumeExitVariableWithInitialization() {
03837:                // ExitVariableWithInitialization ::= $empty
03838:                // do nothing by default
03839:                this .expressionLengthPtr--;
03840:                AbstractVariableDeclaration variableDecl = (AbstractVariableDeclaration) this .astStack[this .astPtr];
03841:                variableDecl.initialization = this .expressionStack[this .expressionPtr--];
03842:                // we need to update the declarationSourceEnd of the local variable declaration to the
03843:                // source end position of the initialization expression
03844:                variableDecl.declarationSourceEnd = variableDecl.initialization.sourceEnd;
03845:                variableDecl.declarationEnd = variableDecl.initialization.sourceEnd;
03846:
03847:                this .recoveryExitFromVariable();
03848:            }
03849:
03850:            protected void consumeExitVariableWithoutInitialization() {
03851:                // ExitVariableWithoutInitialization ::= $empty
03852:                // do nothing by default
03853:
03854:                AbstractVariableDeclaration variableDecl = (AbstractVariableDeclaration) this .astStack[this .astPtr];
03855:                variableDecl.declarationSourceEnd = variableDecl.declarationEnd;
03856:                if (this .currentElement != null
03857:                        && this .currentElement instanceof  RecoveredField) {
03858:                    if (this .endStatementPosition > variableDecl.sourceEnd) {
03859:                        this .currentElement
03860:                                .updateSourceEndIfNecessary(this .endStatementPosition);
03861:                    }
03862:                }
03863:                this .recoveryExitFromVariable();
03864:            }
03865:
03866:            protected void consumeExplicitConstructorInvocation(int flag,
03867:                    int recFlag) {
03868:
03869:                /* flag allows to distinguish 3 cases :
03870:                (0) :   
03871:                ExplicitConstructorInvocation ::= 'this' '(' ArgumentListopt ')' ';'
03872:                ExplicitConstructorInvocation ::= 'super' '(' ArgumentListopt ')' ';'
03873:                (1) :
03874:                ExplicitConstructorInvocation ::= Primary '.' 'super' '(' ArgumentListopt ')' ';'
03875:                ExplicitConstructorInvocation ::= Primary '.' 'this' '(' ArgumentListopt ')' ';'
03876:                (2) :
03877:                ExplicitConstructorInvocation ::= Name '.' 'super' '(' ArgumentListopt ')' ';'
03878:                ExplicitConstructorInvocation ::= Name '.' 'this' '(' ArgumentListopt ')' ';'
03879:                 */
03880:                int startPosition = this .intStack[this .intPtr--];
03881:                ExplicitConstructorCall ecc = new ExplicitConstructorCall(
03882:                        recFlag);
03883:                int length;
03884:                if ((length = this .expressionLengthStack[this .expressionLengthPtr--]) != 0) {
03885:                    this .expressionPtr -= length;
03886:                    System.arraycopy(this .expressionStack,
03887:                            this .expressionPtr + 1,
03888:                            ecc.arguments = new Expression[length], 0, length);
03889:                }
03890:                switch (flag) {
03891:                case 0:
03892:                    ecc.sourceStart = startPosition;
03893:                    break;
03894:                case 1:
03895:                    this .expressionLengthPtr--;
03896:                    ecc.sourceStart = (ecc.qualification = this .expressionStack[this .expressionPtr--]).sourceStart;
03897:                    break;
03898:                case 2:
03899:                    ecc.sourceStart = (ecc.qualification = getUnspecifiedReferenceOptimized()).sourceStart;
03900:                    break;
03901:                }
03902:                pushOnAstStack(ecc);
03903:                ecc.sourceEnd = this .endStatementPosition;
03904:            }
03905:
03906:            protected void consumeExplicitConstructorInvocationWithTypeArguments(
03907:                    int flag, int recFlag) {
03908:
03909:                /* flag allows to distinguish 3 cases :
03910:                (0) :   
03911:                ExplicitConstructorInvocation ::= TypeArguments 'this' '(' ArgumentListopt ')' ';'
03912:                ExplicitConstructorInvocation ::= TypeArguments 'super' '(' ArgumentListopt ')' ';'
03913:                (1) :
03914:                ExplicitConstructorInvocation ::= Primary '.' TypeArguments 'super' '(' ArgumentListopt ')' ';'
03915:                ExplicitConstructorInvocation ::= Primary '.' TypeArguments 'this' '(' ArgumentListopt ')' ';'
03916:                (2) :
03917:                ExplicitConstructorInvocation ::= Name '.' TypeArguments 'super' '(' ArgumentListopt ')' ';'
03918:                ExplicitConstructorInvocation ::= Name '.' TypeArguments 'this' '(' ArgumentListopt ')' ';'
03919:                 */
03920:                int startPosition = this .intStack[this .intPtr--];
03921:                ExplicitConstructorCall ecc = new ExplicitConstructorCall(
03922:                        recFlag);
03923:                int length;
03924:                if ((length = this .expressionLengthStack[this .expressionLengthPtr--]) != 0) {
03925:                    this .expressionPtr -= length;
03926:                    System.arraycopy(this .expressionStack,
03927:                            this .expressionPtr + 1,
03928:                            ecc.arguments = new Expression[length], 0, length);
03929:                }
03930:                length = this .genericsLengthStack[this .genericsLengthPtr--];
03931:                this .genericsPtr -= length;
03932:                System.arraycopy(this .genericsStack, this .genericsPtr + 1,
03933:                        ecc.typeArguments = new TypeReference[length], 0,
03934:                        length);
03935:                ecc.typeArgumentsSourceStart = this .intStack[intPtr--];
03936:
03937:                switch (flag) {
03938:                case 0:
03939:                    ecc.sourceStart = startPosition;
03940:                    break;
03941:                case 1:
03942:                    this .expressionLengthPtr--;
03943:                    ecc.sourceStart = (ecc.qualification = this .expressionStack[this .expressionPtr--]).sourceStart;
03944:                    break;
03945:                case 2:
03946:                    ecc.sourceStart = (ecc.qualification = getUnspecifiedReferenceOptimized()).sourceStart;
03947:                    break;
03948:                }
03949:
03950:                pushOnAstStack(ecc);
03951:                ecc.sourceEnd = this .endStatementPosition;
03952:            }
03953:
03954:            protected void consumeExpressionStatement() {
03955:                // ExpressionStatement ::= StatementExpression ';'
03956:                this .expressionLengthPtr--;
03957:                Expression expression = this .expressionStack[this .expressionPtr--];
03958:                expression.statementEnd = this .endStatementPosition;
03959:                pushOnAstStack(expression);
03960:            }
03961:
03962:            protected void consumeFieldAccess(boolean isSuperAccess) {
03963:                // FieldAccess ::= Primary '.' 'Identifier'
03964:                // FieldAccess ::= 'super' '.' 'Identifier'
03965:
03966:                FieldReference fr = new FieldReference(
03967:                        this .identifierStack[this .identifierPtr],
03968:                        this .identifierPositionStack[this .identifierPtr--]);
03969:                this .identifierLengthPtr--;
03970:                if (isSuperAccess) {
03971:                    //considerates the fieldReference beginning at the 'super' ....	
03972:                    fr.sourceStart = this .intStack[this .intPtr--];
03973:                    fr.receiver = new SuperReference(fr.sourceStart,
03974:                            this .endPosition);
03975:                    pushOnExpressionStack(fr);
03976:                } else {
03977:                    //optimize push/pop
03978:                    fr.receiver = this .expressionStack[this .expressionPtr];
03979:                    //fieldreference begins at the receiver
03980:                    fr.sourceStart = fr.receiver.sourceStart;
03981:                    this .expressionStack[this .expressionPtr] = fr;
03982:                }
03983:            }
03984:
03985:            protected void consumeFieldDeclaration() {
03986:                // See consumeLocalVariableDeclarationDefaultModifier() in case of change: duplicated code
03987:                // FieldDeclaration ::= Modifiersopt Type VariableDeclarators ';'
03988:
03989:                /*
03990:                this.astStack : 
03991:                this.expressionStack: Expression Expression ...... Expression
03992:                this.identifierStack : type  identifier identifier ...... identifier
03993:                this.intStack : typeDim      dim        dim               dim
03994:                 ==>
03995:                this.astStack : FieldDeclaration FieldDeclaration ...... FieldDeclaration
03996:                this.expressionStack :
03997:                this.identifierStack : 
03998:                this.intStack : 
03999:                  
04000:                 */
04001:                int variableDeclaratorsCounter = this .astLengthStack[this .astLengthPtr];
04002:
04003:                for (int i = variableDeclaratorsCounter - 1; i >= 0; i--) {
04004:                    FieldDeclaration fieldDeclaration = (FieldDeclaration) this .astStack[this .astPtr
04005:                            - i];
04006:                    fieldDeclaration.declarationSourceEnd = this .endStatementPosition;
04007:                    fieldDeclaration.declarationEnd = this .endStatementPosition; // semi-colon included
04008:                }
04009:
04010:                updateSourceDeclarationParts(variableDeclaratorsCounter);
04011:                int endPos = flushCommentsDefinedPriorTo(this .endStatementPosition);
04012:                if (endPos != this .endStatementPosition) {
04013:                    for (int i = 0; i < variableDeclaratorsCounter; i++) {
04014:                        FieldDeclaration fieldDeclaration = (FieldDeclaration) this .astStack[this .astPtr
04015:                                - i];
04016:                        fieldDeclaration.declarationSourceEnd = endPos;
04017:                    }
04018:                }
04019:                // update the this.astStack, this.astPtr and this.astLengthStack
04020:                int startIndex = this .astPtr
04021:                        - this .variablesCounter[this .nestedType] + 1;
04022:                System.arraycopy(this .astStack, startIndex, this .astStack,
04023:                        startIndex - 1, variableDeclaratorsCounter);
04024:                this .astPtr--; // remove the type reference
04025:                this .astLengthStack[--this .astLengthPtr] = variableDeclaratorsCounter;
04026:
04027:                // recovery
04028:                if (this .currentElement != null) {
04029:                    this .lastCheckPoint = endPos + 1;
04030:                    if (this .currentElement.parent != null
04031:                            && this .currentElement instanceof  RecoveredField) {
04032:                        if (!(this .currentElement instanceof  RecoveredInitializer)) {
04033:                            this .currentElement = this .currentElement.parent;
04034:                        }
04035:                    }
04036:                    this .restartRecovery = true;
04037:                }
04038:                this .variablesCounter[this .nestedType] = 0;
04039:            }
04040:
04041:            protected void consumeForceNoDiet() {
04042:                // ForceNoDiet ::= $empty
04043:                this .dietInt++;
04044:            }
04045:
04046:            protected void consumeForInit() {
04047:                // ForInit ::= StatementExpressionList
04048:                pushOnAstLengthStack(-1);
04049:            }
04050:
04051:            protected void consumeFormalParameter(boolean isVarArgs) {
04052:                // FormalParameter ::= Type VariableDeclaratorId ==> false
04053:                // FormalParameter ::= Modifiers Type VariableDeclaratorId ==> true
04054:                /*
04055:                this.astStack : 
04056:                this.identifierStack : type identifier
04057:                this.intStack : dim dim
04058:                 ==>
04059:                this.astStack : Argument
04060:                this.identifierStack :   
04061:                this.intStack :  
04062:                 */
04063:
04064:                this .identifierLengthPtr--;
04065:                char[] identifierName = this .identifierStack[this .identifierPtr];
04066:                long namePositions = this .identifierPositionStack[this .identifierPtr--];
04067:                int extendedDimensions = this .intStack[this .intPtr--];
04068:                int endOfEllipsis = 0;
04069:                if (isVarArgs) {
04070:                    endOfEllipsis = this .intStack[this .intPtr--];
04071:                }
04072:                int firstDimensions = this .intStack[this .intPtr--];
04073:                final int typeDimensions = firstDimensions + extendedDimensions;
04074:                TypeReference type = getTypeReference(typeDimensions);
04075:                if (isVarArgs) {
04076:                    type = copyDims(type, typeDimensions + 1);
04077:                    if (extendedDimensions == 0) {
04078:                        type.sourceEnd = endOfEllipsis;
04079:                    }
04080:                    type.bits |= ASTNode.IsVarArgs; // set isVarArgs
04081:                }
04082:                int modifierPositions = this .intStack[this .intPtr--];
04083:                this .intPtr--;
04084:                Argument arg = new Argument(identifierName, namePositions,
04085:                        type, this .intStack[this .intPtr + 1]
04086:                                & ~ClassFileConstants.AccDeprecated); // modifiers
04087:                arg.declarationSourceStart = modifierPositions;
04088:                // consume annotations
04089:                int length;
04090:                if ((length = this .expressionLengthStack[this .expressionLengthPtr--]) != 0) {
04091:                    System
04092:                            .arraycopy(this .expressionStack,
04093:                                    (this .expressionPtr -= length) + 1,
04094:                                    arg.annotations = new Annotation[length],
04095:                                    0, length);
04096:                }
04097:                pushOnAstStack(arg);
04098:
04099:                /* if incomplete method header, this.listLength counter will not have been reset,
04100:                	indicating that some arguments are available on the stack */
04101:                this .listLength++;
04102:
04103:                if (isVarArgs) {
04104:                    if (!this .statementRecoveryActivated
04105:                            && options.sourceLevel < ClassFileConstants.JDK1_5
04106:                            && this .lastErrorEndPositionBeforeRecovery < this .scanner.currentPosition) {
04107:                        this .problemReporter().invalidUsageOfVarargs(arg);
04108:                    } else if (!this .statementRecoveryActivated
04109:                            && extendedDimensions > 0) {
04110:                        this .problemReporter().illegalExtendedDimensions(arg);
04111:                    }
04112:                }
04113:            }
04114:
04115:            protected void consumeFormalParameterList() {
04116:                // FormalParameterList ::= FormalParameterList ',' FormalParameter
04117:                optimizedConcatNodeLists();
04118:            }
04119:
04120:            protected void consumeFormalParameterListopt() {
04121:                // FormalParameterListopt ::= $empty
04122:                pushOnAstLengthStack(0);
04123:            }
04124:
04125:            protected void consumeGenericType() {
04126:                // nothing to do
04127:                // Will be consume by a getTypeRefence call
04128:            }
04129:
04130:            protected void consumeGenericTypeArrayType() {
04131:                // nothing to do
04132:                // Will be consume by a getTypeRefence call
04133:            }
04134:
04135:            protected void consumeGenericTypeNameArrayType() {
04136:                // nothing to do
04137:                // Will be consume by a getTypeRefence call
04138:            }
04139:
04140:            protected void consumeImportDeclaration() {
04141:                // SingleTypeImportDeclaration ::= SingleTypeImportDeclarationName ';'
04142:                ImportReference impt = (ImportReference) this .astStack[this .astPtr];
04143:                // flush annotations defined prior to import statements
04144:                impt.declarationEnd = this .endStatementPosition;
04145:                impt.declarationSourceEnd = this 
04146:                        .flushCommentsDefinedPriorTo(impt.declarationSourceEnd);
04147:
04148:                // recovery
04149:                if (this .currentElement != null) {
04150:                    this .lastCheckPoint = impt.declarationSourceEnd + 1;
04151:                    this .currentElement = this .currentElement.add(impt, 0);
04152:                    this .lastIgnoredToken = -1;
04153:                    this .restartRecovery = true;
04154:                    // used to avoid branching back into the regular automaton
04155:                }
04156:            }
04157:
04158:            protected void consumeImportDeclarations() {
04159:                // ImportDeclarations ::= ImportDeclarations ImportDeclaration 
04160:                optimizedConcatNodeLists();
04161:            }
04162:
04163:            protected void consumeInsideCastExpression() {
04164:                // InsideCastExpression ::= $empty
04165:            }
04166:
04167:            protected void consumeInsideCastExpressionLL1() {
04168:                // InsideCastExpressionLL1 ::= $empty
04169:                pushOnExpressionStack(getUnspecifiedReferenceOptimized());
04170:            }
04171:
04172:            protected void consumeInsideCastExpressionWithQualifiedGenerics() {
04173:                // InsideCastExpressionWithQualifiedGenerics ::= $empty
04174:            }
04175:
04176:            protected void consumeInstanceOfExpression() {
04177:                // RelationalExpression ::= RelationalExpression 'instanceof' ReferenceType
04178:                //optimize the push/pop
04179:
04180:                //by construction, no base type may be used in getTypeReference
04181:                Expression exp;
04182:                this .expressionStack[this .expressionPtr] = exp = new InstanceOfExpression(
04183:                        this .expressionStack[this .expressionPtr],
04184:                        getTypeReference(this .intStack[this .intPtr--]));
04185:                if (exp.sourceEnd == 0) {
04186:                    //array on base type....
04187:                    exp.sourceEnd = this .scanner.startPosition - 1;
04188:                }
04189:                //the scanner is on the next token already....
04190:            }
04191:
04192:            protected void consumeInstanceOfExpressionWithName() {
04193:                // RelationalExpression_NotName ::= Name instanceof ReferenceType
04194:                //optimize the push/pop
04195:
04196:                //by construction, no base type may be used in getTypeReference
04197:                TypeReference reference = getTypeReference(this .intStack[this .intPtr--]);
04198:                pushOnExpressionStack(getUnspecifiedReferenceOptimized());
04199:                Expression exp;
04200:                this .expressionStack[this .expressionPtr] = exp = new InstanceOfExpression(
04201:                        this .expressionStack[this .expressionPtr], reference);
04202:                if (exp.sourceEnd == 0) {
04203:                    //array on base type....
04204:                    exp.sourceEnd = this .scanner.startPosition - 1;
04205:                }
04206:                //the scanner is on the next token already....
04207:            }
04208:
04209:            protected void consumeInterfaceDeclaration() {
04210:                // see consumeClassDeclaration in case of changes: duplicated code
04211:                // InterfaceDeclaration ::= InterfaceHeader InterfaceBody
04212:                int length;
04213:                if ((length = this .astLengthStack[this .astLengthPtr--]) != 0) {
04214:                    //there are length declarations
04215:                    //dispatch.....according to the type of the declarations
04216:                    dispatchDeclarationInto(length);
04217:                }
04218:
04219:                TypeDeclaration typeDecl = (TypeDeclaration) this .astStack[this .astPtr];
04220:
04221:                //convert constructor that do not have the type's name into methods
04222:                typeDecl.checkConstructors(this );
04223:
04224:                //always add <clinit> (will be remove at code gen time if empty)
04225:                if (this .scanner.containsAssertKeyword) {
04226:                    typeDecl.bits |= ASTNode.ContainsAssertion;
04227:                }
04228:                typeDecl.addClinit();
04229:                typeDecl.bodyEnd = this .endStatementPosition;
04230:                if (length == 0
04231:                        && !containsComment(typeDecl.bodyStart,
04232:                                typeDecl.bodyEnd)) {
04233:                    typeDecl.bits |= ASTNode.UndocumentedEmptyBlock;
04234:                }
04235:                typeDecl.declarationSourceEnd = flushCommentsDefinedPriorTo(this .endStatementPosition);
04236:            }
04237:
04238:            protected void consumeInterfaceHeader() {
04239:                // InterfaceHeader ::= InterfaceHeaderName InterfaceHeaderExtendsopt
04240:
04241:                TypeDeclaration typeDecl = (TypeDeclaration) this .astStack[this .astPtr];
04242:                if (this .currentToken == TokenNameLBRACE) {
04243:                    typeDecl.bodyStart = this .scanner.currentPosition;
04244:                }
04245:                if (this .currentElement != null) {
04246:                    this .restartRecovery = true; // used to avoid branching back into the regular automaton		
04247:                }
04248:                // flush the comments related to the interface header
04249:                this .scanner.commentPtr = -1;
04250:            }
04251:
04252:            protected void consumeInterfaceHeaderExtends() {
04253:                // InterfaceHeaderExtends ::= 'extends' InterfaceTypeList
04254:                int length = this .astLengthStack[this .astLengthPtr--];
04255:                //super interfaces
04256:                this .astPtr -= length;
04257:                TypeDeclaration typeDecl = (TypeDeclaration) this .astStack[this .astPtr];
04258:                System.arraycopy(this .astStack, this .astPtr + 1,
04259:                        typeDecl.super Interfaces = new TypeReference[length],
04260:                        0, length);
04261:                for (int i = 0, max = typeDecl.super Interfaces.length; i < max; i++) {
04262:                    typeDecl.super Interfaces[i].bits |= ASTNode.IsSuperType;
04263:                }
04264:                typeDecl.bodyStart = typeDecl.super Interfaces[length - 1].sourceEnd + 1;
04265:                this .listLength = 0; // reset after having read super-interfaces		
04266:                // recovery
04267:                if (this .currentElement != null) {
04268:                    this .lastCheckPoint = typeDecl.bodyStart;
04269:                }
04270:            }
04271:
04272:            protected void consumeInterfaceHeaderName1() {
04273:                // InterfaceHeaderName ::= Modifiersopt 'interface' 'Identifier'
04274:                TypeDeclaration typeDecl = new TypeDeclaration(
04275:                        this .compilationUnit.compilationResult);
04276:
04277:                if (this .nestedMethod[this .nestedType] == 0) {
04278:                    if (this .nestedType != 0) {
04279:                        typeDecl.bits |= ASTNode.IsMemberType;
04280:                    }
04281:                } else {
04282:                    // Record that the block has a declaration for local types
04283:                    typeDecl.bits |= ASTNode.IsLocalType;
04284:                    markEnclosingMemberWithLocalType();
04285:                    blockReal();
04286:                }
04287:
04288:                //highlight the name of the type
04289:                long pos = this .identifierPositionStack[this .identifierPtr];
04290:                typeDecl.sourceEnd = (int) pos;
04291:                typeDecl.sourceStart = (int) (pos >>> 32);
04292:                typeDecl.name = this .identifierStack[this .identifierPtr--];
04293:                this .identifierLengthPtr--;
04294:
04295:                //compute the declaration source too
04296:                // 'class' and 'interface' push two int positions: the beginning of the class token and its end.
04297:                // we want to keep the beginning position but get rid of the end position
04298:                // it is only used for the ClassLiteralAccess positions.
04299:                typeDecl.declarationSourceStart = this .intStack[this .intPtr--];
04300:                this .intPtr--; // remove the end position of the class token
04301:                typeDecl.modifiersSourceStart = this .intStack[this .intPtr--];
04302:                typeDecl.modifiers = this .intStack[this .intPtr--]
04303:                        | ClassFileConstants.AccInterface;
04304:                if (typeDecl.modifiersSourceStart >= 0) {
04305:                    typeDecl.declarationSourceStart = typeDecl.modifiersSourceStart;
04306:                }
04307:
04308:                // Store secondary info
04309:                if ((typeDecl.bits & ASTNode.IsMemberType) == 0
04310:                        && (typeDecl.bits & ASTNode.IsLocalType) == 0) {
04311:                    if (this .compilationUnit != null
04312:                            && !CharOperation.equals(typeDecl.name,
04313:                                    this .compilationUnit.getMainTypeName())) {
04314:                        typeDecl.bits |= ASTNode.IsSecondaryType;
04315:                    }
04316:                }
04317:
04318:                // consume annotations
04319:                int length;
04320:                if ((length = this .expressionLengthStack[this .expressionLengthPtr--]) != 0) {
04321:                    System.arraycopy(this .expressionStack,
04322:                            (this .expressionPtr -= length) + 1,
04323:                            typeDecl.annotations = new Annotation[length], 0,
04324:                            length);
04325:                }
04326:                typeDecl.bodyStart = typeDecl.sourceEnd + 1;
04327:                pushOnAstStack(typeDecl);
04328:                this .listLength = 0; // will be updated when reading super-interfaces
04329:                // recovery
04330:                if (this .currentElement != null) { // is recovering
04331:                    this .lastCheckPoint = typeDecl.bodyStart;
04332:                    this .currentElement = this .currentElement.add(typeDecl, 0);
04333:                    this .lastIgnoredToken = -1;
04334:                }
04335:                // javadoc
04336:                typeDecl.javadoc = this .javadoc;
04337:                this .javadoc = null;
04338:            }
04339:
04340:            protected void consumeInterfaceMemberDeclarations() {
04341:                // InterfaceMemberDeclarations ::= InterfaceMemberDeclarations InterfaceMemberDeclaration
04342:                concatNodeLists();
04343:            }
04344:
04345:            protected void consumeInterfaceMemberDeclarationsopt() {
04346:                // InterfaceMemberDeclarationsopt ::= NestedType InterfaceMemberDeclarations
04347:                this .nestedType--;
04348:            }
04349:
04350:            protected void consumeInterfaceType() {
04351:                // InterfaceType ::= ClassOrInterfaceType
04352:                pushOnAstStack(getTypeReference(0));
04353:                /* if incomplete type header, this.listLength counter will not have been reset,
04354:                	indicating that some interfaces are available on the stack */
04355:                this .listLength++;
04356:            }
04357:
04358:            protected void consumeInterfaceTypeList() {
04359:                // InterfaceTypeList ::= InterfaceTypeList ',' InterfaceType
04360:                optimizedConcatNodeLists();
04361:            }
04362:
04363:            protected void consumeInternalCompilationUnit() {
04364:                // InternalCompilationUnit ::= PackageDeclaration
04365:                // InternalCompilationUnit ::= PackageDeclaration ImportDeclarations ReduceImports
04366:                // InternalCompilationUnit ::= ImportDeclarations ReduceImports
04367:                if (this .compilationUnit.isPackageInfo()) {
04368:                    this .compilationUnit.types = new TypeDeclaration[1];
04369:                    // create a fake interface declaration
04370:                    TypeDeclaration declaration = new TypeDeclaration(
04371:                            compilationUnit.compilationResult);
04372:                    declaration.name = TypeConstants.PACKAGE_INFO_NAME;
04373:                    declaration.modifiers = ClassFileConstants.AccDefault
04374:                            | ClassFileConstants.AccInterface;
04375:                    this .compilationUnit.types[0] = declaration;
04376:                    declaration.javadoc = this .compilationUnit.javadoc;
04377:                }
04378:            }
04379:
04380:            protected void consumeInternalCompilationUnitWithTypes() {
04381:                // InternalCompilationUnit ::= PackageDeclaration ImportDeclarations ReduceImports TypeDeclarations
04382:                // InternalCompilationUnit ::= PackageDeclaration TypeDeclarations
04383:                // InternalCompilationUnit ::= TypeDeclarations
04384:                // InternalCompilationUnit ::= ImportDeclarations ReduceImports TypeDeclarations
04385:                // consume type declarations
04386:                int length;
04387:                if ((length = this .astLengthStack[this .astLengthPtr--]) != 0) {
04388:                    if (this .compilationUnit.isPackageInfo()) {
04389:                        this .compilationUnit.types = new TypeDeclaration[length + 1];
04390:                        this .astPtr -= length;
04391:                        System.arraycopy(this .astStack, this .astPtr + 1,
04392:                                this .compilationUnit.types, 1, length);
04393:                        // create a fake interface declaration
04394:                        TypeDeclaration declaration = new TypeDeclaration(
04395:                                compilationUnit.compilationResult);
04396:                        declaration.name = TypeConstants.PACKAGE_INFO_NAME;
04397:                        declaration.modifiers = ClassFileConstants.AccDefault
04398:                                | ClassFileConstants.AccInterface;
04399:                        this .compilationUnit.types[0] = declaration;
04400:                        declaration.javadoc = this .compilationUnit.javadoc;
04401:                    } else {
04402:                        this .compilationUnit.types = new TypeDeclaration[length];
04403:                        this .astPtr -= length;
04404:                        System.arraycopy(this .astStack, this .astPtr + 1,
04405:                                this .compilationUnit.types, 0, length);
04406:                    }
04407:                }
04408:            }
04409:
04410:            protected void consumeInvalidAnnotationTypeDeclaration() {
04411:                // BlockStatement ::= AnnotationTypeDeclaration
04412:                TypeDeclaration typeDecl = (TypeDeclaration) this .astStack[this .astPtr];
04413:                if (!this .statementRecoveryActivated)
04414:                    problemReporter().illegalLocalTypeDeclaration(typeDecl);
04415:                // remove the ast node created in interface header
04416:                this .astPtr--;
04417:                pushOnAstLengthStack(-1);
04418:                concatNodeLists();
04419:            }
04420:
04421:            protected void consumeInvalidConstructorDeclaration() {
04422:                // ConstructorDeclaration ::= ConstructorHeader ';'
04423:                // now we know that the top of stack is a constructorDeclaration
04424:                ConstructorDeclaration cd = (ConstructorDeclaration) this .astStack[this .astPtr];
04425:
04426:                cd.bodyEnd = this .endPosition; // position just before the trailing semi-colon
04427:                cd.declarationSourceEnd = flushCommentsDefinedPriorTo(this .endStatementPosition);
04428:                // report the problem and continue the parsing - narrowing the problem onto the method
04429:
04430:                cd.modifiers |= ExtraCompilerModifiers.AccSemicolonBody; // remember semi-colon body
04431:            }
04432:
04433:            protected void consumeInvalidConstructorDeclaration(boolean hasBody) {
04434:                // InvalidConstructorDeclaration ::= ConstructorHeader ConstructorBody ==> true
04435:                // InvalidConstructorDeclaration ::= ConstructorHeader ';' ==> false
04436:
04437:                /*
04438:                this.astStack : modifiers arguments throws statements
04439:                this.identifierStack : name
04440:                 ==>
04441:                this.astStack : MethodDeclaration
04442:                this.identifierStack :
04443:                 */
04444:                if (hasBody) {
04445:                    // pop the position of the {  (body of the method) pushed in block decl
04446:                    this .intPtr--;
04447:                }
04448:
04449:                //statements
04450:                if (hasBody) {
04451:                    this .realBlockPtr--;
04452:                }
04453:
04454:                int length;
04455:                if (hasBody
04456:                        && ((length = this .astLengthStack[this .astLengthPtr--]) != 0)) {
04457:                    this .astPtr -= length;
04458:                }
04459:                ConstructorDeclaration constructorDeclaration = (ConstructorDeclaration) this .astStack[this .astPtr];
04460:                constructorDeclaration.bodyEnd = this .endStatementPosition;
04461:                constructorDeclaration.declarationSourceEnd = flushCommentsDefinedPriorTo(this .endStatementPosition);
04462:                if (!hasBody) {
04463:                    constructorDeclaration.modifiers |= ExtraCompilerModifiers.AccSemicolonBody;
04464:                }
04465:            }
04466:
04467:            protected void consumeInvalidInterfaceDeclaration() {
04468:                // BlockStatement ::= InvalidInterfaceDeclaration
04469:                //InterfaceDeclaration ::= Modifiersopt 'interface' 'Identifier' ExtendsInterfacesopt InterfaceHeader InterfaceBody
04470:                TypeDeclaration typeDecl = (TypeDeclaration) this .astStack[this .astPtr];
04471:                if (!this .statementRecoveryActivated)
04472:                    problemReporter().illegalLocalTypeDeclaration(typeDecl);
04473:                // remove the ast node created in interface header
04474:                this .astPtr--;
04475:                pushOnAstLengthStack(-1);
04476:                concatNodeLists();
04477:            }
04478:
04479:            protected void consumeInvalidEnumDeclaration() {
04480:                // BlockStatement ::= EnumDeclaration
04481:                TypeDeclaration typeDecl = (TypeDeclaration) this .astStack[this .astPtr];
04482:                if (!this .statementRecoveryActivated)
04483:                    problemReporter().illegalLocalTypeDeclaration(typeDecl);
04484:                // remove the ast node created in interface header
04485:                this .astPtr--;
04486:                pushOnAstLengthStack(-1);
04487:                concatNodeLists();
04488:            }
04489:
04490:            protected void consumeInvalidMethodDeclaration() {
04491:                // InterfaceMemberDeclaration ::= InvalidMethodDeclaration
04492:
04493:                /*
04494:                this.astStack : modifiers arguments throws statements
04495:                this.identifierStack : type name
04496:                this.intStack : dim dim dim
04497:                 ==>
04498:                this.astStack : MethodDeclaration
04499:                this.identifierStack :
04500:                this.intStack : 
04501:                 */
04502:
04503:                // pop the position of the {  (body of the method) pushed in block decl
04504:                this .intPtr--;
04505:                // retrieve end position of method declarator
04506:
04507:                //statements
04508:                this .realBlockPtr--;
04509:                int length;
04510:                if ((length = this .astLengthStack[this .astLengthPtr--]) != 0) {
04511:                    this .astPtr -= length;
04512:                }
04513:
04514:                //watch for } that could be given as a unicode ! ( u007D is '}' )
04515:                MethodDeclaration md = (MethodDeclaration) this .astStack[this .astPtr];
04516:                md.bodyEnd = this .endPosition;
04517:                md.declarationSourceEnd = flushCommentsDefinedPriorTo(this .endStatementPosition);
04518:
04519:                // report the problem and continue the parsing - narrowing the problem onto the method
04520:                if (!this .statementRecoveryActivated)
04521:                    problemReporter().abstractMethodNeedingNoBody(md);
04522:            }
04523:
04524:            protected void consumeLabel() {
04525:                // Do nothing
04526:            }
04527:
04528:            protected void consumeLeftParen() {
04529:                // PushLPAREN ::= '('
04530:                pushOnIntStack(this .lParenPos);
04531:            }
04532:
04533:            protected void consumeLocalVariableDeclaration() {
04534:                // LocalVariableDeclaration ::= Modifiers Type VariableDeclarators ';'
04535:
04536:                /*
04537:                this.astStack : 
04538:                this.expressionStack: Expression Expression ...... Expression
04539:                this.identifierStack : type  identifier identifier ...... identifier
04540:                this.intStack : typeDim      dim        dim               dim
04541:                 ==>
04542:                this.astStack : FieldDeclaration FieldDeclaration ...... FieldDeclaration
04543:                this.expressionStack :
04544:                this.identifierStack : 
04545:                this.intStack : 
04546:                  
04547:                 */
04548:                int variableDeclaratorsCounter = this .astLengthStack[this .astLengthPtr];
04549:
04550:                // update the this.astStack, this.astPtr and this.astLengthStack
04551:                int startIndex = this .astPtr
04552:                        - this .variablesCounter[this .nestedType] + 1;
04553:                System.arraycopy(this .astStack, startIndex, this .astStack,
04554:                        startIndex - 1, variableDeclaratorsCounter);
04555:                this .astPtr--; // remove the type reference
04556:                this .astLengthStack[--this .astLengthPtr] = variableDeclaratorsCounter;
04557:                this .variablesCounter[this .nestedType] = 0;
04558:            }
04559:
04560:            protected void consumeLocalVariableDeclarationStatement() {
04561:                // LocalVariableDeclarationStatement ::= LocalVariableDeclaration ';'
04562:                // see blockReal in case of change: duplicated code
04563:                // increment the amount of declared variables for this block
04564:                this .realBlockStack[this .realBlockPtr]++;
04565:
04566:                // update source end to include the semi-colon
04567:                int variableDeclaratorsCounter = this .astLengthStack[this .astLengthPtr];
04568:                for (int i = variableDeclaratorsCounter - 1; i >= 0; i--) {
04569:                    LocalDeclaration localDeclaration = (LocalDeclaration) this .astStack[this .astPtr
04570:                            - i];
04571:                    localDeclaration.declarationSourceEnd = this .endStatementPosition;
04572:                    localDeclaration.declarationEnd = this .endStatementPosition; // semi-colon included
04573:                }
04574:
04575:            }
04576:
04577:            protected void consumeMarkerAnnotation() {
04578:                // MarkerAnnotation ::= '@' Name
04579:                MarkerAnnotation markerAnnotation = null;
04580:                TypeReference typeReference = this .getAnnotationType();
04581:                markerAnnotation = new MarkerAnnotation(typeReference,
04582:                        this .intStack[this .intPtr--]);
04583:                markerAnnotation.declarationSourceEnd = markerAnnotation.sourceEnd;
04584:                pushOnExpressionStack(markerAnnotation);
04585:                if (!this .statementRecoveryActivated
04586:                        && options.sourceLevel < ClassFileConstants.JDK1_5
04587:                        && this .lastErrorEndPositionBeforeRecovery < this .scanner.currentPosition) {
04588:                    this .problemReporter().invalidUsageOfAnnotation(
04589:                            markerAnnotation);
04590:                }
04591:                this .recordStringLiterals = true;
04592:            }
04593:
04594:            protected void consumeMemberValueArrayInitializer() {
04595:                // MemberValueArrayInitializer ::= '{' MemberValues ',' '}'
04596:                // MemberValueArrayInitializer ::= '{' MemberValues '}'
04597:                arrayInitializer(this .expressionLengthStack[this .expressionLengthPtr--]);
04598:            }
04599:
04600:            protected void consumeMemberValueAsName() {
04601:                pushOnExpressionStack(getUnspecifiedReferenceOptimized());
04602:            }
04603:
04604:            protected void consumeMemberValuePair() {
04605:                // MemberValuePair ::= SimpleName '=' MemberValue
04606:                char[] simpleName = this .identifierStack[this .identifierPtr];
04607:                long position = this .identifierPositionStack[this .identifierPtr--];
04608:                this .identifierLengthPtr--;
04609:                int end = (int) position;
04610:                int start = (int) (position >>> 32);
04611:                Expression value = this .expressionStack[this .expressionPtr--];
04612:                this .expressionLengthPtr--;
04613:                MemberValuePair memberValuePair = new MemberValuePair(
04614:                        simpleName, start, end, value);
04615:                pushOnAstStack(memberValuePair);
04616:            }
04617:
04618:            protected void consumeMemberValuePairs() {
04619:                // MemberValuePairs ::= MemberValuePairs ',' MemberValuePair
04620:                concatNodeLists();
04621:            }
04622:
04623:            protected void consumeMemberValues() {
04624:                // MemberValues ::= MemberValues ',' MemberValue
04625:                concatExpressionLists();
04626:            }
04627:
04628:            protected void consumeMethodBody() {
04629:                // MethodBody ::= NestedMethod '{' BlockStatementsopt '}' 
04630:                this .nestedMethod[this .nestedType]--;
04631:            }
04632:
04633:            protected void consumeMethodDeclaration(boolean isNotAbstract) {
04634:                // MethodDeclaration ::= MethodHeader MethodBody
04635:                // AbstractMethodDeclaration ::= MethodHeader ';'
04636:
04637:                /*
04638:                this.astStack : modifiers arguments throws statements
04639:                this.identifierStack : type name
04640:                this.intStack : dim dim dim
04641:                 ==>
04642:                this.astStack : MethodDeclaration
04643:                this.identifierStack :
04644:                this.intStack : 
04645:                 */
04646:
04647:                int length;
04648:                if (isNotAbstract) {
04649:                    // pop the position of the {  (body of the method) pushed in block decl
04650:                    this .intPtr--;
04651:                    this .intPtr--;
04652:                }
04653:
04654:                int explicitDeclarations = 0;
04655:                Statement[] statements = null;
04656:                if (isNotAbstract) {
04657:                    //statements
04658:                    explicitDeclarations = this .realBlockStack[this .realBlockPtr--];
04659:                    if ((length = this .astLengthStack[this .astLengthPtr--]) != 0) {
04660:                        System.arraycopy(this .astStack,
04661:                                (this .astPtr -= length) + 1,
04662:                                statements = new Statement[length], 0, length);
04663:                    }
04664:                }
04665:
04666:                // now we know that we have a method declaration at the top of the ast stack
04667:                MethodDeclaration md = (MethodDeclaration) this .astStack[this .astPtr];
04668:                md.statements = statements;
04669:                md.explicitDeclarations = explicitDeclarations;
04670:
04671:                // cannot be done in consumeMethodHeader because we have no idea whether or not there
04672:                // is a body when we reduce the method header
04673:                if (!isNotAbstract) { //remember the fact that the method has a semicolon body
04674:                    md.modifiers |= ExtraCompilerModifiers.AccSemicolonBody;
04675:                } else if (!(this .diet && this .dietInt == 0)
04676:                        && statements == null
04677:                        && !containsComment(md.bodyStart, this .endPosition)) {
04678:                    md.bits |= ASTNode.UndocumentedEmptyBlock;
04679:                }
04680:                // store the this.endPosition (position just before the '}') in case there is
04681:                // a trailing comment behind the end of the method
04682:                md.bodyEnd = this .endPosition;
04683:                md.declarationSourceEnd = flushCommentsDefinedPriorTo(this .endStatementPosition);
04684:            }
04685:
04686:            protected void consumeMethodHeader() {
04687:                // MethodHeader ::= MethodHeaderName MethodHeaderParameters MethodHeaderExtendedDims ThrowsClauseopt
04688:                // AnnotationMethodHeader ::= AnnotationMethodHeaderName FormalParameterListopt MethodHeaderRightParen MethodHeaderExtendedDims AnnotationMethodHeaderDefaultValueopt
04689:                // RecoveryMethodHeader ::= RecoveryMethodHeaderName FormalParameterListopt MethodHeaderRightParen MethodHeaderExtendedDims AnnotationMethodHeaderDefaultValueopt
04690:                // RecoveryMethodHeader ::= RecoveryMethodHeaderName FormalParameterListopt MethodHeaderRightParen MethodHeaderExtendedDims MethodHeaderThrowsClause
04691:
04692:                // retrieve end position of method declarator
04693:                AbstractMethodDeclaration method = (AbstractMethodDeclaration) this .astStack[this .astPtr];
04694:
04695:                if (this .currentToken == TokenNameLBRACE) {
04696:                    method.bodyStart = this .scanner.currentPosition;
04697:                }
04698:                // recovery
04699:                if (this .currentElement != null) {
04700:                    //		if(method.isAnnotationMethod()) {
04701:                    //			method.modifiers |= AccSemicolonBody;
04702:                    //			method.declarationSourceEnd = this.scanner.currentPosition-1;
04703:                    //			method.bodyEnd = this.scanner.currentPosition-1;
04704:                    //			this.currentElement = this.currentElement.parent;
04705:                    //		} else 
04706:                    if (this .currentToken == TokenNameSEMICOLON /*&& !method.isAnnotationMethod()*/) {
04707:                        method.modifiers |= ExtraCompilerModifiers.AccSemicolonBody;
04708:                        method.declarationSourceEnd = this .scanner.currentPosition - 1;
04709:                        method.bodyEnd = this .scanner.currentPosition - 1;
04710:                        if (this .currentElement.parseTree() == method
04711:                                && this .currentElement.parent != null) {
04712:                            this .currentElement = this .currentElement.parent;
04713:                        }
04714:                    } else if (this .currentToken == TokenNameLBRACE) {
04715:                        if (this .currentElement instanceof  RecoveredMethod
04716:                                && ((RecoveredMethod) this .currentElement).methodDeclaration != method) {
04717:                            this .ignoreNextOpeningBrace = true;
04718:                            this .currentElement.bracketBalance++;
04719:                        }
04720:                    }
04721:                    this .restartRecovery = true; // used to avoid branching back into the regular automaton
04722:                }
04723:            }
04724:
04725:            protected void consumeMethodHeaderDefaultValue() {
04726:                // MethodHeaderDefaultValue ::= DefaultValue
04727:                MethodDeclaration md = (MethodDeclaration) this .astStack[this .astPtr];
04728:
04729:                int length = this .expressionLengthStack[this .expressionLengthPtr--];
04730:                if (length == 1) {
04731:                    intPtr--; // we get rid of the position of the default keyword
04732:                    intPtr--; // we get rid of the position of the default keyword
04733:                    if (md.isAnnotationMethod()) {
04734:                        ((AnnotationMethodDeclaration) md).defaultValue = this .expressionStack[this .expressionPtr];
04735:                        md.modifiers |= ClassFileConstants.AccAnnotationDefault;
04736:                    }
04737:                    this .expressionPtr--;
04738:                    this .recordStringLiterals = true;
04739:                }
04740:
04741:                if (this .currentElement != null) {
04742:                    if (md.isAnnotationMethod()) {
04743:                        this .currentElement
04744:                                .updateSourceEndIfNecessary(((AnnotationMethodDeclaration) md).defaultValue.sourceEnd);
04745:                    }
04746:                }
04747:            }
04748:
04749:            protected void consumeMethodHeaderExtendedDims() {
04750:                // MethodHeaderExtendedDims ::= Dimsopt
04751:                // now we update the returnType of the method
04752:                MethodDeclaration md = (MethodDeclaration) this .astStack[this .astPtr];
04753:                int extendedDims = this .intStack[this .intPtr--];
04754:                if (md.isAnnotationMethod()) {
04755:                    ((AnnotationMethodDeclaration) md).extendedDimensions = extendedDims;
04756:                }
04757:                if (extendedDims != 0) {
04758:                    TypeReference returnType = md.returnType;
04759:                    md.sourceEnd = this .endPosition;
04760:                    int dims = returnType.dimensions() + extendedDims;
04761:                    md.returnType = this .copyDims(returnType, dims);
04762:                    if (this .currentToken == TokenNameLBRACE) {
04763:                        md.bodyStart = this .endPosition + 1;
04764:                    }
04765:                    // recovery
04766:                    if (this .currentElement != null) {
04767:                        this .lastCheckPoint = md.bodyStart;
04768:                    }
04769:                }
04770:            }
04771:
04772:            protected void consumeMethodHeaderName(boolean isAnnotationMethod) {
04773:                // MethodHeaderName ::= Modifiersopt Type 'Identifier' '('
04774:                // AnnotationMethodHeaderName ::= Modifiersopt Type 'Identifier' '('
04775:                // RecoveryMethodHeaderName ::= Modifiersopt Type 'Identifier' '('
04776:                MethodDeclaration md = null;
04777:                if (isAnnotationMethod) {
04778:                    md = new AnnotationMethodDeclaration(
04779:                            this .compilationUnit.compilationResult);
04780:                    this .recordStringLiterals = false;
04781:                } else {
04782:                    md = new MethodDeclaration(
04783:                            this .compilationUnit.compilationResult);
04784:                }
04785:
04786:                //name
04787:                md.selector = this .identifierStack[this .identifierPtr];
04788:                long selectorSource = this .identifierPositionStack[this .identifierPtr--];
04789:                this .identifierLengthPtr--;
04790:                //type
04791:                md.returnType = getTypeReference(this .intStack[this .intPtr--]);
04792:                //modifiers
04793:                md.declarationSourceStart = this .intStack[this .intPtr--];
04794:                md.modifiers = this .intStack[this .intPtr--];
04795:                // consume annotations
04796:                int length;
04797:                if ((length = this .expressionLengthStack[this .expressionLengthPtr--]) != 0) {
04798:                    System.arraycopy(this .expressionStack,
04799:                            (this .expressionPtr -= length) + 1,
04800:                            md.annotations = new Annotation[length], 0, length);
04801:                }
04802:                // javadoc
04803:                md.javadoc = this .javadoc;
04804:                this .javadoc = null;
04805:
04806:                //highlight starts at selector start
04807:                md.sourceStart = (int) (selectorSource >>> 32);
04808:                pushOnAstStack(md);
04809:                md.sourceEnd = this .lParenPos;
04810:                md.bodyStart = this .lParenPos + 1;
04811:                this .listLength = 0; // initialize this.listLength before reading parameters/throws
04812:
04813:                // recovery
04814:                if (this .currentElement != null) {
04815:                    if (this .currentElement instanceof  RecoveredType
04816:                    //|| md.modifiers != 0
04817:                            || (Util.getLineNumber(md.returnType.sourceStart,
04818:                                    this .scanner.lineEnds, 0,
04819:                                    this .scanner.linePtr) == Util
04820:                                    .getLineNumber(md.sourceStart,
04821:                                            this .scanner.lineEnds, 0,
04822:                                            this .scanner.linePtr))) {
04823:                        this .lastCheckPoint = md.bodyStart;
04824:                        this .currentElement = this .currentElement.add(md, 0);
04825:                        this .lastIgnoredToken = -1;
04826:                    } else {
04827:                        this .lastCheckPoint = md.sourceStart;
04828:                        this .restartRecovery = true;
04829:                    }
04830:                }
04831:            }
04832:
04833:            protected void consumeMethodHeaderNameWithTypeParameters(
04834:                    boolean isAnnotationMethod) {
04835:                // MethodHeaderName ::= Modifiersopt TypeParameters Type 'Identifier' '('
04836:                // AnnotationMethodHeaderName ::= Modifiersopt TypeParameters Type 'Identifier' '('
04837:                // RecoveryMethodHeaderName ::= Modifiersopt TypeParameters Type 'Identifier' '('
04838:                MethodDeclaration md = null;
04839:                if (isAnnotationMethod) {
04840:                    md = new AnnotationMethodDeclaration(
04841:                            this .compilationUnit.compilationResult);
04842:                    this .recordStringLiterals = false;
04843:                } else {
04844:                    md = new MethodDeclaration(
04845:                            this .compilationUnit.compilationResult);
04846:                }
04847:
04848:                //name
04849:                md.selector = this .identifierStack[this .identifierPtr];
04850:                long selectorSource = this .identifierPositionStack[this .identifierPtr--];
04851:                this .identifierLengthPtr--;
04852:                //type
04853:                md.returnType = getTypeReference(this .intStack[this .intPtr--]);
04854:
04855:                // consume type parameters
04856:                int length = this .genericsLengthStack[this .genericsLengthPtr--];
04857:                this .genericsPtr -= length;
04858:                System.arraycopy(this .genericsStack, this .genericsPtr + 1,
04859:                        md.typeParameters = new TypeParameter[length], 0,
04860:                        length);
04861:
04862:                //modifiers
04863:                md.declarationSourceStart = this .intStack[this .intPtr--];
04864:                md.modifiers = this .intStack[this .intPtr--];
04865:                // consume annotations
04866:                if ((length = this .expressionLengthStack[this .expressionLengthPtr--]) != 0) {
04867:                    System.arraycopy(this .expressionStack,
04868:                            (this .expressionPtr -= length) + 1,
04869:                            md.annotations = new Annotation[length], 0, length);
04870:                }
04871:                // javadoc
04872:                md.javadoc = this .javadoc;
04873:                this .javadoc = null;
04874:
04875:                //highlight starts at selector start
04876:                md.sourceStart = (int) (selectorSource >>> 32);
04877:                pushOnAstStack(md);
04878:                md.sourceEnd = this .lParenPos;
04879:                md.bodyStart = this .lParenPos + 1;
04880:                this .listLength = 0; // initialize this.listLength before reading parameters/throws
04881:
04882:                // recovery
04883:                if (this .currentElement != null) {
04884:                    boolean isType;
04885:                    if ((isType = this .currentElement instanceof  RecoveredType)
04886:                    //|| md.modifiers != 0
04887:                            || (Util.getLineNumber(md.returnType.sourceStart,
04888:                                    this .scanner.lineEnds, 0,
04889:                                    this .scanner.linePtr) == Util
04890:                                    .getLineNumber(md.sourceStart,
04891:                                            this .scanner.lineEnds, 0,
04892:                                            this .scanner.linePtr))) {
04893:                        if (isType) {
04894:                            ((RecoveredType) this .currentElement).pendingTypeParameters = null;
04895:                        }
04896:                        this .lastCheckPoint = md.bodyStart;
04897:                        this .currentElement = this .currentElement.add(md, 0);
04898:                        this .lastIgnoredToken = -1;
04899:                    } else {
04900:                        this .lastCheckPoint = md.sourceStart;
04901:                        this .restartRecovery = true;
04902:                    }
04903:                }
04904:            }
04905:
04906:            protected void consumeMethodHeaderRightParen() {
04907:                // MethodHeaderParameters ::= FormalParameterListopt ')'
04908:                int length = this .astLengthStack[this .astLengthPtr--];
04909:                this .astPtr -= length;
04910:                AbstractMethodDeclaration md = (AbstractMethodDeclaration) this .astStack[this .astPtr];
04911:                md.sourceEnd = this .rParenPos;
04912:                //arguments
04913:                if (length != 0) {
04914:                    System.arraycopy(this .astStack, this .astPtr + 1,
04915:                            md.arguments = new Argument[length], 0, length);
04916:                }
04917:                md.bodyStart = this .rParenPos + 1;
04918:                this .listLength = 0; // reset this.listLength after having read all parameters
04919:                // recovery
04920:                if (this .currentElement != null) {
04921:                    this .lastCheckPoint = md.bodyStart;
04922:                    if (this .currentElement.parseTree() == md)
04923:                        return;
04924:
04925:                    // might not have been attached yet - in some constructor scenarii
04926:                    if (md.isConstructor()) {
04927:                        if ((length != 0)
04928:                                || (this .currentToken == TokenNameLBRACE)
04929:                                || (this .currentToken == TokenNamethrows)) {
04930:                            this .currentElement = this .currentElement
04931:                                    .add(md, 0);
04932:                            this .lastIgnoredToken = -1;
04933:                        }
04934:                    }
04935:                }
04936:            }
04937:
04938:            protected void consumeMethodHeaderThrowsClause() {
04939:                // MethodHeaderThrowsClause ::= 'throws' ClassTypeList
04940:                int length = this .astLengthStack[this .astLengthPtr--];
04941:                this .astPtr -= length;
04942:                AbstractMethodDeclaration md = (AbstractMethodDeclaration) this .astStack[this .astPtr];
04943:                System.arraycopy(this .astStack, this .astPtr + 1,
04944:                        md.thrownExceptions = new TypeReference[length], 0,
04945:                        length);
04946:                md.sourceEnd = md.thrownExceptions[length - 1].sourceEnd;
04947:                md.bodyStart = md.thrownExceptions[length - 1].sourceEnd + 1;
04948:                this .listLength = 0; // reset this.listLength after having read all thrown exceptions	
04949:                // recovery
04950:                if (this .currentElement != null) {
04951:                    this .lastCheckPoint = md.bodyStart;
04952:                }
04953:            }
04954:
04955:            protected void consumeMethodInvocationName() {
04956:                // MethodInvocation ::= Name '(' ArgumentListopt ')'
04957:
04958:                // when the name is only an identifier...we have a message send to "this" (implicit)
04959:
04960:                MessageSend m = newMessageSend();
04961:                m.sourceEnd = this .rParenPos;
04962:                m.sourceStart = (int) ((m.nameSourcePosition = this .identifierPositionStack[this .identifierPtr]) >>> 32);
04963:                m.selector = this .identifierStack[this .identifierPtr--];
04964:                if (this .identifierLengthStack[this .identifierLengthPtr] == 1) {
04965:                    m.receiver = ThisReference.implicitThis();
04966:                    this .identifierLengthPtr--;
04967:                } else {
04968:                    this .identifierLengthStack[this .identifierLengthPtr]--;
04969:                    m.receiver = getUnspecifiedReference();
04970:                    m.sourceStart = m.receiver.sourceStart;
04971:                }
04972:                pushOnExpressionStack(m);
04973:            }
04974:
04975:            protected void consumeMethodInvocationNameWithTypeArguments() {
04976:                // MethodInvocation ::= Name '.' TypeArguments 'Identifier' '(' ArgumentListopt ')'
04977:
04978:                // when the name is only an identifier...we have a message send to "this" (implicit)
04979:
04980:                MessageSend m = newMessageSendWithTypeArguments();
04981:                m.sourceEnd = this .rParenPos;
04982:                m.sourceStart = (int) ((m.nameSourcePosition = this .identifierPositionStack[this .identifierPtr]) >>> 32);
04983:                m.selector = this .identifierStack[this .identifierPtr--];
04984:                this .identifierLengthPtr--;
04985:
04986:                // handle type arguments
04987:                int length = this .genericsLengthStack[this .genericsLengthPtr--];
04988:                this .genericsPtr -= length;
04989:                System.arraycopy(this .genericsStack, this .genericsPtr + 1,
04990:                        m.typeArguments = new TypeReference[length], 0, length);
04991:                intPtr--;
04992:
04993:                m.receiver = getUnspecifiedReference();
04994:                m.sourceStart = m.receiver.sourceStart;
04995:                pushOnExpressionStack(m);
04996:            }
04997:
04998:            protected void consumeMethodInvocationPrimary() {
04999:                //optimize the push/pop
05000:                //MethodInvocation ::= Primary '.' 'Identifier' '(' ArgumentListopt ')'
05001:
05002:                MessageSend m = newMessageSend();
05003:                m.sourceStart = (int) ((m.nameSourcePosition = this .identifierPositionStack[this .identifierPtr]) >>> 32);
05004:                m.selector = this .identifierStack[this .identifierPtr--];
05005:                this .identifierLengthPtr--;
05006:                m.receiver = this .expressionStack[this .expressionPtr];
05007:                m.sourceStart = m.receiver.sourceStart;
05008:                m.sourceEnd = this .rParenPos;
05009:                this .expressionStack[this .expressionPtr] = m;
05010:            }
05011:
05012:            protected void consumeMethodInvocationPrimaryWithTypeArguments() {
05013:                //optimize the push/pop
05014:                //MethodInvocation ::= Primary '.' TypeArguments 'Identifier' '(' ArgumentListopt ')'
05015:
05016:                MessageSend m = newMessageSendWithTypeArguments();
05017:                m.sourceStart = (int) ((m.nameSourcePosition = this .identifierPositionStack[this .identifierPtr]) >>> 32);
05018:                m.selector = this .identifierStack[this .identifierPtr--];
05019:                this .identifierLengthPtr--;
05020:
05021:                // handle type arguments
05022:                int length = this .genericsLengthStack[this .genericsLengthPtr--];
05023:                this .genericsPtr -= length;
05024:                System.arraycopy(this .genericsStack, this .genericsPtr + 1,
05025:                        m.typeArguments = new TypeReference[length], 0, length);
05026:                intPtr--;
05027:
05028:                m.receiver = this .expressionStack[this .expressionPtr];
05029:                m.sourceStart = m.receiver.sourceStart;
05030:                m.sourceEnd = this .rParenPos;
05031:                this .expressionStack[this .expressionPtr] = m;
05032:            }
05033:
05034:            protected void consumeMethodInvocationSuper() {
05035:                // MethodInvocation ::= 'super' '.' 'Identifier' '(' ArgumentListopt ')'
05036:
05037:                MessageSend m = newMessageSend();
05038:                m.sourceStart = this .intStack[this .intPtr--]; // start position of the super keyword
05039:                m.sourceEnd = this .rParenPos;
05040:                m.nameSourcePosition = this .identifierPositionStack[this .identifierPtr];
05041:                m.selector = this .identifierStack[this .identifierPtr--];
05042:                this .identifierLengthPtr--;
05043:                m.receiver = new SuperReference(m.sourceStart, this .endPosition);
05044:                pushOnExpressionStack(m);
05045:            }
05046:
05047:            protected void consumeMethodInvocationSuperWithTypeArguments() {
05048:                // MethodInvocation ::= 'super' '.' TypeArguments 'Identifier' '(' ArgumentListopt ')'
05049:
05050:                MessageSend m = newMessageSendWithTypeArguments();
05051:                intPtr--; // start position of the typeArguments
05052:                m.sourceEnd = this .rParenPos;
05053:                m.nameSourcePosition = this .identifierPositionStack[this .identifierPtr];
05054:                m.selector = this .identifierStack[this .identifierPtr--];
05055:                this .identifierLengthPtr--;
05056:
05057:                // handle type arguments
05058:                int length = this .genericsLengthStack[this .genericsLengthPtr--];
05059:                this .genericsPtr -= length;
05060:                System.arraycopy(this .genericsStack, this .genericsPtr + 1,
05061:                        m.typeArguments = new TypeReference[length], 0, length);
05062:                m.sourceStart = this .intStack[this .intPtr--]; // start position of the super keyword
05063:
05064:                m.receiver = new SuperReference(m.sourceStart, this .endPosition);
05065:                pushOnExpressionStack(m);
05066:            }
05067:
05068:            protected void consumeModifiers() {
05069:                int savedModifiersSourceStart = this .modifiersSourceStart;
05070:                checkComment(); // might update modifiers with AccDeprecated
05071:                pushOnIntStack(this .modifiers); // modifiers
05072:                if (this .modifiersSourceStart >= savedModifiersSourceStart) {
05073:                    this .modifiersSourceStart = savedModifiersSourceStart;
05074:                }
05075:                pushOnIntStack(this .modifiersSourceStart);
05076:                resetModifiers();
05077:            }
05078:
05079:            protected void consumeModifiers2() {
05080:                this .expressionLengthStack[this .expressionLengthPtr - 1] += this .expressionLengthStack[this .expressionLengthPtr--];
05081:            }
05082:
05083:            protected void consumeNameArrayType() {
05084:                pushOnGenericsLengthStack(0); // handle type arguments
05085:                pushOnGenericsIdentifiersLengthStack(this .identifierLengthStack[this .identifierLengthPtr]);
05086:            }
05087:
05088:            protected void consumeNestedMethod() {
05089:                // NestedMethod ::= $empty
05090:                jumpOverMethodBody();
05091:                this .nestedMethod[this .nestedType]++;
05092:                pushOnIntStack(this .scanner.currentPosition);
05093:                consumeOpenBlock();
05094:            }
05095:
05096:            protected void consumeNestedType() {
05097:                // NestedType ::= $empty
05098:                int length = this .nestedMethod.length;
05099:                if (++this .nestedType >= length) {
05100:                    System
05101:                            .arraycopy(this .nestedMethod, 0,
05102:                                    this .nestedMethod = new int[length + 30],
05103:                                    0, length);
05104:                    // increase the size of the variablesCounter as well. It has to be consistent with the size of the nestedMethod collection
05105:                    System.arraycopy(this .variablesCounter, 0,
05106:                            this .variablesCounter = new int[length + 30], 0,
05107:                            length);
05108:                }
05109:                this .nestedMethod[this .nestedType] = 0;
05110:                this .variablesCounter[this .nestedType] = 0;
05111:            }
05112:
05113:            protected void consumeNormalAnnotation() {
05114:                // NormalAnnotation ::= '@' Name '(' MemberValuePairsopt ')'
05115:                NormalAnnotation normalAnnotation = null;
05116:                TypeReference typeReference = this .getAnnotationType();
05117:                normalAnnotation = new NormalAnnotation(typeReference,
05118:                        this .intStack[this .intPtr--]);
05119:                int length;
05120:                if ((length = this .astLengthStack[this .astLengthPtr--]) != 0) {
05121:                    System
05122:                            .arraycopy(
05123:                                    this .astStack,
05124:                                    (this .astPtr -= length) + 1,
05125:                                    normalAnnotation.memberValuePairs = new MemberValuePair[length],
05126:                                    0, length);
05127:                }
05128:                normalAnnotation.declarationSourceEnd = this .rParenPos;
05129:                pushOnExpressionStack(normalAnnotation);
05130:
05131:                if (this .currentElement != null) {
05132:                    annotationRecoveryCheckPoint(normalAnnotation.sourceStart,
05133:                            normalAnnotation.declarationSourceEnd);
05134:                }
05135:
05136:                if (!this .statementRecoveryActivated
05137:                        && options.sourceLevel < ClassFileConstants.JDK1_5
05138:                        && this .lastErrorEndPositionBeforeRecovery < this .scanner.currentPosition) {
05139:                    this .problemReporter().invalidUsageOfAnnotation(
05140:                            normalAnnotation);
05141:                }
05142:                this .recordStringLiterals = true;
05143:            }
05144:
05145:            protected void consumeOneDimLoop() {
05146:                // OneDimLoop ::= '[' ']'
05147:                this .dimensions++;
05148:            }
05149:
05150:            protected void consumeOnlySynchronized() {
05151:                // OnlySynchronized ::= 'synchronized'
05152:                pushOnIntStack(this .synchronizedBlockSourceStart);
05153:                resetModifiers();
05154:                this .expressionLengthPtr--;
05155:            }
05156:
05157:            protected void consumeOnlyTypeArguments() {
05158:                if (!this .statementRecoveryActivated
05159:                        && options.sourceLevel < ClassFileConstants.JDK1_5
05160:                        && this .lastErrorEndPositionBeforeRecovery < this .scanner.currentPosition) {
05161:                    int length = this .genericsLengthStack[this .genericsLengthPtr];
05162:                    this 
05163:                            .problemReporter()
05164:                            .invalidUsageOfTypeArguments(
05165:                                    (TypeReference) this .genericsStack[this .genericsPtr
05166:                                            - length + 1],
05167:                                    (TypeReference) this .genericsStack[this .genericsPtr]);
05168:                }
05169:            }
05170:
05171:            protected void consumeOnlyTypeArgumentsForCastExpression() {
05172:                // OnlyTypeArgumentsForCastExpression ::= OnlyTypeArguments
05173:            }
05174:
05175:            protected void consumeOpenBlock() {
05176:                // OpenBlock ::= $empty
05177:
05178:                pushOnIntStack(this .scanner.startPosition);
05179:                int stackLength = this .realBlockStack.length;
05180:                if (++this .realBlockPtr >= stackLength) {
05181:                    System.arraycopy(this .realBlockStack, 0,
05182:                            this .realBlockStack = new int[stackLength
05183:                                    + StackIncrement], 0, stackLength);
05184:                }
05185:                this .realBlockStack[this .realBlockPtr] = 0;
05186:            }
05187:
05188:            protected void consumePackageComment() {
05189:                // get possible comment for syntax since 1.5
05190:                if (options.sourceLevel >= ClassFileConstants.JDK1_5) {
05191:                    checkComment();
05192:                    resetModifiers();
05193:                }
05194:            }
05195:
05196:            protected void consumePackageDeclaration() {
05197:                // PackageDeclaration ::= 'package' Name ';'
05198:                /* build an ImportRef build from the last name 
05199:                stored in the identifier stack. */
05200:
05201:                ImportReference impt = this .compilationUnit.currentPackage;
05202:                this .compilationUnit.javadoc = this .javadoc;
05203:                this .javadoc = null;
05204:                // flush comments defined prior to import statements
05205:                impt.declarationEnd = this .endStatementPosition;
05206:                impt.declarationSourceEnd = this 
05207:                        .flushCommentsDefinedPriorTo(impt.declarationSourceEnd);
05208:            }
05209:
05210:            protected void consumePackageDeclarationName() {
05211:                // PackageDeclarationName ::= 'package' Name
05212:                /* build an ImportRef build from the last name 
05213:                stored in the identifier stack. */
05214:
05215:                ImportReference impt;
05216:                int length;
05217:                char[][] tokens = new char[length = this .identifierLengthStack[this .identifierLengthPtr--]][];
05218:                this .identifierPtr -= length;
05219:                long[] positions = new long[length];
05220:                System.arraycopy(this .identifierStack, ++this .identifierPtr,
05221:                        tokens, 0, length);
05222:                System.arraycopy(this .identifierPositionStack,
05223:                        this .identifierPtr--, positions, 0, length);
05224:
05225:                impt = new ImportReference(tokens, positions, true,
05226:                        ClassFileConstants.AccDefault);
05227:                this .compilationUnit.currentPackage = impt;
05228:
05229:                if (this .currentToken == TokenNameSEMICOLON) {
05230:                    impt.declarationSourceEnd = this .scanner.currentPosition - 1;
05231:                } else {
05232:                    impt.declarationSourceEnd = impt.sourceEnd;
05233:                }
05234:                impt.declarationEnd = impt.declarationSourceEnd;
05235:                //this.endPosition is just before the ;
05236:                impt.declarationSourceStart = this .intStack[this .intPtr--];
05237:
05238:                // get possible comment source start
05239:                if (this .javadoc != null) {
05240:                    impt.declarationSourceStart = this .javadoc.sourceStart;
05241:                }
05242:
05243:                // recovery
05244:                if (this .currentElement != null) {
05245:                    this .lastCheckPoint = impt.declarationSourceEnd + 1;
05246:                    this .restartRecovery = true; // used to avoid branching back into the regular automaton		
05247:                }
05248:            }
05249:
05250:            protected void consumePackageDeclarationNameWithModifiers() {
05251:                // PackageDeclarationName ::= Modifiers 'package' Name
05252:                /* build an ImportRef build from the last name 
05253:                stored in the identifier stack. */
05254:
05255:                ImportReference impt;
05256:                int length;
05257:                char[][] tokens = new char[length = this .identifierLengthStack[this .identifierLengthPtr--]][];
05258:                this .identifierPtr -= length;
05259:                long[] positions = new long[length];
05260:                System.arraycopy(this .identifierStack, ++this .identifierPtr,
05261:                        tokens, 0, length);
05262:                System.arraycopy(this .identifierPositionStack,
05263:                        this .identifierPtr--, positions, 0, length);
05264:
05265:                int packageModifiersSourceStart = this .intStack[this .intPtr--]; // we don't need the modifiers start
05266:                int packageModifiers = this .intStack[this .intPtr--];
05267:
05268:                impt = new ImportReference(tokens, positions, true,
05269:                        packageModifiers);
05270:                this .compilationUnit.currentPackage = impt;
05271:                // consume annotations
05272:                if ((length = this .expressionLengthStack[this .expressionLengthPtr--]) != 0) {
05273:                    System.arraycopy(this .expressionStack,
05274:                            (this .expressionPtr -= length) + 1,
05275:                            impt.annotations = new Annotation[length], 0,
05276:                            length);
05277:                    impt.declarationSourceStart = packageModifiersSourceStart;
05278:                    intPtr--; // we don't need the position of the 'package keyword
05279:                } else {
05280:                    impt.declarationSourceStart = this .intStack[this .intPtr--];
05281:                    // get possible comment source start
05282:                    if (this .javadoc != null) {
05283:                        impt.declarationSourceStart = this .javadoc.sourceStart;
05284:                    }
05285:                }
05286:
05287:                if (this .currentToken == TokenNameSEMICOLON) {
05288:                    impt.declarationSourceEnd = this .scanner.currentPosition - 1;
05289:                } else {
05290:                    impt.declarationSourceEnd = impt.sourceEnd;
05291:                }
05292:                impt.declarationEnd = impt.declarationSourceEnd;
05293:
05294:                // recovery
05295:                if (this .currentElement != null) {
05296:                    this .lastCheckPoint = impt.declarationSourceEnd + 1;
05297:                    this .restartRecovery = true; // used to avoid branching back into the regular automaton		
05298:                }
05299:            }
05300:
05301:            protected void consumePostfixExpression() {
05302:                // PostfixExpression ::= Name
05303:                pushOnExpressionStack(getUnspecifiedReferenceOptimized());
05304:            }
05305:
05306:            protected void consumePrimaryNoNewArray() {
05307:                // PrimaryNoNewArray ::=  PushLPAREN Expression PushRPAREN 
05308:                final Expression parenthesizedExpression = this .expressionStack[this .expressionPtr];
05309:                updateSourcePosition(parenthesizedExpression);
05310:                int numberOfParenthesis = (parenthesizedExpression.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT;
05311:                parenthesizedExpression.bits &= ~ASTNode.ParenthesizedMASK;
05312:                parenthesizedExpression.bits |= (numberOfParenthesis + 1) << ASTNode.ParenthesizedSHIFT;
05313:            }
05314:
05315:            protected void consumePrimaryNoNewArrayArrayType() {
05316:                // PrimaryNoNewArray ::= Name Dims '.' 'class'
05317:                this .intPtr--; // remove the class start position
05318:
05319:                pushOnGenericsIdentifiersLengthStack(this .identifierLengthStack[this .identifierLengthPtr]);
05320:                pushOnGenericsLengthStack(0);
05321:
05322:                pushOnExpressionStack(new ClassLiteralAccess(
05323:                        this .intStack[this .intPtr--],
05324:                        getTypeReference(this .intStack[this .intPtr--])));
05325:            }
05326:
05327:            protected void consumePrimaryNoNewArrayName() {
05328:                // PrimaryNoNewArray ::= Name '.' 'class'
05329:                this .intPtr--; // remove the class start position
05330:
05331:                // handle type arguments
05332:                pushOnGenericsIdentifiersLengthStack(this .identifierLengthStack[this .identifierLengthPtr]);
05333:                pushOnGenericsLengthStack(0);
05334:                TypeReference typeReference = getTypeReference(0);
05335:
05336:                pushOnExpressionStack(new ClassLiteralAccess(
05337:                        this .intStack[this .intPtr--], typeReference));
05338:            }
05339:
05340:            protected void consumePrimaryNoNewArrayNameSuper() {
05341:                // PrimaryNoNewArray ::= Name '.' 'super'
05342:                // handle type arguments
05343:                pushOnGenericsIdentifiersLengthStack(this .identifierLengthStack[this .identifierLengthPtr]);
05344:                pushOnGenericsLengthStack(0);
05345:                TypeReference typeReference = getTypeReference(0);
05346:
05347:                pushOnExpressionStack(new QualifiedSuperReference(
05348:                        typeReference, this .intStack[this .intPtr--],
05349:                        this .endPosition));
05350:            }
05351:
05352:            protected void consumePrimaryNoNewArrayNameThis() {
05353:                // PrimaryNoNewArray ::= Name '.' 'this'
05354:                // handle type arguments
05355:                pushOnGenericsIdentifiersLengthStack(this .identifierLengthStack[this .identifierLengthPtr]);
05356:                pushOnGenericsLengthStack(0); // handle type arguments
05357:
05358:                TypeReference typeReference = getTypeReference(0);
05359:
05360:                pushOnExpressionStack(new QualifiedThisReference(typeReference,
05361:                        this .intStack[this .intPtr--], this .endPosition));
05362:            }
05363:
05364:            protected void consumePrimaryNoNewArrayPrimitiveArrayType() {
05365:                // PrimaryNoNewArray ::= PrimitiveType Dims '.' 'class'
05366:                this .intPtr--; // remove the class start position
05367:                pushOnExpressionStack(new ClassLiteralAccess(
05368:                        this .intStack[this .intPtr--],
05369:                        getTypeReference(this .intStack[this .intPtr--])));
05370:            }
05371:
05372:            protected void consumePrimaryNoNewArrayPrimitiveType() {
05373:                // PrimaryNoNewArray ::= PrimitiveType '.' 'class'
05374:                this .intPtr--; // remove the class start position
05375:                pushOnExpressionStack(new ClassLiteralAccess(
05376:                        this .intStack[this .intPtr--], getTypeReference(0)));
05377:            }
05378:
05379:            protected void consumePrimaryNoNewArrayThis() {
05380:                // PrimaryNoNewArray ::= 'this'
05381:                pushOnExpressionStack(new ThisReference(
05382:                        this .intStack[this .intPtr--], this .endPosition));
05383:            }
05384:
05385:            protected void consumePrimaryNoNewArrayWithName() {
05386:                // PrimaryNoNewArray ::=  PushLPAREN Expression PushRPAREN 
05387:                pushOnExpressionStack(getUnspecifiedReferenceOptimized());
05388:                final Expression parenthesizedExpression = this .expressionStack[this .expressionPtr];
05389:                updateSourcePosition(parenthesizedExpression);
05390:                int numberOfParenthesis = (parenthesizedExpression.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT;
05391:                parenthesizedExpression.bits &= ~ASTNode.ParenthesizedMASK;
05392:                parenthesizedExpression.bits |= (numberOfParenthesis + 1) << ASTNode.ParenthesizedSHIFT;
05393:            }
05394:
05395:            protected void consumePrimitiveArrayType() {
05396:                // nothing to do
05397:                // Will be consume by a getTypeRefence call
05398:            }
05399:
05400:            protected void consumePrimitiveType() {
05401:                // Type ::= PrimitiveType
05402:                pushOnIntStack(0);
05403:            }
05404:
05405:            protected void consumePushLeftBrace() {
05406:                pushOnIntStack(this .endPosition); // modifiers
05407:            }
05408:
05409:            protected void consumePushRealModifiers() {
05410:                checkComment(); // might update modifiers with AccDeprecated
05411:                pushOnIntStack(this .modifiers); // modifiers
05412:                pushOnIntStack(this .modifiersSourceStart);
05413:                resetModifiers();
05414:            }
05415:
05416:            protected void consumePushModifiers() {
05417:                pushOnIntStack(this .modifiers); // modifiers
05418:                pushOnIntStack(this .modifiersSourceStart);
05419:                resetModifiers();
05420:                pushOnExpressionStackLengthStack(0);
05421:            }
05422:
05423:            protected void consumePushModifiersForHeader() {
05424:                checkComment(); // might update modifiers with AccDeprecated
05425:                pushOnIntStack(this .modifiers); // modifiers
05426:                pushOnIntStack(this .modifiersSourceStart);
05427:                resetModifiers();
05428:                pushOnExpressionStackLengthStack(0);
05429:            }
05430:
05431:            protected void consumePushPosition() {
05432:                // for source managment purpose
05433:                // PushPosition ::= $empty
05434:                pushOnIntStack(this .endPosition);
05435:            }
05436:
05437:            protected void consumeQualifiedName() {
05438:                // QualifiedName ::= Name '.' SimpleName 
05439:                /*back from the recursive loop of QualifiedName.
05440:                Updates identifier length into the length stack*/
05441:
05442:                this .identifierLengthStack[--this .identifierLengthPtr]++;
05443:            }
05444:
05445:            protected void consumeRecoveryMethodHeaderName() {
05446:                // this method is call only inside recovery
05447:                boolean isAnnotationMethod = false;
05448:                if (this .currentElement instanceof  RecoveredType) {
05449:                    isAnnotationMethod = (((RecoveredType) this .currentElement).typeDeclaration.modifiers & ClassFileConstants.AccAnnotation) != 0;
05450:                } else {
05451:                    RecoveredType recoveredType = this .currentElement
05452:                            .enclosingType();
05453:                    if (recoveredType != null) {
05454:                        isAnnotationMethod = (recoveredType.typeDeclaration.modifiers & ClassFileConstants.AccAnnotation) != 0;
05455:                    }
05456:                }
05457:                this .consumeMethodHeaderName(isAnnotationMethod);
05458:            }
05459:
05460:            protected void consumeRecoveryMethodHeaderNameWithTypeParameters() {
05461:                // this method is call only inside recovery
05462:                boolean isAnnotationMethod = false;
05463:                if (this .currentElement instanceof  RecoveredType) {
05464:                    isAnnotationMethod = (((RecoveredType) this .currentElement).typeDeclaration.modifiers & ClassFileConstants.AccAnnotation) != 0;
05465:                } else {
05466:                    RecoveredType recoveredType = this .currentElement
05467:                            .enclosingType();
05468:                    if (recoveredType != null) {
05469:                        isAnnotationMethod = (recoveredType.typeDeclaration.modifiers & ClassFileConstants.AccAnnotation) != 0;
05470:                    }
05471:                }
05472:                this 
05473:                        .consumeMethodHeaderNameWithTypeParameters(isAnnotationMethod);
05474:            }
05475:
05476:            protected void consumeReduceImports() {
05477:                // Consume imports
05478:                int length;
05479:                if ((length = this .astLengthStack[this .astLengthPtr--]) != 0) {
05480:                    this .astPtr -= length;
05481:                    System
05482:                            .arraycopy(
05483:                                    this .astStack,
05484:                                    this .astPtr + 1,
05485:                                    this .compilationUnit.imports = new ImportReference[length],
05486:                                    0, length);
05487:                }
05488:            }
05489:
05490:            protected void consumeReferenceType() {
05491:                pushOnIntStack(0); // handle array type
05492:            }
05493:
05494:            protected void consumeReferenceType1() {
05495:                pushOnGenericsStack(getTypeReference(this .intStack[this .intPtr--]));
05496:            }
05497:
05498:            protected void consumeReferenceType2() {
05499:                pushOnGenericsStack(getTypeReference(this .intStack[this .intPtr--]));
05500:            }
05501:
05502:            protected void consumeReferenceType3() {
05503:                pushOnGenericsStack(getTypeReference(this .intStack[this .intPtr--]));
05504:            }
05505:
05506:            protected void consumeRestoreDiet() {
05507:                // RestoreDiet ::= $empty
05508:                this .dietInt--;
05509:            }
05510:
05511:            protected void consumeRightParen() {
05512:                // PushRPAREN ::= ')'
05513:                pushOnIntStack(this .rParenPos);
05514:            }
05515:
05516:            // This method is part of an automatic generation : do NOT edit-modify  
05517:            protected void consumeRule(int act) {
05518:                switch (act) {
05519:                case 30:
05520:                    if (DEBUG) {
05521:                        System.out.println("Type ::= PrimitiveType");} //$NON-NLS-1$
05522:                    consumePrimitiveType();
05523:                    break;
05524:
05525:                case 44:
05526:                    if (DEBUG) {
05527:                        System.out
05528:                                .println("ReferenceType ::= ClassOrInterfaceType");} //$NON-NLS-1$
05529:                    consumeReferenceType();
05530:                    break;
05531:
05532:                case 48:
05533:                    if (DEBUG) {
05534:                        System.out.println("ClassOrInterface ::= Name");} //$NON-NLS-1$
05535:                    consumeClassOrInterfaceName();
05536:                    break;
05537:
05538:                case 49:
05539:                    if (DEBUG) {
05540:                        System.out
05541:                                .println("ClassOrInterface ::= GenericType DOT Name");} //$NON-NLS-1$
05542:                    consumeClassOrInterface();
05543:                    break;
05544:
05545:                case 50:
05546:                    if (DEBUG) {
05547:                        System.out
05548:                                .println("GenericType ::= ClassOrInterface TypeArguments");} //$NON-NLS-1$
05549:                    consumeGenericType();
05550:                    break;
05551:
05552:                case 51:
05553:                    if (DEBUG) {
05554:                        System.out
05555:                                .println("ArrayTypeWithTypeArgumentsName ::= GenericType DOT Name");} //$NON-NLS-1$
05556:                    consumeArrayTypeWithTypeArgumentsName();
05557:                    break;
05558:
05559:                case 52:
05560:                    if (DEBUG) {
05561:                        System.out.println("ArrayType ::= PrimitiveType Dims");} //$NON-NLS-1$
05562:                    consumePrimitiveArrayType();
05563:                    break;
05564:
05565:                case 53:
05566:                    if (DEBUG) {
05567:                        System.out.println("ArrayType ::= Name Dims");} //$NON-NLS-1$
05568:                    consumeNameArrayType();
05569:                    break;
05570:
05571:                case 54:
05572:                    if (DEBUG) {
05573:                        System.out
05574:                                .println("ArrayType ::= ArrayTypeWithTypeArgumentsName Dims");} //$NON-NLS-1$
05575:                    consumeGenericTypeNameArrayType();
05576:                    break;
05577:
05578:                case 55:
05579:                    if (DEBUG) {
05580:                        System.out.println("ArrayType ::= GenericType Dims");} //$NON-NLS-1$
05581:                    consumeGenericTypeArrayType();
05582:                    break;
05583:
05584:                case 60:
05585:                    if (DEBUG) {
05586:                        System.out
05587:                                .println("QualifiedName ::= Name DOT SimpleName");} //$NON-NLS-1$
05588:                    consumeQualifiedName();
05589:                    break;
05590:
05591:                case 61:
05592:                    if (DEBUG) {
05593:                        System.out
05594:                                .println("CompilationUnit ::= EnterCompilationUnit...");} //$NON-NLS-1$
05595:                    consumeCompilationUnit();
05596:                    break;
05597:
05598:                case 62:
05599:                    if (DEBUG) {
05600:                        System.out
05601:                                .println("InternalCompilationUnit ::= PackageDeclaration");} //$NON-NLS-1$
05602:                    consumeInternalCompilationUnit();
05603:                    break;
05604:
05605:                case 63:
05606:                    if (DEBUG) {
05607:                        System.out
05608:                                .println("InternalCompilationUnit ::= PackageDeclaration...");} //$NON-NLS-1$
05609:                    consumeInternalCompilationUnit();
05610:                    break;
05611:
05612:                case 64:
05613:                    if (DEBUG) {
05614:                        System.out
05615:                                .println("InternalCompilationUnit ::= PackageDeclaration...");} //$NON-NLS-1$
05616:                    consumeInternalCompilationUnitWithTypes();
05617:                    break;
05618:
05619:                case 65:
05620:                    if (DEBUG) {
05621:                        System.out
05622:                                .println("InternalCompilationUnit ::= PackageDeclaration...");} //$NON-NLS-1$
05623:                    consumeInternalCompilationUnitWithTypes();
05624:                    break;
05625:
05626:                case 66:
05627:                    if (DEBUG) {
05628:                        System.out
05629:                                .println("InternalCompilationUnit ::= ImportDeclarations...");} //$NON-NLS-1$
05630:                    consumeInternalCompilationUnit();
05631:                    break;
05632:
05633:                case 67:
05634:                    if (DEBUG) {
05635:                        System.out
05636:                                .println("InternalCompilationUnit ::= TypeDeclarations");} //$NON-NLS-1$
05637:                    consumeInternalCompilationUnitWithTypes();
05638:                    break;
05639:
05640:                case 68:
05641:                    if (DEBUG) {
05642:                        System.out
05643:                                .println("InternalCompilationUnit ::= ImportDeclarations...");} //$NON-NLS-1$
05644:                    consumeInternalCompilationUnitWithTypes();
05645:                    break;
05646:
05647:                case 69:
05648:                    if (DEBUG) {
05649:                        System.out.println("InternalCompilationUnit ::=");} //$NON-NLS-1$
05650:                    consumeEmptyInternalCompilationUnit();
05651:                    break;
05652:
05653:                case 70:
05654:                    if (DEBUG) {
05655:                        System.out.println("ReduceImports ::=");} //$NON-NLS-1$
05656:                    consumeReduceImports();
05657:                    break;
05658:
05659:                case 71:
05660:                    if (DEBUG) {
05661:                        System.out.println("EnterCompilationUnit ::=");} //$NON-NLS-1$
05662:                    consumeEnterCompilationUnit();
05663:                    break;
05664:
05665:                case 87:
05666:                    if (DEBUG) {
05667:                        System.out
05668:                                .println("CatchHeader ::= catch LPAREN FormalParameter RPAREN...");} //$NON-NLS-1$
05669:                    consumeCatchHeader();
05670:                    break;
05671:
05672:                case 89:
05673:                    if (DEBUG) {
05674:                        System.out
05675:                                .println("ImportDeclarations ::= ImportDeclarations...");} //$NON-NLS-1$
05676:                    consumeImportDeclarations();
05677:                    break;
05678:
05679:                case 91:
05680:                    if (DEBUG) {
05681:                        System.out
05682:                                .println("TypeDeclarations ::= TypeDeclarations TypeDeclaration");} //$NON-NLS-1$
05683:                    consumeTypeDeclarations();
05684:                    break;
05685:
05686:                case 92:
05687:                    if (DEBUG) {
05688:                        System.out
05689:                                .println("PackageDeclaration ::= PackageDeclarationName SEMICOLON");} //$NON-NLS-1$
05690:                    consumePackageDeclaration();
05691:                    break;
05692:
05693:                case 93:
05694:                    if (DEBUG) {
05695:                        System.out
05696:                                .println("PackageDeclarationName ::= Modifiers package...");} //$NON-NLS-1$
05697:                    consumePackageDeclarationNameWithModifiers();
05698:                    break;
05699:
05700:                case 94:
05701:                    if (DEBUG) {
05702:                        System.out
05703:                                .println("PackageDeclarationName ::= PackageComment package Name");} //$NON-NLS-1$
05704:                    consumePackageDeclarationName();
05705:                    break;
05706:
05707:                case 95:
05708:                    if (DEBUG) {
05709:                        System.out.println("PackageComment ::=");} //$NON-NLS-1$
05710:                    consumePackageComment();
05711:                    break;
05712:
05713:                case 100:
05714:                    if (DEBUG) {
05715:                        System.out
05716:                                .println("SingleTypeImportDeclaration ::=...");} //$NON-NLS-1$
05717:                    consumeImportDeclaration();
05718:                    break;
05719:
05720:                case 101:
05721:                    if (DEBUG) {
05722:                        System.out
05723:                                .println("SingleTypeImportDeclarationName ::= import Name");} //$NON-NLS-1$
05724:                    consumeSingleTypeImportDeclarationName();
05725:                    break;
05726:
05727:                case 102:
05728:                    if (DEBUG) {
05729:                        System.out
05730:                                .println("TypeImportOnDemandDeclaration ::=...");} //$NON-NLS-1$
05731:                    consumeImportDeclaration();
05732:                    break;
05733:
05734:                case 103:
05735:                    if (DEBUG) {
05736:                        System.out
05737:                                .println("TypeImportOnDemandDeclarationName ::= import Name DOT...");} //$NON-NLS-1$
05738:                    consumeTypeImportOnDemandDeclarationName();
05739:                    break;
05740:
05741:                case 106:
05742:                    if (DEBUG) {
05743:                        System.out.println("TypeDeclaration ::= SEMICOLON");} //$NON-NLS-1$
05744:                    consumeEmptyTypeDeclaration();
05745:                    break;
05746:
05747:                case 110:
05748:                    if (DEBUG) {
05749:                        System.out.println("Modifiers ::= Modifiers Modifier");} //$NON-NLS-1$
05750:                    consumeModifiers2();
05751:                    break;
05752:
05753:                case 122:
05754:                    if (DEBUG) {
05755:                        System.out.println("Modifier ::= Annotation");} //$NON-NLS-1$
05756:                    consumeAnnotationAsModifier();
05757:                    break;
05758:
05759:                case 123:
05760:                    if (DEBUG) {
05761:                        System.out
05762:                                .println("ClassDeclaration ::= ClassHeader ClassBody");} //$NON-NLS-1$
05763:                    consumeClassDeclaration();
05764:                    break;
05765:
05766:                case 124:
05767:                    if (DEBUG) {
05768:                        System.out
05769:                                .println("ClassHeader ::= ClassHeaderName ClassHeaderExtendsopt...");} //$NON-NLS-1$
05770:                    consumeClassHeader();
05771:                    break;
05772:
05773:                case 125:
05774:                    if (DEBUG) {
05775:                        System.out
05776:                                .println("ClassHeaderName ::= ClassHeaderName1 TypeParameters");} //$NON-NLS-1$
05777:                    consumeTypeHeaderNameWithTypeParameters();
05778:                    break;
05779:
05780:                case 127:
05781:                    if (DEBUG) {
05782:                        System.out
05783:                                .println("ClassHeaderName1 ::= Modifiersopt class Identifier");} //$NON-NLS-1$
05784:                    consumeClassHeaderName1();
05785:                    break;
05786:
05787:                case 128:
05788:                    if (DEBUG) {
05789:                        System.out
05790:                                .println("ClassHeaderExtends ::= extends ClassType");} //$NON-NLS-1$
05791:                    consumeClassHeaderExtends();
05792:                    break;
05793:
05794:                case 129:
05795:                    if (DEBUG) {
05796:                        System.out
05797:                                .println("ClassHeaderImplements ::= implements InterfaceTypeList");} //$NON-NLS-1$
05798:                    consumeClassHeaderImplements();
05799:                    break;
05800:
05801:                case 131:
05802:                    if (DEBUG) {
05803:                        System.out
05804:                                .println("InterfaceTypeList ::= InterfaceTypeList COMMA...");} //$NON-NLS-1$
05805:                    consumeInterfaceTypeList();
05806:                    break;
05807:
05808:                case 132:
05809:                    if (DEBUG) {
05810:                        System.out
05811:                                .println("InterfaceType ::= ClassOrInterfaceType");} //$NON-NLS-1$
05812:                    consumeInterfaceType();
05813:                    break;
05814:
05815:                case 135:
05816:                    if (DEBUG) {
05817:                        System.out
05818:                                .println("ClassBodyDeclarations ::= ClassBodyDeclarations...");} //$NON-NLS-1$
05819:                    consumeClassBodyDeclarations();
05820:                    break;
05821:
05822:                case 139:
05823:                    if (DEBUG) {
05824:                        System.out
05825:                                .println("ClassBodyDeclaration ::= Diet NestedMethod...");} //$NON-NLS-1$
05826:                    consumeClassBodyDeclaration();
05827:                    break;
05828:
05829:                case 140:
05830:                    if (DEBUG) {
05831:                        System.out.println("Diet ::=");} //$NON-NLS-1$
05832:                    consumeDiet();
05833:                    break;
05834:
05835:                case 141:
05836:                    if (DEBUG) {
05837:                        System.out
05838:                                .println("Initializer ::= Diet NestedMethod CreateInitializer...");} //$NON-NLS-1$
05839:                    consumeClassBodyDeclaration();
05840:                    break;
05841:
05842:                case 142:
05843:                    if (DEBUG) {
05844:                        System.out.println("CreateInitializer ::=");} //$NON-NLS-1$
05845:                    consumeCreateInitializer();
05846:                    break;
05847:
05848:                case 149:
05849:                    if (DEBUG) {
05850:                        System.out
05851:                                .println("ClassMemberDeclaration ::= SEMICOLON");} //$NON-NLS-1$
05852:                    consumeEmptyTypeDeclaration();
05853:                    break;
05854:
05855:                case 152:
05856:                    if (DEBUG) {
05857:                        System.out
05858:                                .println("FieldDeclaration ::= Modifiersopt Type...");} //$NON-NLS-1$
05859:                    consumeFieldDeclaration();
05860:                    break;
05861:
05862:                case 154:
05863:                    if (DEBUG) {
05864:                        System.out
05865:                                .println("VariableDeclarators ::= VariableDeclarators COMMA...");} //$NON-NLS-1$
05866:                    consumeVariableDeclarators();
05867:                    break;
05868:
05869:                case 157:
05870:                    if (DEBUG) {
05871:                        System.out.println("EnterVariable ::=");} //$NON-NLS-1$
05872:                    consumeEnterVariable();
05873:                    break;
05874:
05875:                case 158:
05876:                    if (DEBUG) {
05877:                        System.out
05878:                                .println("ExitVariableWithInitialization ::=");} //$NON-NLS-1$
05879:                    consumeExitVariableWithInitialization();
05880:                    break;
05881:
05882:                case 159:
05883:                    if (DEBUG) {
05884:                        System.out
05885:                                .println("ExitVariableWithoutInitialization ::=");} //$NON-NLS-1$
05886:                    consumeExitVariableWithoutInitialization();
05887:                    break;
05888:
05889:                case 160:
05890:                    if (DEBUG) {
05891:                        System.out.println("ForceNoDiet ::=");} //$NON-NLS-1$
05892:                    consumeForceNoDiet();
05893:                    break;
05894:
05895:                case 161:
05896:                    if (DEBUG) {
05897:                        System.out.println("RestoreDiet ::=");} //$NON-NLS-1$
05898:                    consumeRestoreDiet();
05899:                    break;
05900:
05901:                case 166:
05902:                    if (DEBUG) {
05903:                        System.out
05904:                                .println("MethodDeclaration ::= MethodHeader MethodBody");} //$NON-NLS-1$
05905:                    // set to true to consume a method with a body
05906:                    consumeMethodDeclaration(true);
05907:                    break;
05908:
05909:                case 167:
05910:                    if (DEBUG) {
05911:                        System.out
05912:                                .println("AbstractMethodDeclaration ::= MethodHeader SEMICOLON");} //$NON-NLS-1$
05913:                    // set to false to consume a method without body
05914:                    consumeMethodDeclaration(false);
05915:                    break;
05916:
05917:                case 168:
05918:                    if (DEBUG) {
05919:                        System.out
05920:                                .println("MethodHeader ::= MethodHeaderName FormalParameterListopt");} //$NON-NLS-1$
05921:                    consumeMethodHeader();
05922:                    break;
05923:
05924:                case 169:
05925:                    if (DEBUG) {
05926:                        System.out
05927:                                .println("MethodHeaderName ::= Modifiersopt TypeParameters Type...");} //$NON-NLS-1$
05928:                    consumeMethodHeaderNameWithTypeParameters(false);
05929:                    break;
05930:
05931:                case 170:
05932:                    if (DEBUG) {
05933:                        System.out
05934:                                .println("MethodHeaderName ::= Modifiersopt Type Identifier LPAREN");} //$NON-NLS-1$
05935:                    consumeMethodHeaderName(false);
05936:                    break;
05937:
05938:                case 171:
05939:                    if (DEBUG) {
05940:                        System.out.println("MethodHeaderRightParen ::= RPAREN");} //$NON-NLS-1$
05941:                    consumeMethodHeaderRightParen();
05942:                    break;
05943:
05944:                case 172:
05945:                    if (DEBUG) {
05946:                        System.out
05947:                                .println("MethodHeaderExtendedDims ::= Dimsopt");} //$NON-NLS-1$
05948:                    consumeMethodHeaderExtendedDims();
05949:                    break;
05950:
05951:                case 173:
05952:                    if (DEBUG) {
05953:                        System.out
05954:                                .println("MethodHeaderThrowsClause ::= throws ClassTypeList");} //$NON-NLS-1$
05955:                    consumeMethodHeaderThrowsClause();
05956:                    break;
05957:
05958:                case 174:
05959:                    if (DEBUG) {
05960:                        System.out
05961:                                .println("ConstructorHeader ::= ConstructorHeaderName...");} //$NON-NLS-1$
05962:                    consumeConstructorHeader();
05963:                    break;
05964:
05965:                case 175:
05966:                    if (DEBUG) {
05967:                        System.out
05968:                                .println("ConstructorHeaderName ::= Modifiersopt TypeParameters...");} //$NON-NLS-1$
05969:                    consumeConstructorHeaderNameWithTypeParameters();
05970:                    break;
05971:
05972:                case 176:
05973:                    if (DEBUG) {
05974:                        System.out
05975:                                .println("ConstructorHeaderName ::= Modifiersopt Identifier LPAREN");} //$NON-NLS-1$
05976:                    consumeConstructorHeaderName();
05977:                    break;
05978:
05979:                case 178:
05980:                    if (DEBUG) {
05981:                        System.out
05982:                                .println("FormalParameterList ::= FormalParameterList COMMA...");} //$NON-NLS-1$
05983:                    consumeFormalParameterList();
05984:                    break;
05985:
05986:                case 179:
05987:                    if (DEBUG) {
05988:                        System.out
05989:                                .println("FormalParameter ::= Modifiersopt Type...");} //$NON-NLS-1$
05990:                    consumeFormalParameter(false);
05991:                    break;
05992:
05993:                case 180:
05994:                    if (DEBUG) {
05995:                        System.out
05996:                                .println("FormalParameter ::= Modifiersopt Type ELLIPSIS...");} //$NON-NLS-1$
05997:                    consumeFormalParameter(true);
05998:                    break;
05999:
06000:                case 182:
06001:                    if (DEBUG) {
06002:                        System.out
06003:                                .println("ClassTypeList ::= ClassTypeList COMMA ClassTypeElt");} //$NON-NLS-1$
06004:                    consumeClassTypeList();
06005:                    break;
06006:
06007:                case 183:
06008:                    if (DEBUG) {
06009:                        System.out.println("ClassTypeElt ::= ClassType");} //$NON-NLS-1$
06010:                    consumeClassTypeElt();
06011:                    break;
06012:
06013:                case 184:
06014:                    if (DEBUG) {
06015:                        System.out
06016:                                .println("MethodBody ::= NestedMethod LBRACE BlockStatementsopt...");} //$NON-NLS-1$
06017:                    consumeMethodBody();
06018:                    break;
06019:
06020:                case 185:
06021:                    if (DEBUG) {
06022:                        System.out.println("NestedMethod ::=");} //$NON-NLS-1$
06023:                    consumeNestedMethod();
06024:                    break;
06025:
06026:                case 186:
06027:                    if (DEBUG) {
06028:                        System.out
06029:                                .println("StaticInitializer ::= StaticOnly Block");} //$NON-NLS-1$
06030:                    consumeStaticInitializer();
06031:                    break;
06032:
06033:                case 187:
06034:                    if (DEBUG) {
06035:                        System.out.println("StaticOnly ::= static");} //$NON-NLS-1$
06036:                    consumeStaticOnly();
06037:                    break;
06038:
06039:                case 188:
06040:                    if (DEBUG) {
06041:                        System.out
06042:                                .println("ConstructorDeclaration ::= ConstructorHeader MethodBody");} //$NON-NLS-1$
06043:                    consumeConstructorDeclaration();
06044:                    break;
06045:
06046:                case 189:
06047:                    if (DEBUG) {
06048:                        System.out
06049:                                .println("ConstructorDeclaration ::= ConstructorHeader SEMICOLON");} //$NON-NLS-1$
06050:                    consumeInvalidConstructorDeclaration();
06051:                    break;
06052:
06053:                case 190:
06054:                    if (DEBUG) {
06055:                        System.out
06056:                                .println("ExplicitConstructorInvocation ::= this LPAREN...");} //$NON-NLS-1$
06057:                    consumeExplicitConstructorInvocation(0, THIS_CALL);
06058:                    break;
06059:
06060:                case 191:
06061:                    if (DEBUG) {
06062:                        System.out
06063:                                .println("ExplicitConstructorInvocation ::= OnlyTypeArguments this");} //$NON-NLS-1$
06064:                    consumeExplicitConstructorInvocationWithTypeArguments(0,
06065:                            THIS_CALL);
06066:                    break;
06067:
06068:                case 192:
06069:                    if (DEBUG) {
06070:                        System.out
06071:                                .println("ExplicitConstructorInvocation ::= super LPAREN...");} //$NON-NLS-1$
06072:                    consumeExplicitConstructorInvocation(0, SUPER_CALL);
06073:                    break;
06074:
06075:                case 193:
06076:                    if (DEBUG) {
06077:                        System.out
06078:                                .println("ExplicitConstructorInvocation ::= OnlyTypeArguments...");} //$NON-NLS-1$
06079:                    consumeExplicitConstructorInvocationWithTypeArguments(0,
06080:                            SUPER_CALL);
06081:                    break;
06082:
06083:                case 194:
06084:                    if (DEBUG) {
06085:                        System.out
06086:                                .println("ExplicitConstructorInvocation ::= Primary DOT super...");} //$NON-NLS-1$
06087:                    consumeExplicitConstructorInvocation(1, SUPER_CALL);
06088:                    break;
06089:
06090:                case 195:
06091:                    if (DEBUG) {
06092:                        System.out
06093:                                .println("ExplicitConstructorInvocation ::= Primary DOT...");} //$NON-NLS-1$
06094:                    consumeExplicitConstructorInvocationWithTypeArguments(1,
06095:                            SUPER_CALL);
06096:                    break;
06097:
06098:                case 196:
06099:                    if (DEBUG) {
06100:                        System.out
06101:                                .println("ExplicitConstructorInvocation ::= Name DOT super LPAREN");} //$NON-NLS-1$
06102:                    consumeExplicitConstructorInvocation(2, SUPER_CALL);
06103:                    break;
06104:
06105:                case 197:
06106:                    if (DEBUG) {
06107:                        System.out
06108:                                .println("ExplicitConstructorInvocation ::= Name DOT...");} //$NON-NLS-1$
06109:                    consumeExplicitConstructorInvocationWithTypeArguments(2,
06110:                            SUPER_CALL);
06111:                    break;
06112:
06113:                case 198:
06114:                    if (DEBUG) {
06115:                        System.out
06116:                                .println("ExplicitConstructorInvocation ::= Primary DOT this...");} //$NON-NLS-1$
06117:                    consumeExplicitConstructorInvocation(1, THIS_CALL);
06118:                    break;
06119:
06120:                case 199:
06121:                    if (DEBUG) {
06122:                        System.out
06123:                                .println("ExplicitConstructorInvocation ::= Primary DOT...");} //$NON-NLS-1$
06124:                    consumeExplicitConstructorInvocationWithTypeArguments(1,
06125:                            THIS_CALL);
06126:                    break;
06127:
06128:                case 200:
06129:                    if (DEBUG) {
06130:                        System.out
06131:                                .println("ExplicitConstructorInvocation ::= Name DOT this LPAREN");} //$NON-NLS-1$
06132:                    consumeExplicitConstructorInvocation(2, THIS_CALL);
06133:                    break;
06134:
06135:                case 201:
06136:                    if (DEBUG) {
06137:                        System.out
06138:                                .println("ExplicitConstructorInvocation ::= Name DOT...");} //$NON-NLS-1$
06139:                    consumeExplicitConstructorInvocationWithTypeArguments(2,
06140:                            THIS_CALL);
06141:                    break;
06142:
06143:                case 202:
06144:                    if (DEBUG) {
06145:                        System.out
06146:                                .println("InterfaceDeclaration ::= InterfaceHeader InterfaceBody");} //$NON-NLS-1$
06147:                    consumeInterfaceDeclaration();
06148:                    break;
06149:
06150:                case 203:
06151:                    if (DEBUG) {
06152:                        System.out
06153:                                .println("InterfaceHeader ::= InterfaceHeaderName...");} //$NON-NLS-1$
06154:                    consumeInterfaceHeader();
06155:                    break;
06156:
06157:                case 204:
06158:                    if (DEBUG) {
06159:                        System.out
06160:                                .println("InterfaceHeaderName ::= InterfaceHeaderName1...");} //$NON-NLS-1$
06161:                    consumeTypeHeaderNameWithTypeParameters();
06162:                    break;
06163:
06164:                case 206:
06165:                    if (DEBUG) {
06166:                        System.out
06167:                                .println("InterfaceHeaderName1 ::= Modifiersopt interface...");} //$NON-NLS-1$
06168:                    consumeInterfaceHeaderName1();
06169:                    break;
06170:
06171:                case 207:
06172:                    if (DEBUG) {
06173:                        System.out
06174:                                .println("InterfaceHeaderExtends ::= extends InterfaceTypeList");} //$NON-NLS-1$
06175:                    consumeInterfaceHeaderExtends();
06176:                    break;
06177:
06178:                case 210:
06179:                    if (DEBUG) {
06180:                        System.out
06181:                                .println("InterfaceMemberDeclarations ::=...");} //$NON-NLS-1$
06182:                    consumeInterfaceMemberDeclarations();
06183:                    break;
06184:
06185:                case 211:
06186:                    if (DEBUG) {
06187:                        System.out
06188:                                .println("InterfaceMemberDeclaration ::= SEMICOLON");} //$NON-NLS-1$
06189:                    consumeEmptyTypeDeclaration();
06190:                    break;
06191:
06192:                case 213:
06193:                    if (DEBUG) {
06194:                        System.out
06195:                                .println("InterfaceMemberDeclaration ::= MethodHeader MethodBody");} //$NON-NLS-1$
06196:                    consumeInvalidMethodDeclaration();
06197:                    break;
06198:
06199:                case 214:
06200:                    if (DEBUG) {
06201:                        System.out
06202:                                .println("InvalidConstructorDeclaration ::= ConstructorHeader...");} //$NON-NLS-1$
06203:                    consumeInvalidConstructorDeclaration(true);
06204:                    break;
06205:
06206:                case 215:
06207:                    if (DEBUG) {
06208:                        System.out
06209:                                .println("InvalidConstructorDeclaration ::= ConstructorHeader...");} //$NON-NLS-1$
06210:                    consumeInvalidConstructorDeclaration(false);
06211:                    break;
06212:
06213:                case 223:
06214:                    if (DEBUG) {
06215:                        System.out.println("PushLeftBrace ::=");} //$NON-NLS-1$
06216:                    consumePushLeftBrace();
06217:                    break;
06218:
06219:                case 224:
06220:                    if (DEBUG) {
06221:                        System.out
06222:                                .println("ArrayInitializer ::= LBRACE PushLeftBrace ,opt RBRACE");} //$NON-NLS-1$
06223:                    consumeEmptyArrayInitializer();
06224:                    break;
06225:
06226:                case 225:
06227:                    if (DEBUG) {
06228:                        System.out
06229:                                .println("ArrayInitializer ::= LBRACE PushLeftBrace...");} //$NON-NLS-1$
06230:                    consumeArrayInitializer();
06231:                    break;
06232:
06233:                case 226:
06234:                    if (DEBUG) {
06235:                        System.out
06236:                                .println("ArrayInitializer ::= LBRACE PushLeftBrace...");} //$NON-NLS-1$
06237:                    consumeArrayInitializer();
06238:                    break;
06239:
06240:                case 228:
06241:                    if (DEBUG) {
06242:                        System.out
06243:                                .println("VariableInitializers ::= VariableInitializers COMMA...");} //$NON-NLS-1$
06244:                    consumeVariableInitializers();
06245:                    break;
06246:
06247:                case 229:
06248:                    if (DEBUG) {
06249:                        System.out
06250:                                .println("Block ::= OpenBlock LBRACE BlockStatementsopt RBRACE");} //$NON-NLS-1$
06251:                    consumeBlock();
06252:                    break;
06253:
06254:                case 230:
06255:                    if (DEBUG) {
06256:                        System.out.println("OpenBlock ::=");} //$NON-NLS-1$
06257:                    consumeOpenBlock();
06258:                    break;
06259:
06260:                case 232:
06261:                    if (DEBUG) {
06262:                        System.out
06263:                                .println("BlockStatements ::= BlockStatements BlockStatement");} //$NON-NLS-1$
06264:                    consumeBlockStatements();
06265:                    break;
06266:
06267:                case 236:
06268:                    if (DEBUG) {
06269:                        System.out
06270:                                .println("BlockStatement ::= InterfaceDeclaration");} //$NON-NLS-1$
06271:                    consumeInvalidInterfaceDeclaration();
06272:                    break;
06273:
06274:                case 237:
06275:                    if (DEBUG) {
06276:                        System.out
06277:                                .println("BlockStatement ::= AnnotationTypeDeclaration");} //$NON-NLS-1$
06278:                    consumeInvalidAnnotationTypeDeclaration();
06279:                    break;
06280:
06281:                case 238:
06282:                    if (DEBUG) {
06283:                        System.out
06284:                                .println("BlockStatement ::= EnumDeclaration");} //$NON-NLS-1$
06285:                    consumeInvalidEnumDeclaration();
06286:                    break;
06287:
06288:                case 239:
06289:                    if (DEBUG) {
06290:                        System.out
06291:                                .println("LocalVariableDeclarationStatement ::=...");} //$NON-NLS-1$
06292:                    consumeLocalVariableDeclarationStatement();
06293:                    break;
06294:
06295:                case 240:
06296:                    if (DEBUG) {
06297:                        System.out
06298:                                .println("LocalVariableDeclaration ::= Type PushModifiers...");} //$NON-NLS-1$
06299:                    consumeLocalVariableDeclaration();
06300:                    break;
06301:
06302:                case 241:
06303:                    if (DEBUG) {
06304:                        System.out
06305:                                .println("LocalVariableDeclaration ::= Modifiers Type...");} //$NON-NLS-1$
06306:                    consumeLocalVariableDeclaration();
06307:                    break;
06308:
06309:                case 242:
06310:                    if (DEBUG) {
06311:                        System.out.println("PushModifiers ::=");} //$NON-NLS-1$
06312:                    consumePushModifiers();
06313:                    break;
06314:
06315:                case 243:
06316:                    if (DEBUG) {
06317:                        System.out.println("PushModifiersForHeader ::=");} //$NON-NLS-1$
06318:                    consumePushModifiersForHeader();
06319:                    break;
06320:
06321:                case 244:
06322:                    if (DEBUG) {
06323:                        System.out.println("PushRealModifiers ::=");} //$NON-NLS-1$
06324:                    consumePushRealModifiers();
06325:                    break;
06326:
06327:                case 270:
06328:                    if (DEBUG) {
06329:                        System.out.println("EmptyStatement ::= SEMICOLON");} //$NON-NLS-1$
06330:                    consumeEmptyStatement();
06331:                    break;
06332:
06333:                case 271:
06334:                    if (DEBUG) {
06335:                        System.out
06336:                                .println("LabeledStatement ::= Label COLON Statement");} //$NON-NLS-1$
06337:                    consumeStatementLabel();
06338:                    break;
06339:
06340:                case 272:
06341:                    if (DEBUG) {
06342:                        System.out
06343:                                .println("LabeledStatementNoShortIf ::= Label COLON...");} //$NON-NLS-1$
06344:                    consumeStatementLabel();
06345:                    break;
06346:
06347:                case 273:
06348:                    if (DEBUG) {
06349:                        System.out.println("Label ::= Identifier");} //$NON-NLS-1$
06350:                    consumeLabel();
06351:                    break;
06352:
06353:                case 274:
06354:                    if (DEBUG) {
06355:                        System.out
06356:                                .println("ExpressionStatement ::= StatementExpression SEMICOLON");} //$NON-NLS-1$
06357:                    consumeExpressionStatement();
06358:                    break;
06359:
06360:                case 283:
06361:                    if (DEBUG) {
06362:                        System.out
06363:                                .println("IfThenStatement ::= if LPAREN Expression RPAREN...");} //$NON-NLS-1$
06364:                    consumeStatementIfNoElse();
06365:                    break;
06366:
06367:                case 284:
06368:                    if (DEBUG) {
06369:                        System.out
06370:                                .println("IfThenElseStatement ::= if LPAREN Expression RPAREN...");} //$NON-NLS-1$
06371:                    consumeStatementIfWithElse();
06372:                    break;
06373:
06374:                case 285:
06375:                    if (DEBUG) {
06376:                        System.out
06377:                                .println("IfThenElseStatementNoShortIf ::= if LPAREN Expression...");} //$NON-NLS-1$
06378:                    consumeStatementIfWithElse();
06379:                    break;
06380:
06381:                case 286:
06382:                    if (DEBUG) {
06383:                        System.out
06384:                                .println("SwitchStatement ::= switch LPAREN Expression RPAREN...");} //$NON-NLS-1$
06385:                    consumeStatementSwitch();
06386:                    break;
06387:
06388:                case 287:
06389:                    if (DEBUG) {
06390:                        System.out.println("SwitchBlock ::= LBRACE RBRACE");} //$NON-NLS-1$
06391:                    consumeEmptySwitchBlock();
06392:                    break;
06393:
06394:                case 290:
06395:                    if (DEBUG) {
06396:                        System.out
06397:                                .println("SwitchBlock ::= LBRACE SwitchBlockStatements...");} //$NON-NLS-1$
06398:                    consumeSwitchBlock();
06399:                    break;
06400:
06401:                case 292:
06402:                    if (DEBUG) {
06403:                        System.out
06404:                                .println("SwitchBlockStatements ::= SwitchBlockStatements...");} //$NON-NLS-1$
06405:                    consumeSwitchBlockStatements();
06406:                    break;
06407:
06408:                case 293:
06409:                    if (DEBUG) {
06410:                        System.out
06411:                                .println("SwitchBlockStatement ::= SwitchLabels BlockStatements");} //$NON-NLS-1$
06412:                    consumeSwitchBlockStatement();
06413:                    break;
06414:
06415:                case 295:
06416:                    if (DEBUG) {
06417:                        System.out
06418:                                .println("SwitchLabels ::= SwitchLabels SwitchLabel");} //$NON-NLS-1$
06419:                    consumeSwitchLabels();
06420:                    break;
06421:
06422:                case 296:
06423:                    if (DEBUG) {
06424:                        System.out
06425:                                .println("SwitchLabel ::= case ConstantExpression COLON");} //$NON-NLS-1$
06426:                    consumeCaseLabel();
06427:                    break;
06428:
06429:                case 297:
06430:                    if (DEBUG) {
06431:                        System.out.println("SwitchLabel ::= default COLON");} //$NON-NLS-1$
06432:                    consumeDefaultLabel();
06433:                    break;
06434:
06435:                case 298:
06436:                    if (DEBUG) {
06437:                        System.out
06438:                                .println("WhileStatement ::= while LPAREN Expression RPAREN...");} //$NON-NLS-1$
06439:                    consumeStatementWhile();
06440:                    break;
06441:
06442:                case 299:
06443:                    if (DEBUG) {
06444:                        System.out
06445:                                .println("WhileStatementNoShortIf ::= while LPAREN Expression...");} //$NON-NLS-1$
06446:                    consumeStatementWhile();
06447:                    break;
06448:
06449:                case 300:
06450:                    if (DEBUG) {
06451:                        System.out
06452:                                .println("DoStatement ::= do Statement while LPAREN Expression...");} //$NON-NLS-1$
06453:                    consumeStatementDo();
06454:                    break;
06455:
06456:                case 301:
06457:                    if (DEBUG) {
06458:                        System.out
06459:                                .println("ForStatement ::= for LPAREN ForInitopt SEMICOLON...");} //$NON-NLS-1$
06460:                    consumeStatementFor();
06461:                    break;
06462:
06463:                case 302:
06464:                    if (DEBUG) {
06465:                        System.out
06466:                                .println("ForStatementNoShortIf ::= for LPAREN ForInitopt...");} //$NON-NLS-1$
06467:                    consumeStatementFor();
06468:                    break;
06469:
06470:                case 303:
06471:                    if (DEBUG) {
06472:                        System.out
06473:                                .println("ForInit ::= StatementExpressionList");} //$NON-NLS-1$
06474:                    consumeForInit();
06475:                    break;
06476:
06477:                case 307:
06478:                    if (DEBUG) {
06479:                        System.out
06480:                                .println("StatementExpressionList ::= StatementExpressionList...");} //$NON-NLS-1$
06481:                    consumeStatementExpressionList();
06482:                    break;
06483:
06484:                case 308:
06485:                    if (DEBUG) {
06486:                        System.out
06487:                                .println("AssertStatement ::= assert Expression SEMICOLON");} //$NON-NLS-1$
06488:                    consumeSimpleAssertStatement();
06489:                    break;
06490:
06491:                case 309:
06492:                    if (DEBUG) {
06493:                        System.out
06494:                                .println("AssertStatement ::= assert Expression COLON Expression");} //$NON-NLS-1$
06495:                    consumeAssertStatement();
06496:                    break;
06497:
06498:                case 310:
06499:                    if (DEBUG) {
06500:                        System.out
06501:                                .println("BreakStatement ::= break SEMICOLON");} //$NON-NLS-1$
06502:                    consumeStatementBreak();
06503:                    break;
06504:
06505:                case 311:
06506:                    if (DEBUG) {
06507:                        System.out
06508:                                .println("BreakStatement ::= break Identifier SEMICOLON");} //$NON-NLS-1$
06509:                    consumeStatementBreakWithLabel();
06510:                    break;
06511:
06512:                case 312:
06513:                    if (DEBUG) {
06514:                        System.out
06515:                                .println("ContinueStatement ::= continue SEMICOLON");} //$NON-NLS-1$
06516:                    consumeStatementContinue();
06517:                    break;
06518:
06519:                case 313:
06520:                    if (DEBUG) {
06521:                        System.out
06522:                                .println("ContinueStatement ::= continue Identifier SEMICOLON");} //$NON-NLS-1$
06523:                    consumeStatementContinueWithLabel();
06524:                    break;
06525:
06526:                case 314:
06527:                    if (DEBUG) {
06528:                        System.out
06529:                                .println("ReturnStatement ::= return Expressionopt SEMICOLON");} //$NON-NLS-1$
06530:                    consumeStatementReturn();
06531:                    break;
06532:
06533:                case 315:
06534:                    if (DEBUG) {
06535:                        System.out
06536:                                .println("ThrowStatement ::= throw Expression SEMICOLON");} //$NON-NLS-1$
06537:                    consumeStatementThrow();
06538:                    break;
06539:
06540:                case 316:
06541:                    if (DEBUG) {
06542:                        System.out
06543:                                .println("SynchronizedStatement ::= OnlySynchronized LPAREN...");} //$NON-NLS-1$
06544:                    consumeStatementSynchronized();
06545:                    break;
06546:
06547:                case 317:
06548:                    if (DEBUG) {
06549:                        System.out.println("OnlySynchronized ::= synchronized");} //$NON-NLS-1$
06550:                    consumeOnlySynchronized();
06551:                    break;
06552:
06553:                case 318:
06554:                    if (DEBUG) {
06555:                        System.out
06556:                                .println("TryStatement ::= try TryBlock Catches");} //$NON-NLS-1$
06557:                    consumeStatementTry(false);
06558:                    break;
06559:
06560:                case 319:
06561:                    if (DEBUG) {
06562:                        System.out
06563:                                .println("TryStatement ::= try TryBlock Catchesopt Finally");} //$NON-NLS-1$
06564:                    consumeStatementTry(true);
06565:                    break;
06566:
06567:                case 321:
06568:                    if (DEBUG) {
06569:                        System.out.println("ExitTryBlock ::=");} //$NON-NLS-1$
06570:                    consumeExitTryBlock();
06571:                    break;
06572:
06573:                case 323:
06574:                    if (DEBUG) {
06575:                        System.out.println("Catches ::= Catches CatchClause");} //$NON-NLS-1$
06576:                    consumeCatches();
06577:                    break;
06578:
06579:                case 324:
06580:                    if (DEBUG) {
06581:                        System.out
06582:                                .println("CatchClause ::= catch LPAREN FormalParameter RPAREN...");} //$NON-NLS-1$
06583:                    consumeStatementCatch();
06584:                    break;
06585:
06586:                case 326:
06587:                    if (DEBUG) {
06588:                        System.out.println("PushLPAREN ::= LPAREN");} //$NON-NLS-1$
06589:                    consumeLeftParen();
06590:                    break;
06591:
06592:                case 327:
06593:                    if (DEBUG) {
06594:                        System.out.println("PushRPAREN ::= RPAREN");} //$NON-NLS-1$
06595:                    consumeRightParen();
06596:                    break;
06597:
06598:                case 332:
06599:                    if (DEBUG) {
06600:                        System.out.println("PrimaryNoNewArray ::= this");} //$NON-NLS-1$
06601:                    consumePrimaryNoNewArrayThis();
06602:                    break;
06603:
06604:                case 333:
06605:                    if (DEBUG) {
06606:                        System.out
06607:                                .println("PrimaryNoNewArray ::= PushLPAREN Expression_NotName...");} //$NON-NLS-1$
06608:                    consumePrimaryNoNewArray();
06609:                    break;
06610:
06611:                case 334:
06612:                    if (DEBUG) {
06613:                        System.out
06614:                                .println("PrimaryNoNewArray ::= PushLPAREN Name PushRPAREN");} //$NON-NLS-1$
06615:                    consumePrimaryNoNewArrayWithName();
06616:                    break;
06617:
06618:                case 337:
06619:                    if (DEBUG) {
06620:                        System.out
06621:                                .println("PrimaryNoNewArray ::= Name DOT this");} //$NON-NLS-1$
06622:                    consumePrimaryNoNewArrayNameThis();
06623:                    break;
06624:
06625:                case 338:
06626:                    if (DEBUG) {
06627:                        System.out
06628:                                .println("PrimaryNoNewArray ::= Name DOT super");} //$NON-NLS-1$
06629:                    consumePrimaryNoNewArrayNameSuper();
06630:                    break;
06631:
06632:                case 339:
06633:                    if (DEBUG) {
06634:                        System.out
06635:                                .println("PrimaryNoNewArray ::= Name DOT class");} //$NON-NLS-1$
06636:                    consumePrimaryNoNewArrayName();
06637:                    break;
06638:
06639:                case 340:
06640:                    if (DEBUG) {
06641:                        System.out
06642:                                .println("PrimaryNoNewArray ::= Name Dims DOT class");} //$NON-NLS-1$
06643:                    consumePrimaryNoNewArrayArrayType();
06644:                    break;
06645:
06646:                case 341:
06647:                    if (DEBUG) {
06648:                        System.out
06649:                                .println("PrimaryNoNewArray ::= PrimitiveType Dims DOT class");} //$NON-NLS-1$
06650:                    consumePrimaryNoNewArrayPrimitiveArrayType();
06651:                    break;
06652:
06653:                case 342:
06654:                    if (DEBUG) {
06655:                        System.out
06656:                                .println("PrimaryNoNewArray ::= PrimitiveType DOT class");} //$NON-NLS-1$
06657:                    consumePrimaryNoNewArrayPrimitiveType();
06658:                    break;
06659:
06660:                case 345:
06661:                    if (DEBUG) {
06662:                        System.out
06663:                                .println("AllocationHeader ::= new ClassType LPAREN...");} //$NON-NLS-1$
06664:                    consumeAllocationHeader();
06665:                    break;
06666:
06667:                case 346:
06668:                    if (DEBUG) {
06669:                        System.out
06670:                                .println("ClassInstanceCreationExpression ::= new...");} //$NON-NLS-1$
06671:                    consumeClassInstanceCreationExpressionWithTypeArguments();
06672:                    break;
06673:
06674:                case 347:
06675:                    if (DEBUG) {
06676:                        System.out
06677:                                .println("ClassInstanceCreationExpression ::= new ClassType LPAREN");} //$NON-NLS-1$
06678:                    consumeClassInstanceCreationExpression();
06679:                    break;
06680:
06681:                case 348:
06682:                    if (DEBUG) {
06683:                        System.out
06684:                                .println("ClassInstanceCreationExpression ::= Primary DOT new...");} //$NON-NLS-1$
06685:                    consumeClassInstanceCreationExpressionQualifiedWithTypeArguments();
06686:                    break;
06687:
06688:                case 349:
06689:                    if (DEBUG) {
06690:                        System.out
06691:                                .println("ClassInstanceCreationExpression ::= Primary DOT new...");} //$NON-NLS-1$
06692:                    consumeClassInstanceCreationExpressionQualified();
06693:                    break;
06694:
06695:                case 350:
06696:                    if (DEBUG) {
06697:                        System.out
06698:                                .println("ClassInstanceCreationExpression ::=...");} //$NON-NLS-1$
06699:                    consumeClassInstanceCreationExpressionQualified();
06700:                    break;
06701:
06702:                case 351:
06703:                    if (DEBUG) {
06704:                        System.out
06705:                                .println("ClassInstanceCreationExpression ::=...");} //$NON-NLS-1$
06706:                    consumeClassInstanceCreationExpressionQualifiedWithTypeArguments();
06707:                    break;
06708:
06709:                case 352:
06710:                    if (DEBUG) {
06711:                        System.out
06712:                                .println("ClassInstanceCreationExpressionName ::= Name DOT");} //$NON-NLS-1$
06713:                    consumeClassInstanceCreationExpressionName();
06714:                    break;
06715:
06716:                case 353:
06717:                    if (DEBUG) {
06718:                        System.out.println("ClassBodyopt ::=");} //$NON-NLS-1$
06719:                    consumeClassBodyopt();
06720:                    break;
06721:
06722:                case 355:
06723:                    if (DEBUG) {
06724:                        System.out.println("EnterAnonymousClassBody ::=");} //$NON-NLS-1$
06725:                    consumeEnterAnonymousClassBody();
06726:                    break;
06727:
06728:                case 357:
06729:                    if (DEBUG) {
06730:                        System.out
06731:                                .println("ArgumentList ::= ArgumentList COMMA Expression");} //$NON-NLS-1$
06732:                    consumeArgumentList();
06733:                    break;
06734:
06735:                case 358:
06736:                    if (DEBUG) {
06737:                        System.out
06738:                                .println("ArrayCreationHeader ::= new PrimitiveType...");} //$NON-NLS-1$
06739:                    consumeArrayCreationHeader();
06740:                    break;
06741:
06742:                case 359:
06743:                    if (DEBUG) {
06744:                        System.out
06745:                                .println("ArrayCreationHeader ::= new ClassOrInterfaceType...");} //$NON-NLS-1$
06746:                    consumeArrayCreationHeader();
06747:                    break;
06748:
06749:                case 360:
06750:                    if (DEBUG) {
06751:                        System.out
06752:                                .println("ArrayCreationWithoutArrayInitializer ::= new...");} //$NON-NLS-1$
06753:                    consumeArrayCreationExpressionWithoutInitializer();
06754:                    break;
06755:
06756:                case 361:
06757:                    if (DEBUG) {
06758:                        System.out
06759:                                .println("ArrayCreationWithArrayInitializer ::= new PrimitiveType");} //$NON-NLS-1$
06760:                    consumeArrayCreationExpressionWithInitializer();
06761:                    break;
06762:
06763:                case 362:
06764:                    if (DEBUG) {
06765:                        System.out
06766:                                .println("ArrayCreationWithoutArrayInitializer ::= new...");} //$NON-NLS-1$
06767:                    consumeArrayCreationExpressionWithoutInitializer();
06768:                    break;
06769:
06770:                case 363:
06771:                    if (DEBUG) {
06772:                        System.out
06773:                                .println("ArrayCreationWithArrayInitializer ::= new...");} //$NON-NLS-1$
06774:                    consumeArrayCreationExpressionWithInitializer();
06775:                    break;
06776:
06777:                case 365:
06778:                    if (DEBUG) {
06779:                        System.out
06780:                                .println("DimWithOrWithOutExprs ::= DimWithOrWithOutExprs...");} //$NON-NLS-1$
06781:                    consumeDimWithOrWithOutExprs();
06782:                    break;
06783:
06784:                case 367:
06785:                    if (DEBUG) {
06786:                        System.out
06787:                                .println("DimWithOrWithOutExpr ::= LBRACKET RBRACKET");} //$NON-NLS-1$
06788:                    consumeDimWithOrWithOutExpr();
06789:                    break;
06790:
06791:                case 368:
06792:                    if (DEBUG) {
06793:                        System.out.println("Dims ::= DimsLoop");} //$NON-NLS-1$
06794:                    consumeDims();
06795:                    break;
06796:
06797:                case 371:
06798:                    if (DEBUG) {
06799:                        System.out.println("OneDimLoop ::= LBRACKET RBRACKET");} //$NON-NLS-1$
06800:                    consumeOneDimLoop();
06801:                    break;
06802:
06803:                case 372:
06804:                    if (DEBUG) {
06805:                        System.out
06806:                                .println("FieldAccess ::= Primary DOT Identifier");} //$NON-NLS-1$
06807:                    consumeFieldAccess(false);
06808:                    break;
06809:
06810:                case 373:
06811:                    if (DEBUG) {
06812:                        System.out
06813:                                .println("FieldAccess ::= super DOT Identifier");} //$NON-NLS-1$
06814:                    consumeFieldAccess(true);
06815:                    break;
06816:
06817:                case 374:
06818:                    if (DEBUG) {
06819:                        System.out
06820:                                .println("MethodInvocation ::= Name LPAREN ArgumentListopt RPAREN");} //$NON-NLS-1$
06821:                    consumeMethodInvocationName();
06822:                    break;
06823:
06824:                case 375:
06825:                    if (DEBUG) {
06826:                        System.out
06827:                                .println("MethodInvocation ::= Name DOT OnlyTypeArguments...");} //$NON-NLS-1$
06828:                    consumeMethodInvocationNameWithTypeArguments();
06829:                    break;
06830:
06831:                case 376:
06832:                    if (DEBUG) {
06833:                        System.out
06834:                                .println("MethodInvocation ::= Primary DOT OnlyTypeArguments...");} //$NON-NLS-1$
06835:                    consumeMethodInvocationPrimaryWithTypeArguments();
06836:                    break;
06837:
06838:                case 377:
06839:                    if (DEBUG) {
06840:                        System.out
06841:                                .println("MethodInvocation ::= Primary DOT Identifier LPAREN...");} //$NON-NLS-1$
06842:                    consumeMethodInvocationPrimary();
06843:                    break;
06844:
06845:                case 378:
06846:                    if (DEBUG) {
06847:                        System.out
06848:                                .println("MethodInvocation ::= super DOT OnlyTypeArguments...");} //$NON-NLS-1$
06849:                    consumeMethodInvocationSuperWithTypeArguments();
06850:                    break;
06851:
06852:                case 379:
06853:                    if (DEBUG) {
06854:                        System.out
06855:                                .println("MethodInvocation ::= super DOT Identifier LPAREN...");} //$NON-NLS-1$
06856:                    consumeMethodInvocationSuper();
06857:                    break;
06858:
06859:                case 380:
06860:                    if (DEBUG) {
06861:                        System.out
06862:                                .println("ArrayAccess ::= Name LBRACKET Expression RBRACKET");} //$NON-NLS-1$
06863:                    consumeArrayAccess(true);
06864:                    break;
06865:
06866:                case 381:
06867:                    if (DEBUG) {
06868:                        System.out
06869:                                .println("ArrayAccess ::= PrimaryNoNewArray LBRACKET Expression...");} //$NON-NLS-1$
06870:                    consumeArrayAccess(false);
06871:                    break;
06872:
06873:                case 382:
06874:                    if (DEBUG) {
06875:                        System.out
06876:                                .println("ArrayAccess ::= ArrayCreationWithArrayInitializer...");} //$NON-NLS-1$
06877:                    consumeArrayAccess(false);
06878:                    break;
06879:
06880:                case 384:
06881:                    if (DEBUG) {
06882:                        System.out.println("PostfixExpression ::= Name");} //$NON-NLS-1$
06883:                    consumePostfixExpression();
06884:                    break;
06885:
06886:                case 387:
06887:                    if (DEBUG) {
06888:                        System.out
06889:                                .println("PostIncrementExpression ::= PostfixExpression PLUS_PLUS");} //$NON-NLS-1$
06890:                    consumeUnaryExpression(OperatorIds.PLUS, true);
06891:                    break;
06892:
06893:                case 388:
06894:                    if (DEBUG) {
06895:                        System.out
06896:                                .println("PostDecrementExpression ::= PostfixExpression...");} //$NON-NLS-1$
06897:                    consumeUnaryExpression(OperatorIds.MINUS, true);
06898:                    break;
06899:
06900:                case 389:
06901:                    if (DEBUG) {
06902:                        System.out.println("PushPosition ::=");} //$NON-NLS-1$
06903:                    consumePushPosition();
06904:                    break;
06905:
06906:                case 392:
06907:                    if (DEBUG) {
06908:                        System.out
06909:                                .println("UnaryExpression ::= PLUS PushPosition UnaryExpression");} //$NON-NLS-1$
06910:                    consumeUnaryExpression(OperatorIds.PLUS);
06911:                    break;
06912:
06913:                case 393:
06914:                    if (DEBUG) {
06915:                        System.out
06916:                                .println("UnaryExpression ::= MINUS PushPosition UnaryExpression");} //$NON-NLS-1$
06917:                    consumeUnaryExpression(OperatorIds.MINUS);
06918:                    break;
06919:
06920:                case 395:
06921:                    if (DEBUG) {
06922:                        System.out
06923:                                .println("PreIncrementExpression ::= PLUS_PLUS PushPosition...");} //$NON-NLS-1$
06924:                    consumeUnaryExpression(OperatorIds.PLUS, false);
06925:                    break;
06926:
06927:                case 396:
06928:                    if (DEBUG) {
06929:                        System.out
06930:                                .println("PreDecrementExpression ::= MINUS_MINUS PushPosition...");} //$NON-NLS-1$
06931:                    consumeUnaryExpression(OperatorIds.MINUS, false);
06932:                    break;
06933:
06934:                case 398:
06935:                    if (DEBUG) {
06936:                        System.out
06937:                                .println("UnaryExpressionNotPlusMinus ::= TWIDDLE PushPosition...");} //$NON-NLS-1$
06938:                    consumeUnaryExpression(OperatorIds.TWIDDLE);
06939:                    break;
06940:
06941:                case 399:
06942:                    if (DEBUG) {
06943:                        System.out
06944:                                .println("UnaryExpressionNotPlusMinus ::= NOT PushPosition...");} //$NON-NLS-1$
06945:                    consumeUnaryExpression(OperatorIds.NOT);
06946:                    break;
06947:
06948:                case 401:
06949:                    if (DEBUG) {
06950:                        System.out
06951:                                .println("CastExpression ::= PushLPAREN PrimitiveType Dimsopt...");} //$NON-NLS-1$
06952:                    consumeCastExpressionWithPrimitiveType();
06953:                    break;
06954:
06955:                case 402:
06956:                    if (DEBUG) {
06957:                        System.out
06958:                                .println("CastExpression ::= PushLPAREN Name...");} //$NON-NLS-1$
06959:                    consumeCastExpressionWithGenericsArray();
06960:                    break;
06961:
06962:                case 403:
06963:                    if (DEBUG) {
06964:                        System.out
06965:                                .println("CastExpression ::= PushLPAREN Name...");} //$NON-NLS-1$
06966:                    consumeCastExpressionWithQualifiedGenericsArray();
06967:                    break;
06968:
06969:                case 404:
06970:                    if (DEBUG) {
06971:                        System.out
06972:                                .println("CastExpression ::= PushLPAREN Name PushRPAREN...");} //$NON-NLS-1$
06973:                    consumeCastExpressionLL1();
06974:                    break;
06975:
06976:                case 405:
06977:                    if (DEBUG) {
06978:                        System.out
06979:                                .println("CastExpression ::= PushLPAREN Name Dims PushRPAREN...");} //$NON-NLS-1$
06980:                    consumeCastExpressionWithNameArray();
06981:                    break;
06982:
06983:                case 406:
06984:                    if (DEBUG) {
06985:                        System.out
06986:                                .println("OnlyTypeArgumentsForCastExpression ::= OnlyTypeArguments");} //$NON-NLS-1$
06987:                    consumeOnlyTypeArgumentsForCastExpression();
06988:                    break;
06989:
06990:                case 407:
06991:                    if (DEBUG) {
06992:                        System.out.println("InsideCastExpression ::=");} //$NON-NLS-1$
06993:                    consumeInsideCastExpression();
06994:                    break;
06995:
06996:                case 408:
06997:                    if (DEBUG) {
06998:                        System.out.println("InsideCastExpressionLL1 ::=");} //$NON-NLS-1$
06999:                    consumeInsideCastExpressionLL1();
07000:                    break;
07001:
07002:                case 409:
07003:                    if (DEBUG) {
07004:                        System.out
07005:                                .println("InsideCastExpressionWithQualifiedGenerics ::=");} //$NON-NLS-1$
07006:                    consumeInsideCastExpressionWithQualifiedGenerics();
07007:                    break;
07008:
07009:                case 411:
07010:                    if (DEBUG) {
07011:                        System.out
07012:                                .println("MultiplicativeExpression ::= MultiplicativeExpression...");} //$NON-NLS-1$
07013:                    consumeBinaryExpression(OperatorIds.MULTIPLY);
07014:                    break;
07015:
07016:                case 412:
07017:                    if (DEBUG) {
07018:                        System.out
07019:                                .println("MultiplicativeExpression ::= MultiplicativeExpression...");} //$NON-NLS-1$
07020:                    consumeBinaryExpression(OperatorIds.DIVIDE);
07021:                    break;
07022:
07023:                case 413:
07024:                    if (DEBUG) {
07025:                        System.out
07026:                                .println("MultiplicativeExpression ::= MultiplicativeExpression...");} //$NON-NLS-1$
07027:                    consumeBinaryExpression(OperatorIds.REMAINDER);
07028:                    break;
07029:
07030:                case 415:
07031:                    if (DEBUG) {
07032:                        System.out
07033:                                .println("AdditiveExpression ::= AdditiveExpression PLUS...");} //$NON-NLS-1$
07034:                    consumeBinaryExpression(OperatorIds.PLUS);
07035:                    break;
07036:
07037:                case 416:
07038:                    if (DEBUG) {
07039:                        System.out
07040:                                .println("AdditiveExpression ::= AdditiveExpression MINUS...");} //$NON-NLS-1$
07041:                    consumeBinaryExpression(OperatorIds.MINUS);
07042:                    break;
07043:
07044:                case 418:
07045:                    if (DEBUG) {
07046:                        System.out
07047:                                .println("ShiftExpression ::= ShiftExpression LEFT_SHIFT...");} //$NON-NLS-1$
07048:                    consumeBinaryExpression(OperatorIds.LEFT_SHIFT);
07049:                    break;
07050:
07051:                case 419:
07052:                    if (DEBUG) {
07053:                        System.out
07054:                                .println("ShiftExpression ::= ShiftExpression RIGHT_SHIFT...");} //$NON-NLS-1$
07055:                    consumeBinaryExpression(OperatorIds.RIGHT_SHIFT);
07056:                    break;
07057:
07058:                case 420:
07059:                    if (DEBUG) {
07060:                        System.out
07061:                                .println("ShiftExpression ::= ShiftExpression UNSIGNED_RIGHT_SHIFT");} //$NON-NLS-1$
07062:                    consumeBinaryExpression(OperatorIds.UNSIGNED_RIGHT_SHIFT);
07063:                    break;
07064:
07065:                case 422:
07066:                    if (DEBUG) {
07067:                        System.out
07068:                                .println("RelationalExpression ::= RelationalExpression LESS...");} //$NON-NLS-1$
07069:                    consumeBinaryExpression(OperatorIds.LESS);
07070:                    break;
07071:
07072:                case 423:
07073:                    if (DEBUG) {
07074:                        System.out
07075:                                .println("RelationalExpression ::= RelationalExpression GREATER...");} //$NON-NLS-1$
07076:                    consumeBinaryExpression(OperatorIds.GREATER);
07077:                    break;
07078:
07079:                case 424:
07080:                    if (DEBUG) {
07081:                        System.out
07082:                                .println("RelationalExpression ::= RelationalExpression LESS_EQUAL");} //$NON-NLS-1$
07083:                    consumeBinaryExpression(OperatorIds.LESS_EQUAL);
07084:                    break;
07085:
07086:                case 425:
07087:                    if (DEBUG) {
07088:                        System.out
07089:                                .println("RelationalExpression ::= RelationalExpression...");} //$NON-NLS-1$
07090:                    consumeBinaryExpression(OperatorIds.GREATER_EQUAL);
07091:                    break;
07092:
07093:                case 427:
07094:                    if (DEBUG) {
07095:                        System.out
07096:                                .println("InstanceofExpression ::= InstanceofExpression instanceof");} //$NON-NLS-1$
07097:                    consumeInstanceOfExpression();
07098:                    break;
07099:
07100:                case 429:
07101:                    if (DEBUG) {
07102:                        System.out
07103:                                .println("EqualityExpression ::= EqualityExpression EQUAL_EQUAL...");} //$NON-NLS-1$
07104:                    consumeEqualityExpression(OperatorIds.EQUAL_EQUAL);
07105:                    break;
07106:
07107:                case 430:
07108:                    if (DEBUG) {
07109:                        System.out
07110:                                .println("EqualityExpression ::= EqualityExpression NOT_EQUAL...");} //$NON-NLS-1$
07111:                    consumeEqualityExpression(OperatorIds.NOT_EQUAL);
07112:                    break;
07113:
07114:                case 432:
07115:                    if (DEBUG) {
07116:                        System.out
07117:                                .println("AndExpression ::= AndExpression AND EqualityExpression");} //$NON-NLS-1$
07118:                    consumeBinaryExpression(OperatorIds.AND);
07119:                    break;
07120:
07121:                case 434:
07122:                    if (DEBUG) {
07123:                        System.out
07124:                                .println("ExclusiveOrExpression ::= ExclusiveOrExpression XOR...");} //$NON-NLS-1$
07125:                    consumeBinaryExpression(OperatorIds.XOR);
07126:                    break;
07127:
07128:                case 436:
07129:                    if (DEBUG) {
07130:                        System.out
07131:                                .println("InclusiveOrExpression ::= InclusiveOrExpression OR...");} //$NON-NLS-1$
07132:                    consumeBinaryExpression(OperatorIds.OR);
07133:                    break;
07134:
07135:                case 438:
07136:                    if (DEBUG) {
07137:                        System.out
07138:                                .println("ConditionalAndExpression ::= ConditionalAndExpression...");} //$NON-NLS-1$
07139:                    consumeBinaryExpression(OperatorIds.AND_AND);
07140:                    break;
07141:
07142:                case 440:
07143:                    if (DEBUG) {
07144:                        System.out
07145:                                .println("ConditionalOrExpression ::= ConditionalOrExpression...");} //$NON-NLS-1$
07146:                    consumeBinaryExpression(OperatorIds.OR_OR);
07147:                    break;
07148:
07149:                case 442:
07150:                    if (DEBUG) {
07151:                        System.out
07152:                                .println("ConditionalExpression ::= ConditionalOrExpression...");} //$NON-NLS-1$
07153:                    consumeConditionalExpression(OperatorIds.QUESTIONCOLON);
07154:                    break;
07155:
07156:                case 445:
07157:                    if (DEBUG) {
07158:                        System.out
07159:                                .println("Assignment ::= PostfixExpression AssignmentOperator...");} //$NON-NLS-1$
07160:                    consumeAssignment();
07161:                    break;
07162:
07163:                case 447:
07164:                    if (DEBUG) {
07165:                        System.out
07166:                                .println("Assignment ::= InvalidArrayInitializerAssignement");} //$NON-NLS-1$
07167:                    ignoreExpressionAssignment();
07168:                    break;
07169:
07170:                case 448:
07171:                    if (DEBUG) {
07172:                        System.out.println("AssignmentOperator ::= EQUAL");} //$NON-NLS-1$
07173:                    consumeAssignmentOperator(EQUAL);
07174:                    break;
07175:
07176:                case 449:
07177:                    if (DEBUG) {
07178:                        System.out
07179:                                .println("AssignmentOperator ::= MULTIPLY_EQUAL");} //$NON-NLS-1$
07180:                    consumeAssignmentOperator(MULTIPLY);
07181:                    break;
07182:
07183:                case 450:
07184:                    if (DEBUG) {
07185:                        System.out
07186:                                .println("AssignmentOperator ::= DIVIDE_EQUAL");} //$NON-NLS-1$
07187:                    consumeAssignmentOperator(DIVIDE);
07188:                    break;
07189:
07190:                case 451:
07191:                    if (DEBUG) {
07192:                        System.out
07193:                                .println("AssignmentOperator ::= REMAINDER_EQUAL");} //$NON-NLS-1$
07194:                    consumeAssignmentOperator(REMAINDER);
07195:                    break;
07196:
07197:                case 452:
07198:                    if (DEBUG) {
07199:                        System.out.println("AssignmentOperator ::= PLUS_EQUAL");} //$NON-NLS-1$
07200:                    consumeAssignmentOperator(PLUS);
07201:                    break;
07202:
07203:                case 453:
07204:                    if (DEBUG) {
07205:                        System.out
07206:                                .println("AssignmentOperator ::= MINUS_EQUAL");} //$NON-NLS-1$
07207:                    consumeAssignmentOperator(MINUS);
07208:                    break;
07209:
07210:                case 454:
07211:                    if (DEBUG) {
07212:                        System.out
07213:                                .println("AssignmentOperator ::= LEFT_SHIFT_EQUAL");} //$NON-NLS-1$
07214:                    consumeAssignmentOperator(LEFT_SHIFT);
07215:                    break;
07216:
07217:                case 455:
07218:                    if (DEBUG) {
07219:                        System.out
07220:                                .println("AssignmentOperator ::= RIGHT_SHIFT_EQUAL");} //$NON-NLS-1$
07221:                    consumeAssignmentOperator(RIGHT_SHIFT);
07222:                    break;
07223:
07224:                case 456:
07225:                    if (DEBUG) {
07226:                        System.out
07227:                                .println("AssignmentOperator ::= UNSIGNED_RIGHT_SHIFT_EQUAL");} //$NON-NLS-1$
07228:                    consumeAssignmentOperator(UNSIGNED_RIGHT_SHIFT);
07229:                    break;
07230:
07231:                case 457:
07232:                    if (DEBUG) {
07233:                        System.out.println("AssignmentOperator ::= AND_EQUAL");} //$NON-NLS-1$
07234:                    consumeAssignmentOperator(AND);
07235:                    break;
07236:
07237:                case 458:
07238:                    if (DEBUG) {
07239:                        System.out.println("AssignmentOperator ::= XOR_EQUAL");} //$NON-NLS-1$
07240:                    consumeAssignmentOperator(XOR);
07241:                    break;
07242:
07243:                case 459:
07244:                    if (DEBUG) {
07245:                        System.out.println("AssignmentOperator ::= OR_EQUAL");} //$NON-NLS-1$
07246:                    consumeAssignmentOperator(OR);
07247:                    break;
07248:
07249:                case 463:
07250:                    if (DEBUG) {
07251:                        System.out.println("Expressionopt ::=");} //$NON-NLS-1$
07252:                    consumeEmptyExpression();
07253:                    break;
07254:
07255:                case 468:
07256:                    if (DEBUG) {
07257:                        System.out.println("ClassBodyDeclarationsopt ::=");} //$NON-NLS-1$
07258:                    consumeEmptyClassBodyDeclarationsopt();
07259:                    break;
07260:
07261:                case 469:
07262:                    if (DEBUG) {
07263:                        System.out
07264:                                .println("ClassBodyDeclarationsopt ::= NestedType...");} //$NON-NLS-1$
07265:                    consumeClassBodyDeclarationsopt();
07266:                    break;
07267:
07268:                case 470:
07269:                    if (DEBUG) {
07270:                        System.out.println("Modifiersopt ::=");} //$NON-NLS-1$
07271:                    consumeDefaultModifiers();
07272:                    break;
07273:
07274:                case 471:
07275:                    if (DEBUG) {
07276:                        System.out.println("Modifiersopt ::= Modifiers");} //$NON-NLS-1$
07277:                    consumeModifiers();
07278:                    break;
07279:
07280:                case 472:
07281:                    if (DEBUG) {
07282:                        System.out.println("BlockStatementsopt ::=");} //$NON-NLS-1$
07283:                    consumeEmptyBlockStatementsopt();
07284:                    break;
07285:
07286:                case 474:
07287:                    if (DEBUG) {
07288:                        System.out.println("Dimsopt ::=");} //$NON-NLS-1$
07289:                    consumeEmptyDimsopt();
07290:                    break;
07291:
07292:                case 476:
07293:                    if (DEBUG) {
07294:                        System.out.println("ArgumentListopt ::=");} //$NON-NLS-1$
07295:                    consumeEmptyArgumentListopt();
07296:                    break;
07297:
07298:                case 480:
07299:                    if (DEBUG) {
07300:                        System.out.println("FormalParameterListopt ::=");} //$NON-NLS-1$
07301:                    consumeFormalParameterListopt();
07302:                    break;
07303:
07304:                case 484:
07305:                    if (DEBUG) {
07306:                        System.out
07307:                                .println("InterfaceMemberDeclarationsopt ::=");} //$NON-NLS-1$
07308:                    consumeEmptyInterfaceMemberDeclarationsopt();
07309:                    break;
07310:
07311:                case 485:
07312:                    if (DEBUG) {
07313:                        System.out
07314:                                .println("InterfaceMemberDeclarationsopt ::= NestedType...");} //$NON-NLS-1$
07315:                    consumeInterfaceMemberDeclarationsopt();
07316:                    break;
07317:
07318:                case 486:
07319:                    if (DEBUG) {
07320:                        System.out.println("NestedType ::=");} //$NON-NLS-1$
07321:                    consumeNestedType();
07322:                    break;
07323:
07324:                case 487:
07325:                    if (DEBUG) {
07326:                        System.out.println("ForInitopt ::=");} //$NON-NLS-1$
07327:                    consumeEmptyForInitopt();
07328:                    break;
07329:
07330:                case 489:
07331:                    if (DEBUG) {
07332:                        System.out.println("ForUpdateopt ::=");} //$NON-NLS-1$
07333:                    consumeEmptyForUpdateopt();
07334:                    break;
07335:
07336:                case 493:
07337:                    if (DEBUG) {
07338:                        System.out.println("Catchesopt ::=");} //$NON-NLS-1$
07339:                    consumeEmptyCatchesopt();
07340:                    break;
07341:
07342:                case 495:
07343:                    if (DEBUG) {
07344:                        System.out
07345:                                .println("EnumDeclaration ::= EnumHeader EnumBody");} //$NON-NLS-1$
07346:                    consumeEnumDeclaration();
07347:                    break;
07348:
07349:                case 496:
07350:                    if (DEBUG) {
07351:                        System.out
07352:                                .println("EnumHeader ::= EnumHeaderName ClassHeaderImplementsopt");} //$NON-NLS-1$
07353:                    consumeEnumHeader();
07354:                    break;
07355:
07356:                case 497:
07357:                    if (DEBUG) {
07358:                        System.out
07359:                                .println("EnumHeaderName ::= Modifiersopt enum Identifier");} //$NON-NLS-1$
07360:                    consumeEnumHeaderName();
07361:                    break;
07362:
07363:                case 498:
07364:                    if (DEBUG) {
07365:                        System.out
07366:                                .println("EnumHeaderName ::= Modifiersopt enum Identifier...");} //$NON-NLS-1$
07367:                    consumeEnumHeaderNameWithTypeParameters();
07368:                    break;
07369:
07370:                case 499:
07371:                    if (DEBUG) {
07372:                        System.out
07373:                                .println("EnumBody ::= LBRACE EnumBodyDeclarationsopt RBRACE");} //$NON-NLS-1$
07374:                    consumeEnumBodyNoConstants();
07375:                    break;
07376:
07377:                case 500:
07378:                    if (DEBUG) {
07379:                        System.out
07380:                                .println("EnumBody ::= LBRACE COMMA EnumBodyDeclarationsopt...");} //$NON-NLS-1$
07381:                    consumeEnumBodyNoConstants();
07382:                    break;
07383:
07384:                case 501:
07385:                    if (DEBUG) {
07386:                        System.out
07387:                                .println("EnumBody ::= LBRACE EnumConstants COMMA...");} //$NON-NLS-1$
07388:                    consumeEnumBodyWithConstants();
07389:                    break;
07390:
07391:                case 502:
07392:                    if (DEBUG) {
07393:                        System.out
07394:                                .println("EnumBody ::= LBRACE EnumConstants...");} //$NON-NLS-1$
07395:                    consumeEnumBodyWithConstants();
07396:                    break;
07397:
07398:                case 504:
07399:                    if (DEBUG) {
07400:                        System.out
07401:                                .println("EnumConstants ::= EnumConstants COMMA EnumConstant");} //$NON-NLS-1$
07402:                    consumeEnumConstants();
07403:                    break;
07404:
07405:                case 505:
07406:                    if (DEBUG) {
07407:                        System.out
07408:                                .println("EnumConstantHeaderName ::= Modifiersopt Identifier");} //$NON-NLS-1$
07409:                    consumeEnumConstantHeaderName();
07410:                    break;
07411:
07412:                case 506:
07413:                    if (DEBUG) {
07414:                        System.out
07415:                                .println("EnumConstantHeader ::= EnumConstantHeaderName...");} //$NON-NLS-1$
07416:                    consumeEnumConstantHeader();
07417:                    break;
07418:
07419:                case 507:
07420:                    if (DEBUG) {
07421:                        System.out
07422:                                .println("EnumConstant ::= EnumConstantHeader ForceNoDiet...");} //$NON-NLS-1$
07423:                    consumeEnumConstantWithClassBody();
07424:                    break;
07425:
07426:                case 508:
07427:                    if (DEBUG) {
07428:                        System.out
07429:                                .println("EnumConstant ::= EnumConstantHeader");} //$NON-NLS-1$
07430:                    consumeEnumConstantNoClassBody();
07431:                    break;
07432:
07433:                case 509:
07434:                    if (DEBUG) {
07435:                        System.out
07436:                                .println("Arguments ::= LPAREN ArgumentListopt RPAREN");} //$NON-NLS-1$
07437:                    consumeArguments();
07438:                    break;
07439:
07440:                case 510:
07441:                    if (DEBUG) {
07442:                        System.out.println("Argumentsopt ::=");} //$NON-NLS-1$
07443:                    consumeEmptyArguments();
07444:                    break;
07445:
07446:                case 512:
07447:                    if (DEBUG) {
07448:                        System.out
07449:                                .println("EnumDeclarations ::= SEMICOLON ClassBodyDeclarationsopt");} //$NON-NLS-1$
07450:                    consumeEnumDeclarations();
07451:                    break;
07452:
07453:                case 513:
07454:                    if (DEBUG) {
07455:                        System.out.println("EnumBodyDeclarationsopt ::=");} //$NON-NLS-1$
07456:                    consumeEmptyEnumDeclarations();
07457:                    break;
07458:
07459:                case 515:
07460:                    if (DEBUG) {
07461:                        System.out
07462:                                .println("EnhancedForStatement ::= EnhancedForStatementHeader...");} //$NON-NLS-1$
07463:                    consumeEnhancedForStatement();
07464:                    break;
07465:
07466:                case 516:
07467:                    if (DEBUG) {
07468:                        System.out
07469:                                .println("EnhancedForStatementNoShortIf ::=...");} //$NON-NLS-1$
07470:                    consumeEnhancedForStatement();
07471:                    break;
07472:
07473:                case 517:
07474:                    if (DEBUG) {
07475:                        System.out
07476:                                .println("EnhancedForStatementHeaderInit ::= for LPAREN Type...");} //$NON-NLS-1$
07477:                    consumeEnhancedForStatementHeaderInit(false);
07478:                    break;
07479:
07480:                case 518:
07481:                    if (DEBUG) {
07482:                        System.out
07483:                                .println("EnhancedForStatementHeaderInit ::= for LPAREN Modifiers");} //$NON-NLS-1$
07484:                    consumeEnhancedForStatementHeaderInit(true);
07485:                    break;
07486:
07487:                case 519:
07488:                    if (DEBUG) {
07489:                        System.out.println("EnhancedForStatementHeader ::=...");} //$NON-NLS-1$
07490:                    consumeEnhancedForStatementHeader();
07491:                    break;
07492:
07493:                case 520:
07494:                    if (DEBUG) {
07495:                        System.out
07496:                                .println("SingleStaticImportDeclaration ::=...");} //$NON-NLS-1$
07497:                    consumeImportDeclaration();
07498:                    break;
07499:
07500:                case 521:
07501:                    if (DEBUG) {
07502:                        System.out
07503:                                .println("SingleStaticImportDeclarationName ::= import static Name");} //$NON-NLS-1$
07504:                    consumeSingleStaticImportDeclarationName();
07505:                    break;
07506:
07507:                case 522:
07508:                    if (DEBUG) {
07509:                        System.out
07510:                                .println("StaticImportOnDemandDeclaration ::=...");} //$NON-NLS-1$
07511:                    consumeImportDeclaration();
07512:                    break;
07513:
07514:                case 523:
07515:                    if (DEBUG) {
07516:                        System.out
07517:                                .println("StaticImportOnDemandDeclarationName ::= import static...");} //$NON-NLS-1$
07518:                    consumeStaticImportOnDemandDeclarationName();
07519:                    break;
07520:
07521:                case 524:
07522:                    if (DEBUG) {
07523:                        System.out
07524:                                .println("TypeArguments ::= LESS TypeArgumentList1");} //$NON-NLS-1$
07525:                    consumeTypeArguments();
07526:                    break;
07527:
07528:                case 525:
07529:                    if (DEBUG) {
07530:                        System.out
07531:                                .println("OnlyTypeArguments ::= LESS TypeArgumentList1");} //$NON-NLS-1$
07532:                    consumeOnlyTypeArguments();
07533:                    break;
07534:
07535:                case 527:
07536:                    if (DEBUG) {
07537:                        System.out
07538:                                .println("TypeArgumentList1 ::= TypeArgumentList COMMA...");} //$NON-NLS-1$
07539:                    consumeTypeArgumentList1();
07540:                    break;
07541:
07542:                case 529:
07543:                    if (DEBUG) {
07544:                        System.out
07545:                                .println("TypeArgumentList ::= TypeArgumentList COMMA TypeArgument");} //$NON-NLS-1$
07546:                    consumeTypeArgumentList();
07547:                    break;
07548:
07549:                case 530:
07550:                    if (DEBUG) {
07551:                        System.out.println("TypeArgument ::= ReferenceType");} //$NON-NLS-1$
07552:                    consumeTypeArgument();
07553:                    break;
07554:
07555:                case 534:
07556:                    if (DEBUG) {
07557:                        System.out
07558:                                .println("ReferenceType1 ::= ReferenceType GREATER");} //$NON-NLS-1$
07559:                    consumeReferenceType1();
07560:                    break;
07561:
07562:                case 535:
07563:                    if (DEBUG) {
07564:                        System.out
07565:                                .println("ReferenceType1 ::= ClassOrInterface LESS...");} //$NON-NLS-1$
07566:                    consumeTypeArgumentReferenceType1();
07567:                    break;
07568:
07569:                case 537:
07570:                    if (DEBUG) {
07571:                        System.out
07572:                                .println("TypeArgumentList2 ::= TypeArgumentList COMMA...");} //$NON-NLS-1$
07573:                    consumeTypeArgumentList2();
07574:                    break;
07575:
07576:                case 540:
07577:                    if (DEBUG) {
07578:                        System.out
07579:                                .println("ReferenceType2 ::= ReferenceType RIGHT_SHIFT");} //$NON-NLS-1$
07580:                    consumeReferenceType2();
07581:                    break;
07582:
07583:                case 541:
07584:                    if (DEBUG) {
07585:                        System.out
07586:                                .println("ReferenceType2 ::= ClassOrInterface LESS...");} //$NON-NLS-1$
07587:                    consumeTypeArgumentReferenceType2();
07588:                    break;
07589:
07590:                case 543:
07591:                    if (DEBUG) {
07592:                        System.out
07593:                                .println("TypeArgumentList3 ::= TypeArgumentList COMMA...");} //$NON-NLS-1$
07594:                    consumeTypeArgumentList3();
07595:                    break;
07596:
07597:                case 546:
07598:                    if (DEBUG) {
07599:                        System.out
07600:                                .println("ReferenceType3 ::= ReferenceType UNSIGNED_RIGHT_SHIFT");} //$NON-NLS-1$
07601:                    consumeReferenceType3();
07602:                    break;
07603:
07604:                case 547:
07605:                    if (DEBUG) {
07606:                        System.out.println("Wildcard ::= QUESTION");} //$NON-NLS-1$
07607:                    consumeWildcard();
07608:                    break;
07609:
07610:                case 548:
07611:                    if (DEBUG) {
07612:                        System.out
07613:                                .println("Wildcard ::= QUESTION WildcardBounds");} //$NON-NLS-1$
07614:                    consumeWildcardWithBounds();
07615:                    break;
07616:
07617:                case 549:
07618:                    if (DEBUG) {
07619:                        System.out
07620:                                .println("WildcardBounds ::= extends ReferenceType");} //$NON-NLS-1$
07621:                    consumeWildcardBoundsExtends();
07622:                    break;
07623:
07624:                case 550:
07625:                    if (DEBUG) {
07626:                        System.out
07627:                                .println("WildcardBounds ::= super ReferenceType");} //$NON-NLS-1$
07628:                    consumeWildcardBoundsSuper();
07629:                    break;
07630:
07631:                case 551:
07632:                    if (DEBUG) {
07633:                        System.out.println("Wildcard1 ::= QUESTION GREATER");} //$NON-NLS-1$
07634:                    consumeWildcard1();
07635:                    break;
07636:
07637:                case 552:
07638:                    if (DEBUG) {
07639:                        System.out
07640:                                .println("Wildcard1 ::= QUESTION WildcardBounds1");} //$NON-NLS-1$
07641:                    consumeWildcard1WithBounds();
07642:                    break;
07643:
07644:                case 553:
07645:                    if (DEBUG) {
07646:                        System.out
07647:                                .println("WildcardBounds1 ::= extends ReferenceType1");} //$NON-NLS-1$
07648:                    consumeWildcardBounds1Extends();
07649:                    break;
07650:
07651:                case 554:
07652:                    if (DEBUG) {
07653:                        System.out
07654:                                .println("WildcardBounds1 ::= super ReferenceType1");} //$NON-NLS-1$
07655:                    consumeWildcardBounds1Super();
07656:                    break;
07657:
07658:                case 555:
07659:                    if (DEBUG) {
07660:                        System.out
07661:                                .println("Wildcard2 ::= QUESTION RIGHT_SHIFT");} //$NON-NLS-1$
07662:                    consumeWildcard2();
07663:                    break;
07664:
07665:                case 556:
07666:                    if (DEBUG) {
07667:                        System.out
07668:                                .println("Wildcard2 ::= QUESTION WildcardBounds2");} //$NON-NLS-1$
07669:                    consumeWildcard2WithBounds();
07670:                    break;
07671:
07672:                case 557:
07673:                    if (DEBUG) {
07674:                        System.out
07675:                                .println("WildcardBounds2 ::= extends ReferenceType2");} //$NON-NLS-1$
07676:                    consumeWildcardBounds2Extends();
07677:                    break;
07678:
07679:                case 558:
07680:                    if (DEBUG) {
07681:                        System.out
07682:                                .println("WildcardBounds2 ::= super ReferenceType2");} //$NON-NLS-1$
07683:                    consumeWildcardBounds2Super();
07684:                    break;
07685:
07686:                case 559:
07687:                    if (DEBUG) {
07688:                        System.out
07689:                                .println("Wildcard3 ::= QUESTION UNSIGNED_RIGHT_SHIFT");} //$NON-NLS-1$
07690:                    consumeWildcard3();
07691:                    break;
07692:
07693:                case 560:
07694:                    if (DEBUG) {
07695:                        System.out
07696:                                .println("Wildcard3 ::= QUESTION WildcardBounds3");} //$NON-NLS-1$
07697:                    consumeWildcard3WithBounds();
07698:                    break;
07699:
07700:                case 561:
07701:                    if (DEBUG) {
07702:                        System.out
07703:                                .println("WildcardBounds3 ::= extends ReferenceType3");} //$NON-NLS-1$
07704:                    consumeWildcardBounds3Extends();
07705:                    break;
07706:
07707:                case 562:
07708:                    if (DEBUG) {
07709:                        System.out
07710:                                .println("WildcardBounds3 ::= super ReferenceType3");} //$NON-NLS-1$
07711:                    consumeWildcardBounds3Super();
07712:                    break;
07713:
07714:                case 563:
07715:                    if (DEBUG) {
07716:                        System.out
07717:                                .println("TypeParameterHeader ::= Identifier");} //$NON-NLS-1$
07718:                    consumeTypeParameterHeader();
07719:                    break;
07720:
07721:                case 564:
07722:                    if (DEBUG) {
07723:                        System.out
07724:                                .println("TypeParameters ::= LESS TypeParameterList1");} //$NON-NLS-1$
07725:                    consumeTypeParameters();
07726:                    break;
07727:
07728:                case 566:
07729:                    if (DEBUG) {
07730:                        System.out
07731:                                .println("TypeParameterList ::= TypeParameterList COMMA...");} //$NON-NLS-1$
07732:                    consumeTypeParameterList();
07733:                    break;
07734:
07735:                case 568:
07736:                    if (DEBUG) {
07737:                        System.out
07738:                                .println("TypeParameter ::= TypeParameterHeader extends...");} //$NON-NLS-1$
07739:                    consumeTypeParameterWithExtends();
07740:                    break;
07741:
07742:                case 569:
07743:                    if (DEBUG) {
07744:                        System.out
07745:                                .println("TypeParameter ::= TypeParameterHeader extends...");} //$NON-NLS-1$
07746:                    consumeTypeParameterWithExtendsAndBounds();
07747:                    break;
07748:
07749:                case 571:
07750:                    if (DEBUG) {
07751:                        System.out
07752:                                .println("AdditionalBoundList ::= AdditionalBoundList...");} //$NON-NLS-1$
07753:                    consumeAdditionalBoundList();
07754:                    break;
07755:
07756:                case 572:
07757:                    if (DEBUG) {
07758:                        System.out
07759:                                .println("AdditionalBound ::= AND ReferenceType");} //$NON-NLS-1$
07760:                    consumeAdditionalBound();
07761:                    break;
07762:
07763:                case 574:
07764:                    if (DEBUG) {
07765:                        System.out
07766:                                .println("TypeParameterList1 ::= TypeParameterList COMMA...");} //$NON-NLS-1$
07767:                    consumeTypeParameterList1();
07768:                    break;
07769:
07770:                case 575:
07771:                    if (DEBUG) {
07772:                        System.out
07773:                                .println("TypeParameter1 ::= TypeParameterHeader GREATER");} //$NON-NLS-1$
07774:                    consumeTypeParameter1();
07775:                    break;
07776:
07777:                case 576:
07778:                    if (DEBUG) {
07779:                        System.out
07780:                                .println("TypeParameter1 ::= TypeParameterHeader extends...");} //$NON-NLS-1$
07781:                    consumeTypeParameter1WithExtends();
07782:                    break;
07783:
07784:                case 577:
07785:                    if (DEBUG) {
07786:                        System.out
07787:                                .println("TypeParameter1 ::= TypeParameterHeader extends...");} //$NON-NLS-1$
07788:                    consumeTypeParameter1WithExtendsAndBounds();
07789:                    break;
07790:
07791:                case 579:
07792:                    if (DEBUG) {
07793:                        System.out
07794:                                .println("AdditionalBoundList1 ::= AdditionalBoundList...");} //$NON-NLS-1$
07795:                    consumeAdditionalBoundList1();
07796:                    break;
07797:
07798:                case 580:
07799:                    if (DEBUG) {
07800:                        System.out
07801:                                .println("AdditionalBound1 ::= AND ReferenceType1");} //$NON-NLS-1$
07802:                    consumeAdditionalBound1();
07803:                    break;
07804:
07805:                case 586:
07806:                    if (DEBUG) {
07807:                        System.out
07808:                                .println("UnaryExpression_NotName ::= PLUS PushPosition...");} //$NON-NLS-1$
07809:                    consumeUnaryExpression(OperatorIds.PLUS);
07810:                    break;
07811:
07812:                case 587:
07813:                    if (DEBUG) {
07814:                        System.out
07815:                                .println("UnaryExpression_NotName ::= MINUS PushPosition...");} //$NON-NLS-1$
07816:                    consumeUnaryExpression(OperatorIds.MINUS);
07817:                    break;
07818:
07819:                case 590:
07820:                    if (DEBUG) {
07821:                        System.out
07822:                                .println("UnaryExpressionNotPlusMinus_NotName ::= TWIDDLE...");} //$NON-NLS-1$
07823:                    consumeUnaryExpression(OperatorIds.TWIDDLE);
07824:                    break;
07825:
07826:                case 591:
07827:                    if (DEBUG) {
07828:                        System.out
07829:                                .println("UnaryExpressionNotPlusMinus_NotName ::= NOT PushPosition");} //$NON-NLS-1$
07830:                    consumeUnaryExpression(OperatorIds.NOT);
07831:                    break;
07832:
07833:                case 594:
07834:                    if (DEBUG) {
07835:                        System.out
07836:                                .println("MultiplicativeExpression_NotName ::=...");} //$NON-NLS-1$
07837:                    consumeBinaryExpression(OperatorIds.MULTIPLY);
07838:                    break;
07839:
07840:                case 595:
07841:                    if (DEBUG) {
07842:                        System.out
07843:                                .println("MultiplicativeExpression_NotName ::= Name MULTIPLY...");} //$NON-NLS-1$
07844:                    consumeBinaryExpressionWithName(OperatorIds.MULTIPLY);
07845:                    break;
07846:
07847:                case 596:
07848:                    if (DEBUG) {
07849:                        System.out
07850:                                .println("MultiplicativeExpression_NotName ::=...");} //$NON-NLS-1$
07851:                    consumeBinaryExpression(OperatorIds.DIVIDE);
07852:                    break;
07853:
07854:                case 597:
07855:                    if (DEBUG) {
07856:                        System.out
07857:                                .println("MultiplicativeExpression_NotName ::= Name DIVIDE...");} //$NON-NLS-1$
07858:                    consumeBinaryExpressionWithName(OperatorIds.DIVIDE);
07859:                    break;
07860:
07861:                case 598:
07862:                    if (DEBUG) {
07863:                        System.out
07864:                                .println("MultiplicativeExpression_NotName ::=...");} //$NON-NLS-1$
07865:                    consumeBinaryExpression(OperatorIds.REMAINDER);
07866:                    break;
07867:
07868:                case 599:
07869:                    if (DEBUG) {
07870:                        System.out
07871:                                .println("MultiplicativeExpression_NotName ::= Name REMAINDER...");} //$NON-NLS-1$
07872:                    consumeBinaryExpressionWithName(OperatorIds.REMAINDER);
07873:                    break;
07874:
07875:                case 601:
07876:                    if (DEBUG) {
07877:                        System.out.println("AdditiveExpression_NotName ::=...");} //$NON-NLS-1$
07878:                    consumeBinaryExpression(OperatorIds.PLUS);
07879:                    break;
07880:
07881:                case 602:
07882:                    if (DEBUG) {
07883:                        System.out
07884:                                .println("AdditiveExpression_NotName ::= Name PLUS...");} //$NON-NLS-1$
07885:                    consumeBinaryExpressionWithName(OperatorIds.PLUS);
07886:                    break;
07887:
07888:                case 603:
07889:                    if (DEBUG) {
07890:                        System.out.println("AdditiveExpression_NotName ::=...");} //$NON-NLS-1$
07891:                    consumeBinaryExpression(OperatorIds.MINUS);
07892:                    break;
07893:
07894:                case 604:
07895:                    if (DEBUG) {
07896:                        System.out
07897:                                .println("AdditiveExpression_NotName ::= Name MINUS...");} //$NON-NLS-1$
07898:                    consumeBinaryExpressionWithName(OperatorIds.MINUS);
07899:                    break;
07900:
07901:                case 606:
07902:                    if (DEBUG) {
07903:                        System.out
07904:                                .println("ShiftExpression_NotName ::= ShiftExpression_NotName...");} //$NON-NLS-1$
07905:                    consumeBinaryExpression(OperatorIds.LEFT_SHIFT);
07906:                    break;
07907:
07908:                case 607:
07909:                    if (DEBUG) {
07910:                        System.out
07911:                                .println("ShiftExpression_NotName ::= Name LEFT_SHIFT...");} //$NON-NLS-1$
07912:                    consumeBinaryExpressionWithName(OperatorIds.LEFT_SHIFT);
07913:                    break;
07914:
07915:                case 608:
07916:                    if (DEBUG) {
07917:                        System.out
07918:                                .println("ShiftExpression_NotName ::= ShiftExpression_NotName...");} //$NON-NLS-1$
07919:                    consumeBinaryExpression(OperatorIds.RIGHT_SHIFT);
07920:                    break;
07921:
07922:                case 609:
07923:                    if (DEBUG) {
07924:                        System.out
07925:                                .println("ShiftExpression_NotName ::= Name RIGHT_SHIFT...");} //$NON-NLS-1$
07926:                    consumeBinaryExpressionWithName(OperatorIds.RIGHT_SHIFT);
07927:                    break;
07928:
07929:                case 610:
07930:                    if (DEBUG) {
07931:                        System.out
07932:                                .println("ShiftExpression_NotName ::= ShiftExpression_NotName...");} //$NON-NLS-1$
07933:                    consumeBinaryExpression(OperatorIds.UNSIGNED_RIGHT_SHIFT);
07934:                    break;
07935:
07936:                case 611:
07937:                    if (DEBUG) {
07938:                        System.out
07939:                                .println("ShiftExpression_NotName ::= Name UNSIGNED_RIGHT_SHIFT...");} //$NON-NLS-1$
07940:                    consumeBinaryExpressionWithName(OperatorIds.UNSIGNED_RIGHT_SHIFT);
07941:                    break;
07942:
07943:                case 613:
07944:                    if (DEBUG) {
07945:                        System.out
07946:                                .println("RelationalExpression_NotName ::= ShiftExpression_NotName");} //$NON-NLS-1$
07947:                    consumeBinaryExpression(OperatorIds.LESS);
07948:                    break;
07949:
07950:                case 614:
07951:                    if (DEBUG) {
07952:                        System.out
07953:                                .println("RelationalExpression_NotName ::= Name LESS...");} //$NON-NLS-1$
07954:                    consumeBinaryExpressionWithName(OperatorIds.LESS);
07955:                    break;
07956:
07957:                case 615:
07958:                    if (DEBUG) {
07959:                        System.out
07960:                                .println("RelationalExpression_NotName ::= ShiftExpression_NotName");} //$NON-NLS-1$
07961:                    consumeBinaryExpression(OperatorIds.GREATER);
07962:                    break;
07963:
07964:                case 616:
07965:                    if (DEBUG) {
07966:                        System.out
07967:                                .println("RelationalExpression_NotName ::= Name GREATER...");} //$NON-NLS-1$
07968:                    consumeBinaryExpressionWithName(OperatorIds.GREATER);
07969:                    break;
07970:
07971:                case 617:
07972:                    if (DEBUG) {
07973:                        System.out
07974:                                .println("RelationalExpression_NotName ::=...");} //$NON-NLS-1$
07975:                    consumeBinaryExpression(OperatorIds.LESS_EQUAL);
07976:                    break;
07977:
07978:                case 618:
07979:                    if (DEBUG) {
07980:                        System.out
07981:                                .println("RelationalExpression_NotName ::= Name LESS_EQUAL...");} //$NON-NLS-1$
07982:                    consumeBinaryExpressionWithName(OperatorIds.LESS_EQUAL);
07983:                    break;
07984:
07985:                case 619:
07986:                    if (DEBUG) {
07987:                        System.out
07988:                                .println("RelationalExpression_NotName ::=...");} //$NON-NLS-1$
07989:                    consumeBinaryExpression(OperatorIds.GREATER_EQUAL);
07990:                    break;
07991:
07992:                case 620:
07993:                    if (DEBUG) {
07994:                        System.out
07995:                                .println("RelationalExpression_NotName ::= Name GREATER_EQUAL...");} //$NON-NLS-1$
07996:                    consumeBinaryExpressionWithName(OperatorIds.GREATER_EQUAL);
07997:                    break;
07998:
07999:                case 622:
08000:                    if (DEBUG) {
08001:                        System.out
08002:                                .println("InstanceofExpression_NotName ::= Name instanceof...");} //$NON-NLS-1$
08003:                    consumeInstanceOfExpressionWithName();
08004:                    break;
08005:
08006:                case 623:
08007:                    if (DEBUG) {
08008:                        System.out
08009:                                .println("InstanceofExpression_NotName ::=...");} //$NON-NLS-1$
08010:                    consumeInstanceOfExpression();
08011:                    break;
08012:
08013:                case 625:
08014:                    if (DEBUG) {
08015:                        System.out.println("EqualityExpression_NotName ::=...");} //$NON-NLS-1$
08016:                    consumeEqualityExpression(OperatorIds.EQUAL_EQUAL);
08017:                    break;
08018:
08019:                case 626:
08020:                    if (DEBUG) {
08021:                        System.out
08022:                                .println("EqualityExpression_NotName ::= Name EQUAL_EQUAL...");} //$NON-NLS-1$
08023:                    consumeEqualityExpressionWithName(OperatorIds.EQUAL_EQUAL);
08024:                    break;
08025:
08026:                case 627:
08027:                    if (DEBUG) {
08028:                        System.out.println("EqualityExpression_NotName ::=...");} //$NON-NLS-1$
08029:                    consumeEqualityExpression(OperatorIds.NOT_EQUAL);
08030:                    break;
08031:
08032:                case 628:
08033:                    if (DEBUG) {
08034:                        System.out
08035:                                .println("EqualityExpression_NotName ::= Name NOT_EQUAL...");} //$NON-NLS-1$
08036:                    consumeEqualityExpressionWithName(OperatorIds.NOT_EQUAL);
08037:                    break;
08038:
08039:                case 630:
08040:                    if (DEBUG) {
08041:                        System.out
08042:                                .println("AndExpression_NotName ::= AndExpression_NotName AND...");} //$NON-NLS-1$
08043:                    consumeBinaryExpression(OperatorIds.AND);
08044:                    break;
08045:
08046:                case 631:
08047:                    if (DEBUG) {
08048:                        System.out
08049:                                .println("AndExpression_NotName ::= Name AND EqualityExpression");} //$NON-NLS-1$
08050:                    consumeBinaryExpressionWithName(OperatorIds.AND);
08051:                    break;
08052:
08053:                case 633:
08054:                    if (DEBUG) {
08055:                        System.out
08056:                                .println("ExclusiveOrExpression_NotName ::=...");} //$NON-NLS-1$
08057:                    consumeBinaryExpression(OperatorIds.XOR);
08058:                    break;
08059:
08060:                case 634:
08061:                    if (DEBUG) {
08062:                        System.out
08063:                                .println("ExclusiveOrExpression_NotName ::= Name XOR AndExpression");} //$NON-NLS-1$
08064:                    consumeBinaryExpressionWithName(OperatorIds.XOR);
08065:                    break;
08066:
08067:                case 636:
08068:                    if (DEBUG) {
08069:                        System.out
08070:                                .println("InclusiveOrExpression_NotName ::=...");} //$NON-NLS-1$
08071:                    consumeBinaryExpression(OperatorIds.OR);
08072:                    break;
08073:
08074:                case 637:
08075:                    if (DEBUG) {
08076:                        System.out
08077:                                .println("InclusiveOrExpression_NotName ::= Name OR...");} //$NON-NLS-1$
08078:                    consumeBinaryExpressionWithName(OperatorIds.OR);
08079:                    break;
08080:
08081:                case 639:
08082:                    if (DEBUG) {
08083:                        System.out
08084:                                .println("ConditionalAndExpression_NotName ::=...");} //$NON-NLS-1$
08085:                    consumeBinaryExpression(OperatorIds.AND_AND);
08086:                    break;
08087:
08088:                case 640:
08089:                    if (DEBUG) {
08090:                        System.out
08091:                                .println("ConditionalAndExpression_NotName ::= Name AND_AND...");} //$NON-NLS-1$
08092:                    consumeBinaryExpressionWithName(OperatorIds.AND_AND);
08093:                    break;
08094:
08095:                case 642:
08096:                    if (DEBUG) {
08097:                        System.out
08098:                                .println("ConditionalOrExpression_NotName ::=...");} //$NON-NLS-1$
08099:                    consumeBinaryExpression(OperatorIds.OR_OR);
08100:                    break;
08101:
08102:                case 643:
08103:                    if (DEBUG) {
08104:                        System.out
08105:                                .println("ConditionalOrExpression_NotName ::= Name OR_OR...");} //$NON-NLS-1$
08106:                    consumeBinaryExpressionWithName(OperatorIds.OR_OR);
08107:                    break;
08108:
08109:                case 645:
08110:                    if (DEBUG) {
08111:                        System.out
08112:                                .println("ConditionalExpression_NotName ::=...");} //$NON-NLS-1$
08113:                    consumeConditionalExpression(OperatorIds.QUESTIONCOLON);
08114:                    break;
08115:
08116:                case 646:
08117:                    if (DEBUG) {
08118:                        System.out
08119:                                .println("ConditionalExpression_NotName ::= Name QUESTION...");} //$NON-NLS-1$
08120:                    consumeConditionalExpressionWithName(OperatorIds.QUESTIONCOLON);
08121:                    break;
08122:
08123:                case 650:
08124:                    if (DEBUG) {
08125:                        System.out
08126:                                .println("AnnotationTypeDeclarationHeaderName ::= Modifiers AT...");} //$NON-NLS-1$
08127:                    consumeAnnotationTypeDeclarationHeaderName();
08128:                    break;
08129:
08130:                case 651:
08131:                    if (DEBUG) {
08132:                        System.out
08133:                                .println("AnnotationTypeDeclarationHeaderName ::= Modifiers AT...");} //$NON-NLS-1$
08134:                    consumeAnnotationTypeDeclarationHeaderNameWithTypeParameters();
08135:                    break;
08136:
08137:                case 652:
08138:                    if (DEBUG) {
08139:                        System.out
08140:                                .println("AnnotationTypeDeclarationHeaderName ::= AT...");} //$NON-NLS-1$
08141:                    consumeAnnotationTypeDeclarationHeaderNameWithTypeParameters();
08142:                    break;
08143:
08144:                case 653:
08145:                    if (DEBUG) {
08146:                        System.out
08147:                                .println("AnnotationTypeDeclarationHeaderName ::= AT...");} //$NON-NLS-1$
08148:                    consumeAnnotationTypeDeclarationHeaderName();
08149:                    break;
08150:
08151:                case 654:
08152:                    if (DEBUG) {
08153:                        System.out
08154:                                .println("AnnotationTypeDeclarationHeader ::=...");} //$NON-NLS-1$
08155:                    consumeAnnotationTypeDeclarationHeader();
08156:                    break;
08157:
08158:                case 655:
08159:                    if (DEBUG) {
08160:                        System.out.println("AnnotationTypeDeclaration ::=...");} //$NON-NLS-1$
08161:                    consumeAnnotationTypeDeclaration();
08162:                    break;
08163:
08164:                case 657:
08165:                    if (DEBUG) {
08166:                        System.out
08167:                                .println("AnnotationTypeMemberDeclarationsopt ::=");} //$NON-NLS-1$
08168:                    consumeEmptyAnnotationTypeMemberDeclarationsopt();
08169:                    break;
08170:
08171:                case 658:
08172:                    if (DEBUG) {
08173:                        System.out
08174:                                .println("AnnotationTypeMemberDeclarationsopt ::= NestedType...");} //$NON-NLS-1$
08175:                    consumeAnnotationTypeMemberDeclarationsopt();
08176:                    break;
08177:
08178:                case 660:
08179:                    if (DEBUG) {
08180:                        System.out
08181:                                .println("AnnotationTypeMemberDeclarations ::=...");} //$NON-NLS-1$
08182:                    consumeAnnotationTypeMemberDeclarations();
08183:                    break;
08184:
08185:                case 661:
08186:                    if (DEBUG) {
08187:                        System.out
08188:                                .println("AnnotationMethodHeaderName ::= Modifiersopt...");} //$NON-NLS-1$
08189:                    consumeMethodHeaderNameWithTypeParameters(true);
08190:                    break;
08191:
08192:                case 662:
08193:                    if (DEBUG) {
08194:                        System.out
08195:                                .println("AnnotationMethodHeaderName ::= Modifiersopt Type...");} //$NON-NLS-1$
08196:                    consumeMethodHeaderName(true);
08197:                    break;
08198:
08199:                case 663:
08200:                    if (DEBUG) {
08201:                        System.out
08202:                                .println("AnnotationMethodHeaderDefaultValueopt ::=");} //$NON-NLS-1$
08203:                    consumeEmptyMethodHeaderDefaultValue();
08204:                    break;
08205:
08206:                case 664:
08207:                    if (DEBUG) {
08208:                        System.out
08209:                                .println("AnnotationMethodHeaderDefaultValueopt ::= DefaultValue");} //$NON-NLS-1$
08210:                    consumeMethodHeaderDefaultValue();
08211:                    break;
08212:
08213:                case 665:
08214:                    if (DEBUG) {
08215:                        System.out
08216:                                .println("AnnotationMethodHeader ::= AnnotationMethodHeaderName...");} //$NON-NLS-1$
08217:                    consumeMethodHeader();
08218:                    break;
08219:
08220:                case 666:
08221:                    if (DEBUG) {
08222:                        System.out
08223:                                .println("AnnotationTypeMemberDeclaration ::=...");} //$NON-NLS-1$
08224:                    consumeAnnotationTypeMemberDeclaration();
08225:                    break;
08226:
08227:                case 674:
08228:                    if (DEBUG) {
08229:                        System.out.println("AnnotationName ::= AT Name");} //$NON-NLS-1$
08230:                    consumeAnnotationName();
08231:                    break;
08232:
08233:                case 675:
08234:                    if (DEBUG) {
08235:                        System.out
08236:                                .println("NormalAnnotation ::= AnnotationName LPAREN...");} //$NON-NLS-1$
08237:                    consumeNormalAnnotation();
08238:                    break;
08239:
08240:                case 676:
08241:                    if (DEBUG) {
08242:                        System.out.println("MemberValuePairsopt ::=");} //$NON-NLS-1$
08243:                    consumeEmptyMemberValuePairsopt();
08244:                    break;
08245:
08246:                case 679:
08247:                    if (DEBUG) {
08248:                        System.out
08249:                                .println("MemberValuePairs ::= MemberValuePairs COMMA...");} //$NON-NLS-1$
08250:                    consumeMemberValuePairs();
08251:                    break;
08252:
08253:                case 680:
08254:                    if (DEBUG) {
08255:                        System.out
08256:                                .println("MemberValuePair ::= SimpleName EQUAL EnterMemberValue...");} //$NON-NLS-1$
08257:                    consumeMemberValuePair();
08258:                    break;
08259:
08260:                case 681:
08261:                    if (DEBUG) {
08262:                        System.out.println("EnterMemberValue ::=");} //$NON-NLS-1$
08263:                    consumeEnterMemberValue();
08264:                    break;
08265:
08266:                case 682:
08267:                    if (DEBUG) {
08268:                        System.out.println("ExitMemberValue ::=");} //$NON-NLS-1$
08269:                    consumeExitMemberValue();
08270:                    break;
08271:
08272:                case 684:
08273:                    if (DEBUG) {
08274:                        System.out.println("MemberValue ::= Name");} //$NON-NLS-1$
08275:                    consumeMemberValueAsName();
08276:                    break;
08277:
08278:                case 687:
08279:                    if (DEBUG) {
08280:                        System.out
08281:                                .println("MemberValueArrayInitializer ::=...");} //$NON-NLS-1$
08282:                    consumeMemberValueArrayInitializer();
08283:                    break;
08284:
08285:                case 688:
08286:                    if (DEBUG) {
08287:                        System.out
08288:                                .println("MemberValueArrayInitializer ::=...");} //$NON-NLS-1$
08289:                    consumeMemberValueArrayInitializer();
08290:                    break;
08291:
08292:                case 689:
08293:                    if (DEBUG) {
08294:                        System.out
08295:                                .println("MemberValueArrayInitializer ::=...");} //$NON-NLS-1$
08296:                    consumeEmptyMemberValueArrayInitializer();
08297:                    break;
08298:
08299:                case 690:
08300:                    if (DEBUG) {
08301:                        System.out
08302:                                .println("MemberValueArrayInitializer ::=...");} //$NON-NLS-1$
08303:                    consumeEmptyMemberValueArrayInitializer();
08304:                    break;
08305:
08306:                case 691:
08307:                    if (DEBUG) {
08308:                        System.out
08309:                                .println("EnterMemberValueArrayInitializer ::=");} //$NON-NLS-1$
08310:                    consumeEnterMemberValueArrayInitializer();
08311:                    break;
08312:
08313:                case 693:
08314:                    if (DEBUG) {
08315:                        System.out
08316:                                .println("MemberValues ::= MemberValues COMMA MemberValue");} //$NON-NLS-1$
08317:                    consumeMemberValues();
08318:                    break;
08319:
08320:                case 694:
08321:                    if (DEBUG) {
08322:                        System.out
08323:                                .println("MarkerAnnotation ::= AnnotationName");} //$NON-NLS-1$
08324:                    consumeMarkerAnnotation();
08325:                    break;
08326:
08327:                case 695:
08328:                    if (DEBUG) {
08329:                        System.out
08330:                                .println("SingleMemberAnnotation ::= AnnotationName LPAREN...");} //$NON-NLS-1$
08331:                    consumeSingleMemberAnnotation();
08332:                    break;
08333:
08334:                case 696:
08335:                    if (DEBUG) {
08336:                        System.out
08337:                                .println("RecoveryMethodHeaderName ::= Modifiersopt TypeParameters");} //$NON-NLS-1$
08338:                    consumeRecoveryMethodHeaderNameWithTypeParameters();
08339:                    break;
08340:
08341:                case 697:
08342:                    if (DEBUG) {
08343:                        System.out
08344:                                .println("RecoveryMethodHeaderName ::= Modifiersopt Type...");} //$NON-NLS-1$
08345:                    consumeRecoveryMethodHeaderName();
08346:                    break;
08347:
08348:                case 698:
08349:                    if (DEBUG) {
08350:                        System.out
08351:                                .println("RecoveryMethodHeader ::= RecoveryMethodHeaderName...");} //$NON-NLS-1$
08352:                    consumeMethodHeader();
08353:                    break;
08354:
08355:                case 699:
08356:                    if (DEBUG) {
08357:                        System.out
08358:                                .println("RecoveryMethodHeader ::= RecoveryMethodHeaderName...");} //$NON-NLS-1$
08359:                    consumeMethodHeader();
08360:                    break;
08361:
08362:                }
08363:            }
08364:
08365:            protected void consumeSimpleAssertStatement() {
08366:                // AssertStatement ::= 'assert' Expression ';'
08367:                this .expressionLengthPtr--;
08368:                pushOnAstStack(new AssertStatement(
08369:                        this .expressionStack[this .expressionPtr--],
08370:                        this .intStack[this .intPtr--]));
08371:            }
08372:
08373:            protected void consumeSingleMemberAnnotation() {
08374:                // SingleMemberAnnotation ::= '@' Name '(' MemberValue ')'
08375:                SingleMemberAnnotation singleMemberAnnotation = null;
08376:                TypeReference typeReference = this .getAnnotationType();
08377:                singleMemberAnnotation = new SingleMemberAnnotation(
08378:                        typeReference, this .intStack[this .intPtr--]);
08379:                singleMemberAnnotation.memberValue = this .expressionStack[this .expressionPtr--];
08380:                this .expressionLengthPtr--;
08381:                singleMemberAnnotation.declarationSourceEnd = this .rParenPos;
08382:                pushOnExpressionStack(singleMemberAnnotation);
08383:
08384:                if (this .currentElement != null) {
08385:                    annotationRecoveryCheckPoint(
08386:                            singleMemberAnnotation.sourceStart,
08387:                            singleMemberAnnotation.declarationSourceEnd);
08388:                }
08389:
08390:                if (!this .statementRecoveryActivated
08391:                        && options.sourceLevel < ClassFileConstants.JDK1_5
08392:                        && this .lastErrorEndPositionBeforeRecovery < this .scanner.currentPosition) {
08393:                    this .problemReporter().invalidUsageOfAnnotation(
08394:                            singleMemberAnnotation);
08395:                }
08396:                this .recordStringLiterals = true;
08397:            }
08398:
08399:            protected void consumeSingleStaticImportDeclarationName() {
08400:                // SingleTypeImportDeclarationName ::= 'import' 'static' Name
08401:                /* push an ImportRef build from the last name 
08402:                stored in the identifier stack. */
08403:
08404:                ImportReference impt;
08405:                int length;
08406:                char[][] tokens = new char[length = this .identifierLengthStack[this .identifierLengthPtr--]][];
08407:                this .identifierPtr -= length;
08408:                long[] positions = new long[length];
08409:                System.arraycopy(this .identifierStack, this .identifierPtr + 1,
08410:                        tokens, 0, length);
08411:                System.arraycopy(this .identifierPositionStack,
08412:                        this .identifierPtr + 1, positions, 0, length);
08413:                pushOnAstStack(impt = new ImportReference(tokens, positions,
08414:                        false, ClassFileConstants.AccStatic));
08415:
08416:                this .modifiers = ClassFileConstants.AccDefault;
08417:                this .modifiersSourceStart = -1; // <-- see comment into modifiersFlag(int)
08418:
08419:                if (this .currentToken == TokenNameSEMICOLON) {
08420:                    impt.declarationSourceEnd = this .scanner.currentPosition - 1;
08421:                } else {
08422:                    impt.declarationSourceEnd = impt.sourceEnd;
08423:                }
08424:                impt.declarationEnd = impt.declarationSourceEnd;
08425:                //this.endPosition is just before the ;
08426:                impt.declarationSourceStart = this .intStack[this .intPtr--];
08427:
08428:                if (!this .statementRecoveryActivated
08429:                        && this .options.sourceLevel < ClassFileConstants.JDK1_5
08430:                        && this .lastErrorEndPositionBeforeRecovery < this .scanner.currentPosition) {
08431:                    impt.modifiers = ClassFileConstants.AccDefault; // convert the static import reference to a non-static importe reference
08432:                    this .problemReporter().invalidUsageOfStaticImports(impt);
08433:                }
08434:
08435:                // recovery
08436:                if (this .currentElement != null) {
08437:                    this .lastCheckPoint = impt.declarationSourceEnd + 1;
08438:                    this .currentElement = this .currentElement.add(impt, 0);
08439:                    this .lastIgnoredToken = -1;
08440:                    this .restartRecovery = true; // used to avoid branching back into the regular automaton		
08441:                }
08442:            }
08443:
08444:            protected void consumeSingleTypeImportDeclarationName() {
08445:                // SingleTypeImportDeclarationName ::= 'import' Name
08446:                /* push an ImportRef build from the last name 
08447:                stored in the identifier stack. */
08448:
08449:                ImportReference impt;
08450:                int length;
08451:                char[][] tokens = new char[length = this .identifierLengthStack[this .identifierLengthPtr--]][];
08452:                this .identifierPtr -= length;
08453:                long[] positions = new long[length];
08454:                System.arraycopy(this .identifierStack, this .identifierPtr + 1,
08455:                        tokens, 0, length);
08456:                System.arraycopy(this .identifierPositionStack,
08457:                        this .identifierPtr + 1, positions, 0, length);
08458:                pushOnAstStack(impt = new ImportReference(tokens, positions,
08459:                        false, ClassFileConstants.AccDefault));
08460:
08461:                if (this .currentToken == TokenNameSEMICOLON) {
08462:                    impt.declarationSourceEnd = this .scanner.currentPosition - 1;
08463:                } else {
08464:                    impt.declarationSourceEnd = impt.sourceEnd;
08465:                }
08466:                impt.declarationEnd = impt.declarationSourceEnd;
08467:                //this.endPosition is just before the ;
08468:                impt.declarationSourceStart = this .intStack[this .intPtr--];
08469:
08470:                // recovery
08471:                if (this .currentElement != null) {
08472:                    this .lastCheckPoint = impt.declarationSourceEnd + 1;
08473:                    this .currentElement = this .currentElement.add(impt, 0);
08474:                    this .lastIgnoredToken = -1;
08475:                    this .restartRecovery = true; // used to avoid branching back into the regular automaton		
08476:                }
08477:            }
08478:
08479:            protected void consumeStatementBreak() {
08480:                // BreakStatement ::= 'break' ';'
08481:                // break pushs a position on this.intStack in case there is no label
08482:
08483:                pushOnAstStack(new BreakStatement(null,
08484:                        this .intStack[this .intPtr--], this .endStatementPosition));
08485:
08486:                if (this .pendingRecoveredType != null) {
08487:                    // Used only in statements recovery.
08488:                    // This is not a real break statement but a placeholder for an existing local type.
08489:                    // The break statement must be replace by the local type.
08490:                    if (this .pendingRecoveredType.allocation == null
08491:                            && this .endPosition <= this .pendingRecoveredType.declarationSourceEnd) {
08492:                        this .astStack[this .astPtr] = this .pendingRecoveredType;
08493:                        this .pendingRecoveredType = null;
08494:                        return;
08495:                    }
08496:                    this .pendingRecoveredType = null;
08497:                }
08498:            }
08499:
08500:            protected void consumeStatementBreakWithLabel() {
08501:                // BreakStatement ::= 'break' Identifier ';'
08502:                // break pushs a position on this.intStack in case there is no label
08503:
08504:                pushOnAstStack(new BreakStatement(
08505:                        this .identifierStack[this .identifierPtr--],
08506:                        this .intStack[this .intPtr--], this .endStatementPosition));
08507:                this .identifierLengthPtr--;
08508:            }
08509:
08510:            protected void consumeStatementCatch() {
08511:                // CatchClause ::= 'catch' '(' FormalParameter ')'    Block
08512:
08513:                //catch are stored directly into the Try
08514:                //has they always comes two by two....
08515:                //we remove one entry from the astlengthPtr.
08516:                //The construction of the try statement must
08517:                //then fetch the catches using  2*i and 2*i + 1
08518:
08519:                this .astLengthPtr--;
08520:                this .listLength = 0; // reset formalParameter counter (incremented for catch variable)
08521:            }
08522:
08523:            protected void consumeStatementContinue() {
08524:                // ContinueStatement ::= 'continue' ';'
08525:                // continue pushs a position on this.intStack in case there is no label
08526:
08527:                pushOnAstStack(new ContinueStatement(null,
08528:                        this .intStack[this .intPtr--], this .endStatementPosition));
08529:            }
08530:
08531:            protected void consumeStatementContinueWithLabel() {
08532:                // ContinueStatement ::= 'continue' Identifier ';'
08533:                // continue pushs a position on this.intStack in case there is no label
08534:
08535:                pushOnAstStack(new ContinueStatement(
08536:                        this .identifierStack[this .identifierPtr--],
08537:                        this .intStack[this .intPtr--], this .endStatementPosition));
08538:                this .identifierLengthPtr--;
08539:            }
08540:
08541:            protected void consumeStatementDo() {
08542:                // DoStatement ::= 'do' Statement 'while' '(' Expression ')' ';'
08543:
08544:                //the 'while' pushes a value on this.intStack that we need to remove
08545:                this .intPtr--;
08546:
08547:                Statement statement = (Statement) this .astStack[this .astPtr];
08548:                this .expressionLengthPtr--;
08549:                this .astStack[this .astPtr] = new DoStatement(
08550:                        this .expressionStack[this .expressionPtr--], statement,
08551:                        this .intStack[this .intPtr--], this .endStatementPosition);
08552:            }
08553:
08554:            protected void consumeStatementExpressionList() {
08555:                // StatementExpressionList ::= StatementExpressionList ',' StatementExpression
08556:                concatExpressionLists();
08557:            }
08558:
08559:            protected void consumeStatementFor() {
08560:                // ForStatement ::= 'for' '(' ForInitopt ';' Expressionopt ';' ForUpdateopt ')' Statement
08561:                // ForStatementNoShortIf ::= 'for' '(' ForInitopt ';' Expressionopt ';' ForUpdateopt ')' StatementNoShortIf
08562:
08563:                int length;
08564:                Expression cond = null;
08565:                Statement[] inits, updates;
08566:                boolean scope = true;
08567:
08568:                //statements
08569:                this .astLengthPtr--;
08570:                Statement statement = (Statement) this .astStack[this .astPtr--];
08571:
08572:                //updates are on the expresion stack
08573:                if ((length = this .expressionLengthStack[this .expressionLengthPtr--]) == 0) {
08574:                    updates = null;
08575:                } else {
08576:                    this .expressionPtr -= length;
08577:                    System.arraycopy(this .expressionStack,
08578:                            this .expressionPtr + 1,
08579:                            updates = new Statement[length], 0, length);
08580:                }
08581:
08582:                if (this .expressionLengthStack[this .expressionLengthPtr--] != 0)
08583:                    cond = this .expressionStack[this .expressionPtr--];
08584:
08585:                //inits may be on two different stacks
08586:                if ((length = this .astLengthStack[this .astLengthPtr--]) == 0) {
08587:                    inits = null;
08588:                    scope = false;
08589:                } else {
08590:                    if (length == -1) { //on this.expressionStack
08591:                        scope = false;
08592:                        length = this .expressionLengthStack[this .expressionLengthPtr--];
08593:                        this .expressionPtr -= length;
08594:                        System.arraycopy(this .expressionStack,
08595:                                this .expressionPtr + 1,
08596:                                inits = new Statement[length], 0, length);
08597:                    } else { //on this.astStack
08598:                        this .astPtr -= length;
08599:                        System.arraycopy(this .astStack, this .astPtr + 1,
08600:                                inits = new Statement[length], 0, length);
08601:                    }
08602:                }
08603:                pushOnAstStack(new ForStatement(inits, cond, updates,
08604:                        statement, scope, this .intStack[this .intPtr--],
08605:                        this .endStatementPosition));
08606:            }
08607:
08608:            protected void consumeStatementIfNoElse() {
08609:                // IfThenStatement ::=  'if' '(' Expression ')' Statement
08610:
08611:                //optimize the push/pop
08612:                this .expressionLengthPtr--;
08613:                Statement thenStatement = (Statement) this .astStack[this .astPtr];
08614:                this .astStack[this .astPtr] = new IfStatement(
08615:                        this .expressionStack[this .expressionPtr--],
08616:                        thenStatement, this .intStack[this .intPtr--],
08617:                        this .endStatementPosition);
08618:            }
08619:
08620:            protected void consumeStatementIfWithElse() {
08621:                // IfThenElseStatement ::=  'if' '(' Expression ')' StatementNoShortIf 'else' Statement
08622:                // IfThenElseStatementNoShortIf ::=  'if' '(' Expression ')' StatementNoShortIf 'else' StatementNoShortIf
08623:
08624:                this .expressionLengthPtr--;
08625:
08626:                // optimized {..., Then, Else } ==> {..., If }
08627:                this .astLengthPtr--;
08628:
08629:                //optimize the push/pop
08630:                this .astStack[--this .astPtr] = new IfStatement(
08631:                        this .expressionStack[this .expressionPtr--],
08632:                        (Statement) this .astStack[this .astPtr],
08633:                        (Statement) this .astStack[this .astPtr + 1],
08634:                        this .intStack[this .intPtr--], this .endStatementPosition);
08635:            }
08636:
08637:            protected void consumeStatementLabel() {
08638:                // LabeledStatement ::= 'Identifier' ':' Statement
08639:                // LabeledStatementNoShortIf ::= 'Identifier' ':' StatementNoShortIf
08640:
08641:                //optimize push/pop
08642:                Statement statement = (Statement) this .astStack[this .astPtr];
08643:                this .astStack[this .astPtr] = new LabeledStatement(
08644:                        this .identifierStack[this .identifierPtr], statement,
08645:                        this .identifierPositionStack[this .identifierPtr--],
08646:                        this .endStatementPosition);
08647:                this .identifierLengthPtr--;
08648:            }
08649:
08650:            protected void consumeStatementReturn() {
08651:                // ReturnStatement ::= 'return' Expressionopt ';'
08652:                // return pushs a position on this.intStack in case there is no expression
08653:
08654:                if (this .expressionLengthStack[this .expressionLengthPtr--] != 0) {
08655:                    pushOnAstStack(new ReturnStatement(
08656:                            this .expressionStack[this .expressionPtr--],
08657:                            this .intStack[this .intPtr--],
08658:                            this .endStatementPosition));
08659:                } else {
08660:                    pushOnAstStack(new ReturnStatement(null,
08661:                            this .intStack[this .intPtr--],
08662:                            this .endStatementPosition));
08663:                }
08664:            }
08665:
08666:            protected void consumeStatementSwitch() {
08667:                // SwitchStatement ::= 'switch' OpenBlock '(' Expression ')' SwitchBlock
08668:
08669:                //OpenBlock just makes the semantic action blockStart()
08670:                //the block is inlined but a scope need to be created
08671:                //if some declaration occurs.
08672:
08673:                int length;
08674:                SwitchStatement switchStatement = new SwitchStatement();
08675:                this .expressionLengthPtr--;
08676:                switchStatement.expression = this .expressionStack[this .expressionPtr--];
08677:                if ((length = this .astLengthStack[this .astLengthPtr--]) != 0) {
08678:                    this .astPtr -= length;
08679:                    System.arraycopy(this .astStack, this .astPtr + 1,
08680:                            switchStatement.statements = new Statement[length],
08681:                            0, length);
08682:                }
08683:                switchStatement.explicitDeclarations = this .realBlockStack[this .realBlockPtr--];
08684:                pushOnAstStack(switchStatement);
08685:                switchStatement.blockStart = this .intStack[this .intPtr--];
08686:                switchStatement.sourceStart = this .intStack[this .intPtr--];
08687:                switchStatement.sourceEnd = this .endStatementPosition;
08688:                if (length == 0
08689:                        && !containsComment(switchStatement.blockStart,
08690:                                switchStatement.sourceEnd)) {
08691:                    switchStatement.bits |= ASTNode.UndocumentedEmptyBlock;
08692:                }
08693:            }
08694:
08695:            protected void consumeStatementSynchronized() {
08696:                // SynchronizedStatement ::= OnlySynchronized '(' Expression ')' Block
08697:                //optimize the push/pop
08698:
08699:                if (this .astLengthStack[this .astLengthPtr] == 0) {
08700:                    this .astLengthStack[this .astLengthPtr] = 1;
08701:                    this .expressionLengthPtr--;
08702:                    this .astStack[++this .astPtr] = new SynchronizedStatement(
08703:                            this .expressionStack[this .expressionPtr--], null,
08704:                            this .intStack[this .intPtr--],
08705:                            this .endStatementPosition);
08706:                } else {
08707:                    this .expressionLengthPtr--;
08708:                    this .astStack[this .astPtr] = new SynchronizedStatement(
08709:                            this .expressionStack[this .expressionPtr--],
08710:                            (Block) this .astStack[this .astPtr],
08711:                            this .intStack[this .intPtr--],
08712:                            this .endStatementPosition);
08713:                }
08714:                resetModifiers();
08715:            }
08716:
08717:            protected void consumeStatementThrow() {
08718:                // ThrowStatement ::= 'throw' Expression ';'
08719:                this .expressionLengthPtr--;
08720:                pushOnAstStack(new ThrowStatement(
08721:                        this .expressionStack[this .expressionPtr--],
08722:                        this .intStack[this .intPtr--], this .endStatementPosition));
08723:            }
08724:
08725:            protected void consumeStatementTry(boolean withFinally) {
08726:                //TryStatement ::= 'try'  Block Catches
08727:                //TryStatement ::= 'try'  Block Catchesopt Finally
08728:
08729:                int length;
08730:                TryStatement tryStmt = new TryStatement();
08731:                //finally
08732:                if (withFinally) {
08733:                    this .astLengthPtr--;
08734:                    tryStmt.finallyBlock = (Block) this .astStack[this .astPtr--];
08735:                }
08736:                //catches are handle by two <argument-block> [see statementCatch]
08737:                if ((length = this .astLengthStack[this .astLengthPtr--]) != 0) {
08738:                    if (length == 1) {
08739:                        tryStmt.catchBlocks = new Block[] { (Block) this .astStack[this .astPtr--] };
08740:                        tryStmt.catchArguments = new Argument[] { (Argument) this .astStack[this .astPtr--] };
08741:                    } else {
08742:                        Block[] bks = (tryStmt.catchBlocks = new Block[length]);
08743:                        Argument[] args = (tryStmt.catchArguments = new Argument[length]);
08744:                        while (length-- > 0) {
08745:                            bks[length] = (Block) this .astStack[this .astPtr--];
08746:                            args[length] = (Argument) this .astStack[this .astPtr--];
08747:                        }
08748:                    }
08749:                }
08750:                //try
08751:                this .astLengthPtr--;
08752:                tryStmt.tryBlock = (Block) this .astStack[this .astPtr--];
08753:
08754:                //positions
08755:                tryStmt.sourceEnd = this .endStatementPosition;
08756:                tryStmt.sourceStart = this .intStack[this .intPtr--];
08757:                pushOnAstStack(tryStmt);
08758:            }
08759:
08760:            protected void consumeStatementWhile() {
08761:                // WhileStatement ::= 'while' '(' Expression ')' Statement
08762:                // WhileStatementNoShortIf ::= 'while' '(' Expression ')' StatementNoShortIf
08763:
08764:                this .expressionLengthPtr--;
08765:                Statement statement = (Statement) this .astStack[this .astPtr];
08766:                this .astStack[this .astPtr] = new WhileStatement(
08767:                        this .expressionStack[this .expressionPtr--], statement,
08768:                        this .intStack[this .intPtr--], this .endStatementPosition);
08769:            }
08770:
08771:            protected void consumeStaticImportOnDemandDeclarationName() {
08772:                // TypeImportOnDemandDeclarationName ::= 'import' 'static' Name '.' '*'
08773:                /* push an ImportRef build from the last name 
08774:                stored in the identifier stack. */
08775:
08776:                ImportReference impt;
08777:                int length;
08778:                char[][] tokens = new char[length = this .identifierLengthStack[this .identifierLengthPtr--]][];
08779:                this .identifierPtr -= length;
08780:                long[] positions = new long[length];
08781:                System.arraycopy(this .identifierStack, this .identifierPtr + 1,
08782:                        tokens, 0, length);
08783:                System.arraycopy(this .identifierPositionStack,
08784:                        this .identifierPtr + 1, positions, 0, length);
08785:                pushOnAstStack(impt = new ImportReference(tokens, positions,
08786:                        true, ClassFileConstants.AccStatic));
08787:
08788:                this .modifiers = ClassFileConstants.AccDefault;
08789:                this .modifiersSourceStart = -1; // <-- see comment into modifiersFlag(int)
08790:
08791:                if (this .currentToken == TokenNameSEMICOLON) {
08792:                    impt.declarationSourceEnd = this .scanner.currentPosition - 1;
08793:                } else {
08794:                    impt.declarationSourceEnd = impt.sourceEnd;
08795:                }
08796:                impt.declarationEnd = impt.declarationSourceEnd;
08797:                //this.endPosition is just before the ;
08798:                impt.declarationSourceStart = this .intStack[this .intPtr--];
08799:
08800:                if (!this .statementRecoveryActivated
08801:                        && options.sourceLevel < ClassFileConstants.JDK1_5
08802:                        && this .lastErrorEndPositionBeforeRecovery < this .scanner.currentPosition) {
08803:                    impt.modifiers = ClassFileConstants.AccDefault; // convert the static import reference to a non-static importe reference
08804:                    this .problemReporter().invalidUsageOfStaticImports(impt);
08805:                }
08806:
08807:                // recovery
08808:                if (this .currentElement != null) {
08809:                    this .lastCheckPoint = impt.declarationSourceEnd + 1;
08810:                    this .currentElement = this .currentElement.add(impt, 0);
08811:                    this .lastIgnoredToken = -1;
08812:                    this .restartRecovery = true; // used to avoid branching back into the regular automaton		
08813:                }
08814:            }
08815:
08816:            protected void consumeStaticInitializer() {
08817:                // StaticInitializer ::=  StaticOnly Block
08818:                //push an Initializer
08819:                //optimize the push/pop
08820:                Block block = (Block) this .astStack[this .astPtr];
08821:                if (this .diet)
08822:                    block.bits &= ~ASTNode.UndocumentedEmptyBlock; // clear bit set since was diet
08823:                Initializer initializer = new Initializer(block,
08824:                        ClassFileConstants.AccStatic);
08825:                this .astStack[this .astPtr] = initializer;
08826:                initializer.sourceEnd = this .endStatementPosition;
08827:                initializer.declarationSourceEnd = flushCommentsDefinedPriorTo(this .endStatementPosition);
08828:                this .nestedMethod[this .nestedType]--;
08829:                initializer.declarationSourceStart = this .intStack[this .intPtr--];
08830:                initializer.bodyStart = this .intStack[this .intPtr--];
08831:                initializer.bodyEnd = this .endPosition;
08832:                // doc comment
08833:                initializer.javadoc = this .javadoc;
08834:                this .javadoc = null;
08835:
08836:                // recovery
08837:                if (this .currentElement != null) {
08838:                    this .lastCheckPoint = initializer.declarationSourceEnd;
08839:                    this .currentElement = this .currentElement.add(initializer,
08840:                            0);
08841:                    this .lastIgnoredToken = -1;
08842:                }
08843:            }
08844:
08845:            protected void consumeStaticOnly() {
08846:                // StaticOnly ::= 'static'
08847:                int savedModifiersSourceStart = this .modifiersSourceStart;
08848:                checkComment(); // might update declaration source start
08849:                if (this .modifiersSourceStart >= savedModifiersSourceStart) {
08850:                    this .modifiersSourceStart = savedModifiersSourceStart;
08851:                }
08852:                pushOnIntStack(this .scanner.currentPosition);
08853:                pushOnIntStack(this .modifiersSourceStart >= 0 ? this .modifiersSourceStart
08854:                        : this .scanner.startPosition);
08855:                jumpOverMethodBody();
08856:                this .nestedMethod[this .nestedType]++;
08857:                resetModifiers();
08858:                this .expressionLengthPtr--; // remove the 0 pushed in consumeToken() for the static modifier
08859:
08860:                // recovery
08861:                if (this .currentElement != null) {
08862:                    this .recoveredStaticInitializerStart = this .intStack[this .intPtr]; // remember start position only for static initializers
08863:                }
08864:            }
08865:
08866:            protected void consumeSwitchBlock() {
08867:                // SwitchBlock ::= '{' SwitchBlockStatements SwitchLabels '}'
08868:                concatNodeLists();
08869:            }
08870:
08871:            protected void consumeSwitchBlockStatement() {
08872:                // SwitchBlockStatement ::= SwitchLabels BlockStatements
08873:                concatNodeLists();
08874:            }
08875:
08876:            protected void consumeSwitchBlockStatements() {
08877:                // SwitchBlockStatements ::= SwitchBlockStatements SwitchBlockStatement
08878:                concatNodeLists();
08879:            }
08880:
08881:            protected void consumeSwitchLabels() {
08882:                // SwitchLabels ::= SwitchLabels SwitchLabel
08883:                optimizedConcatNodeLists();
08884:            }
08885:
08886:            protected void consumeToken(int type) {
08887:                /* remember the last consumed value */
08888:                /* try to minimize the number of build values */
08889:                //	// clear the commentPtr of the scanner in case we read something different from a modifier
08890:                //	switch(type) {
08891:                //		case TokenNameabstract :
08892:                //		case TokenNamestrictfp :
08893:                //		case TokenNamefinal :
08894:                //		case TokenNamenative :
08895:                //		case TokenNameprivate :
08896:                //		case TokenNameprotected :
08897:                //		case TokenNamepublic :
08898:                //		case TokenNametransient :
08899:                //		case TokenNamevolatile :
08900:                //		case TokenNamestatic :
08901:                //		case TokenNamesynchronized :
08902:                //			break;
08903:                //		default:
08904:                //			this.scanner.commentPtr = -1;
08905:                //	}
08906:                //System.out.println(this.scanner.toStringAction(type));
08907:                switch (type) {
08908:                case TokenNameIdentifier:
08909:                    pushIdentifier();
08910:                    if (this .scanner.useAssertAsAnIndentifier
08911:                            && this .lastErrorEndPositionBeforeRecovery < this .scanner.currentPosition) {
08912:                        long positions = this .identifierPositionStack[this .identifierPtr];
08913:                        if (!this .statementRecoveryActivated)
08914:                            problemReporter().useAssertAsAnIdentifier(
08915:                                    (int) (positions >>> 32), (int) positions);
08916:                    }
08917:                    if (this .scanner.useEnumAsAnIndentifier
08918:                            && this .lastErrorEndPositionBeforeRecovery < this .scanner.currentPosition) {
08919:                        long positions = this .identifierPositionStack[this .identifierPtr];
08920:                        if (!this .statementRecoveryActivated)
08921:                            problemReporter().useEnumAsAnIdentifier(
08922:                                    (int) (positions >>> 32), (int) positions);
08923:                    }
08924:                    break;
08925:                case TokenNameinterface:
08926:                    //'class' is pushing two int (positions) on the stack ==> 'interface' needs to do it too....
08927:                    pushOnIntStack(this .scanner.currentPosition - 1);
08928:                    pushOnIntStack(this .scanner.startPosition);
08929:                    break;
08930:                case TokenNameabstract:
08931:                    checkAndSetModifiers(ClassFileConstants.AccAbstract);
08932:                    pushOnExpressionStackLengthStack(0);
08933:                    break;
08934:                case TokenNamestrictfp:
08935:                    checkAndSetModifiers(ClassFileConstants.AccStrictfp);
08936:                    pushOnExpressionStackLengthStack(0);
08937:                    break;
08938:                case TokenNamefinal:
08939:                    checkAndSetModifiers(ClassFileConstants.AccFinal);
08940:                    pushOnExpressionStackLengthStack(0);
08941:                    break;
08942:                case TokenNamenative:
08943:                    checkAndSetModifiers(ClassFileConstants.AccNative);
08944:                    pushOnExpressionStackLengthStack(0);
08945:                    break;
08946:                case TokenNameprivate:
08947:                    checkAndSetModifiers(ClassFileConstants.AccPrivate);
08948:                    pushOnExpressionStackLengthStack(0);
08949:                    break;
08950:                case TokenNameprotected:
08951:                    checkAndSetModifiers(ClassFileConstants.AccProtected);
08952:                    pushOnExpressionStackLengthStack(0);
08953:                    break;
08954:                case TokenNamepublic:
08955:                    checkAndSetModifiers(ClassFileConstants.AccPublic);
08956:                    pushOnExpressionStackLengthStack(0);
08957:                    break;
08958:                case TokenNametransient:
08959:                    checkAndSetModifiers(ClassFileConstants.AccTransient);
08960:                    pushOnExpressionStackLengthStack(0);
08961:                    break;
08962:                case TokenNamevolatile:
08963:                    checkAndSetModifiers(ClassFileConstants.AccVolatile);
08964:                    pushOnExpressionStackLengthStack(0);
08965:                    break;
08966:                case TokenNamestatic:
08967:                    checkAndSetModifiers(ClassFileConstants.AccStatic);
08968:                    pushOnExpressionStackLengthStack(0);
08969:                    break;
08970:                case TokenNamesynchronized:
08971:                    this .synchronizedBlockSourceStart = this .scanner.startPosition;
08972:                    checkAndSetModifiers(ClassFileConstants.AccSynchronized);
08973:                    pushOnExpressionStackLengthStack(0);
08974:                    break;
08975:                //==============================
08976:                case TokenNamevoid:
08977:                    pushIdentifier(-T_void);
08978:                    pushOnIntStack(this .scanner.currentPosition - 1);
08979:                    pushOnIntStack(this .scanner.startPosition);
08980:                    break;
08981:                //push a default dimension while void is not part of the primitive
08982:                //declaration baseType and so takes the place of a type without getting into
08983:                //regular type parsing that generates a dimension on this.intStack
08984:                case TokenNameboolean:
08985:                    pushIdentifier(-T_boolean);
08986:                    pushOnIntStack(this .scanner.currentPosition - 1);
08987:                    pushOnIntStack(this .scanner.startPosition);
08988:                    break;
08989:                case TokenNamebyte:
08990:                    pushIdentifier(-T_byte);
08991:                    pushOnIntStack(this .scanner.currentPosition - 1);
08992:                    pushOnIntStack(this .scanner.startPosition);
08993:                    break;
08994:                case TokenNamechar:
08995:                    pushIdentifier(-T_char);
08996:                    pushOnIntStack(this .scanner.currentPosition - 1);
08997:                    pushOnIntStack(this .scanner.startPosition);
08998:                    break;
08999:                case TokenNamedouble:
09000:                    pushIdentifier(-T_double);
09001:                    pushOnIntStack(this .scanner.currentPosition - 1);
09002:                    pushOnIntStack(this .scanner.startPosition);
09003:                    break;
09004:                case TokenNamefloat:
09005:                    pushIdentifier(-T_float);
09006:                    pushOnIntStack(this .scanner.currentPosition - 1);
09007:                    pushOnIntStack(this .scanner.startPosition);
09008:                    break;
09009:                case TokenNameint:
09010:                    pushIdentifier(-T_int);
09011:                    pushOnIntStack(this .scanner.currentPosition - 1);
09012:                    pushOnIntStack(this .scanner.startPosition);
09013:                    break;
09014:                case TokenNamelong:
09015:                    pushIdentifier(-T_long);
09016:                    pushOnIntStack(this .scanner.currentPosition - 1);
09017:                    pushOnIntStack(this .scanner.startPosition);
09018:                    break;
09019:                case TokenNameshort:
09020:                    pushIdentifier(-T_short);
09021:                    pushOnIntStack(this .scanner.currentPosition - 1);
09022:                    pushOnIntStack(this .scanner.startPosition);
09023:                    break;
09024:                //==============================
09025:                case TokenNameIntegerLiteral:
09026:                    pushOnExpressionStack(new IntLiteral(this .scanner
09027:                            .getCurrentTokenSource(),
09028:                            this .scanner.startPosition,
09029:                            this .scanner.currentPosition - 1));
09030:                    break;
09031:                case TokenNameLongLiteral:
09032:                    pushOnExpressionStack(new LongLiteral(this .scanner
09033:                            .getCurrentTokenSource(),
09034:                            this .scanner.startPosition,
09035:                            this .scanner.currentPosition - 1));
09036:                    break;
09037:                case TokenNameFloatingPointLiteral:
09038:                    pushOnExpressionStack(new FloatLiteral(this .scanner
09039:                            .getCurrentTokenSource(),
09040:                            this .scanner.startPosition,
09041:                            this .scanner.currentPosition - 1));
09042:                    break;
09043:                case TokenNameDoubleLiteral:
09044:                    pushOnExpressionStack(new DoubleLiteral(this .scanner
09045:                            .getCurrentTokenSource(),
09046:                            this .scanner.startPosition,
09047:                            this .scanner.currentPosition - 1));
09048:                    break;
09049:                case TokenNameCharacterLiteral:
09050:                    pushOnExpressionStack(new CharLiteral(this .scanner
09051:                            .getCurrentTokenSource(),
09052:                            this .scanner.startPosition,
09053:                            this .scanner.currentPosition - 1));
09054:                    break;
09055:                case TokenNameStringLiteral:
09056:                    StringLiteral stringLiteral;
09057:                    if (this .recordStringLiterals
09058:                            && this .checkExternalizeStrings
09059:                            && !this .statementRecoveryActivated) {
09060:                        stringLiteral = this .createStringLiteral(this .scanner
09061:                                .getCurrentTokenSourceString(),
09062:                                this .scanner.startPosition,
09063:                                this .scanner.currentPosition - 1, Util
09064:                                        .getLineNumber(
09065:                                                this .scanner.startPosition,
09066:                                                this .scanner.lineEnds, 0,
09067:                                                this .scanner.linePtr));
09068:                        this .compilationUnit.recordStringLiteral(stringLiteral);
09069:                    } else {
09070:                        stringLiteral = this .createStringLiteral(this .scanner
09071:                                .getCurrentTokenSourceString(),
09072:                                this .scanner.startPosition,
09073:                                this .scanner.currentPosition - 1, 0);
09074:                    }
09075:                    pushOnExpressionStack(stringLiteral);
09076:                    break;
09077:                case TokenNamefalse:
09078:                    pushOnExpressionStack(new FalseLiteral(
09079:                            this .scanner.startPosition,
09080:                            this .scanner.currentPosition - 1));
09081:                    break;
09082:                case TokenNametrue:
09083:                    pushOnExpressionStack(new TrueLiteral(
09084:                            this .scanner.startPosition,
09085:                            this .scanner.currentPosition - 1));
09086:                    break;
09087:                case TokenNamenull:
09088:                    pushOnExpressionStack(new NullLiteral(
09089:                            this .scanner.startPosition,
09090:                            this .scanner.currentPosition - 1));
09091:                    break;
09092:                //============================
09093:                case TokenNamesuper :
09094:                case TokenNamethis :
09095:                    this .endPosition = this .scanner.currentPosition - 1;
09096:                    pushOnIntStack(this .scanner.startPosition);
09097:                    break;
09098:                case TokenNameassert:
09099:                case TokenNameimport:
09100:                case TokenNamepackage:
09101:                case TokenNamethrow:
09102:                case TokenNamedo:
09103:                case TokenNameif:
09104:                case TokenNamefor:
09105:                case TokenNameswitch:
09106:                case TokenNametry:
09107:                case TokenNamewhile:
09108:                case TokenNamebreak:
09109:                case TokenNamecontinue:
09110:                case TokenNamereturn:
09111:                case TokenNamecase:
09112:                    pushOnIntStack(this .scanner.startPosition);
09113:                    break;
09114:                case TokenNamenew:
09115:                    // https://bugs.eclipse.org/bugs/show_bug.cgi?id=40954
09116:                    resetModifiers();
09117:                    pushOnIntStack(this .scanner.startPosition);
09118:                    break;
09119:                case TokenNameclass:
09120:                    pushOnIntStack(this .scanner.currentPosition - 1);
09121:                    pushOnIntStack(this .scanner.startPosition);
09122:                    break;
09123:                case TokenNameenum:
09124:                    pushOnIntStack(this .scanner.currentPosition - 1);
09125:                    pushOnIntStack(this .scanner.startPosition);
09126:                    break;
09127:                case TokenNamedefault:
09128:                    pushOnIntStack(this .scanner.startPosition);
09129:                    pushOnIntStack(this .scanner.currentPosition - 1);
09130:                    break;
09131:                //let extra semantic action decide when to push
09132:                case TokenNameRBRACKET:
09133:                    this .endPosition = this .scanner.startPosition;
09134:                    this .endStatementPosition = this .scanner.currentPosition - 1;
09135:                    break;
09136:                case TokenNameLBRACE:
09137:                    this .endStatementPosition = this .scanner.currentPosition - 1;
09138:                case TokenNamePLUS:
09139:                case TokenNameMINUS:
09140:                case TokenNameNOT:
09141:                case TokenNameTWIDDLE:
09142:                    this .endPosition = this .scanner.startPosition;
09143:                    break;
09144:                case TokenNamePLUS_PLUS:
09145:                case TokenNameMINUS_MINUS:
09146:                    this .endPosition = this .scanner.startPosition;
09147:                    this .endStatementPosition = this .scanner.currentPosition - 1;
09148:                    break;
09149:                case TokenNameRBRACE:
09150:                case TokenNameSEMICOLON:
09151:                    this .endStatementPosition = this .scanner.currentPosition - 1;
09152:                    this .endPosition = this .scanner.startPosition - 1;
09153:                    //the item is not part of the potential futur expression/statement
09154:                    break;
09155:                case TokenNameRPAREN:
09156:                    // in order to handle ( expression) ////// (cast)expression///// foo(x)
09157:                    this .rParenPos = this .scanner.currentPosition - 1; // position of the end of right parenthesis (in case of unicode \u0029) lex00101
09158:                    break;
09159:                case TokenNameLPAREN:
09160:                    this .lParenPos = this .scanner.startPosition;
09161:                    break;
09162:                case TokenNameAT:
09163:                    pushOnIntStack(this .scanner.startPosition);
09164:                    break;
09165:                case TokenNameQUESTION:
09166:                    pushOnIntStack(this .scanner.startPosition);
09167:                    pushOnIntStack(this .scanner.currentPosition - 1);
09168:                    break;
09169:                case TokenNameLESS:
09170:                    pushOnIntStack(this .scanner.startPosition);
09171:                    break;
09172:                case TokenNameELLIPSIS:
09173:                    pushOnIntStack(this .scanner.currentPosition - 1);
09174:                    break;
09175:                //  case TokenNameCOMMA :
09176:                //  case TokenNameCOLON  :
09177:                //  case TokenNameEQUAL  :
09178:                //  case TokenNameLBRACKET  :
09179:                //  case TokenNameDOT :
09180:                //  case TokenNameERROR :
09181:                //  case TokenNameEOF  :
09182:                //  case TokenNamecase  :
09183:                //  case TokenNamecatch  :
09184:                //  case TokenNameelse  :
09185:                //  case TokenNameextends  :
09186:                //  case TokenNamefinally  :
09187:                //  case TokenNameimplements  :
09188:                //  case TokenNamethrows  :
09189:                //  case TokenNameinstanceof  :
09190:                //  case TokenNameEQUAL_EQUAL  :
09191:                //  case TokenNameLESS_EQUAL  :
09192:                //  case TokenNameGREATER_EQUAL  :
09193:                //  case TokenNameNOT_EQUAL  :
09194:                //  case TokenNameLEFT_SHIFT  :
09195:                //  case TokenNameRIGHT_SHIFT  :
09196:                //  case TokenNameUNSIGNED_RIGHT_SHIFT :
09197:                //  case TokenNamePLUS_EQUAL  :
09198:                //  case TokenNameMINUS_EQUAL  :
09199:                //  case TokenNameMULTIPLY_EQUAL  :
09200:                //  case TokenNameDIVIDE_EQUAL  :
09201:                //  case TokenNameAND_EQUAL  :
09202:                //  case TokenNameOR_EQUAL  :
09203:                //  case TokenNameXOR_EQUAL  :
09204:                //  case TokenNameREMAINDER_EQUAL  :
09205:                //  case TokenNameLEFT_SHIFT_EQUAL  :
09206:                //  case TokenNameRIGHT_SHIFT_EQUAL  :
09207:                //  case TokenNameUNSIGNED_RIGHT_SHIFT_EQUAL  :
09208:                //  case TokenNameOR_OR  :
09209:                //  case TokenNameAND_AND  :
09210:                //  case TokenNameREMAINDER :
09211:                //  case TokenNameXOR  :
09212:                //  case TokenNameAND  :
09213:                //  case TokenNameMULTIPLY :
09214:                //  case TokenNameOR  :
09215:                //  case TokenNameDIVIDE :
09216:                //  case TokenNameGREATER  :
09217:                }
09218:            }
09219:
09220:            protected void consumeTypeArgument() {
09221:                pushOnGenericsStack(getTypeReference(this .intStack[this .intPtr--]));
09222:            }
09223:
09224:            protected void consumeTypeArgumentList() {
09225:                concatGenericsLists();
09226:            }
09227:
09228:            protected void consumeTypeArgumentList1() {
09229:                concatGenericsLists();
09230:            }
09231:
09232:            protected void consumeTypeArgumentList2() {
09233:                concatGenericsLists();
09234:            }
09235:
09236:            protected void consumeTypeArgumentList3() {
09237:                concatGenericsLists();
09238:            }
09239:
09240:            protected void consumeTypeArgumentReferenceType1() {
09241:                concatGenericsLists();
09242:                pushOnGenericsStack(getTypeReference(0));
09243:                intPtr--;
09244:            }
09245:
09246:            protected void consumeTypeArgumentReferenceType2() {
09247:                concatGenericsLists();
09248:                pushOnGenericsStack(getTypeReference(0));
09249:                intPtr--;
09250:            }
09251:
09252:            protected void consumeTypeArguments() {
09253:                concatGenericsLists();
09254:                intPtr--;
09255:
09256:                if (!this .statementRecoveryActivated
09257:                        && options.sourceLevel < ClassFileConstants.JDK1_5
09258:                        && this .lastErrorEndPositionBeforeRecovery < this .scanner.currentPosition) {
09259:                    int length = this .genericsLengthStack[this .genericsLengthPtr];
09260:                    this 
09261:                            .problemReporter()
09262:                            .invalidUsageOfTypeArguments(
09263:                                    (TypeReference) this .genericsStack[this .genericsPtr
09264:                                            - length + 1],
09265:                                    (TypeReference) this .genericsStack[this .genericsPtr]);
09266:                }
09267:            }
09268:
09269:            protected void consumeTypeDeclarations() {
09270:                // TypeDeclarations ::= TypeDeclarations TypeDeclaration
09271:                concatNodeLists();
09272:            }
09273:
09274:            protected void consumeTypeImportOnDemandDeclarationName() {
09275:                // TypeImportOnDemandDeclarationName ::= 'import' Name '.' '*'
09276:                /* push an ImportRef build from the last name 
09277:                stored in the identifier stack. */
09278:
09279:                ImportReference impt;
09280:                int length;
09281:                char[][] tokens = new char[length = this .identifierLengthStack[this .identifierLengthPtr--]][];
09282:                this .identifierPtr -= length;
09283:                long[] positions = new long[length];
09284:                System.arraycopy(this .identifierStack, this .identifierPtr + 1,
09285:                        tokens, 0, length);
09286:                System.arraycopy(this .identifierPositionStack,
09287:                        this .identifierPtr + 1, positions, 0, length);
09288:                pushOnAstStack(impt = new ImportReference(tokens, positions,
09289:                        true, ClassFileConstants.AccDefault));
09290:
09291:                if (this .currentToken == TokenNameSEMICOLON) {
09292:                    impt.declarationSourceEnd = this .scanner.currentPosition - 1;
09293:                } else {
09294:                    impt.declarationSourceEnd = impt.sourceEnd;
09295:                }
09296:                impt.declarationEnd = impt.declarationSourceEnd;
09297:                //this.endPosition is just before the ;
09298:                impt.declarationSourceStart = this .intStack[this .intPtr--];
09299:
09300:                // recovery
09301:                if (this .currentElement != null) {
09302:                    this .lastCheckPoint = impt.declarationSourceEnd + 1;
09303:                    this .currentElement = this .currentElement.add(impt, 0);
09304:                    this .lastIgnoredToken = -1;
09305:                    this .restartRecovery = true; // used to avoid branching back into the regular automaton		
09306:                }
09307:            }
09308:
09309:            protected void consumeTypeParameterHeader() {
09310:                //TypeParameterHeader ::= Identifier
09311:                TypeParameter typeParameter = new TypeParameter();
09312:                long pos = this .identifierPositionStack[this .identifierPtr];
09313:                final int end = (int) pos;
09314:                typeParameter.declarationSourceEnd = end;
09315:                typeParameter.sourceEnd = end;
09316:                final int start = (int) (pos >>> 32);
09317:                typeParameter.declarationSourceStart = start;
09318:                typeParameter.sourceStart = start;
09319:                typeParameter.name = this .identifierStack[this .identifierPtr--];
09320:                this .identifierLengthPtr--;
09321:                pushOnGenericsStack(typeParameter);
09322:
09323:                this .listTypeParameterLength++;
09324:            }
09325:
09326:            protected void consumeTypeParameter1() {
09327:                // nothing to do
09328:            }
09329:
09330:            protected void consumeTypeParameter1WithExtends() {
09331:                //TypeParameter1 ::= TypeParameterHeader 'extends' ReferenceType1
09332:                TypeReference super Type = (TypeReference) this .genericsStack[this .genericsPtr--];
09333:                this .genericsLengthPtr--;
09334:                TypeParameter typeParameter = (TypeParameter) this .genericsStack[this .genericsPtr];
09335:                typeParameter.declarationSourceEnd = super Type.sourceEnd;
09336:                typeParameter.type = super Type;
09337:                super Type.bits |= ASTNode.IsSuperType;
09338:                this .genericsStack[this .genericsPtr] = typeParameter;
09339:            }
09340:
09341:            protected void consumeTypeParameter1WithExtendsAndBounds() {
09342:                //TypeParameter1 ::= TypeParameterHeader 'extends' ReferenceType AdditionalBoundList1
09343:                int additionalBoundsLength = this .genericsLengthStack[this .genericsLengthPtr--];
09344:                TypeReference[] bounds = new TypeReference[additionalBoundsLength];
09345:                this .genericsPtr -= additionalBoundsLength;
09346:                System.arraycopy(this .genericsStack, this .genericsPtr + 1,
09347:                        bounds, 0, additionalBoundsLength);
09348:                TypeReference super Type = getTypeReference(this .intStack[this .intPtr--]);
09349:                TypeParameter typeParameter = (TypeParameter) this .genericsStack[this .genericsPtr];
09350:                typeParameter.declarationSourceEnd = bounds[additionalBoundsLength - 1].sourceEnd;
09351:                typeParameter.type = super Type;
09352:                super Type.bits |= ASTNode.IsSuperType;
09353:                typeParameter.bounds = bounds;
09354:                for (int i = 0, max = bounds.length; i < max; i++) {
09355:                    bounds[i].bits |= ASTNode.IsSuperType;
09356:                }
09357:            }
09358:
09359:            protected void consumeTypeParameterList() {
09360:                //TypeParameterList ::= TypeParameterList ',' TypeParameter
09361:                concatGenericsLists();
09362:            }
09363:
09364:            protected void consumeTypeParameterList1() {
09365:                //TypeParameterList1 ::= TypeParameterList ',' TypeParameter1
09366:                concatGenericsLists();
09367:            }
09368:
09369:            protected void consumeTypeParameters() {
09370:                int startPos = this .intStack[this .intPtr--];
09371:
09372:                if (this .currentElement != null) {
09373:                    if (this .currentElement instanceof  RecoveredType) {
09374:                        RecoveredType recoveredType = (RecoveredType) this .currentElement;
09375:                        int length = this .genericsLengthStack[this .genericsLengthPtr];
09376:                        TypeParameter[] typeParameters = new TypeParameter[length];
09377:                        System.arraycopy(this .genericsStack, genericsPtr
09378:                                - length + 1, typeParameters, 0, length);
09379:
09380:                        recoveredType.add(typeParameters, startPos);
09381:                    }
09382:                }
09383:
09384:                if (!this .statementRecoveryActivated
09385:                        && options.sourceLevel < ClassFileConstants.JDK1_5
09386:                        && this .lastErrorEndPositionBeforeRecovery < this .scanner.currentPosition) {
09387:                    int length = this .genericsLengthStack[this .genericsLengthPtr];
09388:                    this .problemReporter().invalidUsageOfTypeParameters(
09389:                            (TypeParameter) this .genericsStack[genericsPtr
09390:                                    - length + 1],
09391:                            (TypeParameter) this .genericsStack[genericsPtr]);
09392:                }
09393:            }
09394:
09395:            protected void consumeTypeParameterWithExtends() {
09396:                //TypeParameter ::= TypeParameterHeader 'extends' ReferenceType
09397:                TypeReference super Type = getTypeReference(this .intStack[this .intPtr--]);
09398:                TypeParameter typeParameter = (TypeParameter) this .genericsStack[this .genericsPtr];
09399:                typeParameter.declarationSourceEnd = super Type.sourceEnd;
09400:                typeParameter.type = super Type;
09401:                super Type.bits |= ASTNode.IsSuperType;
09402:            }
09403:
09404:            protected void consumeTypeParameterWithExtendsAndBounds() {
09405:                //TypeParameter ::= TypeParameterHeader 'extends' ReferenceType AdditionalBoundList
09406:                int additionalBoundsLength = this .genericsLengthStack[this .genericsLengthPtr--];
09407:                TypeReference[] bounds = new TypeReference[additionalBoundsLength];
09408:                this .genericsPtr -= additionalBoundsLength;
09409:                System.arraycopy(this .genericsStack, this .genericsPtr + 1,
09410:                        bounds, 0, additionalBoundsLength);
09411:                TypeReference super Type = getTypeReference(this .intStack[this .intPtr--]);
09412:                TypeParameter typeParameter = (TypeParameter) this .genericsStack[this .genericsPtr];
09413:                typeParameter.type = super Type;
09414:                super Type.bits |= ASTNode.IsSuperType;
09415:                typeParameter.bounds = bounds;
09416:                typeParameter.declarationSourceEnd = bounds[additionalBoundsLength - 1].sourceEnd;
09417:                for (int i = 0, max = bounds.length; i < max; i++) {
09418:                    bounds[i].bits |= ASTNode.IsSuperType;
09419:                }
09420:            }
09421:
09422:            protected void consumeUnaryExpression(int op) {
09423:                // UnaryExpression ::= '+' PushPosition UnaryExpression
09424:                // UnaryExpression ::= '-' PushPosition UnaryExpression
09425:                // UnaryExpressionNotPlusMinus ::= '~' PushPosition UnaryExpression
09426:                // UnaryExpressionNotPlusMinus ::= '!' PushPosition UnaryExpression
09427:
09428:                //optimize the push/pop
09429:
09430:                //handle manually the -2147483648 while it is not a real
09431:                //computation of an - and 2147483648 (notice that 2147483648
09432:                //is Integer.MAX_VALUE+1.....)
09433:                //Same for -9223372036854775808L ............
09434:
09435:                //this.intStack have the position of the operator
09436:
09437:                Expression r, exp = this .expressionStack[this .expressionPtr];
09438:                if (op == MINUS) {
09439:                    if ((exp instanceof  IntLiteral)
09440:                            && (((IntLiteral) exp).mayRepresentMIN_VALUE())) {
09441:                        r = this .expressionStack[this .expressionPtr] = new IntLiteralMinValue();
09442:                    } else {
09443:                        if ((exp instanceof  LongLiteral)
09444:                                && (((LongLiteral) exp).mayRepresentMIN_VALUE())) {
09445:                            r = this .expressionStack[this .expressionPtr] = new LongLiteralMinValue();
09446:                        } else {
09447:                            r = this .expressionStack[this .expressionPtr] = new UnaryExpression(
09448:                                    exp, op);
09449:                        }
09450:                    }
09451:                } else {
09452:                    r = this .expressionStack[this .expressionPtr] = new UnaryExpression(
09453:                            exp, op);
09454:                }
09455:                r.sourceStart = this .intStack[this .intPtr--];
09456:                r.sourceEnd = exp.sourceEnd;
09457:            }
09458:
09459:            protected void consumeUnaryExpression(int op, boolean post) {
09460:                // PreIncrementExpression ::= '++' PushPosition UnaryExpression
09461:                // PreDecrementExpression ::= '--' PushPosition UnaryExpression
09462:
09463:                // ++ and -- operators
09464:                //optimize the push/pop
09465:
09466:                //this.intStack has the position of the operator when prefix
09467:
09468:                Expression leftHandSide = this .expressionStack[this .expressionPtr];
09469:                if (leftHandSide instanceof  Reference) {
09470:                    // ++foo()++ is unvalid 
09471:                    if (post) {
09472:                        this .expressionStack[this .expressionPtr] = new PostfixExpression(
09473:                                leftHandSide, IntLiteral.One, op,
09474:                                this .endStatementPosition);
09475:                    } else {
09476:                        this .expressionStack[this .expressionPtr] = new PrefixExpression(
09477:                                leftHandSide, IntLiteral.One, op,
09478:                                this .intStack[this .intPtr--]);
09479:                    }
09480:                } else {
09481:                    //the ++ or the -- is NOT taken into account if code gen proceeds
09482:                    if (!post) {
09483:                        this .intPtr--;
09484:                    }
09485:                    if (!this .statementRecoveryActivated)
09486:                        problemReporter().invalidUnaryExpression(leftHandSide);
09487:                }
09488:            }
09489:
09490:            protected void consumeVariableDeclarators() {
09491:                // VariableDeclarators ::= VariableDeclarators ',' VariableDeclarator
09492:                optimizedConcatNodeLists();
09493:            }
09494:
09495:            protected void consumeVariableInitializers() {
09496:                // VariableInitializers ::= VariableInitializers ',' VariableInitializer
09497:                concatExpressionLists();
09498:            }
09499:
09500:            protected void consumeWildcard() {
09501:                final Wildcard wildcard = new Wildcard(Wildcard.UNBOUND);
09502:                wildcard.sourceEnd = this .intStack[this .intPtr--];
09503:                wildcard.sourceStart = this .intStack[this .intPtr--];
09504:                pushOnGenericsStack(wildcard);
09505:            }
09506:
09507:            protected void consumeWildcard1() {
09508:                final Wildcard wildcard = new Wildcard(Wildcard.UNBOUND);
09509:                wildcard.sourceEnd = this .intStack[this .intPtr--];
09510:                wildcard.sourceStart = this .intStack[this .intPtr--];
09511:                pushOnGenericsStack(wildcard);
09512:            }
09513:
09514:            protected void consumeWildcard1WithBounds() {
09515:                // Nothing to do
09516:                // The wildcard is created by the consumeWildcardBounds1Extends or by consumeWildcardBounds1Super
09517:            }
09518:
09519:            protected void consumeWildcard2() {
09520:                final Wildcard wildcard = new Wildcard(Wildcard.UNBOUND);
09521:                wildcard.sourceEnd = this .intStack[this .intPtr--];
09522:                wildcard.sourceStart = this .intStack[this .intPtr--];
09523:                pushOnGenericsStack(wildcard);
09524:            }
09525:
09526:            protected void consumeWildcard2WithBounds() {
09527:                // Nothing to do
09528:                // The wildcard is created by the consumeWildcardBounds2Extends or by consumeWildcardBounds2Super
09529:            }
09530:
09531:            protected void consumeWildcard3() {
09532:                final Wildcard wildcard = new Wildcard(Wildcard.UNBOUND);
09533:                wildcard.sourceEnd = this .intStack[this .intPtr--];
09534:                wildcard.sourceStart = this .intStack[this .intPtr--];
09535:                pushOnGenericsStack(wildcard);
09536:            }
09537:
09538:            protected void consumeWildcard3WithBounds() {
09539:                // Nothing to do
09540:                // The wildcard is created by the consumeWildcardBounds3Extends or by consumeWildcardBounds3Super
09541:            }
09542:
09543:            protected void consumeWildcardBounds1Extends() {
09544:                Wildcard wildcard = new Wildcard(Wildcard.EXTENDS);
09545:                wildcard.bound = (TypeReference) this .genericsStack[this .genericsPtr];
09546:                wildcard.sourceEnd = wildcard.bound.sourceEnd;
09547:                this .intPtr--; // remove end position of the '?'
09548:                wildcard.sourceStart = this .intStack[this .intPtr--];
09549:                this .genericsStack[this .genericsPtr] = wildcard;
09550:            }
09551:
09552:            protected void consumeWildcardBounds1Super() {
09553:                Wildcard wildcard = new Wildcard(Wildcard.SUPER);
09554:                wildcard.bound = (TypeReference) this .genericsStack[this .genericsPtr];
09555:                this .intPtr--; // remove the starting position of the super keyword
09556:                wildcard.sourceEnd = wildcard.bound.sourceEnd;
09557:                this .intPtr--; // remove end position of the '?'
09558:                wildcard.sourceStart = this .intStack[this .intPtr--];
09559:                this .genericsStack[this .genericsPtr] = wildcard;
09560:            }
09561:
09562:            protected void consumeWildcardBounds2Extends() {
09563:                Wildcard wildcard = new Wildcard(Wildcard.EXTENDS);
09564:                wildcard.bound = (TypeReference) this .genericsStack[this .genericsPtr];
09565:                wildcard.sourceEnd = wildcard.bound.sourceEnd;
09566:                this .intPtr--; // remove end position of the '?'
09567:                wildcard.sourceStart = this .intStack[this .intPtr--];
09568:                this .genericsStack[this .genericsPtr] = wildcard;
09569:            }
09570:
09571:            protected void consumeWildcardBounds2Super() {
09572:                Wildcard wildcard = new Wildcard(Wildcard.SUPER);
09573:                wildcard.bound = (TypeReference) this .genericsStack[this .genericsPtr];
09574:                this .intPtr--; // remove the starting position of the super keyword
09575:                wildcard.sourceEnd = wildcard.bound.sourceEnd;
09576:                this .intPtr--; // remove end position of the '?'
09577:                wildcard.sourceStart = this .intStack[this .intPtr--];
09578:                this .genericsStack[this .genericsPtr] = wildcard;
09579:            }
09580:
09581:            protected void consumeWildcardBounds3Extends() {
09582:                Wildcard wildcard = new Wildcard(Wildcard.EXTENDS);
09583:                wildcard.bound = (TypeReference) this .genericsStack[this .genericsPtr];
09584:                wildcard.sourceEnd = wildcard.bound.sourceEnd;
09585:                this .intPtr--; // remove end position of the '?'
09586:                wildcard.sourceStart = this .intStack[this .intPtr--];
09587:                this .genericsStack[this .genericsPtr] = wildcard;
09588:            }
09589:
09590:            protected void consumeWildcardBounds3Super() {
09591:                Wildcard wildcard = new Wildcard(Wildcard.SUPER);
09592:                wildcard.bound = (TypeReference) this .genericsStack[this .genericsPtr];
09593:                this .intPtr--; // remove the starting position of the super keyword
09594:                wildcard.sourceEnd = wildcard.bound.sourceEnd;
09595:                this .intPtr--; // remove end position of the '?'
09596:                wildcard.sourceStart = this .intStack[this .intPtr--];
09597:                this .genericsStack[this .genericsPtr] = wildcard;
09598:            }
09599:
09600:            protected void consumeWildcardBoundsExtends() {
09601:                Wildcard wildcard = new Wildcard(Wildcard.EXTENDS);
09602:                wildcard.bound = getTypeReference(this .intStack[this .intPtr--]);
09603:                wildcard.sourceEnd = wildcard.bound.sourceEnd;
09604:                this .intPtr--; // remove end position of the '?'
09605:                wildcard.sourceStart = this .intStack[this .intPtr--];
09606:                pushOnGenericsStack(wildcard);
09607:            }
09608:
09609:            protected void consumeWildcardBoundsSuper() {
09610:                Wildcard wildcard = new Wildcard(Wildcard.SUPER);
09611:                wildcard.bound = getTypeReference(this .intStack[this .intPtr--]);
09612:                this .intPtr--; // remove the starting position of the super keyword
09613:                wildcard.sourceEnd = wildcard.bound.sourceEnd;
09614:                this .intPtr--; // remove end position of the '?'
09615:                wildcard.sourceStart = this .intStack[this .intPtr--];
09616:                pushOnGenericsStack(wildcard);
09617:            }
09618:
09619:            protected void consumeWildcardWithBounds() {
09620:                // Nothing to do
09621:                // The wildcard is created by the consumeWildcardBoundsExtends or by consumeWildcardBoundsSuper
09622:            }
09623:
09624:            /**
09625:             * Given the current comment stack, answer whether some comment is available in a certain exclusive range
09626:             * 
09627:             * @param sourceStart int
09628:             * @param sourceEnd int
09629:             * @return boolean
09630:             */
09631:            public boolean containsComment(int sourceStart, int sourceEnd) {
09632:                int iComment = this .scanner.commentPtr;
09633:                for (; iComment >= 0; iComment--) {
09634:                    int commentStart = this .scanner.commentStarts[iComment];
09635:                    // ignore comments before start
09636:                    if (commentStart < sourceStart)
09637:                        continue;
09638:                    // ignore comments after end
09639:                    if (commentStart > sourceEnd)
09640:                        continue;
09641:                    return true;
09642:                }
09643:                return false;
09644:            }
09645:
09646:            public MethodDeclaration convertToMethodDeclaration(
09647:                    ConstructorDeclaration c,
09648:                    CompilationResult compilationResult) {
09649:                MethodDeclaration m = new MethodDeclaration(compilationResult);
09650:                m.typeParameters = c.typeParameters;
09651:                m.sourceStart = c.sourceStart;
09652:                m.sourceEnd = c.sourceEnd;
09653:                m.bodyStart = c.bodyStart;
09654:                m.bodyEnd = c.bodyEnd;
09655:                m.declarationSourceEnd = c.declarationSourceEnd;
09656:                m.declarationSourceStart = c.declarationSourceStart;
09657:                m.selector = c.selector;
09658:                m.statements = c.statements;
09659:                m.modifiers = c.modifiers;
09660:                m.annotations = c.annotations;
09661:                m.arguments = c.arguments;
09662:                m.thrownExceptions = c.thrownExceptions;
09663:                m.explicitDeclarations = c.explicitDeclarations;
09664:                m.returnType = null;
09665:                m.javadoc = c.javadoc;
09666:                return m;
09667:            }
09668:
09669:            protected TypeReference copyDims(TypeReference typeRef, int dim) {
09670:                return typeRef.copyDims(dim);
09671:            }
09672:
09673:            protected FieldDeclaration createFieldDeclaration(
09674:                    char[] fieldDeclarationName, int sourceStart, int sourceEnd) {
09675:                return new FieldDeclaration(fieldDeclarationName, sourceStart,
09676:                        sourceEnd);
09677:            }
09678:
09679:            protected JavadocParser createJavadocParser() {
09680:                return new JavadocParser(this );
09681:            }
09682:
09683:            protected LocalDeclaration createLocalDeclaration(
09684:                    char[] localDeclarationName, int sourceStart, int sourceEnd) {
09685:                return new LocalDeclaration(localDeclarationName, sourceStart,
09686:                        sourceEnd);
09687:            }
09688:
09689:            protected StringLiteral createStringLiteral(char[] token,
09690:                    int start, int end, int lineNumber) {
09691:                return new StringLiteral(token, start, end, lineNumber);
09692:            }
09693:
09694:            protected RecoveredType currentRecoveryType() {
09695:                if (this .currentElement != null) {
09696:                    if (this .currentElement instanceof  RecoveredType) {
09697:                        return (RecoveredType) this .currentElement;
09698:                    } else {
09699:                        return this .currentElement.enclosingType();
09700:                    }
09701:                }
09702:                return null;
09703:            }
09704:
09705:            public CompilationUnitDeclaration dietParse(
09706:                    ICompilationUnit sourceUnit,
09707:                    CompilationResult compilationResult) {
09708:
09709:                CompilationUnitDeclaration parsedUnit;
09710:                boolean old = this .diet;
09711:                try {
09712:                    this .diet = true;
09713:                    parsedUnit = parse(sourceUnit, compilationResult);
09714:                } finally {
09715:                    this .diet = old;
09716:                }
09717:                return parsedUnit;
09718:            }
09719:
09720:            protected void dispatchDeclarationInto(int length) {
09721:                /* they are length on this.astStack that should go into
09722:                   methods fields constructors lists of the typeDecl
09723:
09724:                   Return if there is a constructor declaration in the methods declaration */
09725:
09726:                // Looks for the size of each array . 
09727:                if (length == 0)
09728:                    return;
09729:                int[] flag = new int[length + 1]; //plus one -- see <HERE>
09730:                int size1 = 0, size2 = 0, size3 = 0;
09731:                boolean hasAbstractMethods = false;
09732:                for (int i = length - 1; i >= 0; i--) {
09733:                    ASTNode astNode = this .astStack[this .astPtr--];
09734:                    if (astNode instanceof  AbstractMethodDeclaration) {
09735:                        //methods and constructors have been regrouped into one single list
09736:                        flag[i] = 2;
09737:                        size2++;
09738:                        if (((AbstractMethodDeclaration) astNode).isAbstract()) {
09739:                            hasAbstractMethods = true;
09740:                        }
09741:                    } else if (astNode instanceof  TypeDeclaration) {
09742:                        flag[i] = 3;
09743:                        size3++;
09744:                    } else {
09745:                        //field
09746:                        flag[i] = 1;
09747:                        size1++;
09748:                    }
09749:                }
09750:
09751:                //arrays creation
09752:                TypeDeclaration typeDecl = (TypeDeclaration) this .astStack[this .astPtr];
09753:                if (size1 != 0) {
09754:                    typeDecl.fields = new FieldDeclaration[size1];
09755:                }
09756:                if (size2 != 0) {
09757:                    typeDecl.methods = new AbstractMethodDeclaration[size2];
09758:                    if (hasAbstractMethods)
09759:                        typeDecl.bits |= ASTNode.HasAbstractMethods;
09760:                }
09761:                if (size3 != 0) {
09762:                    typeDecl.memberTypes = new TypeDeclaration[size3];
09763:                }
09764:
09765:                //arrays fill up
09766:                size1 = size2 = size3 = 0;
09767:                int flagI = flag[0], start = 0;
09768:                int length2;
09769:                for (int end = 0; end <= length; end++) //<HERE> the plus one allows to 
09770:                {
09771:                    if (flagI != flag[end]) //treat the last element as a ended flag.....
09772:                    { //array copy
09773:                        switch (flagI) {
09774:                        case 1:
09775:                            size1 += (length2 = end - start);
09776:                            System.arraycopy(this .astStack, this .astPtr + start
09777:                                    + 1, typeDecl.fields, size1 - length2,
09778:                                    length2);
09779:                            break;
09780:                        case 2:
09781:                            size2 += (length2 = end - start);
09782:                            System.arraycopy(this .astStack, this .astPtr + start
09783:                                    + 1, typeDecl.methods, size2 - length2,
09784:                                    length2);
09785:                            break;
09786:                        case 3:
09787:                            size3 += (length2 = end - start);
09788:                            System.arraycopy(this .astStack, this .astPtr + start
09789:                                    + 1, typeDecl.memberTypes, size3 - length2,
09790:                                    length2);
09791:                            break;
09792:                        }
09793:                        flagI = flag[start = end];
09794:                    }
09795:                }
09796:
09797:                if (typeDecl.memberTypes != null) {
09798:                    for (int i = typeDecl.memberTypes.length - 1; i >= 0; i--) {
09799:                        typeDecl.memberTypes[i].enclosingType = typeDecl;
09800:                    }
09801:                }
09802:            }
09803:
09804:            protected void dispatchDeclarationIntoEnumDeclaration(int length) {
09805:
09806:                if (length == 0)
09807:                    return;
09808:                int[] flag = new int[length + 1]; //plus one -- see <HERE>
09809:                int size1 = 0, size2 = 0, size3 = 0;
09810:                TypeDeclaration enumDeclaration = (TypeDeclaration) this .astStack[this .astPtr
09811:                        - length];
09812:                boolean hasAbstractMethods = false;
09813:                for (int i = length - 1; i >= 0; i--) {
09814:                    ASTNode astNode = this .astStack[this .astPtr--];
09815:                    if (astNode instanceof  AbstractMethodDeclaration) {
09816:                        //methods and constructors have been regrouped into one single list
09817:                        flag[i] = 2;
09818:                        size2++;
09819:                        if (((AbstractMethodDeclaration) astNode).isAbstract()) {
09820:                            hasAbstractMethods = true;
09821:                        }
09822:                    } else if (astNode instanceof  TypeDeclaration) {
09823:                        flag[i] = 3;
09824:                        size3++;
09825:                    } else if (astNode instanceof  FieldDeclaration) {
09826:                        flag[i] = 1;
09827:                        size1++;
09828:                        //         if(astNode instanceof EnumConstant) {
09829:                        //            EnumConstant constant = (EnumConstant) astNode;
09830:                        //            ((AllocationExpression)constant.initialization).type = new SingleTypeReference(enumDeclaration.name,
09831:                        //                  (((long) enumDeclaration.sourceStart) << 32) + enumDeclaration.sourceEnd);
09832:                        //         }
09833:                    }
09834:                }
09835:
09836:                //arrays creation
09837:                if (size1 != 0) {
09838:                    enumDeclaration.fields = new FieldDeclaration[size1];
09839:                }
09840:                if (size2 != 0) {
09841:                    enumDeclaration.methods = new AbstractMethodDeclaration[size2];
09842:                    if (hasAbstractMethods)
09843:                        enumDeclaration.bits |= ASTNode.HasAbstractMethods;
09844:                }
09845:                if (size3 != 0) {
09846:                    enumDeclaration.memberTypes = new TypeDeclaration[size3];
09847:                }
09848:
09849:                //arrays fill up
09850:                size1 = size2 = size3 = 0;
09851:                int flagI = flag[0], start = 0;
09852:                int length2;
09853:                for (int end = 0; end <= length; end++) //<HERE> the plus one allows to 
09854:                {
09855:                    if (flagI != flag[end]) //treat the last element as a ended flag.....
09856:                    { //array copy
09857:                        switch (flagI) {
09858:                        case 1:
09859:                            size1 += (length2 = end - start);
09860:                            System.arraycopy(this .astStack, this .astPtr + start
09861:                                    + 1, enumDeclaration.fields, size1
09862:                                    - length2, length2);
09863:                            break;
09864:                        case 2:
09865:                            size2 += (length2 = end - start);
09866:                            System.arraycopy(this .astStack, this .astPtr + start
09867:                                    + 1, enumDeclaration.methods, size2
09868:                                    - length2, length2);
09869:                            break;
09870:                        case 3:
09871:                            size3 += (length2 = end - start);
09872:                            System.arraycopy(this .astStack, this .astPtr + start
09873:                                    + 1, enumDeclaration.memberTypes, size3
09874:                                    - length2, length2);
09875:                            break;
09876:                        }
09877:                        flagI = flag[start = end];
09878:                    }
09879:                }
09880:
09881:                if (enumDeclaration.memberTypes != null) {
09882:                    for (int i = enumDeclaration.memberTypes.length - 1; i >= 0; i--) {
09883:                        enumDeclaration.memberTypes[i].enclosingType = enumDeclaration;
09884:                    }
09885:                }
09886:            }
09887:
09888:            protected CompilationUnitDeclaration endParse(int act) {
09889:
09890:                this .lastAct = act;
09891:
09892:                if (this .statementRecoveryActivated) {
09893:                    RecoveredElement recoveredElement = this 
09894:                            .buildInitialRecoveryState();
09895:                    recoveredElement.topElement().updateParseTree();
09896:                    if (this .hasError)
09897:                        this .resetStacks();
09898:                } else if (this .currentElement != null) {
09899:                    if (VERBOSE_RECOVERY) {
09900:                        System.out.print(Messages.parser_syntaxRecovery);
09901:                        System.out.println("--------------------------"); //$NON-NLS-1$
09902:                        System.out.println(this .compilationUnit);
09903:                        System.out
09904:                                .println("----------------------------------"); //$NON-NLS-1$
09905:                    }
09906:                    this .currentElement.topElement().updateParseTree();
09907:                } else {
09908:                    if (this .diet & VERBOSE_RECOVERY) {
09909:                        System.out.print(Messages.parser_regularParse);
09910:                        System.out.println("--------------------------"); //$NON-NLS-1$
09911:                        System.out.println(this .compilationUnit);
09912:                        System.out
09913:                                .println("----------------------------------"); //$NON-NLS-1$
09914:                    }
09915:                }
09916:                persistLineSeparatorPositions();
09917:                for (int i = 0; i < this .scanner.foundTaskCount; i++) {
09918:                    if (!this .statementRecoveryActivated)
09919:                        problemReporter()
09920:                                .task(
09921:                                        new String(
09922:                                                this .scanner.foundTaskTags[i]),
09923:                                        new String(
09924:                                                this .scanner.foundTaskMessages[i]),
09925:                                        this .scanner.foundTaskPriorities[i] == null ? null
09926:                                                : new String(
09927:                                                        this .scanner.foundTaskPriorities[i]),
09928:                                        this .scanner.foundTaskPositions[i][0],
09929:                                        this .scanner.foundTaskPositions[i][1]);
09930:                }
09931:                return this .compilationUnit;
09932:            }
09933:
09934:            /*
09935:             * Flush comments defined prior to a given positions.
09936:             *
09937:             * Note: comments are stacked in syntactical order
09938:             *
09939:             * Either answer given <position>, or the end position of a comment line 
09940:             * immediately following the <position> (same line)
09941:             *
09942:             * e.g.
09943:             * void foo(){
09944:             * } // end of method foo
09945:             */
09946:
09947:            public int flushCommentsDefinedPriorTo(int position) {
09948:
09949:                int lastCommentIndex = this .scanner.commentPtr;
09950:                if (lastCommentIndex < 0)
09951:                    return position; // no comment
09952:
09953:                // compute the index of the first obsolete comment
09954:                int index = lastCommentIndex;
09955:                int validCount = 0;
09956:                while (index >= 0) {
09957:                    int commentEnd = this .scanner.commentStops[index];
09958:                    if (commentEnd < 0)
09959:                        commentEnd = -commentEnd; // negative end position for non-javadoc comments
09960:                    if (commentEnd <= position) {
09961:                        break;
09962:                    }
09963:                    index--;
09964:                    validCount++;
09965:                }
09966:                // if the source at <position> is immediately followed by a line comment, then
09967:                // flush this comment and shift <position> to the comment end.
09968:                if (validCount > 0) {
09969:                    int immediateCommentEnd = -this .scanner.commentStops[index + 1]; //non-javadoc comment end positions are negative
09970:                    if (immediateCommentEnd > 0) { // only tolerating non-javadoc comments
09971:                        // is there any line break until the end of the immediate comment ? (thus only tolerating line comment)
09972:                        immediateCommentEnd--; // comment end in one char too far
09973:                        if (Util.getLineNumber(position, this .scanner.lineEnds,
09974:                                0, this .scanner.linePtr) == Util.getLineNumber(
09975:                                immediateCommentEnd, this .scanner.lineEnds, 0,
09976:                                this .scanner.linePtr)) {
09977:                            position = immediateCommentEnd;
09978:                            validCount--; // flush this comment
09979:                            index++;
09980:                        }
09981:                    }
09982:                }
09983:
09984:                if (index < 0)
09985:                    return position; // no obsolete comment
09986:
09987:                switch (validCount) {
09988:                case 0:
09989:                    // do nothing
09990:                    break;
09991:                // move valid comment infos, overriding obsolete comment infos
09992:                case 2:
09993:                    this .scanner.commentStarts[0] = this .scanner.commentStarts[index + 1];
09994:                    this .scanner.commentStops[0] = this .scanner.commentStops[index + 1];
09995:                    this .scanner.commentTagStarts[0] = this .scanner.commentTagStarts[index + 1];
09996:                    this .scanner.commentStarts[1] = this .scanner.commentStarts[index + 2];
09997:                    this .scanner.commentStops[1] = this .scanner.commentStops[index + 2];
09998:                    this .scanner.commentTagStarts[1] = this .scanner.commentTagStarts[index + 2];
09999:                    break;
10000:                case 1:
10001:                    this .scanner.commentStarts[0] = this .scanner.commentStarts[index + 1];
10002:                    this .scanner.commentStops[0] = this .scanner.commentStops[index + 1];
10003:                    this .scanner.commentTagStarts[0] = this .scanner.commentTagStarts[index + 1];
10004:                    break;
10005:                default:
10006:                    System.arraycopy(this .scanner.commentStarts, index + 1,
10007:                            this .scanner.commentStarts, 0, validCount);
10008:                    System.arraycopy(this .scanner.commentStops, index + 1,
10009:                            this .scanner.commentStops, 0, validCount);
10010:                    System.arraycopy(this .scanner.commentTagStarts, index + 1,
10011:                            this .scanner.commentTagStarts, 0, validCount);
10012:                }
10013:                this .scanner.commentPtr = validCount - 1;
10014:                return position;
10015:            }
10016:
10017:            protected TypeReference getAnnotationType() {
10018:                int length = this .identifierLengthStack[this .identifierLengthPtr--];
10019:                if (length == 1) {
10020:                    return new SingleTypeReference(
10021:                            this .identifierStack[this .identifierPtr],
10022:                            this .identifierPositionStack[this .identifierPtr--]);
10023:                } else {
10024:                    char[][] tokens = new char[length][];
10025:                    this .identifierPtr -= length;
10026:                    long[] positions = new long[length];
10027:                    System.arraycopy(this .identifierStack,
10028:                            this .identifierPtr + 1, tokens, 0, length);
10029:                    System.arraycopy(this .identifierPositionStack,
10030:                            this .identifierPtr + 1, positions, 0, length);
10031:                    return new QualifiedTypeReference(tokens, positions);
10032:                }
10033:            }
10034:
10035:            public int getFirstToken() {
10036:                // the first token is a virtual token that
10037:                // allows the parser to parse several goals
10038:                // even if they aren't LALR(1)....
10039:                // Goal ::= '++' CompilationUnit
10040:                // Goal ::= '--' MethodBody
10041:                // Goal ::= '==' ConstructorBody
10042:                // -- Initializer
10043:                // Goal ::= '>>' StaticInitializer
10044:                // Goal ::= '>>' Block
10045:                // -- error recovery
10046:                // Goal ::= '>>>' Headers
10047:                // Goal ::= '*' BlockStatements
10048:                // Goal ::= '*' MethodPushModifiersHeader
10049:                // -- JDOM
10050:                // Goal ::= '&&' FieldDeclaration
10051:                // Goal ::= '||' ImportDeclaration
10052:                // Goal ::= '?' PackageDeclaration
10053:                // Goal ::= '+' TypeDeclaration
10054:                // Goal ::= '/' GenericMethodDeclaration
10055:                // Goal ::= '&' ClassBodyDeclaration
10056:                // -- code snippet
10057:                // Goal ::= '%' Expression
10058:                // -- completion parser
10059:                // Goal ::= '!' ConstructorBlockStatementsopt
10060:                // Goal ::= '~' BlockStatementsopt
10061:
10062:                return this .firstToken;
10063:            }
10064:
10065:            /*
10066:             * Answer back an array of sourceStart/sourceEnd positions of the available JavaDoc comments.
10067:             * The array is a flattened structure: 2*n entries with consecutives start and end positions.
10068:             *
10069:             * If no JavaDoc is available, then null is answered instead of an empty array.
10070:             *
10071:             * e.g. { 10, 20, 25, 45 }  --> javadoc1 from 10 to 20, javadoc2 from 25 to 45
10072:             */
10073:            public int[] getJavaDocPositions() {
10074:
10075:                int javadocCount = 0;
10076:                for (int i = 0, max = this .scanner.commentPtr; i <= max; i++) {
10077:                    // javadoc only (non javadoc comment have negative end positions.)
10078:                    if (this .scanner.commentStops[i] > 0) {
10079:                        javadocCount++;
10080:                    }
10081:                }
10082:                if (javadocCount == 0)
10083:                    return null;
10084:
10085:                int[] positions = new int[2 * javadocCount];
10086:                int index = 0;
10087:                for (int i = 0, max = this .scanner.commentPtr; i <= max; i++) {
10088:                    // javadoc only (non javadoc comment have negative end positions.)
10089:                    if (this .scanner.commentStops[i] > 0) {
10090:                        positions[index++] = this .scanner.commentStarts[i];
10091:                        positions[index++] = this .scanner.commentStops[i] - 1; //stop is one over			
10092:                    }
10093:                }
10094:                return positions;
10095:            }
10096:
10097:            public void getMethodBodies(CompilationUnitDeclaration unit) {
10098:                //fill the methods bodies in order for the code to be generated
10099:
10100:                if (unit == null)
10101:                    return;
10102:
10103:                if (unit.ignoreMethodBodies) {
10104:                    unit.ignoreFurtherInvestigation = true;
10105:                    return;
10106:                    // if initial diet parse did not work, no need to dig into method bodies.
10107:                }
10108:
10109:                if ((unit.bits & ASTNode.HasAllMethodBodies) != 0)
10110:                    return; //work already done ...
10111:
10112:                // save existing values to restore them at the end of the parsing process
10113:                // see bug 47079 for more details
10114:                int[] oldLineEnds = this .scanner.lineEnds;
10115:                int oldLinePtr = this .scanner.linePtr;
10116:
10117:                //real parse of the method....
10118:                CompilationResult compilationResult = unit.compilationResult;
10119:                char[] contents = compilationResult.compilationUnit
10120:                        .getContents();
10121:                this .scanner.setSource(contents, compilationResult);
10122:
10123:                if (this .javadocParser != null
10124:                        && this .javadocParser.checkDocComment) {
10125:                    this .javadocParser.scanner.setSource(contents);
10126:                }
10127:                if (unit.types != null) {
10128:                    for (int i = unit.types.length; --i >= 0;)
10129:                        unit.types[i].parseMethod(this , unit);
10130:                }
10131:
10132:                // tag unit has having read bodies
10133:                unit.bits |= ASTNode.HasAllMethodBodies;
10134:
10135:                // this is done to prevent any side effects on the compilation unit result
10136:                // line separator positions array.
10137:                this .scanner.lineEnds = oldLineEnds;
10138:                this .scanner.linePtr = oldLinePtr;
10139:            }
10140:
10141:            protected char getNextCharacter(char[] comment, int[] index) {
10142:                char nextCharacter = comment[index[0]++];
10143:                switch (nextCharacter) {
10144:                case '\\':
10145:                    int c1,
10146:                    c2,
10147:                    c3,
10148:                    c4;
10149:                    index[0]++;
10150:                    while (comment[index[0]] == 'u')
10151:                        index[0]++;
10152:                    if (!(((c1 = ScannerHelper
10153:                            .getNumericValue(comment[index[0]++])) > 15 || c1 < 0)
10154:                            || ((c2 = ScannerHelper
10155:                                    .getNumericValue(comment[index[0]++])) > 15 || c2 < 0)
10156:                            || ((c3 = ScannerHelper
10157:                                    .getNumericValue(comment[index[0]++])) > 15 || c3 < 0) || ((c4 = ScannerHelper
10158:                            .getNumericValue(comment[index[0]++])) > 15 || c4 < 0))) {
10159:                        nextCharacter = (char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4);
10160:                    }
10161:                    break;
10162:                }
10163:                return nextCharacter;
10164:            }
10165:
10166:            protected Expression getTypeReference(Expression exp) {
10167:
10168:                exp.bits &= ~ASTNode.RestrictiveFlagMASK;
10169:                exp.bits |= Binding.TYPE;
10170:                return exp;
10171:            }
10172:
10173:            protected TypeReference getTypeReference(int dim) {
10174:                /* build a Reference on a variable that may be qualified or not
10175:                 This variable is a type reference and dim will be its dimensions*/
10176:
10177:                TypeReference ref;
10178:                int length = this .identifierLengthStack[this .identifierLengthPtr--];
10179:                if (length < 0) { //flag for precompiled type reference on base types
10180:                    ref = TypeReference.baseTypeReference(-length, dim);
10181:                    ref.sourceStart = this .intStack[this .intPtr--];
10182:                    if (dim == 0) {
10183:                        ref.sourceEnd = this .intStack[this .intPtr--];
10184:                    } else {
10185:                        this .intPtr--;
10186:                        ref.sourceEnd = this .endPosition;
10187:                    }
10188:                } else {
10189:                    int numberOfIdentifiers = this .genericsIdentifiersLengthStack[this .genericsIdentifiersLengthPtr--];
10190:                    if (length != numberOfIdentifiers
10191:                            || this .genericsLengthStack[this .genericsLengthPtr] != 0) {
10192:                        // generic type
10193:                        ref = getTypeReferenceForGenericType(dim, length,
10194:                                numberOfIdentifiers);
10195:                    } else if (length == 1) {
10196:                        // single variable reference
10197:                        this .genericsLengthPtr--; // pop the 0
10198:                        if (dim == 0) {
10199:                            ref = new SingleTypeReference(
10200:                                    this .identifierStack[this .identifierPtr],
10201:                                    this .identifierPositionStack[this .identifierPtr--]);
10202:                        } else {
10203:                            ref = new ArrayTypeReference(
10204:                                    this .identifierStack[this .identifierPtr],
10205:                                    dim,
10206:                                    this .identifierPositionStack[this .identifierPtr--]);
10207:                            ref.sourceEnd = this .endPosition;
10208:                        }
10209:                    } else {
10210:                        this .genericsLengthPtr--;
10211:                        //Qualified variable reference
10212:                        char[][] tokens = new char[length][];
10213:                        this .identifierPtr -= length;
10214:                        long[] positions = new long[length];
10215:                        System.arraycopy(this .identifierStack,
10216:                                this .identifierPtr + 1, tokens, 0, length);
10217:                        System.arraycopy(this .identifierPositionStack,
10218:                                this .identifierPtr + 1, positions, 0, length);
10219:                        if (dim == 0) {
10220:                            ref = new QualifiedTypeReference(tokens, positions);
10221:                        } else {
10222:                            ref = new ArrayQualifiedTypeReference(tokens, dim,
10223:                                    positions);
10224:                            ref.sourceEnd = this .endPosition;
10225:                        }
10226:                    }
10227:                }
10228:                return ref;
10229:            }
10230:
10231:            protected TypeReference getTypeReferenceForGenericType(int dim,
10232:                    int identifierLength, int numberOfIdentifiers) {
10233:                if (identifierLength == 1 && numberOfIdentifiers == 1) {
10234:                    int currentTypeArgumentsLength = this .genericsLengthStack[this .genericsLengthPtr--];
10235:                    TypeReference[] typeArguments = new TypeReference[currentTypeArgumentsLength];
10236:                    this .genericsPtr -= currentTypeArgumentsLength;
10237:                    System.arraycopy(this .genericsStack, this .genericsPtr + 1,
10238:                            typeArguments, 0, currentTypeArgumentsLength);
10239:                    ParameterizedSingleTypeReference parameterizedSingleTypeReference = new ParameterizedSingleTypeReference(
10240:                            this .identifierStack[this .identifierPtr],
10241:                            typeArguments, dim,
10242:                            this .identifierPositionStack[this .identifierPtr--]);
10243:                    if (dim != 0) {
10244:                        parameterizedSingleTypeReference.sourceEnd = this .endStatementPosition;
10245:                    }
10246:                    return parameterizedSingleTypeReference;
10247:                } else {
10248:                    TypeReference[][] typeArguments = new TypeReference[numberOfIdentifiers][];
10249:                    char[][] tokens = new char[numberOfIdentifiers][];
10250:                    long[] positions = new long[numberOfIdentifiers];
10251:                    int index = numberOfIdentifiers;
10252:                    int currentIdentifiersLength = identifierLength;
10253:                    while (index > 0) {
10254:                        int currentTypeArgumentsLength = this .genericsLengthStack[this .genericsLengthPtr--];
10255:                        if (currentTypeArgumentsLength != 0) {
10256:                            this .genericsPtr -= currentTypeArgumentsLength;
10257:                            System
10258:                                    .arraycopy(
10259:                                            this .genericsStack,
10260:                                            this .genericsPtr + 1,
10261:                                            typeArguments[index - 1] = new TypeReference[currentTypeArgumentsLength],
10262:                                            0, currentTypeArgumentsLength);
10263:                        }
10264:                        switch (currentIdentifiersLength) {
10265:                        case 1:
10266:                            // we are in a case A<B>.C<D> or A<B>.C<D>
10267:                            tokens[index - 1] = this .identifierStack[this .identifierPtr];
10268:                            positions[index - 1] = this .identifierPositionStack[this .identifierPtr--];
10269:                            break;
10270:                        default:
10271:                            // we are in a case A.B.C<B>.C<D> or A.B.C<B>...
10272:                            this .identifierPtr -= currentIdentifiersLength;
10273:                            System.arraycopy(this .identifierStack,
10274:                                    this .identifierPtr + 1, tokens, index
10275:                                            - currentIdentifiersLength,
10276:                                    currentIdentifiersLength);
10277:                            System.arraycopy(this .identifierPositionStack,
10278:                                    this .identifierPtr + 1, positions, index
10279:                                            - currentIdentifiersLength,
10280:                                    currentIdentifiersLength);
10281:                        }
10282:                        index -= currentIdentifiersLength;
10283:                        if (index > 0) {
10284:                            currentIdentifiersLength = this .identifierLengthStack[this .identifierLengthPtr--];
10285:                        }
10286:                    }
10287:                    ParameterizedQualifiedTypeReference parameterizedQualifiedTypeReference = new ParameterizedQualifiedTypeReference(
10288:                            tokens, typeArguments, dim, positions);
10289:                    if (dim != 0) {
10290:                        parameterizedQualifiedTypeReference.sourceEnd = this .endStatementPosition;
10291:                    }
10292:                    return parameterizedQualifiedTypeReference;
10293:                }
10294:            }
10295:
10296:            protected NameReference getUnspecifiedReference() {
10297:                /* build a (unspecified) NameReference which may be qualified*/
10298:
10299:                int length;
10300:                NameReference ref;
10301:                if ((length = this .identifierLengthStack[this .identifierLengthPtr--]) == 1)
10302:                    // single variable reference
10303:                    ref = new SingleNameReference(
10304:                            this .identifierStack[this .identifierPtr],
10305:                            this .identifierPositionStack[this .identifierPtr--]);
10306:                else
10307:                //Qualified variable reference
10308:                {
10309:                    char[][] tokens = new char[length][];
10310:                    this .identifierPtr -= length;
10311:                    System.arraycopy(this .identifierStack,
10312:                            this .identifierPtr + 1, tokens, 0, length);
10313:                    long[] positions = new long[length];
10314:                    System.arraycopy(this .identifierPositionStack,
10315:                            this .identifierPtr + 1, positions, 0, length);
10316:                    ref = new QualifiedNameReference(
10317:                            tokens,
10318:                            positions,
10319:                            (int) (this .identifierPositionStack[this .identifierPtr + 1] >> 32), // sourceStart
10320:                            (int) this .identifierPositionStack[this .identifierPtr
10321:                                    + length]); // sourceEnd
10322:                }
10323:                return ref;
10324:            }
10325:
10326:            protected NameReference getUnspecifiedReferenceOptimized() {
10327:                /* build a (unspecified) NameReference which may be qualified
10328:                The optimization occurs for qualified reference while we are
10329:                certain in this case the last item of the qualified name is
10330:                a field access. This optimization is IMPORTANT while it results
10331:                that when a NameReference is build, the type checker should always
10332:                look for that it is not a type reference */
10333:
10334:                int length;
10335:                NameReference ref;
10336:                if ((length = this .identifierLengthStack[this .identifierLengthPtr--]) == 1) {
10337:                    // single variable reference
10338:                    ref = new SingleNameReference(
10339:                            this .identifierStack[this .identifierPtr],
10340:                            this .identifierPositionStack[this .identifierPtr--]);
10341:                    ref.bits &= ~ASTNode.RestrictiveFlagMASK;
10342:                    ref.bits |= Binding.LOCAL | Binding.FIELD;
10343:                    return ref;
10344:                }
10345:
10346:                //Qualified-variable-reference
10347:                //In fact it is variable-reference DOT field-ref , but it would result in a type
10348:                //conflict tha can be only reduce by making a superclass (or inetrface ) between
10349:                //nameReference and FiledReference or putting FieldReference under NameReference
10350:                //or else..........This optimisation is not really relevant so just leave as it is
10351:
10352:                char[][] tokens = new char[length][];
10353:                this .identifierPtr -= length;
10354:                System.arraycopy(this .identifierStack, this .identifierPtr + 1,
10355:                        tokens, 0, length);
10356:                long[] positions = new long[length];
10357:                System.arraycopy(this .identifierPositionStack,
10358:                        this .identifierPtr + 1, positions, 0, length);
10359:                ref = new QualifiedNameReference(
10360:                        tokens,
10361:                        positions,
10362:                        (int) (this .identifierPositionStack[this .identifierPtr + 1] >> 32), // sourceStart
10363:                        (int) this .identifierPositionStack[this .identifierPtr
10364:                                + length]); // sourceEnd
10365:                ref.bits &= ~ASTNode.RestrictiveFlagMASK;
10366:                ref.bits |= Binding.LOCAL | Binding.FIELD;
10367:                return ref;
10368:            }
10369:
10370:            public void goForBlockStatementsopt() {
10371:                //tells the scanner to go for block statements opt parsing
10372:
10373:                this .firstToken = TokenNameTWIDDLE;
10374:                this .scanner.recordLineSeparator = false;
10375:            }
10376:
10377:            public void goForBlockStatementsOrCatchHeader() {
10378:                //tells the scanner to go for block statements or method headers parsing 
10379:
10380:                this .firstToken = TokenNameMULTIPLY;
10381:                this .scanner.recordLineSeparator = false;
10382:            }
10383:
10384:            public void goForClassBodyDeclarations() {
10385:                //tells the scanner to go for any body declarations parsing
10386:
10387:                this .firstToken = TokenNameAND;
10388:                this .scanner.recordLineSeparator = true;
10389:            }
10390:
10391:            public void goForCompilationUnit() {
10392:                //tells the scanner to go for compilation unit parsing
10393:
10394:                this .firstToken = TokenNamePLUS_PLUS;
10395:                this .scanner.foundTaskCount = 0;
10396:                this .scanner.recordLineSeparator = true;
10397:            }
10398:
10399:            public void goForExpression() {
10400:                //tells the scanner to go for an expression parsing
10401:
10402:                this .firstToken = TokenNameREMAINDER;
10403:                this .scanner.recordLineSeparator = true; // recovery goals must record line separators
10404:            }
10405:
10406:            public void goForFieldDeclaration() {
10407:                //tells the scanner to go for field declaration parsing
10408:
10409:                this .firstToken = TokenNameAND_AND;
10410:                this .scanner.recordLineSeparator = true;
10411:            }
10412:
10413:            public void goForGenericMethodDeclaration() {
10414:                //tells the scanner to go for generic method declarations parsing
10415:
10416:                this .firstToken = TokenNameDIVIDE;
10417:                this .scanner.recordLineSeparator = true;
10418:            }
10419:
10420:            public void goForHeaders() {
10421:                //tells the scanner to go for headers only parsing
10422:                RecoveredType currentType = this .currentRecoveryType();
10423:                if (currentType != null && currentType.insideEnumConstantPart) {
10424:                    this .firstToken = TokenNameNOT;
10425:                } else {
10426:                    this .firstToken = TokenNameUNSIGNED_RIGHT_SHIFT;
10427:                }
10428:                this .scanner.recordLineSeparator = true; // recovery goals must record line separators
10429:            }
10430:
10431:            public void goForImportDeclaration() {
10432:                //tells the scanner to go for import declaration parsing
10433:
10434:                this .firstToken = TokenNameOR_OR;
10435:                this .scanner.recordLineSeparator = true;
10436:            }
10437:
10438:            public void goForInitializer() {
10439:                //tells the scanner to go for initializer parsing
10440:
10441:                this .firstToken = TokenNameRIGHT_SHIFT;
10442:                this .scanner.recordLineSeparator = false;
10443:            }
10444:
10445:            public void goForMemberValue() {
10446:                //tells the scanner to go for a member value parsing
10447:
10448:                this .firstToken = TokenNameOR_OR;
10449:                this .scanner.recordLineSeparator = true; // recovery goals must record line separators
10450:            }
10451:
10452:            public void goForMethodBody() {
10453:                //tells the scanner to go for method body parsing
10454:
10455:                this .firstToken = TokenNameMINUS_MINUS;
10456:                this .scanner.recordLineSeparator = false;
10457:            }
10458:
10459:            public void goForPackageDeclaration() {
10460:                //tells the scanner to go for package declaration parsing
10461:
10462:                this .firstToken = TokenNameQUESTION;
10463:                this .scanner.recordLineSeparator = true;
10464:            }
10465:
10466:            public void goForTypeDeclaration() {
10467:                //tells the scanner to go for type (interface or class) declaration parsing
10468:
10469:                this .firstToken = TokenNamePLUS;
10470:                this .scanner.recordLineSeparator = true;
10471:            }
10472:
10473:            protected void ignoreExpressionAssignment() {
10474:                // Assignment ::= InvalidArrayInitializerAssignement
10475:                // encoded operator would be: this.intStack[this.intPtr]
10476:                this .intPtr--;
10477:                ArrayInitializer arrayInitializer = (ArrayInitializer) this .expressionStack[this .expressionPtr--];
10478:                this .expressionLengthPtr--;
10479:                // report a syntax error and abort parsing
10480:                if (!this .statementRecoveryActivated)
10481:                    problemReporter().arrayConstantsOnlyInArrayInitializers(
10482:                            arrayInitializer.sourceStart,
10483:                            arrayInitializer.sourceEnd);
10484:            }
10485:
10486:            public void initialize() {
10487:                this .initialize(false);
10488:            }
10489:
10490:            public void initialize(boolean initializeNLS) {
10491:                //positionning the parser for a new compilation unit
10492:                //avoiding stack reallocation and all that....
10493:                this .astPtr = -1;
10494:                this .astLengthPtr = -1;
10495:                this .expressionPtr = -1;
10496:                this .expressionLengthPtr = -1;
10497:                this .identifierPtr = -1;
10498:                this .identifierLengthPtr = -1;
10499:                this .intPtr = -1;
10500:                this .nestedMethod[this .nestedType = 0] = 0; // need to reset for further reuse
10501:                this .variablesCounter[this .nestedType] = 0;
10502:                this .dimensions = 0;
10503:                this .realBlockPtr = -1;
10504:                this .compilationUnit = null;
10505:                this .referenceContext = null;
10506:                this .endStatementPosition = 0;
10507:
10508:                //remove objects from stack too, while the same parser/compiler couple is
10509:                //re-used between two compilations ....
10510:
10511:                int astLength = this .astStack.length;
10512:                if (this .noAstNodes.length < astLength) {
10513:                    this .noAstNodes = new ASTNode[astLength];
10514:                    //System.out.println("Resized AST stacks : "+ astLength);
10515:
10516:                }
10517:                System.arraycopy(this .noAstNodes, 0, this .astStack, 0,
10518:                        astLength);
10519:
10520:                int expressionLength = this .expressionStack.length;
10521:                if (this .noExpressions.length < expressionLength) {
10522:                    this .noExpressions = new Expression[expressionLength];
10523:                    //System.out.println("Resized EXPR stacks : "+ expressionLength);
10524:                }
10525:                System.arraycopy(this .noExpressions, 0, this .expressionStack,
10526:                        0, expressionLength);
10527:
10528:                // reset this.scanner state
10529:                this .scanner.commentPtr = -1;
10530:                this .scanner.foundTaskCount = 0;
10531:                this .scanner.eofPosition = Integer.MAX_VALUE;
10532:                this .recordStringLiterals = true;
10533:                final boolean checkNLS = this .options
10534:                        .getSeverity(CompilerOptions.NonExternalizedString) != ProblemSeverities.Ignore;
10535:                this .checkExternalizeStrings = checkNLS;
10536:                this .scanner.checkNonExternalizedStringLiterals = initializeNLS
10537:                        && checkNLS;
10538:
10539:                resetModifiers();
10540:
10541:                // recovery
10542:                this .lastCheckPoint = -1;
10543:                this .currentElement = null;
10544:                this .restartRecovery = false;
10545:                this .hasReportedError = false;
10546:                this .recoveredStaticInitializerStart = 0;
10547:                this .lastIgnoredToken = -1;
10548:                this .lastErrorEndPosition = -1;
10549:                this .lastErrorEndPositionBeforeRecovery = -1;
10550:                this .lastJavadocEnd = -1;
10551:                this .listLength = 0;
10552:                this .listTypeParameterLength = 0;
10553:
10554:                this .rBraceStart = 0;
10555:                this .rBraceEnd = 0;
10556:                this .rBraceSuccessorStart = 0;
10557:
10558:                this .genericsIdentifiersLengthPtr = -1;
10559:                this .genericsLengthPtr = -1;
10560:                this .genericsPtr = -1;
10561:            }
10562:
10563:            public void initializeScanner() {
10564:                this .scanner = new Scanner(false /*comment*/,
10565:                        false /*whitespace*/, false, /* will be set in initialize(boolean) */
10566:                        this .options.sourceLevel /*sourceLevel*/,
10567:                        this .options.complianceLevel /*complianceLevel*/,
10568:                        this .options.taskTags/*taskTags*/,
10569:                        this .options.taskPriorites/*taskPriorities*/,
10570:                        this .options.isTaskCaseSensitive/*taskCaseSensitive*/);
10571:            }
10572:
10573:            public void jumpOverMethodBody() {
10574:                //on diet parsing.....do not buffer method statements
10575:
10576:                //the scanner.diet is reinitialized to false
10577:                //automatically by the scanner once it has jumped over
10578:                //the statements
10579:
10580:                if (this .diet && (this .dietInt == 0))
10581:                    this .scanner.diet = true;
10582:            }
10583:
10584:            private void jumpOverType() {
10585:                if (this .recoveredTypes != null && this .nextTypeStart > -1
10586:                        && this .nextTypeStart < this .scanner.currentPosition) {
10587:
10588:                    if (DEBUG_AUTOMATON) {
10589:                        System.out.println("Jump         -"); //$NON-NLS-1$
10590:                    }
10591:
10592:                    TypeDeclaration typeDeclaration = this .recoveredTypes[this .recoveredTypePtr];
10593:                    boolean isAnonymous = typeDeclaration.allocation != null;
10594:
10595:                    int end = this .scanner.eofPosition;
10596:                    this .scanner.resetTo(
10597:                            typeDeclaration.declarationSourceEnd + 1, end - 1);
10598:                    if (!isAnonymous) {
10599:                        ((RecoveryScanner) this .scanner)
10600:                                .setPendingTokens(new int[] {
10601:                                        TokenNameSEMICOLON, TokenNamebreak });
10602:                    } else {
10603:                        ((RecoveryScanner) this .scanner)
10604:                                .setPendingTokens(new int[] {
10605:                                        TokenNameIdentifier, TokenNameEQUAL,
10606:                                        TokenNameIdentifier });
10607:                    }
10608:
10609:                    this .pendingRecoveredType = typeDeclaration;
10610:
10611:                    try {
10612:                        this .currentToken = this .scanner.getNextToken();
10613:                    } catch (InvalidInputException e) {
10614:                        // it's impossible because we added pending tokens before
10615:                    }
10616:
10617:                    if (++this .recoveredTypePtr < this .recoveredTypes.length) {
10618:                        TypeDeclaration nextTypeDeclaration = this .recoveredTypes[this .recoveredTypePtr];
10619:                        this .nextTypeStart = nextTypeDeclaration.allocation == null ? nextTypeDeclaration.declarationSourceStart
10620:                                : nextTypeDeclaration.allocation.sourceStart;
10621:                    } else {
10622:                        this .nextTypeStart = Integer.MAX_VALUE;
10623:                    }
10624:                }
10625:            }
10626:
10627:            protected void markEnclosingMemberWithLocalType() {
10628:                if (this .currentElement != null)
10629:                    return; // this is already done in the recovery code
10630:                for (int i = this .astPtr; i >= 0; i--) {
10631:                    ASTNode node = this .astStack[i];
10632:                    if (node instanceof  AbstractMethodDeclaration
10633:                            || node instanceof  FieldDeclaration
10634:                            || (node instanceof  TypeDeclaration // mark type for now: all initializers will be marked when added to this type
10635:                            // and enclosing type must not be closed (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=147485)
10636:                            && ((TypeDeclaration) node).declarationSourceEnd == 0)) {
10637:                        node.bits |= ASTNode.HasLocalType;
10638:                        return;
10639:                    }
10640:                }
10641:                // default to reference context (case of parse method body)
10642:                if (this .referenceContext instanceof  AbstractMethodDeclaration
10643:                        || this .referenceContext instanceof  TypeDeclaration) {
10644:                    ((ASTNode) this .referenceContext).bits |= ASTNode.HasLocalType;
10645:                }
10646:            }
10647:
10648:            /*
10649:             * Move checkpoint location (current implementation is moving it by one token)
10650:             *
10651:             * Answers true if successfully moved checkpoint (in other words, it did not attempt to move it
10652:             * beyond end of file).
10653:             */
10654:            protected boolean moveRecoveryCheckpoint() {
10655:
10656:                int pos = this .lastCheckPoint;
10657:                /* reset this.scanner, and move checkpoint by one token */
10658:                this .scanner.startPosition = pos;
10659:                this .scanner.currentPosition = pos;
10660:                this .scanner.diet = false; // quit jumping over method bodies
10661:
10662:                /* if about to restart, then no need to shift token */
10663:                if (this .restartRecovery) {
10664:                    this .lastIgnoredToken = -1;
10665:                    this .scanner.insideRecovery = true;
10666:                    return true;
10667:                }
10668:
10669:                /* protect against shifting on an invalid token */
10670:                this .lastIgnoredToken = this .nextIgnoredToken;
10671:                this .nextIgnoredToken = -1;
10672:                do {
10673:                    try {
10674:                        this .nextIgnoredToken = this .scanner.getNextToken();
10675:                        if (this .scanner.currentPosition == this .scanner.startPosition) {
10676:                            this .scanner.currentPosition++; // on fake completion identifier
10677:                            this .nextIgnoredToken = -1;
10678:                        }
10679:
10680:                    } catch (InvalidInputException e) {
10681:                        pos = this .scanner.currentPosition;
10682:                    }
10683:                } while (this .nextIgnoredToken < 0);
10684:
10685:                if (this .nextIgnoredToken == TokenNameEOF) { // no more recovery after this point
10686:                    if (this .currentToken == TokenNameEOF) { // already tried one iteration on EOF
10687:                        return false;
10688:                    }
10689:                }
10690:                this .lastCheckPoint = this .scanner.currentPosition;
10691:
10692:                /* reset this.scanner again to previous checkpoint location*/
10693:                this .scanner.startPosition = pos;
10694:                this .scanner.currentPosition = pos;
10695:                this .scanner.commentPtr = -1;
10696:                this .scanner.foundTaskCount = 0;
10697:                return true;
10698:
10699:                /*
10700:                 The following implementation moves the checkpoint location by one line:
10701:                
10702:                 int pos = this.lastCheckPoint;
10703:                 // reset this.scanner, and move checkpoint by one token
10704:                 this.scanner.startPosition = pos;
10705:                 this.scanner.currentPosition = pos;
10706:                 this.scanner.diet = false; // quit jumping over method bodies
10707:                
10708:                 // if about to restart, then no need to shift token
10709:                 if (this.restartRecovery){
10710:                 this.lastIgnoredToken = -1;
10711:                 return true;
10712:                 }
10713:                
10714:                 // protect against shifting on an invalid token
10715:                 this.lastIgnoredToken = this.nextIgnoredToken;
10716:                 this.nextIgnoredToken = -1;
10717:                
10718:                 boolean wasTokenizingWhiteSpace = this.scanner.tokenizeWhiteSpace;
10719:                 this.scanner.tokenizeWhiteSpace = true;
10720:                 checkpointMove: 
10721:                 do {
10722:                 try {
10723:                 this.nextIgnoredToken = this.scanner.getNextToken();
10724:                 switch(this.nextIgnoredToken){
10725:                 case Scanner.TokenNameWHITESPACE :
10726:                 if(this.scanner.getLineNumber(this.scanner.startPosition)
10727:                 == this.scanner.getLineNumber(this.scanner.currentPosition)){
10728:                 this.nextIgnoredToken = -1;
10729:                 }
10730:                 break;
10731:                 case TokenNameSEMICOLON :
10732:                 case TokenNameLBRACE :
10733:                 case TokenNameRBRACE :
10734:                 break;
10735:                 case TokenNameIdentifier :
10736:                 if(this.scanner.currentPosition == this.scanner.startPosition){
10737:                 this.scanner.currentPosition++; // on fake completion identifier
10738:                 }
10739:                 default:						
10740:                 this.nextIgnoredToken = -1;
10741:                 break;
10742:                 case TokenNameEOF :
10743:                 break checkpointMove;
10744:                 }
10745:                 } catch(InvalidInputException e){
10746:                 pos = this.scanner.currentPosition;
10747:                 }
10748:                 } while (this.nextIgnoredToken < 0);
10749:                 this.scanner.tokenizeWhiteSpace = wasTokenizingWhiteSpace;
10750:                
10751:                 if (this.nextIgnoredToken == TokenNameEOF) { // no more recovery after this point
10752:                 if (this.currentToken == TokenNameEOF) { // already tried one iteration on EOF
10753:                 return false;
10754:                 }
10755:                 }
10756:                 this.lastCheckPoint = this.scanner.currentPosition;
10757:                
10758:                 // reset this.scanner again to previous checkpoint location
10759:                 this.scanner.startPosition = pos;
10760:                 this.scanner.currentPosition = pos;
10761:                 this.scanner.commentPtr = -1;
10762:
10763:                 return true;
10764:                 */
10765:            }
10766:
10767:            protected MessageSend newMessageSend() {
10768:                // '(' ArgumentListopt ')'
10769:                // the arguments are on the expression stack
10770:
10771:                MessageSend m = new MessageSend();
10772:                int length;
10773:                if ((length = this .expressionLengthStack[this .expressionLengthPtr--]) != 0) {
10774:                    this .expressionPtr -= length;
10775:                    System.arraycopy(this .expressionStack,
10776:                            this .expressionPtr + 1,
10777:                            m.arguments = new Expression[length], 0, length);
10778:                }
10779:                return m;
10780:            }
10781:
10782:            protected MessageSend newMessageSendWithTypeArguments() {
10783:                MessageSend m = new MessageSend();
10784:                int length;
10785:                if ((length = this .expressionLengthStack[this .expressionLengthPtr--]) != 0) {
10786:                    this .expressionPtr -= length;
10787:                    System.arraycopy(this .expressionStack,
10788:                            this .expressionPtr + 1,
10789:                            m.arguments = new Expression[length], 0, length);
10790:                }
10791:                return m;
10792:            }
10793:
10794:            protected void optimizedConcatNodeLists() {
10795:                /*back from a recursive loop. Virtualy group the
10796:                astNode into an array using this.astLengthStack*/
10797:
10798:                /*
10799:                 * This is a case where you have two sublists into the this.astStack that you want
10800:                 * to merge in one list. There is no action required on the this.astStack. The only
10801:                 * thing you need to do is merge the two lengths specified on the astStackLength.
10802:                 * The top two length are for example:
10803:                 * ... p   n
10804:                 * and you want to result in a list like:
10805:                 * ... n+p 
10806:                 * This means that the p could be equals to 0 in case there is no astNode pushed
10807:                 * on the this.astStack.
10808:                 * Look at the InterfaceMemberDeclarations for an example.
10809:                 * This case optimizes the fact that p == 1.
10810:                 */
10811:
10812:                this .astLengthStack[--this .astLengthPtr]++;
10813:            }
10814:
10815:            /*main loop of the automat
10816:             When a rule is reduced, the method consumeRule(int) is called with the number
10817:             of the consumed rule. When a terminal is consumed, the method consumeToken(int) is 
10818:             called in order to remember (when needed) the consumed token */
10819:            // (int)asr[asi(act)]
10820:            // name[symbol_index[currentKind]]
10821:            protected void parse() {
10822:                if (DEBUG)
10823:                    System.out.println("-- ENTER INSIDE PARSE METHOD --"); //$NON-NLS-1$
10824:
10825:                if (DEBUG_AUTOMATON) {
10826:                    System.out
10827:                            .println("- Start --------------------------------"); //$NON-NLS-1$
10828:                }
10829:
10830:                boolean isDietParse = this .diet;
10831:                int oldFirstToken = getFirstToken();
10832:                this .hasError = false;
10833:
10834:                this .hasReportedError = false;
10835:                int act = START_STATE;
10836:                this .stateStackTop = -1;
10837:                this .currentToken = getFirstToken();
10838:                ProcessTerminals: for (;;) {
10839:                    int stackLength = this .stack.length;
10840:                    if (++this .stateStackTop >= stackLength) {
10841:                        System.arraycopy(this .stack, 0,
10842:                                this .stack = new int[stackLength
10843:                                        + StackIncrement], 0, stackLength);
10844:                    }
10845:                    this .stack[this .stateStackTop] = act;
10846:
10847:                    act = tAction(act, this .currentToken);
10848:                    if (act == ERROR_ACTION || this .restartRecovery) {
10849:
10850:                        if (DEBUG_AUTOMATON) {
10851:                            if (this .restartRecovery) {
10852:                                System.out.println("Restart      - "); //$NON-NLS-1$
10853:                            } else {
10854:                                System.out.println("Error        - "); //$NON-NLS-1$
10855:                            }
10856:                        }
10857:
10858:                        int errorPos = this .scanner.currentPosition;
10859:                        if (!this .hasReportedError) {
10860:                            this .hasError = true;
10861:                        }
10862:                        if (resumeOnSyntaxError()) {
10863:                            if (act == ERROR_ACTION)
10864:                                this .lastErrorEndPosition = errorPos;
10865:                            act = START_STATE;
10866:                            this .stateStackTop = -1;
10867:                            this .currentToken = getFirstToken();
10868:                            continue ProcessTerminals;
10869:                        }
10870:                        act = ERROR_ACTION;
10871:                        break ProcessTerminals;
10872:                    }
10873:                    if (act <= NUM_RULES) {
10874:                        this .stateStackTop--;
10875:
10876:                        if (DEBUG_AUTOMATON) {
10877:                            System.out.print("Reduce       - "); //$NON-NLS-1$
10878:                        }
10879:
10880:                    } else if (act > ERROR_ACTION) { /* shift-reduce */
10881:                        consumeToken(this .currentToken);
10882:                        if (this .currentElement != null)
10883:                            this .recoveryTokenCheck();
10884:                        try {
10885:                            this .currentToken = this .scanner.getNextToken();
10886:                        } catch (InvalidInputException e) {
10887:                            if (!this .hasReportedError) {
10888:                                this .problemReporter().scannerError(this ,
10889:                                        e.getMessage());
10890:                                this .hasReportedError = true;
10891:                            }
10892:                            this .lastCheckPoint = this .scanner.currentPosition;
10893:                            this .restartRecovery = true;
10894:                        }
10895:                        if (this .statementRecoveryActivated) {
10896:                            this .jumpOverType();
10897:                        }
10898:                        act -= ERROR_ACTION;
10899:
10900:                        if (DEBUG_AUTOMATON) {
10901:                            System.out
10902:                                    .print("Shift/Reduce - (" + name[terminal_index[this .currentToken]] + ") "); //$NON-NLS-1$  //$NON-NLS-2$ 
10903:                        }
10904:
10905:                    } else {
10906:                        if (act < ACCEPT_ACTION) { /* shift */
10907:                            consumeToken(this .currentToken);
10908:                            if (this .currentElement != null)
10909:                                this .recoveryTokenCheck();
10910:                            try {
10911:                                this .currentToken = this .scanner.getNextToken();
10912:                            } catch (InvalidInputException e) {
10913:                                if (!this .hasReportedError) {
10914:                                    this .problemReporter().scannerError(this ,
10915:                                            e.getMessage());
10916:                                    this .hasReportedError = true;
10917:                                }
10918:                                this .lastCheckPoint = this .scanner.currentPosition;
10919:                                this .restartRecovery = true;
10920:                            }
10921:                            if (this .statementRecoveryActivated) {
10922:                                this .jumpOverType();
10923:                            }
10924:                            if (DEBUG_AUTOMATON) {
10925:                                System.out
10926:                                        .println("Shift        - (" + name[terminal_index[this .currentToken]] + ")"); //$NON-NLS-1$  //$NON-NLS-2$
10927:                            }
10928:                            continue ProcessTerminals;
10929:                        }
10930:                        break ProcessTerminals;
10931:                    }
10932:
10933:                    // ProcessNonTerminals : 
10934:                    do { /* reduce */
10935:
10936:                        if (DEBUG_AUTOMATON) {
10937:                            System.out
10938:                                    .println(name[non_terminal_index[lhs[act]]]);
10939:                        }
10940:
10941:                        consumeRule(act);
10942:                        this .stateStackTop -= (rhs[act] - 1);
10943:                        act = ntAction(this .stack[this .stateStackTop], lhs[act]);
10944:
10945:                        if (DEBUG_AUTOMATON && act <= NUM_RULES) {
10946:                            System.out.print("             - "); //$NON-NLS-1$
10947:                        }
10948:
10949:                    } while (act <= NUM_RULES);
10950:
10951:                    if (DEBUG_AUTOMATON) {
10952:                        System.out
10953:                                .println("----------------------------------------"); //$NON-NLS-1$
10954:                    }
10955:                }
10956:
10957:                if (DEBUG_AUTOMATON) {
10958:                    System.out
10959:                            .println("- End ----------------------------------"); //$NON-NLS-1$
10960:                }
10961:
10962:                endParse(act);
10963:                // record all nls tags in the corresponding compilation unit
10964:                final NLSTag[] tags = this .scanner.getNLSTags();
10965:                if (tags != null) {
10966:                    this .compilationUnit.nlsTags = tags;
10967:                }
10968:
10969:                this .scanner.checkNonExternalizedStringLiterals = false;
10970:                if (this .reportSyntaxErrorIsRequired && this .hasError
10971:                        && !this .statementRecoveryActivated) {
10972:                    if (!this .options.performStatementsRecovery) {
10973:                        reportSyntaxErrors(isDietParse, oldFirstToken);
10974:                    } else {
10975:                        RecoveryScannerData data = this .referenceContext
10976:                                .compilationResult().recoveryScannerData;
10977:
10978:                        if (this .recoveryScanner == null) {
10979:                            this .recoveryScanner = new RecoveryScanner(
10980:                                    this .scanner, data);
10981:                        } else {
10982:                            this .recoveryScanner.setData(data);
10983:                        }
10984:
10985:                        this .recoveryScanner.setSource(scanner.source);
10986:                        this .recoveryScanner.lineEnds = this .scanner.lineEnds;
10987:                        this .recoveryScanner.linePtr = this .scanner.linePtr;
10988:
10989:                        reportSyntaxErrors(isDietParse, oldFirstToken);
10990:
10991:                        if (data == null) {
10992:                            this .referenceContext.compilationResult().recoveryScannerData = this .recoveryScanner
10993:                                    .getData();
10994:                        }
10995:
10996:                        if (this .methodRecoveryActivated
10997:                                && this .options.performStatementsRecovery) {
10998:                            this .methodRecoveryActivated = false;
10999:                            this .recoverStatements();
11000:                            this .methodRecoveryActivated = true;
11001:
11002:                            this .lastAct = ERROR_ACTION;
11003:                        }
11004:                    }
11005:                }
11006:
11007:                if (DEBUG)
11008:                    System.out.println("-- EXIT FROM PARSE METHOD --"); //$NON-NLS-1$
11009:            }
11010:
11011:            public void parse(ConstructorDeclaration cd,
11012:                    CompilationUnitDeclaration unit) {
11013:                parse(cd, unit, false);
11014:            }
11015:
11016:            public void parse(ConstructorDeclaration cd,
11017:                    CompilationUnitDeclaration unit, boolean recordLineSeparator) {
11018:                //only parse the method body of cd
11019:                //fill out its statements
11020:
11021:                //convert bugs into parse error
11022:
11023:                boolean oldMethodRecoveryActivated = this .methodRecoveryActivated;
11024:                if (this .options.performMethodsFullRecovery) {
11025:                    this .methodRecoveryActivated = true;
11026:                }
11027:
11028:                initialize();
11029:                goForBlockStatementsopt();
11030:                if (recordLineSeparator) {
11031:                    this .scanner.recordLineSeparator = true;
11032:                }
11033:                this .nestedMethod[this .nestedType]++;
11034:                pushOnRealBlockStack(0);
11035:
11036:                this .referenceContext = cd;
11037:                this .compilationUnit = unit;
11038:
11039:                this .scanner.resetTo(cd.bodyStart, cd.bodyEnd);
11040:                try {
11041:                    parse();
11042:                } catch (AbortCompilation ex) {
11043:                    this .lastAct = ERROR_ACTION;
11044:                } finally {
11045:                    this .nestedMethod[this .nestedType]--;
11046:                    if (this .options.performStatementsRecovery) {
11047:                        this .methodRecoveryActivated = oldMethodRecoveryActivated;
11048:                    }
11049:                }
11050:
11051:                checkNonNLSAfterBodyEnd(cd.declarationSourceEnd);
11052:
11053:                if (this .lastAct == ERROR_ACTION) {
11054:                    initialize();
11055:                    return;
11056:                }
11057:
11058:                //statements
11059:                cd.explicitDeclarations = this .realBlockStack[this .realBlockPtr--];
11060:                int length;
11061:                if (astLengthPtr > -1
11062:                        && (length = this .astLengthStack[this .astLengthPtr--]) != 0) {
11063:                    this .astPtr -= length;
11064:                    if (this .astStack[this .astPtr + 1] instanceof  ExplicitConstructorCall)
11065:                    //avoid a isSomeThing that would only be used here BUT what is faster between two alternatives ?
11066:                    {
11067:                        System.arraycopy(this .astStack, this .astPtr + 2,
11068:                                cd.statements = new Statement[length - 1], 0,
11069:                                length - 1);
11070:                        cd.constructorCall = (ExplicitConstructorCall) this .astStack[this .astPtr + 1];
11071:                    } else { //need to add explicitly the super();
11072:                        System.arraycopy(this .astStack, this .astPtr + 1,
11073:                                cd.statements = new Statement[length], 0,
11074:                                length);
11075:                        cd.constructorCall = SuperReference
11076:                                .implicitSuperConstructorCall();
11077:                    }
11078:                } else {
11079:                    cd.constructorCall = SuperReference
11080:                            .implicitSuperConstructorCall();
11081:                    if (!containsComment(cd.bodyStart, cd.bodyEnd)) {
11082:                        cd.bits |= ASTNode.UndocumentedEmptyBlock;
11083:                    }
11084:                }
11085:
11086:                if (cd.constructorCall.sourceEnd == 0) {
11087:                    cd.constructorCall.sourceEnd = cd.sourceEnd;
11088:                    cd.constructorCall.sourceStart = cd.sourceStart;
11089:                }
11090:            }
11091:
11092:            // A P I
11093:
11094:            public void parse(FieldDeclaration field, TypeDeclaration type,
11095:                    CompilationUnitDeclaration unit, char[] initializationSource) {
11096:                //only parse the initializationSource of the given field
11097:
11098:                //convert bugs into parse error
11099:
11100:                initialize();
11101:                goForExpression();
11102:                this .nestedMethod[this .nestedType]++;
11103:
11104:                this .referenceContext = type;
11105:                this .compilationUnit = unit;
11106:
11107:                this .scanner.setSource(initializationSource);
11108:                this .scanner.resetTo(0, initializationSource.length - 1);
11109:                try {
11110:                    parse();
11111:                } catch (AbortCompilation ex) {
11112:                    this .lastAct = ERROR_ACTION;
11113:                } finally {
11114:                    this .nestedMethod[this .nestedType]--;
11115:                }
11116:
11117:                if (this .lastAct == ERROR_ACTION) {
11118:                    return;
11119:                }
11120:
11121:                field.initialization = this .expressionStack[this .expressionPtr];
11122:
11123:                // mark field with local type if one was found during parsing
11124:                if ((type.bits & ASTNode.HasLocalType) != 0) {
11125:                    field.bits |= ASTNode.HasLocalType;
11126:                }
11127:            }
11128:
11129:            // A P I
11130:
11131:            public CompilationUnitDeclaration parse(
11132:                    ICompilationUnit sourceUnit,
11133:                    CompilationResult compilationResult) {
11134:                // parses a compilation unit and manages error handling (even bugs....)
11135:
11136:                return parse(sourceUnit, compilationResult, -1, -1/*parse without reseting the scanner*/);
11137:            }
11138:
11139:            // A P I
11140:
11141:            public CompilationUnitDeclaration parse(
11142:                    ICompilationUnit sourceUnit,
11143:                    CompilationResult compilationResult, int start, int end) {
11144:                // parses a compilation unit and manages error handling (even bugs....)
11145:
11146:                CompilationUnitDeclaration unit;
11147:                try {
11148:                    /* automaton initialization */
11149:                    initialize(true);
11150:                    goForCompilationUnit();
11151:
11152:                    /* unit creation */
11153:                    this .referenceContext = this .compilationUnit = new CompilationUnitDeclaration(
11154:                            this .problemReporter, compilationResult, 0);
11155:
11156:                    /* scanners initialization */
11157:                    char[] contents;
11158:                    try {
11159:                        contents = sourceUnit.getContents();
11160:                    } catch (AbortCompilationUnit abortException) {
11161:                        this .problemReporter().cannotReadSource(
11162:                                this .compilationUnit, abortException,
11163:                                this .options.verbose);
11164:                        contents = CharOperation.NO_CHAR; // pretend empty from thereon
11165:                    }
11166:                    this .scanner.setSource(contents);
11167:                    this .compilationUnit.sourceEnd = this .scanner.source.length - 1;
11168:                    if (end != -1)
11169:                        this .scanner.resetTo(start, end);
11170:                    if (this .javadocParser != null
11171:                            && this .javadocParser.checkDocComment) {
11172:                        this .javadocParser.scanner.setSource(contents);
11173:                        if (end != -1) {
11174:                            this .javadocParser.scanner.resetTo(start, end);
11175:                        }
11176:                    }
11177:                    /* run automaton */
11178:                    parse();
11179:                } finally {
11180:                    unit = this .compilationUnit;
11181:                    this .compilationUnit = null; // reset parser
11182:                    // tag unit has having read bodies
11183:                    if (!this .diet)
11184:                        unit.bits |= ASTNode.HasAllMethodBodies;
11185:                }
11186:                return unit;
11187:            }
11188:
11189:            // A P I
11190:
11191:            public void parse(Initializer initializer, TypeDeclaration type,
11192:                    CompilationUnitDeclaration unit) {
11193:                //only parse the method body of md
11194:                //fill out method statements
11195:
11196:                //convert bugs into parse error
11197:
11198:                boolean oldMethodRecoveryActivated = this .methodRecoveryActivated;
11199:                if (this .options.performMethodsFullRecovery) {
11200:                    this .methodRecoveryActivated = true;
11201:                }
11202:
11203:                initialize();
11204:                goForBlockStatementsopt();
11205:                this .nestedMethod[this .nestedType]++;
11206:                pushOnRealBlockStack(0);
11207:
11208:                this .referenceContext = type;
11209:                this .compilationUnit = unit;
11210:
11211:                this .scanner
11212:                        .resetTo(initializer.bodyStart, initializer.bodyEnd); // just on the beginning {
11213:                try {
11214:                    parse();
11215:                } catch (AbortCompilation ex) {
11216:                    this .lastAct = ERROR_ACTION;
11217:                } finally {
11218:                    this .nestedMethod[this .nestedType]--;
11219:                    if (this .options.performStatementsRecovery) {
11220:                        this .methodRecoveryActivated = oldMethodRecoveryActivated;
11221:                    }
11222:                }
11223:
11224:                checkNonNLSAfterBodyEnd(initializer.declarationSourceEnd);
11225:
11226:                if (this .lastAct == ERROR_ACTION) {
11227:                    return;
11228:                }
11229:
11230:                //refill statements
11231:                initializer.block.explicitDeclarations = this .realBlockStack[this .realBlockPtr--];
11232:                int length;
11233:                if (astLengthPtr > -1
11234:                        && (length = this .astLengthStack[this .astLengthPtr--]) > 0) {
11235:                    System
11236:                            .arraycopy(
11237:                                    this .astStack,
11238:                                    (this .astPtr -= length) + 1,
11239:                                    initializer.block.statements = new Statement[length],
11240:                                    0, length);
11241:                } else {
11242:                    // check whether this block at least contains some comment in it
11243:                    if (!containsComment(initializer.block.sourceStart,
11244:                            initializer.block.sourceEnd)) {
11245:                        initializer.block.bits |= ASTNode.UndocumentedEmptyBlock;
11246:                    }
11247:                }
11248:
11249:                // mark initializer with local type if one was found during parsing
11250:                if ((type.bits & ASTNode.HasLocalType) != 0) {
11251:                    initializer.bits |= ASTNode.HasLocalType;
11252:                }
11253:            }
11254:
11255:            // A P I
11256:            public void parse(MethodDeclaration md,
11257:                    CompilationUnitDeclaration unit) {
11258:                //only parse the method body of md
11259:                //fill out method statements
11260:
11261:                //convert bugs into parse error
11262:
11263:                if (md.isAbstract())
11264:                    return;
11265:                if (md.isNative())
11266:                    return;
11267:                if ((md.modifiers & ExtraCompilerModifiers.AccSemicolonBody) != 0)
11268:                    return;
11269:
11270:                boolean oldMethodRecoveryActivated = this .methodRecoveryActivated;
11271:                if (this .options.performMethodsFullRecovery) {
11272:                    this .methodRecoveryActivated = true;
11273:                    this .rParenPos = md.sourceEnd;
11274:                }
11275:                initialize();
11276:                goForBlockStatementsopt();
11277:                this .nestedMethod[this .nestedType]++;
11278:                pushOnRealBlockStack(0);
11279:
11280:                this .referenceContext = md;
11281:                this .compilationUnit = unit;
11282:
11283:                this .scanner.resetTo(md.bodyStart, md.bodyEnd);
11284:                // reset the scanner to parser from { down to }
11285:                try {
11286:                    parse();
11287:                } catch (AbortCompilation ex) {
11288:                    this .lastAct = ERROR_ACTION;
11289:                } finally {
11290:                    this .nestedMethod[this .nestedType]--;
11291:                    if (this .options.performStatementsRecovery) {
11292:                        this .methodRecoveryActivated = oldMethodRecoveryActivated;
11293:                    }
11294:                }
11295:
11296:                checkNonNLSAfterBodyEnd(md.declarationSourceEnd);
11297:
11298:                if (this .lastAct == ERROR_ACTION) {
11299:                    return;
11300:                }
11301:
11302:                //refill statements
11303:                md.explicitDeclarations = this .realBlockStack[this .realBlockPtr--];
11304:                int length;
11305:                if (astLengthPtr > -1
11306:                        && (length = this .astLengthStack[this .astLengthPtr--]) != 0) {
11307:                    System.arraycopy(this .astStack,
11308:                            (this .astPtr -= length) + 1,
11309:                            md.statements = new Statement[length], 0, length);
11310:                } else {
11311:                    if (!containsComment(md.bodyStart, md.bodyEnd)) {
11312:                        md.bits |= ASTNode.UndocumentedEmptyBlock;
11313:                    }
11314:                }
11315:            }
11316:
11317:            public ASTNode[] parseClassBodyDeclarations(char[] source,
11318:                    int offset, int length, CompilationUnitDeclaration unit) {
11319:                /* automaton initialization */
11320:                initialize();
11321:                goForClassBodyDeclarations();
11322:                /* scanner initialization */
11323:                this .scanner.setSource(source);
11324:                this .scanner.resetTo(offset, offset + length - 1);
11325:                if (this .javadocParser != null
11326:                        && this .javadocParser.checkDocComment) {
11327:                    this .javadocParser.scanner.setSource(source);
11328:                    this .javadocParser.scanner.resetTo(offset, offset + length
11329:                            - 1);
11330:                }
11331:
11332:                /* type declaration should be parsed as member type declaration */
11333:                this .nestedType = 1;
11334:
11335:                /* unit creation */
11336:                this .referenceContext = unit;
11337:                this .compilationUnit = unit;
11338:
11339:                /* run automaton */
11340:                try {
11341:                    parse();
11342:                } catch (AbortCompilation ex) {
11343:                    this .lastAct = ERROR_ACTION;
11344:                }
11345:
11346:                if (this .lastAct == ERROR_ACTION) {
11347:                    return null;
11348:                }
11349:                int astLength;
11350:                if (astLengthPtr > -1
11351:                        && (astLength = this .astLengthStack[this .astLengthPtr--]) != 0) {
11352:                    ASTNode[] result = new ASTNode[astLength];
11353:                    this .astPtr -= astLength;
11354:                    System.arraycopy(this .astStack, this .astPtr + 1, result, 0,
11355:                            astLength);
11356:                    return result;
11357:                }
11358:                return null;
11359:            }
11360:
11361:            public Expression parseExpression(char[] source, int offset,
11362:                    int length, CompilationUnitDeclaration unit) {
11363:
11364:                initialize();
11365:                goForExpression();
11366:                this .nestedMethod[this .nestedType]++;
11367:
11368:                this .referenceContext = unit;
11369:                this .compilationUnit = unit;
11370:
11371:                this .scanner.setSource(source);
11372:                this .scanner.resetTo(offset, offset + length - 1);
11373:                try {
11374:                    parse();
11375:                } catch (AbortCompilation ex) {
11376:                    this .lastAct = ERROR_ACTION;
11377:                } finally {
11378:                    this .nestedMethod[this .nestedType]--;
11379:                }
11380:
11381:                if (this .lastAct == ERROR_ACTION) {
11382:                    return null;
11383:                }
11384:
11385:                return this .expressionStack[this .expressionPtr];
11386:            }
11387:
11388:            public Expression parseMemberValue(char[] source, int offset,
11389:                    int length, CompilationUnitDeclaration unit) {
11390:
11391:                initialize();
11392:                goForMemberValue();
11393:                this .nestedMethod[this .nestedType]++;
11394:
11395:                this .referenceContext = unit;
11396:                this .compilationUnit = unit;
11397:
11398:                this .scanner.setSource(source);
11399:                this .scanner.resetTo(offset, offset + length - 1);
11400:                try {
11401:                    parse();
11402:                } catch (AbortCompilation ex) {
11403:                    this .lastAct = ERROR_ACTION;
11404:                } finally {
11405:                    this .nestedMethod[this .nestedType]--;
11406:                }
11407:
11408:                if (this .lastAct == ERROR_ACTION) {
11409:                    return null;
11410:                }
11411:
11412:                return this .expressionStack[this .expressionPtr];
11413:            }
11414:
11415:            public void parseStatements(ReferenceContext rc, int start,
11416:                    int end, TypeDeclaration[] types,
11417:                    CompilationUnitDeclaration unit) {
11418:                boolean oldStatementRecoveryEnabled = this .statementRecoveryActivated;
11419:                this .statementRecoveryActivated = true;
11420:
11421:                initialize();
11422:
11423:                goForBlockStatementsopt();
11424:                this .nestedMethod[this .nestedType]++;
11425:                pushOnRealBlockStack(0);
11426:
11427:                pushOnAstLengthStack(0);
11428:
11429:                this .referenceContext = rc;
11430:                this .compilationUnit = unit;
11431:
11432:                this .pendingRecoveredType = null;
11433:
11434:                if (types != null && types.length > 0) {
11435:                    this .recoveredTypes = types;
11436:                    this .recoveredTypePtr = 0;
11437:                    this .nextTypeStart = this .recoveredTypes[0].allocation == null ? this .recoveredTypes[0].declarationSourceStart
11438:                            : this .recoveredTypes[0].allocation.sourceStart;
11439:                } else {
11440:                    this .recoveredTypes = null;
11441:                    this .recoveredTypePtr = -1;
11442:                    this .nextTypeStart = -1;
11443:                }
11444:
11445:                this .scanner.resetTo(start, end);
11446:                // reset the scanner to parser from { down to }
11447:
11448:                this .lastCheckPoint = this .scanner.initialPosition;
11449:
11450:                this .stateStackTop = -1;
11451:
11452:                try {
11453:                    parse();
11454:                } catch (AbortCompilation ex) {
11455:                    this .lastAct = ERROR_ACTION;
11456:                } finally {
11457:                    this .nestedMethod[this .nestedType]--;
11458:                    this .recoveredTypes = null;
11459:                    this .statementRecoveryActivated = oldStatementRecoveryEnabled;
11460:                }
11461:
11462:                checkNonNLSAfterBodyEnd(end);
11463:            }
11464:
11465:            public void persistLineSeparatorPositions() {
11466:                if (this .scanner.recordLineSeparator) {
11467:                    this .compilationUnit.compilationResult.lineSeparatorPositions = this .scanner
11468:                            .getLineEnds();
11469:                }
11470:            }
11471:
11472:            /*
11473:             * Prepares the state of the parser to go for BlockStatements.
11474:             */
11475:            protected void prepareForBlockStatements() {
11476:                this .nestedMethod[this .nestedType = 0] = 1;
11477:                this .variablesCounter[this .nestedType] = 0;
11478:                this .realBlockStack[this .realBlockPtr = 1] = 0;
11479:            }
11480:
11481:            /**
11482:             * Returns this parser's problem reporter initialized with its reference context.
11483:             * Also it is assumed that a problem is going to be reported, so initializes
11484:             * the compilation result's line positions.
11485:             * 
11486:             * @return ProblemReporter
11487:             */
11488:            public ProblemReporter problemReporter() {
11489:                if (this .scanner.recordLineSeparator) {
11490:                    this .compilationUnit.compilationResult.lineSeparatorPositions = this .scanner
11491:                            .getLineEnds();
11492:                }
11493:                this .problemReporter.referenceContext = this .referenceContext;
11494:                return this .problemReporter;
11495:            }
11496:
11497:            protected void pushIdentifier() {
11498:                /*push the consumeToken on the identifier stack.
11499:                Increase the total number of identifier in the stack.
11500:                identifierPtr points on the next top */
11501:
11502:                int stackLength = this .identifierStack.length;
11503:                if (++this .identifierPtr >= stackLength) {
11504:                    System
11505:                            .arraycopy(
11506:                                    this .identifierStack,
11507:                                    0,
11508:                                    this .identifierStack = new char[stackLength + 20][],
11509:                                    0, stackLength);
11510:                    System
11511:                            .arraycopy(
11512:                                    this .identifierPositionStack,
11513:                                    0,
11514:                                    this .identifierPositionStack = new long[stackLength + 20],
11515:                                    0, stackLength);
11516:                }
11517:                this .identifierStack[this .identifierPtr] = this .scanner
11518:                        .getCurrentIdentifierSource();
11519:                this .identifierPositionStack[this .identifierPtr] = (((long) this .scanner.startPosition) << 32)
11520:                        + (this .scanner.currentPosition - 1);
11521:
11522:                stackLength = this .identifierLengthStack.length;
11523:                if (++this .identifierLengthPtr >= stackLength) {
11524:                    System
11525:                            .arraycopy(
11526:                                    this .identifierLengthStack,
11527:                                    0,
11528:                                    this .identifierLengthStack = new int[stackLength + 10],
11529:                                    0, stackLength);
11530:                }
11531:                this .identifierLengthStack[this .identifierLengthPtr] = 1;
11532:            }
11533:
11534:            protected void pushIdentifier(int flag) {
11535:                /*push a special flag on the stack :
11536:                -zero stands for optional Name
11537:                -negative number for direct ref to base types.
11538:                identifierLengthPtr points on the top */
11539:
11540:                int stackLength = this .identifierLengthStack.length;
11541:                if (++this .identifierLengthPtr >= stackLength) {
11542:                    System
11543:                            .arraycopy(
11544:                                    this .identifierLengthStack,
11545:                                    0,
11546:                                    this .identifierLengthStack = new int[stackLength + 10],
11547:                                    0, stackLength);
11548:                }
11549:                this .identifierLengthStack[this .identifierLengthPtr] = flag;
11550:            }
11551:
11552:            protected void pushOnAstLengthStack(int pos) {
11553:
11554:                int stackLength = this .astLengthStack.length;
11555:                if (++this .astLengthPtr >= stackLength) {
11556:                    System.arraycopy(this .astLengthStack, 0,
11557:                            this .astLengthStack = new int[stackLength
11558:                                    + StackIncrement], 0, stackLength);
11559:                }
11560:                this .astLengthStack[this .astLengthPtr] = pos;
11561:            }
11562:
11563:            protected void pushOnAstStack(ASTNode node) {
11564:                /*add a new obj on top of the ast stack
11565:                astPtr points on the top*/
11566:
11567:                int stackLength = this .astStack.length;
11568:                if (++this .astPtr >= stackLength) {
11569:                    System.arraycopy(this .astStack, 0,
11570:                            this .astStack = new ASTNode[stackLength
11571:                                    + AstStackIncrement], 0, stackLength);
11572:                    this .astPtr = stackLength;
11573:                }
11574:                this .astStack[this .astPtr] = node;
11575:
11576:                stackLength = this .astLengthStack.length;
11577:                if (++this .astLengthPtr >= stackLength) {
11578:                    System.arraycopy(this .astLengthStack, 0,
11579:                            this .astLengthStack = new int[stackLength
11580:                                    + AstStackIncrement], 0, stackLength);
11581:                }
11582:                this .astLengthStack[this .astLengthPtr] = 1;
11583:            }
11584:
11585:            protected void pushOnExpressionStack(Expression expr) {
11586:
11587:                int stackLength = this .expressionStack.length;
11588:                if (++this .expressionPtr >= stackLength) {
11589:                    System
11590:                            .arraycopy(
11591:                                    this .expressionStack,
11592:                                    0,
11593:                                    this .expressionStack = new Expression[stackLength
11594:                                            + ExpressionStackIncrement], 0,
11595:                                    stackLength);
11596:                }
11597:                this .expressionStack[this .expressionPtr] = expr;
11598:
11599:                stackLength = this .expressionLengthStack.length;
11600:                if (++this .expressionLengthPtr >= stackLength) {
11601:                    System
11602:                            .arraycopy(
11603:                                    this .expressionLengthStack,
11604:                                    0,
11605:                                    this .expressionLengthStack = new int[stackLength
11606:                                            + ExpressionStackIncrement], 0,
11607:                                    stackLength);
11608:                }
11609:                this .expressionLengthStack[this .expressionLengthPtr] = 1;
11610:            }
11611:
11612:            protected void pushOnExpressionStackLengthStack(int pos) {
11613:
11614:                int stackLength = this .expressionLengthStack.length;
11615:                if (++this .expressionLengthPtr >= stackLength) {
11616:                    System.arraycopy(this .expressionLengthStack, 0,
11617:                            this .expressionLengthStack = new int[stackLength
11618:                                    + StackIncrement], 0, stackLength);
11619:                }
11620:                this .expressionLengthStack[this .expressionLengthPtr] = pos;
11621:            }
11622:
11623:            protected void pushOnGenericsStack(ASTNode node) {
11624:                /*add a new obj on top of the generics stack
11625:                genericsPtr points on the top*/
11626:
11627:                int stackLength = this .genericsStack.length;
11628:                if (++this .genericsPtr >= stackLength) {
11629:                    System.arraycopy(this .genericsStack, 0,
11630:                            this .genericsStack = new ASTNode[stackLength
11631:                                    + GenericsStackIncrement], 0, stackLength);
11632:                }
11633:                this .genericsStack[this .genericsPtr] = node;
11634:
11635:                stackLength = this .genericsLengthStack.length;
11636:                if (++this .genericsLengthPtr >= stackLength) {
11637:                    System.arraycopy(this .genericsLengthStack, 0,
11638:                            this .genericsLengthStack = new int[stackLength
11639:                                    + GenericsStackIncrement], 0, stackLength);
11640:                }
11641:                this .genericsLengthStack[this .genericsLengthPtr] = 1;
11642:            }
11643:
11644:            protected void pushOnGenericsIdentifiersLengthStack(int pos) {
11645:                int stackLength = this .genericsIdentifiersLengthStack.length;
11646:                if (++this .genericsIdentifiersLengthPtr >= stackLength) {
11647:                    System
11648:                            .arraycopy(
11649:                                    this .genericsIdentifiersLengthStack,
11650:                                    0,
11651:                                    this .genericsIdentifiersLengthStack = new int[stackLength
11652:                                            + GenericsStackIncrement], 0,
11653:                                    stackLength);
11654:                }
11655:                this .genericsIdentifiersLengthStack[this .genericsIdentifiersLengthPtr] = pos;
11656:            }
11657:
11658:            protected void pushOnGenericsLengthStack(int pos) {
11659:                int stackLength = this .genericsLengthStack.length;
11660:                if (++this .genericsLengthPtr >= stackLength) {
11661:                    System.arraycopy(this .genericsLengthStack, 0,
11662:                            this .genericsLengthStack = new int[stackLength
11663:                                    + GenericsStackIncrement], 0, stackLength);
11664:                }
11665:                this .genericsLengthStack[this .genericsLengthPtr] = pos;
11666:            }
11667:
11668:            protected void pushOnIntStack(int pos) {
11669:
11670:                int stackLength = this .intStack.length;
11671:                if (++this .intPtr >= stackLength) {
11672:                    System.arraycopy(this .intStack, 0,
11673:                            this .intStack = new int[stackLength
11674:                                    + StackIncrement], 0, stackLength);
11675:                }
11676:                this .intStack[this .intPtr] = pos;
11677:            }
11678:
11679:            protected void pushOnRealBlockStack(int i) {
11680:
11681:                int stackLength = this .realBlockStack.length;
11682:                if (++this .realBlockPtr >= stackLength) {
11683:                    System.arraycopy(this .realBlockStack, 0,
11684:                            this .realBlockStack = new int[stackLength
11685:                                    + StackIncrement], 0, stackLength);
11686:                }
11687:                this .realBlockStack[this .realBlockPtr] = i;
11688:            }
11689:
11690:            protected void recoverStatements() {
11691:                class MethodVisitor extends ASTVisitor {
11692:                    public ASTVisitor typeVisitor;
11693:
11694:                    TypeDeclaration enclosingType; // used only for initializer
11695:
11696:                    TypeDeclaration[] types = new TypeDeclaration[0];
11697:                    int typePtr = -1;
11698:
11699:                    public boolean visit(
11700:                            ConstructorDeclaration constructorDeclaration,
11701:                            ClassScope scope) {
11702:                        typePtr = -1;
11703:                        return true;
11704:                    }
11705:
11706:                    public boolean visit(Initializer initializer,
11707:                            MethodScope scope) {
11708:                        typePtr = -1;
11709:                        if (initializer.block == null)
11710:                            return false;
11711:                        return true;
11712:                    }
11713:
11714:                    public boolean visit(MethodDeclaration methodDeclaration,
11715:                            ClassScope scope) {
11716:                        typePtr = -1;
11717:                        return true;
11718:                    }
11719:
11720:                    public boolean visit(TypeDeclaration typeDeclaration,
11721:                            BlockScope scope) {
11722:                        return this .visit(typeDeclaration);
11723:                    }
11724:
11725:                    public boolean visit(TypeDeclaration typeDeclaration,
11726:                            ClassScope scope) {
11727:                        return this .visit(typeDeclaration);
11728:                    }
11729:
11730:                    private boolean visit(TypeDeclaration typeDeclaration) {
11731:                        if (this .types.length <= ++this .typePtr) {
11732:                            int length = this .typePtr;
11733:                            System
11734:                                    .arraycopy(
11735:                                            this .types,
11736:                                            0,
11737:                                            this .types = new TypeDeclaration[length * 2 + 1],
11738:                                            0, length);
11739:                        }
11740:                        this .types[this .typePtr] = typeDeclaration;
11741:                        return false;
11742:                    }
11743:
11744:                    public void endVisit(
11745:                            ConstructorDeclaration constructorDeclaration,
11746:                            ClassScope scope) {
11747:                        this .endVisitMethod(constructorDeclaration, scope);
11748:                    }
11749:
11750:                    public void endVisit(MethodDeclaration methodDeclaration,
11751:                            ClassScope scope) {
11752:                        this .endVisitMethod(methodDeclaration, scope);
11753:                    }
11754:
11755:                    private void endVisitMethod(
11756:                            AbstractMethodDeclaration methodDeclaration,
11757:                            ClassScope scope) {
11758:                        TypeDeclaration[] foundTypes = null;
11759:                        int length = 0;
11760:                        if (this .typePtr > -1) {
11761:                            length = this .typePtr + 1;
11762:                            foundTypes = new TypeDeclaration[length];
11763:                            System.arraycopy(this .types, 0, foundTypes, 0,
11764:                                    length);
11765:                        }
11766:                        ReferenceContext oldContext = Parser.this .referenceContext;
11767:                        Parser.this .recoveryScanner.resetTo(
11768:                                methodDeclaration.bodyStart,
11769:                                methodDeclaration.bodyEnd);
11770:                        Scanner oldScanner = Parser.this .scanner;
11771:                        Parser.this .scanner = Parser.this .recoveryScanner;
11772:                        Parser.this .parseStatements(methodDeclaration,
11773:                                methodDeclaration.bodyStart,
11774:                                methodDeclaration.bodyEnd, foundTypes,
11775:                                compilationUnit);
11776:                        Parser.this .scanner = oldScanner;
11777:                        Parser.this .referenceContext = oldContext;
11778:
11779:                        for (int i = 0; i < length; i++) {
11780:                            foundTypes[i].traverse(typeVisitor, scope);
11781:                        }
11782:                    }
11783:
11784:                    public void endVisit(Initializer initializer,
11785:                            MethodScope scope) {
11786:                        if (initializer.block == null)
11787:                            return;
11788:                        TypeDeclaration[] foundTypes = null;
11789:                        int length = 0;
11790:                        if (this .typePtr > -1) {
11791:                            length = this .typePtr + 1;
11792:                            foundTypes = new TypeDeclaration[length];
11793:                            System.arraycopy(this .types, 0, foundTypes, 0,
11794:                                    length);
11795:                        }
11796:                        ReferenceContext oldContext = Parser.this .referenceContext;
11797:                        Parser.this .recoveryScanner.resetTo(
11798:                                initializer.bodyStart, initializer.bodyEnd);
11799:                        Scanner oldScanner = Parser.this .scanner;
11800:                        Parser.this .scanner = Parser.this .recoveryScanner;
11801:                        Parser.this .parseStatements(this .enclosingType,
11802:                                initializer.bodyStart, initializer.bodyEnd,
11803:                                foundTypes, compilationUnit);
11804:                        Parser.this .scanner = oldScanner;
11805:                        Parser.this .referenceContext = oldContext;
11806:
11807:                        for (int i = 0; i < length; i++) {
11808:                            foundTypes[i].traverse(typeVisitor, scope);
11809:                        }
11810:                    }
11811:                }
11812:                class TypeVisitor extends ASTVisitor {
11813:                    public MethodVisitor methodVisitor;
11814:
11815:                    TypeDeclaration[] types = new TypeDeclaration[0];
11816:                    int typePtr = -1;
11817:
11818:                    public void endVisit(TypeDeclaration typeDeclaration,
11819:                            BlockScope scope) {
11820:                        endVisitType();
11821:                    }
11822:
11823:                    public void endVisit(TypeDeclaration typeDeclaration,
11824:                            ClassScope scope) {
11825:                        endVisitType();
11826:                    }
11827:
11828:                    private void endVisitType() {
11829:                        this .typePtr--;
11830:                    }
11831:
11832:                    public boolean visit(TypeDeclaration typeDeclaration,
11833:                            BlockScope scope) {
11834:                        return this .visit(typeDeclaration);
11835:                    }
11836:
11837:                    public boolean visit(TypeDeclaration typeDeclaration,
11838:                            ClassScope scope) {
11839:                        return this .visit(typeDeclaration);
11840:                    }
11841:
11842:                    private boolean visit(TypeDeclaration typeDeclaration) {
11843:                        if (this .types.length <= ++this .typePtr) {
11844:                            int length = this .typePtr;
11845:                            System
11846:                                    .arraycopy(
11847:                                            this .types,
11848:                                            0,
11849:                                            this .types = new TypeDeclaration[length * 2 + 1],
11850:                                            0, length);
11851:                        }
11852:                        this .types[this .typePtr] = typeDeclaration;
11853:                        return true;
11854:                    }
11855:
11856:                    public boolean visit(
11857:                            ConstructorDeclaration constructorDeclaration,
11858:                            ClassScope scope) {
11859:                        if (constructorDeclaration.isDefaultConstructor())
11860:                            return false;
11861:
11862:                        constructorDeclaration.traverse(methodVisitor, scope);
11863:                        return false;
11864:                    }
11865:
11866:                    public boolean visit(Initializer initializer,
11867:                            MethodScope scope) {
11868:                        if (initializer.block == null)
11869:                            return false;
11870:                        methodVisitor.enclosingType = this .types[typePtr];
11871:                        initializer.traverse(methodVisitor, scope);
11872:                        return false;
11873:                    }
11874:
11875:                    public boolean visit(MethodDeclaration methodDeclaration,
11876:                            ClassScope scope) {
11877:                        methodDeclaration.traverse(methodVisitor, scope);
11878:                        return false;
11879:                    }
11880:                }
11881:
11882:                MethodVisitor methodVisitor = new MethodVisitor();
11883:                TypeVisitor typeVisitor = new TypeVisitor();
11884:                methodVisitor.typeVisitor = typeVisitor;
11885:                typeVisitor.methodVisitor = methodVisitor;
11886:
11887:                if (this .referenceContext instanceof  AbstractMethodDeclaration) {
11888:                    ((AbstractMethodDeclaration) this .referenceContext)
11889:                            .traverse(methodVisitor, (ClassScope) null);
11890:                } else if (this .referenceContext instanceof  TypeDeclaration) {
11891:                    TypeDeclaration typeContext = (TypeDeclaration) this .referenceContext;
11892:
11893:                    int length = typeContext.fields.length;
11894:                    for (int i = 0; i < length; i++) {
11895:                        final FieldDeclaration fieldDeclaration = typeContext.fields[i];
11896:                        switch (fieldDeclaration.getKind()) {
11897:                        case AbstractVariableDeclaration.INITIALIZER:
11898:                            Initializer initializer = (Initializer) fieldDeclaration;
11899:                            if (initializer.block == null)
11900:                                break;
11901:                            methodVisitor.enclosingType = typeContext;
11902:                            initializer.traverse(methodVisitor,
11903:                                    (MethodScope) null);
11904:                            break;
11905:                        }
11906:                    }
11907:                }
11908:            }
11909:
11910:            public void recoveryExitFromVariable() {
11911:                if (this .currentElement != null
11912:                        && this .currentElement.parent != null) {
11913:                    if (this .currentElement instanceof  RecoveredLocalVariable) {
11914:
11915:                        int end = ((RecoveredLocalVariable) this .currentElement).localDeclaration.sourceEnd;
11916:                        this .currentElement.updateSourceEndIfNecessary(end);
11917:                        this .currentElement = this .currentElement.parent;
11918:                    } else if (this .currentElement instanceof  RecoveredField
11919:                            && !(this .currentElement instanceof  RecoveredInitializer)) {
11920:
11921:                        int end = ((RecoveredField) this .currentElement).fieldDeclaration.sourceEnd;
11922:                        this .currentElement.updateSourceEndIfNecessary(end);
11923:                        this .currentElement = this .currentElement.parent;
11924:                    }
11925:                }
11926:            }
11927:
11928:            /* Token check performed on every token shift once having entered
11929:             * recovery mode.
11930:             */
11931:            public void recoveryTokenCheck() {
11932:                switch (this .currentToken) {
11933:                case TokenNameLBRACE:
11934:                    RecoveredElement newElement = null;
11935:                    if (!this .ignoreNextOpeningBrace) {
11936:                        newElement = this .currentElement.updateOnOpeningBrace(
11937:                                this .scanner.startPosition - 1,
11938:                                this .scanner.currentPosition - 1);
11939:                    }
11940:                    this .lastCheckPoint = this .scanner.currentPosition;
11941:                    if (newElement != null) { // null means nothing happened
11942:                        this .restartRecovery = true; // opening brace detected
11943:                        this .currentElement = newElement;
11944:                    }
11945:                    break;
11946:
11947:                case TokenNameRBRACE:
11948:                    this .rBraceStart = this .scanner.startPosition - 1;
11949:                    this .rBraceEnd = this .scanner.currentPosition - 1;
11950:                    this .endPosition = this 
11951:                            .flushCommentsDefinedPriorTo(this .rBraceEnd);
11952:                    newElement = this .currentElement.updateOnClosingBrace(
11953:                            this .scanner.startPosition, this .rBraceEnd);
11954:                    this .lastCheckPoint = this .scanner.currentPosition;
11955:                    if (newElement != this .currentElement) {
11956:                        this .currentElement = newElement;
11957:                        //				if (newElement instanceof RecoveredField && this.dietInt <= 0) {
11958:                        //					if (((RecoveredField)newElement).fieldDeclaration.type == null) { // enum constant
11959:                        //						this.isInsideEnumConstantPart = true; // restore status
11960:                        //					}
11961:                        //				}
11962:                    }
11963:                    break;
11964:                case TokenNameSEMICOLON:
11965:                    this .endStatementPosition = this .scanner.currentPosition - 1;
11966:                    this .endPosition = this .scanner.startPosition - 1;
11967:                    RecoveredType currentType = this .currentRecoveryType();
11968:                    if (currentType != null) {
11969:                        currentType.insideEnumConstantPart = false;
11970:                    }
11971:                    // fall through
11972:                default: {
11973:                    if (this .rBraceEnd > this .rBraceSuccessorStart
11974:                            && this .scanner.currentPosition != this .scanner.startPosition) {
11975:                        this .rBraceSuccessorStart = this .scanner.startPosition;
11976:                    }
11977:                    break;
11978:                }
11979:                }
11980:                this .ignoreNextOpeningBrace = false;
11981:            }
11982:
11983:            // A P I
11984:            protected void reportSyntaxErrors(boolean isDietParse,
11985:                    int oldFirstToken) {
11986:                if (this .referenceContext instanceof  MethodDeclaration) {
11987:                    MethodDeclaration methodDeclaration = (MethodDeclaration) this .referenceContext;
11988:                    if ((methodDeclaration.bits & ASTNode.ErrorInSignature) != 0) {
11989:                        return;
11990:                    }
11991:                }
11992:                this .compilationUnit.compilationResult.lineSeparatorPositions = this .scanner
11993:                        .getLineEnds();
11994:                this .scanner.recordLineSeparator = false;
11995:
11996:                int start = this .scanner.initialPosition;
11997:                int end = this .scanner.eofPosition == Integer.MAX_VALUE ? this .scanner.eofPosition
11998:                        : this .scanner.eofPosition - 1;
11999:                if (isDietParse) {
12000:                    TypeDeclaration[] types = this .compilationUnit.types;
12001:                    int[][] intervalToSkip = org.eclipse.jdt.internal.compiler.parser.diagnose.RangeUtil
12002:                            .computeDietRange(types);
12003:                    DiagnoseParser diagnoseParser = new DiagnoseParser(this ,
12004:                            oldFirstToken, start, end, intervalToSkip[0],
12005:                            intervalToSkip[1], intervalToSkip[2], this .options);
12006:                    diagnoseParser.diagnoseParse(false);
12007:
12008:                    reportSyntaxErrorsForSkippedMethod(types);
12009:                    this .scanner.resetTo(start, end);
12010:                } else {
12011:                    DiagnoseParser diagnoseParser = new DiagnoseParser(this ,
12012:                            oldFirstToken, start, end, this .options);
12013:                    diagnoseParser
12014:                            .diagnoseParse(this .options.performStatementsRecovery);
12015:                }
12016:            }
12017:
12018:            private void reportSyntaxErrorsForSkippedMethod(
12019:                    TypeDeclaration[] types) {
12020:                if (types != null) {
12021:                    for (int i = 0; i < types.length; i++) {
12022:                        TypeDeclaration[] memberTypes = types[i].memberTypes;
12023:                        if (memberTypes != null) {
12024:                            reportSyntaxErrorsForSkippedMethod(memberTypes);
12025:                        }
12026:
12027:                        AbstractMethodDeclaration[] methods = types[i].methods;
12028:                        if (methods != null) {
12029:                            for (int j = 0; j < methods.length; j++) {
12030:                                AbstractMethodDeclaration method = methods[j];
12031:                                if ((method.bits & ASTNode.ErrorInSignature) != 0) {
12032:                                    if (method.isAnnotationMethod()) {
12033:                                        DiagnoseParser diagnoseParser = new DiagnoseParser(
12034:                                                this , TokenNameQUESTION,
12035:                                                method.declarationSourceStart,
12036:                                                method.declarationSourceEnd,
12037:                                                this .options);
12038:                                        diagnoseParser
12039:                                                .diagnoseParse(this .options.performStatementsRecovery);
12040:                                    } else {
12041:                                        DiagnoseParser diagnoseParser = new DiagnoseParser(
12042:                                                this , TokenNameDIVIDE,
12043:                                                method.declarationSourceStart,
12044:                                                method.declarationSourceEnd,
12045:                                                this .options);
12046:                                        diagnoseParser
12047:                                                .diagnoseParse(this .options.performStatementsRecovery);
12048:                                    }
12049:
12050:                                }
12051:                            }
12052:                        }
12053:
12054:                        FieldDeclaration[] fields = types[i].fields;
12055:                        if (fields != null) {
12056:                            int length = fields.length;
12057:                            for (int j = 0; j < length; j++) {
12058:                                if (fields[j] instanceof  Initializer) {
12059:                                    Initializer initializer = (Initializer) fields[j];
12060:                                    if ((initializer.bits & ASTNode.ErrorInSignature) != 0) {
12061:                                        DiagnoseParser diagnoseParser = new DiagnoseParser(
12062:                                                this ,
12063:                                                TokenNameRIGHT_SHIFT,
12064:                                                initializer.declarationSourceStart,
12065:                                                initializer.declarationSourceEnd,
12066:                                                this .options);
12067:                                        diagnoseParser
12068:                                                .diagnoseParse(this .options.performStatementsRecovery);
12069:                                    }
12070:                                }
12071:                            }
12072:                        }
12073:                    }
12074:                }
12075:            }
12076:
12077:            protected void resetModifiers() {
12078:                this .modifiers = ClassFileConstants.AccDefault;
12079:                this .modifiersSourceStart = -1; // <-- see comment into modifiersFlag(int)
12080:                this .scanner.commentPtr = -1;
12081:            }
12082:
12083:            /*
12084:             * Reset context so as to resume to regular parse loop
12085:             */
12086:            protected void resetStacks() {
12087:
12088:                this .astPtr = -1;
12089:                this .astLengthPtr = -1;
12090:                this .expressionPtr = -1;
12091:                this .expressionLengthPtr = -1;
12092:                this .identifierPtr = -1;
12093:                this .identifierLengthPtr = -1;
12094:                this .intPtr = -1;
12095:                this .nestedMethod[this .nestedType = 0] = 0; // need to reset for further reuse
12096:                this .variablesCounter[this .nestedType] = 0;
12097:                this .dimensions = 0;
12098:                this .realBlockStack[this .realBlockPtr = 0] = 0;
12099:                this .recoveredStaticInitializerStart = 0;
12100:                this .listLength = 0;
12101:                this .listTypeParameterLength = 0;
12102:
12103:                this .genericsIdentifiersLengthPtr = -1;
12104:                this .genericsLengthPtr = -1;
12105:                this .genericsPtr = -1;
12106:            }
12107:
12108:            /*
12109:             * Reset context so as to resume to regular parse loop
12110:             * If unable to reset for resuming, answers false.
12111:             *
12112:             * Move checkpoint location, reset internal stacks and
12113:             * decide which grammar goal is activated.
12114:             */
12115:            protected boolean resumeAfterRecovery() {
12116:                if (!this .methodRecoveryActivated
12117:                        && !this .statementRecoveryActivated) {
12118:
12119:                    // reset internal stacks 
12120:                    this .resetStacks();
12121:                    this .resetModifiers();
12122:
12123:                    /* attempt to move checkpoint location */
12124:                    if (!this .moveRecoveryCheckpoint()) {
12125:                        return false;
12126:                    }
12127:
12128:                    // only look for headers
12129:                    if (this .referenceContext instanceof  CompilationUnitDeclaration) {
12130:                        goForHeaders();
12131:                        this .diet = true; // passed this point, will not consider method bodies
12132:                        return true;
12133:                    }
12134:
12135:                    // does not know how to restart
12136:                    return false;
12137:                } else if (!this .statementRecoveryActivated) {
12138:
12139:                    // reset internal stacks 
12140:                    this .resetStacks();
12141:                    this .resetModifiers();
12142:
12143:                    /* attempt to move checkpoint location */
12144:                    if (!this .moveRecoveryCheckpoint()) {
12145:                        return false;
12146:                    }
12147:
12148:                    // only look for headers
12149:                    goForHeaders();
12150:                    return true;
12151:                } else {
12152:                    return false;
12153:                }
12154:            }
12155:
12156:            protected boolean resumeOnSyntaxError() {
12157:                this .checkExternalizeStrings = false;
12158:                this .scanner.checkNonExternalizedStringLiterals = false;
12159:                /* request recovery initialization */
12160:                if (this .currentElement == null) {
12161:                    // Reset javadoc before restart parsing after recovery
12162:                    this .javadoc = null;
12163:
12164:                    // do not investigate deeper in statement recovery
12165:                    if (this .statementRecoveryActivated)
12166:                        return false;
12167:
12168:                    // build some recovered elements
12169:                    this .currentElement = buildInitialRecoveryState();
12170:                }
12171:                /* do not investigate deeper in recovery when no recovered element */
12172:                if (this .currentElement == null)
12173:                    return false;
12174:
12175:                /* manual forced recovery restart - after headers */
12176:                if (this .restartRecovery) {
12177:                    this .restartRecovery = false;
12178:                }
12179:                /* update recovery state with current error state of the parser */
12180:                this .updateRecoveryState();
12181:
12182:                /* attempt to reset state in order to resume to parse loop */
12183:                return this .resumeAfterRecovery();
12184:            }
12185:
12186:            public void setMethodsFullRecovery(boolean enabled) {
12187:                this .options.performMethodsFullRecovery = enabled;
12188:            }
12189:
12190:            public void setStatementsRecovery(boolean enabled) {
12191:                if (enabled)
12192:                    this .options.performMethodsFullRecovery = true;
12193:                this .options.performStatementsRecovery = enabled;
12194:            }
12195:
12196:            public String toString() {
12197:
12198:                String s = "lastCheckpoint : int = " + String.valueOf(this .lastCheckPoint) + "\n"; //$NON-NLS-1$ //$NON-NLS-2$
12199:                s = s
12200:                        + "identifierStack : char[" + (this .identifierPtr + 1) + "][] = {"; //$NON-NLS-1$ //$NON-NLS-2$
12201:                for (int i = 0; i <= this .identifierPtr; i++) {
12202:                    s = s
12203:                            + "\"" + String.valueOf(this .identifierStack[i]) + "\","; //$NON-NLS-1$ //$NON-NLS-2$
12204:                }
12205:                s = s + "}\n"; //$NON-NLS-1$
12206:
12207:                s = s
12208:                        + "identifierLengthStack : int[" + (this .identifierLengthPtr + 1) + "] = {"; //$NON-NLS-1$ //$NON-NLS-2$
12209:                for (int i = 0; i <= this .identifierLengthPtr; i++) {
12210:                    s = s + this .identifierLengthStack[i] + ","; //$NON-NLS-1$
12211:                }
12212:                s = s + "}\n"; //$NON-NLS-1$
12213:
12214:                s = s
12215:                        + "astLengthStack : int[" + (this .astLengthPtr + 1) + "] = {"; //$NON-NLS-1$ //$NON-NLS-2$
12216:                for (int i = 0; i <= this .astLengthPtr; i++) {
12217:                    s = s + this .astLengthStack[i] + ","; //$NON-NLS-1$
12218:                }
12219:                s = s + "}\n"; //$NON-NLS-1$
12220:                s = s + "astPtr : int = " + String.valueOf(this .astPtr) + "\n"; //$NON-NLS-1$ //$NON-NLS-2$
12221:
12222:                s = s + "intStack : int[" + (this .intPtr + 1) + "] = {"; //$NON-NLS-1$ //$NON-NLS-2$
12223:                for (int i = 0; i <= this .intPtr; i++) {
12224:                    s = s + this .intStack[i] + ","; //$NON-NLS-1$
12225:                }
12226:                s = s + "}\n"; //$NON-NLS-1$
12227:
12228:                s = s
12229:                        + "expressionLengthStack : int[" + (this .expressionLengthPtr + 1) + "] = {"; //$NON-NLS-1$ //$NON-NLS-2$
12230:                for (int i = 0; i <= this .expressionLengthPtr; i++) {
12231:                    s = s + this .expressionLengthStack[i] + ","; //$NON-NLS-1$
12232:                }
12233:                s = s + "}\n"; //$NON-NLS-1$
12234:
12235:                s = s
12236:                        + "expressionPtr : int = " + String.valueOf(this .expressionPtr) + "\n"; //$NON-NLS-1$ //$NON-NLS-2$
12237:
12238:                s = s
12239:                        + "genericsIdentifiersLengthStack : int[" + (this .genericsIdentifiersLengthPtr + 1) + "] = {"; //$NON-NLS-1$ //$NON-NLS-2$
12240:                for (int i = 0; i <= this .genericsIdentifiersLengthPtr; i++) {
12241:                    s = s + this .genericsIdentifiersLengthStack[i] + ","; //$NON-NLS-1$
12242:                }
12243:                s = s + "}\n"; //$NON-NLS-1$
12244:
12245:                s = s
12246:                        + "genericsLengthStack : int[" + (this .genericsLengthPtr + 1) + "] = {"; //$NON-NLS-1$ //$NON-NLS-2$
12247:                for (int i = 0; i <= this .genericsLengthPtr; i++) {
12248:                    s = s + this .genericsLengthStack[i] + ","; //$NON-NLS-1$
12249:                }
12250:                s = s + "}\n"; //$NON-NLS-1$
12251:
12252:                s = s
12253:                        + "genericsPtr : int = " + String.valueOf(this .genericsPtr) + "\n"; //$NON-NLS-1$ //$NON-NLS-2$
12254:
12255:                s = s
12256:                        + "\n\n\n----------------Scanner--------------\n" + this .scanner.toString(); //$NON-NLS-1$
12257:                return s;
12258:
12259:            }
12260:
12261:            /*
12262:             * Update recovery state based on current parser/scanner state
12263:             */
12264:            protected void updateRecoveryState() {
12265:
12266:                /* expose parser state to recovery state */
12267:                this .currentElement.updateFromParserState();
12268:
12269:                /* check and update recovered state based on current token,
12270:                	this action is also performed when shifting token after recovery
12271:                	got activated once. 
12272:                 */
12273:                this .recoveryTokenCheck();
12274:            }
12275:
12276:            protected void updateSourceDeclarationParts(
12277:                    int variableDeclaratorsCounter) {
12278:                //fields is a definition of fields that are grouped together like in
12279:                //public int[] a, b[], c
12280:                //which results into 3 fields.
12281:
12282:                FieldDeclaration field;
12283:                int endTypeDeclarationPosition = -1
12284:                        + this .astStack[this .astPtr
12285:                                - variableDeclaratorsCounter + 1].sourceStart;
12286:                for (int i = 0; i < variableDeclaratorsCounter - 1; i++) {
12287:                    //last one is special(see below)
12288:                    field = (FieldDeclaration) this .astStack[this .astPtr - i
12289:                            - 1];
12290:                    field.endPart1Position = endTypeDeclarationPosition;
12291:                    field.endPart2Position = -1
12292:                            + this .astStack[this .astPtr - i].sourceStart;
12293:                }
12294:                //last one
12295:                (field = (FieldDeclaration) this .astStack[this .astPtr]).endPart1Position = endTypeDeclarationPosition;
12296:                field.endPart2Position = field.declarationSourceEnd;
12297:
12298:            }
12299:
12300:            protected void updateSourcePosition(Expression exp) {
12301:                //update the source Position of the expression
12302:
12303:                //this.intStack : int int
12304:                //-->
12305:                //this.intStack : 
12306:
12307:                exp.sourceEnd = this.intStack[this.intPtr--];
12308:                exp.sourceStart = this.intStack[this.intPtr--];
12309:            }
12310:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.