private Expression parseMemberValue(char[] memberValue) { // memberValue must not be null if (this.parser == null) { this.parser = new Parser(this.problemReporter, true); } return this.parser.parseMemberValue(memberValue, 0, memberValue.length, this.unit); } }
public void parseStatements( Parser parser, TypeDeclaration typeDeclaration, CompilationUnitDeclaration unit) { //fill up the method body with statement parser.parse(this, typeDeclaration, unit); }
unit = unitsToProcess[i]; this.reportProgress(Messages.bind(Messages.compilation_processing, new String(unit.getFileName()))); this.parser.getMethodBodies(unit);
markEnclosingMemberWithLocalType(); blockReal(); pushOnAstStack(typeDecl);
static class IntArrayList { public int[] list = new int[5]; public int length = 0; public void add(int i) { if (this.list.length == this.length) { System.arraycopy(this.list, 0, this.list = new int[this.length*2], 0, this.length); } this.list[this.length++] = i; } }
markEnclosingMemberWithLocalType(); blockReal(); pushOnAstStack(annotationTypeDeclaration); if(!this.statementRecoveryActivated && this.options.sourceLevel < ClassFileConstants.JDK1_5 && this.lastErrorEndPositionBeforeRecovery < this.scanner.currentPosition) { problemReporter().invalidUsageOfAnnotationDeclarations(annotationTypeDeclaration);
private CompilationUnitDeclaration convert(IModule module, CompilationResult compilationResult) throws JavaModelException { this.unit = new CompilationUnitDeclaration(this.problemReporter, compilationResult, 0); // not filled at this point ModuleDescriptionInfo moduleInfo = (ModuleDescriptionInfo) module; org.eclipse.jdt.core.ICompilationUnit cuHandle = moduleInfo.getHandle().getCompilationUnit(); this.cu = (ICompilationUnit) cuHandle; // always parse, because (a) dietParse is always sufficient, (b) we don't yet have the necessary conversion methods for module directives return new Parser(this.problemReporter, true).dietParse(this.cu, compilationResult); }
blockReal(); pushOnAstStack(enumDeclaration); this.lastErrorEndPositionBeforeRecovery < this.scanner.currentPosition) { problemReporter().invalidUsageOfEnumDeclarations(enumDeclaration);
private static Parser makeDummyParser(ProblemReporter reporter, String mainTypeName) { Parser parser = new Parser(reporter, false); CompilationResult cr = new CompilationResult((mainTypeName + ".java").toCharArray(), 0, 1, 0); parser.compilationUnit = new CompilationUnitDeclaration(reporter, cr, 0); return parser; }
private ReferenceExpression copy() { final Parser parser = new Parser(this.enclosingScope.problemReporter(), false); final ICompilationUnit compilationUnit = this.compilationResult.getCompilationUnit(); final char[] source = compilationUnit != null ? compilationUnit.getContents() : this.text; ReferenceExpression copy = (ReferenceExpression) parser.parseExpression(source, compilationUnit != null ? this.sourceStart : 0, this.sourceEnd - this.sourceStart + 1, this.enclosingScope.referenceCompilationUnit(), false /* record line separators */); copy.original = this; copy.sourceStart = this.sourceStart; copy.sourceEnd = this.sourceEnd; return copy; }
protected CompilationUnitDeclaration buildBindings(ICompilationUnit compilationUnit, boolean isTopLevelOrMember) throws JavaModelException { // source unit org.eclipse.jdt.internal.compiler.env.ICompilationUnit sourceUnit = (org.eclipse.jdt.internal.compiler.env.ICompilationUnit) compilationUnit; CompilationResult compilationResult = new CompilationResult(sourceUnit, 1, 1, 0); CompilationUnitDeclaration unit = isTopLevelOrMember ? this.locator.basicParser().dietParse(sourceUnit, compilationResult) : this.locator.basicParser().parse(sourceUnit, compilationResult); if (unit != null) { this.locator.lookupEnvironment.buildTypeBindings(unit, null /*no access restriction*/); this.locator.lookupEnvironment.completeTypeBindings(unit, !isTopLevelOrMember); if (!isTopLevelOrMember) { if (unit.scope != null) unit.scope.faultInTypes(); // fault in fields & methods unit.resolve(); } } return unit; } public char[][][] collect() throws JavaModelException {
protected void consumeAnnotationName() { if(this.currentElement != null) { int start = this.intStack[this.intPtr]; int end = (int) (this.identifierPositionStack[this.identifierPtr] & 0x00000000FFFFFFFFL); annotationRecoveryCheckPoint(start, end); if (this.annotationRecoveryActivated) { this.currentElement = this.currentElement.addAnnotationName(this.identifierPtr, this.identifierLengthPtr, start, 0); } } this.recordStringLiterals = false; } protected void consumeAnnotationTypeDeclaration() {
LambdaExpression copy() { final Parser parser = new Parser(this.enclosingScope.problemReporter(), false); final char[] source = this.compilationResult.getCompilationUnit().getContents(); LambdaExpression copy = (LambdaExpression) parser.parseLambdaExpression(source, this.sourceStart, this.sourceEnd - this.sourceStart + 1, this.enclosingScope.referenceCompilationUnit(), false /* record line separators */); if (copy != null) { // ==> syntax errors == null copy.original = this; } return copy; }
protected void consumeEmptyArrayInitializer() { // ArrayInitializer ::= '{' ,opt '}' arrayInitializer(0); } protected void consumeEmptyArrayInitializeropt() {
protected static int original_state(int state) { return -base_check(state); }
private int mergeCandidate(int state, int buffer_position) { char[] name1 = this.lexStream.name(this.buffer[buffer_position]); char[] name2 = this.lexStream.name(this.buffer[buffer_position + 1]); int len = name1.length + name2.length; char[] str = CharOperation.concat(name1, name2); for (int k = Parser.asi(state); Parser.asr[k] != 0; k++) { int l = Parser.terminal_index[Parser.asr[k]]; if (len == Parser.name[l].length()) { char[] name = Parser.name[l].toCharArray(); if (CharOperation.equals(str, name, false)) { return Parser.asr[k]; } } } return 0; }
buildFile(file, entries);
@Override public void accept(ICompilationUnit unit, AccessRestriction accessRestriction) { CompilationResult unitResult = new CompilationResult(unit, 1, 1, this.options.maxProblemsPerUnit); CompilationUnitDeclaration parsedUnit = this.basicParser.dietParse(unit, unitResult); this.lookupEnvironment.buildTypeBindings(parsedUnit, accessRestriction); this.lookupEnvironment.completeTypeBindings(parsedUnit, true); }
markEnclosingMemberWithLocalType(); blockReal(); pushOnAstStack(typeDecl);
static class IntArrayList { public int[] list = new int[5]; public int length = 0; public void add(int i) { if (this.list.length == this.length) { System.arraycopy(this.list, 0, this.list = new int[this.length*2], 0, this.length); } this.list[this.length++] = i; } }