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

E13403-05

oracle.javatools.parser.plsql.syntax
Class PlsqlLexer

java.lang.Object
  extended by oracle.javatools.parser.AbstractLexer
      extended by oracle.javatools.parser.plsql.syntax.PlsqlLexer
All Implemented Interfaces:
Lexer, PlsqlTokens, SqlTokens

public class PlsqlLexer
extends AbstractLexer
implements PlsqlTokens

The PlsqlLexer is specifically designed for use with an incremental parser. Note that the token interface and lexing interface is actually different!


Nested Class Summary
protected static class BaseSqlLexer.Context
           
 
Nested classes/interfaces inherited from class oracle.javatools.parser.AbstractLexer
AbstractLexer.DefaultLexerToken
 
Field Summary
protected static int CONTEXT_SIZE
          The number of elements in the int[] context.
protected  int endOffset
          The ending offset of the last token found.
protected  int hash
          If lastToken is TK_IDENTIFIER or is in the keywordTable, then this will be the token's hash value.
protected  int lastToken
          The last token found from lex() operation.
protected  int startOffset
          The starting offset of the last token found.
protected static int TK_NOT_FOUND
          To resolve compiler ambiguity.
 
Fields inherited from class oracle.javatools.parser.AbstractLexer
currentPos, textBuffer
 
