org.eclipse.jdt.internal.compiler.parser.Parser类的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(208)

本文整理了Java中org.eclipse.jdt.internal.compiler.parser.Parser类的一些代码示例,展示了Parser类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Parser类的具体详情如下:
包路径:org.eclipse.jdt.internal.compiler.parser.Parser
类名称:Parser

Parser介绍

暂无

代码示例

代码示例来源:origin: com.google.code.maven-play-plugin.org.eclipse.jdt/org.eclipse.jdt.core

  1. private Expression parseMemberValue(char[] memberValue) {
  2. // memberValue must not be null
  3. if (this.parser == null) {
  4. this.parser = new Parser(this.problemReporter, true);
  5. }
  6. return this.parser.parseMemberValue(memberValue, 0, memberValue.length, this.unit);
  7. }
  8. }

代码示例来源:origin: org.eclipse.jdt.core.compiler/ecj

  1. public void parseStatements(
  2. Parser parser,
  3. TypeDeclaration typeDeclaration,
  4. CompilationUnitDeclaration unit) {
  5. //fill up the method body with statement
  6. parser.parse(this, typeDeclaration, unit);
  7. }

代码示例来源:origin: INRIA/spoon

  1. unit = unitsToProcess[i];
  2. this.reportProgress(Messages.bind(Messages.compilation_processing, new String(unit.getFileName())));
  3. this.parser.getMethodBodies(unit);

