Class SourceTokenOperator
- Namespace
- gudusoft.gsqlparser.pp.utils
- Assembly
- gudusoft.gsqlparser.dll
the helper class used for operating the source token
@author zhoujun
public class SourceTokenOperator
- Inheritance
-
SourceTokenOperator
- Inherited Members
Methods
addAfter(GFmtOpt, TSourceToken, TSourceToken)
public static void addAfter(GFmtOpt opt, TSourceToken targetToken, TSourceToken needAddToken)
Parameters
optGFmtOpttargetTokenTSourceTokenneedAddTokenTSourceToken
addBefore(GFmtOpt, TSourceToken, TSourceToken)
insert the source token before the target source token
public static void addBefore(GFmtOpt opt, TSourceToken targetToken, TSourceToken needAddToken)
Parameters
optGFmtOpttargetTokenTSourceTokenneedAddTokenTSourceToken
combineWhitespace(TSourceTokenList, int, int)
combine all the white spaces into a single white space
public static void combineWhitespace(TSourceTokenList list, int startPos, int endPos)
Parameters
listTSourceTokenListstartPosintendPosint
createNoFormatFlagToken()
public static TSourceToken createNoFormatFlagToken()
Returns
createReturnSourceToken()
public static TSourceToken createReturnSourceToken()
Returns
createWhitespaceSourceToken(int)
create the white space source token
public static TSourceToken createWhitespaceSourceToken(int length)
Parameters
lengthint@return
Returns
curColumnNumberVT(TSourceToken)
calcaulate the text length from a given position to the line start. VT is the abbr for "virtual token" (which contains before tokens, after tokens and replace token)
public static int curColumnNumberVT(TSourceToken token)
Parameters
tokenTSourceToken@return
Returns
curColumnNumberVT(TSourceTokenList, int)
calcaulate the text length from a given position to the line start. VT is the abbr for "virtual token" (which contains before tokens, after tokens and replace token)
public static int curColumnNumberVT(TSourceTokenList list, int pos)
Parameters
listTSourceTokenListposint@return
Returns
curIndentLenVT(TSourceToken)
calculate the current indent length VT is the abbr for "virtual token" (which contains before tokens, after tokens and replace token)
public static int curIndentLenVT(TSourceToken token)
Parameters
tokenTSourceToken@return
Returns
curIndentLenVT(TSourceTokenList, int)
calculate the current indent length VT is the abbr for "virtual token" (which contains before tokens, after tokens and replace token)
public static int curIndentLenVT(TSourceTokenList list, int pos)
Parameters
listTSourceTokenListposint@return
Returns
removeAllBeforeTokenVT(GFmtOpt, TSourceToken)
remove all source token in the before source token list VT is the abbr for "virtual token" (that this method will operates before tokens, after tokens and replace token)
public static void removeAllBeforeTokenVT(GFmtOpt opt, TSourceToken targetToken)
Parameters
optGFmtOpttargetTokenTSourceToken
removeThisToken(TSourceToken)
public static void removeThisToken(TSourceToken token)
Parameters
tokenTSourceToken
removeWhitespaceAndReturn(GFmtOpt, TSourceTokenList, int, int)
remove the white space and the return token
public static void removeWhitespaceAndReturn(GFmtOpt opt, TSourceTokenList list, int start, int end)
Parameters
optGFmtOptlistTSourceTokenListstartintendint
removeWhitespaceAndReturnFormBeforeAndAfter(GFmtOpt, TSourceToken)
remove the white space and the return token before this token and after this token
public static void removeWhitespaceAndReturnFormBeforeAndAfter(GFmtOpt opt, TSourceToken token)
Parameters
optGFmtOpttokenTSourceToken
removeWhitespaceAndReturnFromEnd(GFmtOpt, TSourceToken)
remove the white space and the return token from the end
public static int removeWhitespaceAndReturnFromEnd(GFmtOpt opt, TSourceToken token)
Parameters
optGFmtOpttokenTSourceToken
Returns
- int
the pos which is not whitespace and return token in the source token list
removeWhitespaceAndReturnFromEnd(GFmtOpt, TSourceTokenList, int)
remove the white space and the return token from the end
public static int removeWhitespaceAndReturnFromEnd(GFmtOpt opt, TSourceTokenList list, int end)
Parameters
optGFmtOptlistTSourceTokenListendint
Returns
- int
the pos which is not white space and return token in the source token list
removeWhitespaceAndReturnFromStart(GFmtOpt, TSourceTokenList, int)
remove the white space and the return token from the end
public static int removeWhitespaceAndReturnFromStart(GFmtOpt opt, TSourceTokenList list, int startPos)
Parameters
optGFmtOptlistTSourceTokenListstartPosint
Returns
removeWhitespaceBackward(GFmtOpt, TSourceTokenList, int)
public static int removeWhitespaceBackward(GFmtOpt opt, TSourceTokenList list, int end)
Parameters
optGFmtOptlistTSourceTokenListendint
Returns
textLengthVT(TSourceTokenList, int, int)
calculate the text length for all virtual token (which are call before tokens, after tokens and replace token)
public static int textLengthVT(TSourceTokenList list, int start, int end)
Parameters
listTSourceTokenListstartintendint@return