Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## gudusoft.gsqlparser.pp.utils
Class SourceTokenOperator

    java.lang.Object
      gudusoft.gsqlparser.pp.utils.SourceTokenOperator

    public class SourceTokenOperator

extends java.lang.Object

the helper class used for operating the source token

Author:
  zhoujun

Constructor Summary
`SourceTokenOperator()`

Method Summary
`static void` | `addAfter(GFmtOpt opt, TSourceToken targetToken, TSourceToken needAddToken)`
`static void` | `addBefore(GFmtOpt opt, TSourceToken targetToken, TSourceToken needAddToken)` insert the source token before the target source token
`static void` | `combineWhitespace(TSourceTokenList list, int startPos, int endPos)` combine all the white spaces into a single white space
`static TSourceToken` | `createNoFormatFlagToken()`
`static TSourceToken` | `createReturnSourceToken()`
`static TSourceToken` | `createWhitespaceSourceToken(int length)` create the white space source token
`static int` | `curColumnNumberVT(TSourceToken token)` calcaulate the text length from a given position to the line start.
`static int` | `curColumnNumberVT(TSourceTokenList list, int pos)` calcaulate the text length from a given position to the line start.
`static int` | `curIndentLenVT(TSourceToken token)` calculate the current indent length VT is the abbr for "virtual token" (which contains before tokens, after tokens and replace token)
`static int` | `curIndentLenVT(TSourceTokenList list, int pos)` calculate the current indent length VT is the abbr for "virtual token" (which contains before tokens, after tokens and replace token)
`static void` | `removeAllBeforeTokenVT(GFmtOpt opt, TSourceToken targetToken)` 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)
`static void` | `removeThisToken(TSourceToken token)`
`static void` | `removeWhitespaceAndReturn(GFmtOpt opt, TSourceTokenList list, int start, int end)` remove the white space and the return token
`static void` | `removeWhitespaceAndReturnFormBeforeAndAfter(GFmtOpt opt, TSourceToken token)` remove the white space and the return token before this token and after this token
`static int` | `removeWhitespaceAndReturnFromEnd(GFmtOpt opt, TSourceToken token)` remove the white space and the return token from the end
`static int` | `removeWhitespaceAndReturnFromEnd(GFmtOpt opt, TSourceTokenList list, int end)` remove the white space and the return token from the end
`static int` | `removeWhitespaceAndReturnFromStart(GFmtOpt opt, TSourceTokenList list, int startPos)` remove the white space and the return token from the end
`static int` | `removeWhitespaceBackward(GFmtOpt opt, TSourceTokenList list, int end)`
`static int` | `textLengthVT(TSourceTokenList list, int start, int end)` calculate the text length for all virtual token (which are call before tokens, after tokens and replace token)

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SourceTokenOperator

    public SourceTokenOperator()

Method Detail

### removeWhitespaceBackward

    public static int removeWhitespaceBackward(GFmtOpt opt,
                                               TSourceTokenList list,
                                               int end)

### removeWhitespaceAndReturnFromEnd

    public static int removeWhitespaceAndReturnFromEnd(GFmtOpt opt,
                                                       TSourceTokenList list,
                                                       int end)

  remove the white space and the return token from the end

  Parameters:
    `list` -
    `end` -
  Returns:
    the pos which is not white space and return token in the source token list

### removeWhitespaceAndReturnFromEnd

    public static int removeWhitespaceAndReturnFromEnd(GFmtOpt opt,
                                                       TSourceToken token)

  remove the white space and the return token from the end

  Parameters:
    `token` -
  Returns:
    the pos which is not whitespace and return token in the source token list

### removeWhitespaceAndReturnFormBeforeAndAfter

    public static void removeWhitespaceAndReturnFormBeforeAndAfter(GFmtOpt opt,
                                                                   TSourceToken token)

  remove the white space and the return token before this token and after this token

  Parameters:
    `opt` -
    `token` -

### removeWhitespaceAndReturn

    public static void removeWhitespaceAndReturn(GFmtOpt opt,
                                                 TSourceTokenList list,
                                                 int start,
                                                 int end)

  remove the white space and the return token

  Parameters:
    `list` -
    `start` -
    `end` -

### removeWhitespaceAndReturnFromStart

    public static int removeWhitespaceAndReturnFromStart(GFmtOpt opt,
                                                         TSourceTokenList list,
                                                         int startPos)

  remove the white space and the return token from the end

  Parameters:
    `list` -
    `end` -

### textLengthVT

    public static int textLengthVT(TSourceTokenList list,
                                   int start,
                                   int end)

  calculate the text length for all virtual token (which are call before tokens, after tokens and replace token)

  Parameters:
    `list` -
    `start` -
    `end` -
  Returns:

### curColumnNumberVT

    public static int curColumnNumberVT(TSourceTokenList list,
                                        int pos)

  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)

  Parameters:
    `list` -
    `pos` -
  Returns:

### curColumnNumberVT

    public static int curColumnNumberVT(TSourceToken token)

  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)

  Parameters:
    `token` -
  Returns:

### curIndentLenVT

    public static int curIndentLenVT(TSourceTokenList list,
                                     int pos)

  calculate the current indent length VT is the abbr for "virtual token" (which contains before tokens, after tokens and replace token)

  Parameters:
    `list` -
    `pos` -
  Returns:

### curIndentLenVT

    public static int curIndentLenVT(TSourceToken token)

  calculate the current indent length VT is the abbr for "virtual token" (which contains before tokens, after tokens and replace token)

  Parameters:
    `token` -
  Returns:

### createWhitespaceSourceToken

    public static TSourceToken createWhitespaceSourceToken(int length)

  create the white space source token

  Parameters:
    `length` -
  Returns:

### createNoFormatFlagToken

    public static TSourceToken createNoFormatFlagToken()

### createReturnSourceToken

    public static TSourceToken createReturnSourceToken()

### combineWhitespace

    public static void combineWhitespace(TSourceTokenList list,
                                         int startPos,
                                         int endPos)

  combine all the white spaces into a single white space

  Parameters:
    `list` -
    `startPos` -
    `endPos` -

### addBefore

    public static void addBefore(GFmtOpt opt,
                                 TSourceToken targetToken,
                                 TSourceToken needAddToken)

  insert the source token before the target source token

  Parameters:
    `targetToken` -
    `needAddToken` -

### addAfter

    public static void addAfter(GFmtOpt opt,
                                TSourceToken targetToken,
                                TSourceToken needAddToken)

### removeAllBeforeTokenVT

    public static void removeAllBeforeTokenVT(GFmtOpt opt,
                                              TSourceToken targetToken)

  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)

  Parameters:
    `targetToken` -

### removeThisToken

    public static void removeThisToken(TSourceToken token)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD