org.codehaus.groovy.syntax.lexer
Class GroovyLexer

java.lang.Object
  extended byorg.codehaus.groovy.syntax.lexer.LexerBase
      extended byorg.codehaus.groovy.syntax.lexer.GroovyLexerBase
          extended byorg.codehaus.groovy.syntax.lexer.GroovyLexer
All Implemented Interfaces:
Lexer

public class GroovyLexer
extends GroovyLexerBase

Identifies and returns tokens from a source text. nextToken() is the primary entry point. This is the primary lexer for the Groovy language. It can delegate operations, but will not accept being delegated to.

Author:
Bob Mcwhirter, James Strachan, John Wilson, Chris Poirier

Field Summary
protected  int column
           
protected  int line
           
 
Fields inherited from class org.codehaus.groovy.syntax.lexer.GroovyLexerBase
gstringLexer, stringLexer
 
Fields inherited from class org.codehaus.groovy.syntax.lexer.LexerBase
delegate, source, startColumn, startLine
 
Constructor Summary
GroovyLexer(CharStream charStream)
          Initializes the Lexer from an opened CharStream.
 
Method Summary
 char consume()
          Eats a character from the input stream.
 CharStream getCharStream()
          Returns the underlying CharStream.
 int getColumn()
          Returns the current column within that line.
 int getLine()
          Returns the current line number.
 char la(int k)
          Returns the next kth character, without consuming any.
 void setSource(Lexer source)
          Refuses to set a source.
 void unsetSource()
          Similarly refuses to clear a source.
 
Methods inherited from class org.codehaus.groovy.syntax.lexer.GroovyLexerBase
nextToken
 
Methods inherited from class org.codehaus.groovy.syntax.lexer.LexerBase
delegate, getDelegate, getSource, getStartColumn, getStartLine, isDelegated, isExternallySourced, la, mark, readEOL, readEOL, reset, symbol, symbol, tokenizeEOL, undelegate, undelegatedNextToken, unexpected, unexpected, unexpected
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

line

protected int line

column

protected int column
Constructor Detail

GroovyLexer

public GroovyLexer(CharStream charStream)
Initializes the Lexer from an opened CharStream.

Method Detail

getCharStream

public CharStream getCharStream()
Returns the underlying CharStream.


setSource

public void setSource(Lexer source)
Refuses to set a source.

Specified by:
setSource in interface Lexer
Overrides:
setSource in class LexerBase

unsetSource

public void unsetSource()
Similarly refuses to clear a source.

Specified by:
unsetSource in interface Lexer
Overrides:
unsetSource in class LexerBase

getLine

public int getLine()
Returns the current line number.

Specified by:
getLine in interface Lexer
Overrides:
getLine in class LexerBase

getColumn

public int getColumn()
Returns the current column within that line.

Specified by:
getColumn in interface Lexer
Overrides:
getColumn in class LexerBase

la

public char la(int k)
        throws LexerException,
               ReadException
Returns the next kth character, without consuming any.

Specified by:
la in interface Lexer
Overrides:
la in class LexerBase
Throws:
LexerException
ReadException

consume

public char consume()
             throws LexerException,
                    ReadException
Eats a character from the input stream. We don't support sources here, as we own the CharStream on which we are working.

Specified by:
consume in interface Lexer
Overrides:
consume in class LexerBase
Throws:
LexerException
ReadException


Copyright © 2003-2004 The Codehaus. All Rights Reserved.