Top Description Methods
com.sun.tools.javac.parser

public Interface Lexer

Known Direct Implementers
com.sun.tools.javac.parser.Scanner, com.sun.tools.javac.parser.VirtualParser.VirtualScanner
Imports
java.util.Queue, com.sun.tools.javac.parser.Tokens.*, com.sun.tools.javac.util.Position.LineMap

The lexical analyzer maps an input stream consisting of ASCII characters and Unicode escapes into a token sequence.

This is NOT part of any supported API. If you write code that depends on this, you do so at your own risk. This code and its internal interfaces are subject to change or deletion without notice.

Method Summary

Modifier and TypeMethod and Description
public int
errPos()

Return the position where a lexical error occurred;

public void
errPos(int pos)

Set the position where a lexical error occurred;

public Queue<Tokens.Comment>
getDocComments()

Returns a queue for the documentation comments encountered in a compilation unit.

public Position.LineMap

Returns:

a LineMap
getLineMap
()

Build a map for translating between line numbers and positions in the input.

public void
nextToken()

Consume the next token.

public Tokens.Token
prevToken()

Return the last character position of the previous token.

public void
setPrevToken(Tokens.Token prevToken)

Sets the previous token.

public Tokens.Token
split()

Splits the current token in two and return the first (split) token.

public Tokens.Token
token()

Return current token.

public Tokens.Token
token(int lookahead)

Return token with given lookahead.

Method Detail

errPosback to summary
public int errPos()

Return the position where a lexical error occurred;

errPosback to summary
public void errPos(int pos)

Set the position where a lexical error occurred;

getDocCommentsback to summary
public Queue<Tokens.Comment> getDocComments()

Returns a queue for the documentation comments encountered in a compilation unit. Comments may be added to this queue by the implementation; clients may remove them from the queue as they are analyzed.

Note

all comments may also be associated with the following token.

getLineMapback to summary
public Position.LineMap getLineMap()

Build a map for translating between line numbers and positions in the input.

Returns:Position.LineMap

a LineMap

nextTokenback to summary
public void nextToken()

Consume the next token.

prevTokenback to summary
public Tokens.Token prevToken()

Return the last character position of the previous token.

setPrevTokenback to summary
public void setPrevToken(Tokens.Token prevToken)

Sets the previous token.

splitback to summary
public Tokens.Token split()

Splits the current token in two and return the first (split) token. For instance '<<<' is split into two tokens '<' and '<<' respectively, and the latter is returned.

tokenback to summary
public Tokens.Token token()

Return current token.

tokenback to summary
public Tokens.Token token(int lookahead)

Return token with given lookahead.