Fields inherited from interface oracle.javatools.parser.plsql.PlsqlTokens
KW_A, KW_ADD, KW_AGENT, KW_AGGREGATE, KW_ALL, KW_ALTER, KW_AND, KW_ANY, KW_ARRAY, KW_AS, KW_ASC, KW_AT, KW_ATTRIBUTE, KW_AUTHID, KW_AVG, KW_base, KW_BEGIN, KW_BETWEEN, KW_BFILE_BASE, KW_BINARY, KW_BLOB_BASE, KW_BLOCK, KW_BODY, KW_BOTH, KW_BOUND, KW_BULK, KW_BY, KW_BYTE, KW_C, KW_CALL, KW_CALLING, KW_CASCADE, KW_CASE, KW_CHAR, KW_CHAR_BASE, KW_CHARACTER, KW_CHARSET, KW_CHARSETFORM, KW_CHARSETID, KW_CHECK, KW_CLOB_BASE, KW_CLOSE, KW_CLUSTER, KW_CLUSTERS, KW_COLAUTH, KW_COLLECT, KW_COLUMNS, KW_COMMENT, KW_COMMIT, KW_COMMITTED, KW_COMPILED, KW_COMPRESS, KW_CONNECT, KW_CONSTANT, KW_CONSTRUCTOR, KW_CONTEXT, KW_CONVERT, KW_COUNT, KW_CRASH, KW_CREATE, KW_CURRENT, KW_CURSOR, KW_CUSTOMDATUM, KW_DANGLING, KW_DATA, KW_DATE, KW_DATE_BASE, KW_DAY, KW_DECIMAL, KW_DECLARE, KW_DEFAULT, KW_DEFINE, KW_DELETE, KW_DESC, KW_DETERMINISTIC, KW_DISTINCT, KW_DOUBLE, KW_DROP, KW_DURATION, KW_ELEMENT, KW_ELSE, KW_ELSIF, KW_EMPTY, KW_END, KW_ESCAPE, KW_EXCEPT, KW_EXCEPTION, KW_EXCEPTIONS, KW_EXCLUSIVE, KW_EXECUTE, KW_EXISTS, KW_EXIT, KW_EXTERNAL, KW_FETCH, KW_FINAL, KW_FIXED, KW_FLOAT, KW_FOR, KW_FORALL, KW_FORCE, KW_FORM, KW_FROM, KW_FUNCTION, KW_GENERAL, KW_GOTO, KW_GRANT, KW_GROUP, KW_HASH, KW_HAVING, KW_HEAP, KW_HIDDEN, KW_HOUR, KW_IDENTIFIED, KW_IF, KW_IMMEDIATE, KW_IN, KW_INCLUDING, KW_INDEX, KW_INDEXES, KW_INDICATOR, KW_INDICES, KW_INFINITE, KW_INSERT, KW_INSTANTIABLE, KW_INT, KW_INTERFACE, KW_INTERSECT, KW_INTERVAL, KW_INTO, KW_INVALIDATE, KW_IS, KW_ISOLATION, KW_JAVA, KW_LANGUAGE, KW_LARGE, KW_LEADING, KW_LENGTH, KW_LEVEL, KW_LIBRARY, KW_LIKE, KW_LIMIT, KW_LIMITED, KW_LOCAL, KW_LOCK, KW_LONG, KW_LOOP, KW_MAP, KW_max, KW_MAX, KW_MAXLEN, KW_MEMBER, KW_MERGE, KW_MIN, KW_MINUS, KW_MINUTE, KW_MOD, KW_MODE, KW_MODIFY, KW_MONTH, KW_MULTISET, KW_NAME, KW_NAN, KW_NATIONAL, KW_NATIVE, KW_NCHAR, KW_NEW, KW_NOCOMPRESS, KW_NOCOPY, KW_NOT, KW_NOWAIT, KW_NULL, KW_NUMBER_BASE, KW_OBJECT, KW_OCICOLL, KW_OCIDATE, KW_OCIDATETIME, KW_OCIDURATION, KW_OCIINTERVAL, KW_OCILOBLOCATOR, KW_OCINUMBER, KW_OCIRAW, KW_OCIREF, KW_OCIREFCURSOR, KW_OCIROWID, KW_OCISTRING, KW_OCITYPE, KW_OF, KW_ON, KW_ONLY, KW_OPAQUE, KW_OPEN, KW_OPERATOR, KW_OPTION, KW_OR, KW_ORACLE, KW_ORADATA, KW_ORDER, KW_ORGANIZATION, KW_ORLANY, KW_ORLVARY, KW_OTHERS, KW_OUT, KW_OVERLAPS, KW_OVERRIDING, KW_PACKAGE, KW_PARALLEL_ENABLE, KW_PARAMETER, KW_PARAMETERS, KW_PARTITION, KW_PASCAL, KW_PIPE, KW_PIPELINED, KW_PRAGMA, KW_PRECISION, KW_PRIOR, KW_PRIVATE, KW_PROCEDURE, KW_PUBLIC, KW_RAISE, KW_RANGE, KW_RAW, KW_READ, KW_RECORD, KW_REF, KW_REFERENCE, KW_REM, KW_REMAINDER, KW_RENAME, KW_REPLACE, KW_RESOURCE, KW_RESULT, KW_RETURN, KW_RETURNING, KW_REVERSE, KW_REVOKE, KW_ROLLBACK, KW_ROW, KW_SAMPLE, KW_SAVE, KW_SAVEPOINT, KW_SB1, KW_SB2, KW_SB4, KW_SECOND, KW_SEGMENT, KW_SELECT, KW_SELF, KW_SEPARATE, KW_SEQUENCE, KW_SERIALIZABLE, KW_SET, KW_SHARE, KW_SHORT, KW_SIZE, KW_SIZE_T, KW_SOME, KW_SPARSE, KW_SQL, KW_SQLCODE, KW_SQLDATA, KW_SQLNAME, KW_SQLSTATE, KW_STANDARD, KW_START, KW_STATIC, KW_STDDEV, KW_STORED, KW_STRING, KW_STRUCT, KW_STYLE, KW_SUBMULTISET, KW_SUBPARTITION, KW_SUBSTITUTABLE, KW_SUBTYPE, KW_SUM, KW_SYNONYM, KW_TABAUTH, KW_TABLE, KW_TDO, KW_THE, KW_THEN, KW_TIME, KW_TIMESTAMP, KW_TIMEZONE_ABBR, KW_TIMEZONE_HOUR, KW_TIMEZONE_MINUTE, KW_TIMEZONE_REGION, KW_TO, KW_TRAILING, KW_TRANSAC, KW_TRANSACTIONAL, KW_TRUSTED, KW_TYPE, KW_UB1, KW_UB2, KW_UB4, KW_UNDER, KW_UNION, KW_UNIQUE, KW_UNSIGNED, KW_UNTRUSTED, KW_UPDATE, KW_USE, KW_USING, KW_VALIST, KW_VALUE, KW_VALUES, KW_VARIABLE, KW_VARIANCE, KW_VARRAY, KW_VARYING, KW_VIEW, KW_VIEWS, KW_VOID, KW_WHEN, KW_WHERE, KW_WHILE, KW_WITH, KW_words, KW_WORK, KW_WRAPPED, KW_WRITE, KW_YEAR, KW_ZONE
 
