Package com.pnfsoftware.jeb.util.format
Class TokenExtractor
java.lang.Object
com.pnfsoftware.jeb.util.format.TokenExtractor
A customizable string token extractor. Standard delimiters are provided: see
DF_xxx
objects.
Example: Consider the line "hello world". If you use a wsp token
extractor, asking for which token is at:
- offset 0,1,2,3,4 would return "hello".
- offset 5 would return null (it falls on the space char).
- offset 6,7,8,9,10 would return "world".
- anywhere else, null would be returned.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceDefinition of a delimiter. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final TokenExtractor.IDelimiterFinderDelimiter= '=' character.static final TokenExtractor.IDelimiterFinderDelimiter= any character that is generally not legal in a symbol name, in particular: any character allowed in java identifier additional '/' character for java signature additional '+' character for native relative signaturestatic final TokenExtractor.IDelimiterFinderDelimiter= any character that is generally not legal in a symbol name, in particular: any character allowed in java identifier all other characters are delimitersstatic final TokenExtractor.IDelimiterFinderDelimiter= any character that is neither a letter nor a digit.static final TokenExtractor.IDelimiterFinderDelimiter= whitespace characters (perisWhitespace) -
Constructor Summary
ConstructorsConstructorDescriptionTokenExtractor(TokenExtractor.IDelimiterFinder delimiterFinder) Create a token extractor. -
Method Summary
Modifier and TypeMethodDescriptionExtract the token spanning over the provided offset of the input string.int[]extractCoordinates(String s, int o) Extract the token spanning over the provided offset of the input string.static List<TokenExtractor> Retrieve the generic list of Token Extractor, based on DF_*TokenExtractor.IDelimiterFinder.protected boolean
-
Field Details
-
DF_WhiteSpace
Delimiter= whitespace characters (perisWhitespace) -
DF_CommonFullSymbolChars
Delimiter= any character that is generally not legal in a symbol name, in particular:- any character allowed in java identifier
- additional '/' character for java signature
- additional '+' character for native relative signature
-
DF_CommonSymbolChars
Delimiter= any character that is generally not legal in a symbol name, in particular:- any character allowed in java identifier
- all other characters are delimiters
-
DF_NonAlphaNum
Delimiter= any character that is neither a letter nor a digit. -
DF_Assignment
Delimiter= '=' character. In particular on decompilation comment with pattern when x=myvalue
-
-
Constructor Details
-
TokenExtractor
Create a token extractor.- Parameters:
delimiterFinder- a delimiter finder; client code may either create their own or use one of the standard finders, seeDF_*
-
-
Method Details
-
getGenericTokenList
Retrieve the generic list of Token Extractor, based on DF_*TokenExtractor.IDelimiterFinder. List is sorted from least to most restrictive.- Returns:
- token extractor list
-
extract
Extract the token spanning over the provided offset of the input string.- Parameters:
s- input stringo- start offset- Returns:
- the token as a substring of s or null if not found.
-
extractCoordinates
Extract the token spanning over the provided offset of the input string.- Parameters:
s- input stringo- start offset- Returns:
- an array with 2 indexes [start, end] of the token, or null if not found.
-
match
-