org.eigenbase.sql.parser
Class SqlAbstractParserImpl.MetadataImpl

java.lang.Object
  extended by org.eigenbase.sql.parser.SqlAbstractParserImpl.MetadataImpl
All Implemented Interfaces:
SqlAbstractParserImpl.Metadata
Enclosing class:
SqlAbstractParserImpl

public static class SqlAbstractParserImpl.MetadataImpl
extends Object
implements SqlAbstractParserImpl.Metadata

Default implementation of the SqlAbstractParserImpl.Metadata interface.


Field Summary
private  Set<String> contextVariableNames
           
private  Set<String> nonReservedKeyWordSet
           
private  Set<String> reservedFunctionNames
           
private  Set<String> reservedWords
           
private  String sql92ReservedWords
           
private  List<String> tokenList
          Immutable list of all tokens, in alphabetical order.
private  SortedSet<String> tokenSet
          Set of all tokens.
 
Constructor Summary
SqlAbstractParserImpl.MetadataImpl(SqlAbstractParserImpl sqlParser)
          Creates a MetadataImpl.
 
Method Summary
private  String constructSql92ReservedWordList()
          Builds a comma-separated list of JDBC reserved words.
 String getJdbcKeywords()
          Returns comma-separated list of JDBC keywords.
 List<String> getTokens()
          Returns a list of all tokens in alphabetical order.
private  void initList(SqlAbstractParserImpl parserImpl, Set<String> keywords, String name)
          Initializes lists of keywords.
 boolean isContextVariableName(String token)
          Returns whether token is the name of a context variable such as "CURRENT_USER".
 boolean isKeyword(String token)
          Returns whether token is a keyword.
 boolean isNonReservedKeyword(String token)
          Returns true if token is a keyword but not a reserved word.
 boolean isReservedFunctionName(String token)
          Returns whether token is a reserved function name such as "CURRENT_USER".
 boolean isReservedWord(String token)
          Returns whether token is a reserved word.
 boolean isSql92ReservedWord(String token)
          Returns whether token is a reserved word as specified by the SQL:92 standard.
private  Object virtualCall(SqlAbstractParserImpl parserImpl, String name)
          Uses reflection to invoke a method on this parser.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

reservedFunctionNames

private final Set<String> reservedFunctionNames

contextVariableNames

private final Set<String> contextVariableNames

nonReservedKeyWordSet

private final Set<String> nonReservedKeyWordSet

tokenSet

private final SortedSet<String> tokenSet
Set of all tokens.


tokenList

private final List<String> tokenList
Immutable list of all tokens, in alphabetical order.


reservedWords

private final Set<String> reservedWords

sql92ReservedWords

private final String sql92ReservedWords
Constructor Detail

SqlAbstractParserImpl.MetadataImpl

public SqlAbstractParserImpl.MetadataImpl(SqlAbstractParserImpl sqlParser)
Creates a MetadataImpl.

Parameters:
sqlParser - Parser
Method Detail

initList

private void initList(SqlAbstractParserImpl parserImpl,
                      Set<String> keywords,
                      String name)
Initializes lists of keywords.


virtualCall

private Object virtualCall(SqlAbstractParserImpl parserImpl,
                           String name)
                    throws Throwable
Uses reflection to invoke a method on this parser. The method must be public and have no parameters.

Parameters:
parserImpl - Parser
name - Name of method. For example "ReservedFunctionName".
Returns:
Result of calling method
Throws:
Throwable

constructSql92ReservedWordList

private String constructSql92ReservedWordList()
Builds a comma-separated list of JDBC reserved words.


getTokens

public List<String> getTokens()
Description copied from interface: SqlAbstractParserImpl.Metadata
Returns a list of all tokens in alphabetical order.

Specified by:
getTokens in interface SqlAbstractParserImpl.Metadata

isSql92ReservedWord

public boolean isSql92ReservedWord(String token)
Description copied from interface: SqlAbstractParserImpl.Metadata
Returns whether token is a reserved word as specified by the SQL:92 standard.

Specified by:
isSql92ReservedWord in interface SqlAbstractParserImpl.Metadata

getJdbcKeywords

public String getJdbcKeywords()
Description copied from interface: SqlAbstractParserImpl.Metadata
Returns comma-separated list of JDBC keywords.

Specified by:
getJdbcKeywords in interface SqlAbstractParserImpl.Metadata

isKeyword

public boolean isKeyword(String token)
Description copied from interface: SqlAbstractParserImpl.Metadata
Returns whether token is a keyword. (That is, a non-reserved keyword, a context variable, or a reserved function name.)

Specified by:
isKeyword in interface SqlAbstractParserImpl.Metadata

isNonReservedKeyword

public boolean isNonReservedKeyword(String token)
Description copied from interface: SqlAbstractParserImpl.Metadata
Returns true if token is a keyword but not a reserved word. For example, "KEY".

Specified by:
isNonReservedKeyword in interface SqlAbstractParserImpl.Metadata

isReservedFunctionName

public boolean isReservedFunctionName(String token)
Description copied from interface: SqlAbstractParserImpl.Metadata
Returns whether token is a reserved function name such as "CURRENT_USER".

Specified by:
isReservedFunctionName in interface SqlAbstractParserImpl.Metadata

isContextVariableName

public boolean isContextVariableName(String token)
Description copied from interface: SqlAbstractParserImpl.Metadata
Returns whether token is the name of a context variable such as "CURRENT_USER".

Specified by:
isContextVariableName in interface SqlAbstractParserImpl.Metadata

isReservedWord

public boolean isReservedWord(String token)
Description copied from interface: SqlAbstractParserImpl.Metadata
Returns whether token is a reserved word.

Specified by:
isReservedWord in interface SqlAbstractParserImpl.Metadata