org.eclipse.jdt.internal.compiler.parser.Parser.dietParse()方法的使用及代码示例

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

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

Parser.dietParse介绍

暂无

代码示例

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

@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);
}

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

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);
}

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

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);
}

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

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);
}

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

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);
}

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

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);
}

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

/**
 * Add an additional compilation unit into the loop
 *  ->  build compilation unit declarations, their bindings and record their results.
 */
public void accept(ICompilationUnit sourceUnit, AccessRestriction accessRestriction) {
  // Switch the current policy and compilation result for this unit to the requested one.
  CompilationResult unitResult = new CompilationResult(sourceUnit, 1, 1, this.options.maxProblemsPerUnit);
  try {
    CompilationUnitDeclaration parsedUnit = basicParser().dietParse(sourceUnit, unitResult);
    this.lookupEnvironment.buildTypeBindings(parsedUnit, accessRestriction);
    this.lookupEnvironment.completeTypeBindings(parsedUnit, true);
  } catch (AbortCompilationUnit e) {
    // at this point, currentCompilationUnitResult may not be sourceUnit, but some other
    // one requested further along to resolve sourceUnit.
    if (unitResult.compilationUnit == sourceUnit) { // only report once
      //requestor.acceptResult(unitResult.tagAsAccepted());
    } else {
      throw e; // want to abort enclosing request to compile
    }
  }
  // Display unit error in debug mode
  if (BasicSearchEngine.VERBOSE) {
    if (unitResult.problemCount > 0) {
      System.out.println(unitResult);
    }
  }
}
/**

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

/**
 * Add an additional compilation unit into the loop
 *  ->  build compilation unit declarations, their bindings and record their results.
 */
@Override
public void accept(ICompilationUnit sourceUnit, AccessRestriction accessRestriction) {
  // Switch the current policy and compilation result for this unit to the requested one.
  CompilationResult unitResult = new CompilationResult(sourceUnit, 1, 1, this.options.maxProblemsPerUnit);
  try {
    CompilationUnitDeclaration parsedUnit = basicParser().dietParse(sourceUnit, unitResult);
    this.lookupEnvironment.buildTypeBindings(parsedUnit, accessRestriction);
    this.lookupEnvironment.completeTypeBindings(parsedUnit, true);
  } catch (AbortCompilationUnit e) {
    // at this point, currentCompilationUnitResult may not be sourceUnit, but some other
    // one requested further along to resolve sourceUnit.
    if (unitResult.compilationUnit == sourceUnit) { // only report once
      //requestor.acceptResult(unitResult.tagAsAccepted());
    } else {
      throw e; // want to abort enclosing request to compile
    }
  }
  // Display unit error in debug mode
  if (BasicSearchEngine.VERBOSE) {
    if (unitResult.problemCount > 0) {
      System.out.println(unitResult);
    }
  }
}
/**

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

/**
 * Add an additional compilation unit into the loop
 *  ->  build compilation unit declarations, their bindings and record their results.
 */
public void accept(ICompilationUnit sourceUnit, AccessRestriction accessRestriction) {
  // Switch the current policy and compilation result for this unit to the requested one.
  CompilationResult unitResult = new CompilationResult(sourceUnit, 1, 1, this.options.maxProblemsPerUnit);
  try {
    CompilationUnitDeclaration parsedUnit = basicParser().dietParse(sourceUnit, unitResult);
    this.lookupEnvironment.buildTypeBindings(parsedUnit, accessRestriction);
    this.lookupEnvironment.completeTypeBindings(parsedUnit, true);
  } catch (AbortCompilationUnit e) {
    // at this point, currentCompilationUnitResult may not be sourceUnit, but some other
    // one requested further along to resolve sourceUnit.
    if (unitResult.compilationUnit == sourceUnit) { // only report once
      //requestor.acceptResult(unitResult.tagAsAccepted());
    } else {
      throw e; // want to abort enclosing request to compile
    }
  }
  // Display unit error in debug mode
  if (BasicSearchEngine.VERBOSE) {
    if (unitResult.problemCount > 0) {
      System.out.println(unitResult);
    }
  }
}
/**

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

/**
 * Add an additional compilation unit.
 * @param sourceUnit
 */
@Override
public void accept(ICompilationUnit sourceUnit, AccessRestriction accessRestriction) {
  if (CharOperation.equals(TypeConstants.MODULE_INFO_NAME, sourceUnit.getMainTypeName())) {
    // module is needed for resolving, so parse and build it now:
    CompilationResult unitResult = new CompilationResult(sourceUnit, 1, 1, this.options.maxProblemsPerUnit);
    CompilationUnitDeclaration parsedUnit = basicParser().dietParse(sourceUnit, unitResult);
    this.lookupEnvironment.buildTypeBindings(parsedUnit, accessRestriction);
    this.lookupEnvironment.completeTypeBindings(parsedUnit, true); // work done inside checkAndSetImports() 
  } else {
    //System.out.println("Cannot accept compilation units inside the HierarchyResolver.");
    this.lookupEnvironment.problemReporter.abortDueToInternalError(
      new StringBuffer(Messages.accept_cannot)
        .append(sourceUnit.getFileName())
        .toString());
  }
}
private Parser basicParser() {

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

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;
    }
  }

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

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;
    }
  }

代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.jdt.core

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;
    }
  }

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

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;
    }
  }

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

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 {

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

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 {

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

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 {

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

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 {

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

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 {

代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.jdt.core

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 {

相关文章

Parser类方法