gudusoft.gsqlparser.pp.utils
Class SourceTokenSearcher

java.lang.Object
  extended by gudusoft.gsqlparser.pp.utils.SourceTokenSearcher

public class SourceTokenSearcher
extends java.lang.Object


Constructor Summary
SourceTokenSearcher()
           
 
Method Summary
static TSourceToken backforwardSearch(TSourceToken token, int backsearchSize, java.lang.String text)
          backward search the source token
static TSourceToken firstNotWhitespaceAndReturnToken(TSourceTokenList list, int startPos, int endPos)
          get first token which is not whitespace and return token
static TSourceToken firstSelectNotWhitespaceAndReturnToken(TSourceTokenList list, int startPos, java.lang.String text)
          forward search the token which is the first not whitespace or return token, and its value is a fixed text
static TSourceToken forwardSearch(TSourceToken token, int forwardSearchSize, java.lang.String text)
          forward search the source token
static int indexOf(TSourceTokenList list, int startPos, int endPos, ETokenType type)
          search the source token in the source token list from the top
static int indexOf(TSourceTokenList list, int startPos, int endPos, java.lang.String text)
          search the source token in the source token list from the top
static int indexOf(TSourceTokenList list, int startPos, java.lang.String text)
          search the source token in the source token list from the top
static boolean isNewLineToken(TSourceToken token)
           
static boolean isSimpleComment(TSourceToken token)
           
static int lastIndexOf(TSourceTokenList list, int startPos, int endPos, java.lang.String text)
          search the source token in the source token list from the end
static int lastIndexOf(TSourceTokenList list, int endPos, java.lang.String text)
          search the source token in the source token list from the end
static TSourceToken lastNotWhitespaceAndReturnToken(TSourceTokenList list, int endPos)
          get last token which is not whitespace and return token
static TSourceToken lastNotWhitespaceAndReturnToken(TSourceTokenList list, int startPos, int endPos)
          get last token which is not whitespace and return token
static TSourceToken lastSelectedNotWhitespaceAndReturnToken(TSourceTokenList list, int endPos, java.lang.String text)
          backward search the token which is the first not whitespace or return token, and its value is a fixed text
static TSourceToken lastSelectedNotWhitespaceAndReturnToken(TSourceToken token, java.lang.String text)
          backward search the token which is the first not whitespace or return token, and its value is a fixed text
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SourceTokenSearcher

public SourceTokenSearcher()
Method Detail

indexOf

public static int indexOf(TSourceTokenList list,
                          int startPos,
                          int endPos,
                          java.lang.String text)
search the source token in the source token list from the top

Parameters:
list -
startPos -
endPos -
text -
Returns:
position

indexOf

public static int indexOf(TSourceTokenList list,
                          int startPos,
                          int endPos,
                          ETokenType type)
search the source token in the source token list from the top

Parameters:
list -
startPos -
endPos -
type -
Returns:

indexOf

public static int indexOf(TSourceTokenList list,
                          int startPos,
                          java.lang.String text)
search the source token in the source token list from the top

Parameters:
list -
startPos -
text -
Returns:

backforwardSearch

public static TSourceToken backforwardSearch(TSourceToken token,
                                             int backsearchSize,
                                             java.lang.String text)
backward search the source token

Parameters:
list -
startPos -
backsearchSize -
text -
Returns:

forwardSearch

public static TSourceToken forwardSearch(TSourceToken token,
                                         int forwardSearchSize,
                                         java.lang.String text)
forward search the source token

Parameters:
token -
forwardSearchSize -
text -
Returns:

lastIndexOf

public static int lastIndexOf(TSourceTokenList list,
                              int startPos,
                              int endPos,
                              java.lang.String text)
search the source token in the source token list from the end

Parameters:
list -
startPos -
endPos -
text -
Returns:
position

lastIndexOf

public static int lastIndexOf(TSourceTokenList list,
                              int endPos,
                              java.lang.String text)
search the source token in the source token list from the end

Parameters:
list -
endPos -
text -
Returns:

lastNotWhitespaceAndReturnToken

public static TSourceToken lastNotWhitespaceAndReturnToken(TSourceTokenList list,
                                                           int startPos,
                                                           int endPos)
get last token which is not whitespace and return token

Parameters:
list -
startPos -
endPos -
Returns:

lastNotWhitespaceAndReturnToken

public static TSourceToken lastNotWhitespaceAndReturnToken(TSourceTokenList list,
                                                           int endPos)
get last token which is not whitespace and return token

Parameters:
list -
endPos -
Returns:

lastSelectedNotWhitespaceAndReturnToken

public static TSourceToken lastSelectedNotWhitespaceAndReturnToken(TSourceTokenList list,
                                                                   int endPos,
                                                                   java.lang.String text)
backward search the token which is the first not whitespace or return token, and its value is a fixed text

Parameters:
list -
endPos -
value - the fixed value
Returns:

firstNotWhitespaceAndReturnToken

public static TSourceToken firstNotWhitespaceAndReturnToken(TSourceTokenList list,
                                                            int startPos,
                                                            int endPos)
get first token which is not whitespace and return token

Parameters:
list -
startPos -
endPos -
Returns:

firstSelectNotWhitespaceAndReturnToken

public static TSourceToken firstSelectNotWhitespaceAndReturnToken(TSourceTokenList list,
                                                                  int startPos,
                                                                  java.lang.String text)
forward search the token which is the first not whitespace or return token, and its value is a fixed text

Parameters:
list -
startPos -
text -
Returns:

lastSelectedNotWhitespaceAndReturnToken

public static TSourceToken lastSelectedNotWhitespaceAndReturnToken(TSourceToken token,
                                                                   java.lang.String text)
backward search the token which is the first not whitespace or return token, and its value is a fixed text

Parameters:
token -
text -
Returns:

isNewLineToken

public static boolean isNewLineToken(TSourceToken token)

isSimpleComment

public static boolean isSimpleComment(TSourceToken token)