public void call(SourceUnit source) throws CompilationFailedException { source.parse(); } }, Phases.PARSING);
public ModuleNode parse(String text, String description) throws Exception { SourceUnit unit = SourceUnit.create(description, text); unit.parse(); unit.convert(); return unit.getAST(); } }
public ExpressionInfo build() { try { SourceUnit unit = SourceUnit.create("Spec expression", adjustedText); unit.parse(); unit.completePhase(); unit.convert();
public void call(SourceUnit source) throws CompilationFailedException { source.parse(); } }, Phases.PARSING);
public void call(SourceUnit source) throws CompilationFailedException { source.parse(); } }, Phases.PARSING);
public void call(SourceUnit source) throws CompilationFailedException { source.parse(); } }, Phases.PARSING);
public void call(SourceUnit source) throws CompilationFailedException { source.parse(); } }, Phases.PARSING);
/** * <p> Attempts to parse the specified code with the specified tolerance. * Updates the * <code>parser</code> and * <code>error</code> members appropriately. Returns true if the text * parsed, false otherwise. The attempts to identify and suppress errors * resulting from the unfinished source text. </p> <p> <b>Note:</b> taken * from {@link groovy.ui.InteractiveShell}. </p> */ private static boolean parse(final String code, final int tolerance) { assert code != null; boolean parsed = false; // Create the parser and attempt to parse the text as a top-level statement. try { SourceUnit parser = SourceUnit.create("vrl-script", code, tolerance); parser.parse(); parsed = true; } // We report errors other than unexpected EOF to the user. catch (CompilationFailedException e) { // } catch (Exception e) { // } return parsed; }
/** * Attempts to parse the specified code with the specified tolerance. * Updates the <code>parser</code> and <code>error</code> members * appropriately. Returns true if the text parsed, false otherwise. * The attempts to identify and suppress errors resulting from the * unfinished source text. */ private boolean parse(final String code, final int tolerance) { assert code != null; boolean parsed = false; parser = null; error = null; // Create the parser and attempt to parse the text as a top-level statement. try { parser = SourceUnit.create("groovysh-script", code, tolerance); parser.parse(); parsed = true; } // We report errors other than unexpected EOF to the user. catch (CompilationFailedException e) { if (parser.getErrorCollector().getErrorCount() > 1 || !parser.failedWithUnexpectedEOF()) { error = e; } } catch (Exception e) { error = e; } return parsed; }
parser.parse(); parsed = true;
/** * Attempts to parse the specified code with the specified tolerance. * Updates the <code>parser</code> and <code>error</code> members * appropriately. Returns true if the text parsed, false otherwise. * The attempts to identify and suppress errors resulting from the * unfinished source text. */ private boolean parse(final String code, final int tolerance) { assert code != null; boolean parsed = false; parser = null; error = null; // Create the parser and attempt to parse the text as a top-level statement. try { parser = SourceUnit.create("groovysh-script", code, tolerance); parser.parse(); parsed = true; } // We report errors other than unexpected EOF to the user. catch (CompilationFailedException e) { if (parser.getErrorCollector().getErrorCount() > 1 || !parser.failedWithUnexpectedEOF()) { error = e; } } catch (Exception e) { error = e; } return parsed; }
/** * Attempts to parse the specified code with the specified tolerance. * Updates the <code>parser</code> and <code>error</code> members * appropriately. Returns true if the text parsed, false otherwise. * The attempts to identify and suppress errors resulting from the * unfinished source text. */ private boolean parse(final String code, final int tolerance) { assert code != null; boolean parsed = false; parser = null; error = null; // Create the parser and attempt to parse the text as a top-level statement. try { parser = SourceUnit.create("groovysh-script", code, tolerance); parser.parse(); parsed = true; } // We report errors other than unexpected EOF to the user. catch (CompilationFailedException e) { if (parser.getErrorCollector().getErrorCount() > 1 || !parser.failedWithUnexpectedEOF()) { error = e; } } catch (Exception e) { error = e; } return parsed; }
/** * Attempts to parse the specified code with the specified tolerance. * Updates the <code>parser</code> and <code>error</code> members * appropriately. Returns true if the text parsed, false otherwise. * The attempts to identify and suppress errors resulting from the * unfinished source text. */ private boolean parse(final String code, final int tolerance) { assert code != null; boolean parsed = false; parser = null; error = null; // Create the parser and attempt to parse the text as a top-level statement. try { parser = SourceUnit.create("groovysh-script", code, tolerance); parser.parse(); parsed = true; } // We report errors other than unexpected EOF to the user. catch (CompilationFailedException e) { if (parser.getErrorCollector().getErrorCount() > 1 || !parser.failedWithUnexpectedEOF()) { error = e; } } catch (Exception e) { error = e; } return parsed; }