List of usage examples for org.eclipse.jdt.internal.compiler.parser Parser parseExpression
public Expression parseExpression(char[] source, int offset, int length, CompilationUnitDeclaration unit, boolean recordLineSeparators)
From source file:org.eclipse.objectteams.otdt.internal.core.compiler.mappings.CallinImplementorDyn.java
License:Open Source License
Expression copyExpression(Expression expression, Scope scope, ICompilationUnit cu) {
if (cu == null)
return expression; // FIXME: do we need a fallback when cu is built from model?
final Parser parser = new Parser(scope.problemReporter(), false);
char[] source = cu.getContents();
return parser.parseExpression(source, expression.sourceStart,
expression.sourceEnd - expression.sourceStart + 1, scope.referenceCompilationUnit(),
false /* record line separators */);
}