Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1)

E13403-04

oracle.javatools.parser
Interface LexerToken

All Known Implementing Classes:
AbstractLexer.DefaultLexerToken, ArrayedLexer, FastLexer, JavadocLexer, JavaLexer

public interface LexerToken

The LexerToken interface encapsulates a single token retrieved by a call to Lexer.lex(). This simply provides a convenient way for the lexer to return multiple pieces of information (token class, start offset, end offset) from the Lexer to its clients.

It is defined as an interface to allow language-specific Lexer implementations to add additional information pieces to the token object.

The LexerToken is allocated using a call to Lexer.createLexerToken(), and is passed into the Lexer.lex() to be filled in.

See Also:
Lexer

Method Summary
 int getEndOffset()
          Fetches the end offset of the token (offset relative to the original ReadTextBuffer being lexed.
 int getStartOffset()
          Fetches the start offset of the token (offset relative to the original ReadTextBuffer being lexed.
 int getToken()
          Fetches the (language-specific) token represented by this LexerToken.
 

Method Detail

getToken

int getToken()
Fetches the (language-specific) token represented by this LexerToken. You must refer to the language-specific Lexer that was responsible for filling this LexerToken instance to interpret the token.

Returns:
the lexer token

getStartOffset

int getStartOffset()
Fetches the start offset of the token (offset relative to the original ReadTextBuffer being lexed. Note that the start offset is inclusive (compare to end offset which is exclusive), to match the behavior in the String class.

Returns:
the starting offset

getEndOffset

int getEndOffset()
Fetches the end offset of the token (offset relative to the original ReadTextBuffer being lexed. Note that the end offset is exclusive (similar to end offsets in the String class.)

Returns:
the ending offset

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1)

E13403-04

Copyright © 1997, 2010, Oracle. All rights reserved.