public GroovyLexer(InputBuffer ib) { this(new LexerSharedInputState(ib)); } public GroovyLexer(LexerSharedInputState state) {
protected Token makeToken(int t) { GroovySourceToken tok = new GroovySourceToken(t); tok.setColumn(inputState.getTokenStartColumn()); tok.setLine(inputState.getTokenStartLine()); tok.setColumnLast(inputState.getColumn()); tok.setLineLast(inputState.getLine()); return tok; }
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) {
@Override public int getTokenStartColumn() { if (line == tokenStartLine) { return super.getTokenStartColumn() + escapingReader.getUnescapedUnicodeColumnCount(); } else { return super.getTokenStartColumn() + prevUnescape; } } }
@Override public int getColumn() { prevUnescape = escapingReader.getUnescapedUnicodeColumnCount(); return super.getColumn() + prevUnescape; }
protected Token makeToken(int t) { GroovySourceToken tok = new GroovySourceToken(t); tok.setColumn(inputState.getTokenStartColumn()); tok.setLine(inputState.getTokenStartLine()); tok.setColumnLast(inputState.getColumn()); tok.setLineLast(inputState.getLine()); return tok; }
public JavaLexer(InputBuffer ib) { this(new LexerSharedInputState(ib)); } public JavaLexer(LexerSharedInputState state) {
public GroovyLexer(InputBuffer ib) { this(new LexerSharedInputState(ib)); } public GroovyLexer(LexerSharedInputState state) {
public JavaLexer(InputBuffer ib) { this(new LexerSharedInputState(ib)); } public JavaLexer(LexerSharedInputState state) {
private void restart(LexerRestartInfo<GroovyTokenId> info) { tokenFactory = info.tokenFactory(); this.lexerInput = info.input(); LexerSharedInputState inputState = null; if (lexerInput != null) { myCharBuffer = new MyCharBuffer(new LexerInputReader(lexerInput)); inputState = new LexerSharedInputState(myCharBuffer); } scanner.setInputState(inputState); if (inputState != null) { scanner.resetText(); } scanner.setState((State) info.state()); }