Example usage for org.eclipse.jdt.internal.compiler.parser Parser parseExpression

List of usage examples for org.eclipse.jdt.internal.compiler.parser Parser parseExpression

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.parser Parser parseExpression.

Prototype

public Expression parseExpression(char[] source, int offset, int length, CompilationUnitDeclaration unit,
            boolean recordLineSeparators) 

Source Link

Usage

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