public static GroovyRecognizer make(Reader in) { return make(new GroovyLexer(in)); } public static GroovyRecognizer make(InputBuffer in) { return make(new GroovyLexer(in)); }
private boolean matchGenericTypeBrackets(boolean z, String problem, String solution) throws SemanticException { if (!z) matchGenericTypeBracketsFailed(problem, solution); return z; }
protected void newlineCheck(boolean check) throws RecognitionException { if (check && suppressNewline > 0) { require(suppressNewline == 0, "end of line reached within a simple string 'x' or \"x\" or /x/", "for multi-line literals, use triple quotes '''x''' or \"\"\"x\"\"\" or /x/ or $/x/$"); suppressNewline = 0; // shut down any flood of errors } newline(); }
private GroovyRecognizer getGroovyParser(String input, SourceBuffer sourceBuffer) { UnicodeEscapingReader unicodeReader = new UnicodeEscapingReader(new StringReader(input), sourceBuffer); GroovyLexer lexer = new GroovyLexer(unicodeReader); unicodeReader.setLexer(lexer); GroovyRecognizer parser = GroovyRecognizer.make(lexer); parser.setSourceBuffer(sourceBuffer); return parser; }
/** This factory is the correct way to wire together a Groovy parser and lexer. */ public static GroovyRecognizer make(GroovyLexer lexer) { GroovyRecognizer parser = new GroovyRecognizer(lexer.plumb()); // TODO: set up a common error-handling control block, to avoid excessive tangle between these guys parser.lexer = lexer; lexer.parser = parser; parser.getASTFactory().setASTNodeClass(GroovySourceAST.class); parser.warningList = new ArrayList(); return parser; } // Create a scanner that reads from the input stream passed to us...
protected GroovyRecognizer(TokenBuffer tokenBuf, int k) { super(tokenBuf,k); tokenNames = _tokenNames; buildTokenTypeASTClassMap(); astFactory = new ASTFactory(getTokenTypeToASTClassMap()); }
public AST create(int type, String txt, AST first, Token last) { return attachLast(create(type, txt, first), last); }
private void require(boolean z, String problem, String solution) throws SemanticException { // TODO: Direct to a common error handler, rather than through the parser. if (!z && parser!=null) parser.requireFailed(problem, solution); if (!z) { int lineNum = inputState.getLine(), colNum = inputState.getColumn(); throw new SemanticException(problem + ";\n solution: " + solution, getFilename(), lineNum, colNum); } } public GroovyLexer(InputStream in) {
private void require(boolean z, String problem, String solution) throws SemanticException { if (!z) requireFailed(problem, solution); }
protected boolean allowRegexpLiteral() { return !isExpressionEndingToken(lastSigTokenType); }
public void traceOut(String rname) throws CharStreamException { if (!GroovyLexer.tracing) return; if (_returnToken != null) rname += tokenStringOf(_returnToken); super.traceOut(rname); } private static java.util.HashMap ttypes;
public static GroovyRecognizer make(InputBuffer in) { return make(new GroovyLexer(in)); } public static GroovyRecognizer make(LexerSharedInputState in) { return make(new GroovyLexer(in)); }
protected GroovyRecognizer(TokenStream lexer, int k) { super(lexer,k); tokenNames = _tokenNames; buildTokenTypeASTClassMap(); astFactory = new ASTFactory(getTokenTypeToASTClassMap()); }
public AST create(int type, String txt, AST first, AST last) { return attachLast(create(type, txt, first), last); }
public static GroovyRecognizer make(InputStream in) { return make(new GroovyLexer(in)); } public static GroovyRecognizer make(Reader in) { return make(new GroovyLexer(in)); }
public GroovyRecognizer(ParserSharedInputState state) { super(state,2); tokenNames = _tokenNames; buildTokenTypeASTClassMap(); astFactory = new ASTFactory(getTokenTypeToASTClassMap()); }
public static GroovyRecognizer make(LexerSharedInputState in) { return make(new GroovyLexer(in)); }