Fields inherited from interface oracle.javatools.parser.plsql.SqlTokens
OP_AMPERSAND, OP_ARROW, OP_ASSIGN, OP_ATSIGN, OP_base, OP_CAT, OP_COLON, OP_COMMA, OP_DBLDOT, OP_DOT, OP_ELLIPSIS, OP_EQUAL, OP_EXP, OP_GREATER, OP_GTEQL, OP_L_LBL, OP_LBRKT, OP_LESS, OP_LPAREN, OP_LTEQ, OP_max, OP_MINUS, OP_NOTEQL1, OP_NOTEQL2, OP_NOTEQL3, OP_NOTEQL4, OP_OR, OP_OUTERJOIN, OP_PERCENT, OP_PLUS, OP_R_LBL, OP_RBRKT, OP_RPAREN, OP_SEMICLN, OP_SHRIEK, OP_SLASH, OP_STAR, OP_words, TK_BIND_VAR, TK_EOS, TK_IDENTIFIER, TK_invalid, TK_INVALID, TK_MULTI_COMMENT, TK_N, TK_QUOTED_IDENTIFIER, TK_SINGLE_COMMENT, TK_STRING
 
Fields inherited from interface oracle.javatools.parser.Lexer
TK_EOF
 
Constructor Summary
PlsqlLexer()
          Constructs a default PlsqlLexer with a starting position of 0.
 
Method Summary
 void backup()
          Unlexes the last found token.
static boolean isDecimalDigit(char digit)
          Utility routine to check whether the given digit is a decimal digit.
 int lex(LexerToken lexedToken)
          Scans the text buffer at the current position and returns the token that was found.
protected  void restore_context(BaseSqlLexer.Context context)
           
protected  void save_context(BaseSqlLexer.Context context)
           
 void setSkipComments(boolean skipComments)
          Sets whether the PlsqlLexer should generate tokens for Java comments.
protected  void skipQuotedStringLiteral()
          Skip an alternatively quoted string literal, syntax introduced in Database 10gR1.
protected  void skipStringLiteral()
          Utility routine which scans through the text buffer to find the end of the string literal.
 
Methods inherited from class oracle.javatools.parser.AbstractLexer
createLexerToken, getTextBuffer, setPosition, setTextBuffer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONTEXT_SIZE

protected static final int CONTEXT_SIZE
The number of elements in the int[] context.

See Also:
Constant Field Values

TK_NOT_FOUND

protected static final int TK_NOT_FOUND
To resolve compiler ambiguity.

See Also:
Constant Field Values

lastToken

protected int lastToken
The last token found from lex() operation.


startOffset

protected int startOffset
The starting offset of the last token found.


endOffset

protected int endOffset
The ending offset of the last token found.


hash

protected int hash
If lastToken is TK_IDENTIFIER or is in the keywordTable, then this will be the token's hash value.

Constructor Detail

PlsqlLexer

public PlsqlLexer()
Constructs a default PlsqlLexer with a starting position of 0. Clients must call setTextBuffer() to initialize the text buffer used for the Lexer. To start lexing from an offset other than 0, call setPosition().

Method Detail

setSkipComments

public void setSkipComments(boolean skipComments)
Sets whether the PlsqlLexer should generate tokens for Java comments.

Parameters:
skipComments - true to ignore comments in token generation

lex

public int lex(LexerToken lexedToken)
Scans the text buffer at the current position and returns the token that was found. The token and offset information is also stored in the lexedToken instance passed in to the call.

Specified by:
lex in interface Lexer
Specified by:
lex in class AbstractLexer
Parameters:
lexedToken - the instance passed in where token info is stored
Returns:
the token that was found, same as calling lexedToken.getToken() (for convenience)

backup

public void backup()
Unlexes the last found token. The next call to lex() will return the last token and offset information found.

Specified by:
backup in interface Lexer
Specified by:
backup in class AbstractLexer

skipStringLiteral

protected final void skipStringLiteral()
Utility routine which scans through the text buffer to find the end of the string literal. Sets the current position on the character after the trailing ('), or on the end of line character.


skipQuotedStringLiteral

protected final void skipQuotedStringLiteral()
Skip an alternatively quoted string literal, syntax introduced in Database 10gR1.


isDecimalDigit

public static boolean isDecimalDigit(char digit)
Utility routine to check whether the given digit is a decimal digit.

Parameters:
digit - the digit to check

save_context

protected void save_context(BaseSqlLexer.Context context)

restore_context

protected void restore_context(BaseSqlLexer.Context context)

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

E13403-05

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