public class SourceTokenOperator extends Object
Constructor and Description |
---|
SourceTokenOperator() |
Modifier and Type | Method and Description |
---|---|
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)
|
public SourceTokenOperator()
public static int removeWhitespaceBackward(GFmtOpt opt, TSourceTokenList list, int end)
public static int removeWhitespaceAndReturnFromEnd(GFmtOpt opt, TSourceTokenList list, int end)
list
- end
- public static int removeWhitespaceAndReturnFromEnd(GFmtOpt opt, TSourceToken token)
token
- public static void removeWhitespaceAndReturnFormBeforeAndAfter(GFmtOpt opt, TSourceToken token)
opt
- token
- public static void removeWhitespaceAndReturn(GFmtOpt opt, TSourceTokenList list, int start, int end)
list
- start
- end
- public static int removeWhitespaceAndReturnFromStart(GFmtOpt opt, TSourceTokenList list, int startPos)
list
- public static int textLengthVT(TSourceTokenList list, int start, int end)
list
- start
- end
- public static int curColumnNumberVT(TSourceTokenList list, int pos)
list
- pos
- public static int curColumnNumberVT(TSourceToken token)
token
- public static int curIndentLenVT(TSourceTokenList list, int pos)
list
- pos
- public static int curIndentLenVT(TSourceToken token)
token
- public static TSourceToken createWhitespaceSourceToken(int length)
length
- public static TSourceToken createNoFormatFlagToken()
public static TSourceToken createReturnSourceToken()
public static void combineWhitespace(TSourceTokenList list, int startPos, int endPos)
list
- startPos
- endPos
- public static void addBefore(GFmtOpt opt, TSourceToken targetToken, TSourceToken needAddToken)
targetToken
- needAddToken
- public static void addAfter(GFmtOpt opt, TSourceToken targetToken, TSourceToken needAddToken)
public static void removeAllBeforeTokenVT(GFmtOpt opt, TSourceToken targetToken)
targetToken
- public static void removeThisToken(TSourceToken token)