代码示例来源:origin: org.eclipse.jdt.core.compiler/ecj

  1. markEnclosingMemberWithLocalType();
  2. blockReal();
  3. pushOnAstStack(typeDecl);

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.core

  1. static class IntArrayList {
  2. public int[] list = new int[5];
  3. public int length = 0;
  4. public void add(int i) {
  5. if (this.list.length == this.length) {
  6. System.arraycopy(this.list, 0, this.list = new int[this.length*2], 0, this.length);
  7. }
  8. this.list[this.length++] = i;
  9. }
  10. }

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core

  1. markEnclosingMemberWithLocalType();
  2. blockReal();
  3. pushOnAstStack(annotationTypeDeclaration);
  4. if(!this.statementRecoveryActivated &&
  5. this.options.sourceLevel < ClassFileConstants.JDK1_5 &&
  6. this.lastErrorEndPositionBeforeRecovery < this.scanner.currentPosition) {
  7. problemReporter().invalidUsageOfAnnotationDeclarations(annotationTypeDeclaration);

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core

  1. private CompilationUnitDeclaration convert(IModule module, CompilationResult compilationResult) throws JavaModelException {
  2. this.unit = new CompilationUnitDeclaration(this.problemReporter, compilationResult, 0);
  3. // not filled at this point
  4. ModuleDescriptionInfo moduleInfo = (ModuleDescriptionInfo) module;
  5. org.eclipse.jdt.core.ICompilationUnit cuHandle = moduleInfo.getHandle().getCompilationUnit();
  6. this.cu = (ICompilationUnit) cuHandle;
  7. // always parse, because (a) dietParse is always sufficient, (b) we don't yet have the necessary conversion methods for module directives
  8. return new Parser(this.problemReporter, true).dietParse(this.cu, compilationResult);
  9. }

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core

  1. blockReal();
  2. pushOnAstStack(enumDeclaration);
  3. this.lastErrorEndPositionBeforeRecovery < this.scanner.currentPosition) {
  4. problemReporter().invalidUsageOfEnumDeclarations(enumDeclaration);

代码示例来源:origin: org.projectlombok/lombok.ast

  1. private static Parser makeDummyParser(ProblemReporter reporter, String mainTypeName) {
  2. Parser parser = new Parser(reporter, false);
  3. CompilationResult cr = new CompilationResult((mainTypeName + ".java").toCharArray(), 0, 1, 0);
  4. parser.compilationUnit = new CompilationUnitDeclaration(reporter, cr, 0);
  5. return parser;
  6. }

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.core

  1. private ReferenceExpression copy() {
  2. final Parser parser = new Parser(this.enclosingScope.problemReporter(), false);
  3. final ICompilationUnit compilationUnit = this.compilationResult.getCompilationUnit();
  4. final char[] source = compilationUnit != null ? compilationUnit.getContents() : this.text;
  5. ReferenceExpression copy = (ReferenceExpression) parser.parseExpression(source, compilationUnit != null ? this.sourceStart : 0, this.sourceEnd - this.sourceStart + 1,
  6. this.enclosingScope.referenceCompilationUnit(), false /* record line separators */);
  7. copy.original = this;
  8. copy.sourceStart = this.sourceStart;
  9. copy.sourceEnd = this.sourceEnd;
  10. return copy;
  11. }

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.core

  1. protected CompilationUnitDeclaration buildBindings(ICompilationUnit compilationUnit, boolean isTopLevelOrMember) throws JavaModelException {
  2. // source unit
  3. org.eclipse.jdt.internal.compiler.env.ICompilationUnit sourceUnit = (org.eclipse.jdt.internal.compiler.env.ICompilationUnit) compilationUnit;
  4. CompilationResult compilationResult = new CompilationResult(sourceUnit, 1, 1, 0);
  5. CompilationUnitDeclaration unit =
  6. isTopLevelOrMember ?
  7. this.locator.basicParser().dietParse(sourceUnit, compilationResult) :
  8. this.locator.basicParser().parse(sourceUnit, compilationResult);
  9. if (unit != null) {
  10. this.locator.lookupEnvironment.buildTypeBindings(unit, null /*no access restriction*/);
  11. this.locator.lookupEnvironment.completeTypeBindings(unit, !isTopLevelOrMember);
  12. if (!isTopLevelOrMember) {
  13. if (unit.scope != null)
  14. unit.scope.faultInTypes(); // fault in fields & methods
  15. unit.resolve();
  16. }
  17. }
  18. return unit;
  19. }
  20. public char[][][] collect() throws JavaModelException {

代码示例来源:origin: org.eclipse.jetty.orbit/org.eclipse.jdt.core

  1. protected void consumeAnnotationName() {
  2. if(this.currentElement != null) {
  3. int start = this.intStack[this.intPtr];
  4. int end = (int) (this.identifierPositionStack[this.identifierPtr] & 0x00000000FFFFFFFFL);
  5. annotationRecoveryCheckPoint(start, end);
  6. if (this.annotationRecoveryActivated) {
  7. this.currentElement = this.currentElement.addAnnotationName(this.identifierPtr, this.identifierLengthPtr, start, 0);
  8. }
  9. }
  10. this.recordStringLiterals = false;
  11. }
  12. protected void consumeAnnotationTypeDeclaration() {

代码示例来源:origin: trylimits/Eclipse-Postfix-Code-Completion

  1. LambdaExpression copy() {
  2. final Parser parser = new Parser(this.enclosingScope.problemReporter(), false);
  3. final char[] source = this.compilationResult.getCompilationUnit().getContents();
  4. LambdaExpression copy = (LambdaExpression) parser.parseLambdaExpression(source, this.sourceStart, this.sourceEnd - this.sourceStart + 1,
  5. this.enclosingScope.referenceCompilationUnit(), false /* record line separators */);
  6. if (copy != null) { // ==> syntax errors == null
  7. copy.original = this;
  8. }
  9. return copy;
  10. }

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core

  1. protected void consumeEmptyArrayInitializer() {
  2. // ArrayInitializer ::= '{' ,opt '}'
  3. arrayInitializer(0);
  4. }
  5. protected void consumeEmptyArrayInitializeropt() {

代码示例来源:origin: org.eclipse.scout.sdk.deps/ecj

  1. protected static int original_state(int state) {
  2. return -base_check(state);
  3. }

代码示例来源:origin: org.eclipse.jdt.core.compiler/ecj

  1. private int mergeCandidate(int state, int buffer_position) {
  2. char[] name1 = this.lexStream.name(this.buffer[buffer_position]);
  3. char[] name2 = this.lexStream.name(this.buffer[buffer_position + 1]);
  4. int len = name1.length + name2.length;
  5. char[] str = CharOperation.concat(name1, name2);
  6. for (int k = Parser.asi(state); Parser.asr[k] != 0; k++) {
  7. int l = Parser.terminal_index[Parser.asr[k]];
  8. if (len == Parser.name[l].length()) {
  9. char[] name = Parser.name[l].toCharArray();
  10. if (CharOperation.equals(str, name, false)) {
  11. return Parser.asr[k];
  12. }
  13. }
  14. }
  15. return 0;
  16. }

代码示例来源:origin: org.eclipse.jdt.core.compiler/ecj

  1. buildFile(file, entries);

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core

  1. @Override
  2. public void accept(ICompilationUnit unit, AccessRestriction accessRestriction) {
  3. CompilationResult unitResult = new CompilationResult(unit, 1, 1, this.options.maxProblemsPerUnit);
  4. CompilationUnitDeclaration parsedUnit = this.basicParser.dietParse(unit, unitResult);
  5. this.lookupEnvironment.buildTypeBindings(parsedUnit, accessRestriction);
  6. this.lookupEnvironment.completeTypeBindings(parsedUnit, true);
  7. }

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core

  1. markEnclosingMemberWithLocalType();
  2. blockReal();
  3. pushOnAstStack(typeDecl);

代码示例来源:origin: com.google.code.maven-play-plugin.org.eclipse.jdt/org.eclipse.jdt.core

  1. static class IntArrayList {
  2. public int[] list = new int[5];
  3. public int length = 0;
  4. public void add(int i) {
  5. if (this.list.length == this.length) {
  6. System.arraycopy(this.list, 0, this.list = new int[this.length*2], 0, this.length);
  7. }
  8. this.list[this.length++] = i;
  9. }
  10. }

相关文章

Parser类方法