Class TokenExtractor

java.lang.Object
com.pnfsoftware.jeb.util.format.TokenExtractor

public class TokenExtractor extends Object
A customizable string token extractor. Standard delimiters are provided: see DF_xxx objects.
  • Field Details

    • DF_WhiteSpace

      public static final TokenExtractor.IDelimiterFinder DF_WhiteSpace
      Delimiter= whitespace character
    • DF_CommonFullSymbolChars

      public static final TokenExtractor.IDelimiterFinder 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

      public static final TokenExtractor.IDelimiterFinder DF_CommonSymbolChars
      Delimiter= any character that is generally not legal in a symbol name, in particular:
    • any character allowed in java identifier
    • a
    • DF_NonAlphaNum

      public static final TokenExtractor.IDelimiterFinder DF_NonAlphaNum
      Delimiter= any character that is neither a letter for a digit
    • DF_Assignment

      public static final TokenExtractor.IDelimiterFinder DF_Assignment
      Delimiter= '=' character. In particular on decompilation comment with pattern when x=myvalue
  • Constructor Details

    • TokenExtractor

      public TokenExtractor(TokenExtractor.IDelimiterFinder delimiterFinder)
      Create a token extractor.
      Parameters:
      delimiterFinder - a delimiter finder; client code may either create their own or use one of the standard finders, see DF_*
  • Method Details

    • getGenericTokenList

      public static List<TokenExtractor> 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

      public String extract(String s, int o)
      Extract the token spanning over the provided offset of the input string.
      Parameters:
      s - input string
      o - start offset
      Returns:
      the token as a substring of s or null if not found.
    • extractCoordinates

      public int[] extractCoordinates(String s, int o)
      Extract the token spanning over the provided offset of the input string.
      Parameters:
      s - input string
      o - start offset
      Returns:
      an array with 2 indexes [start, end] of the token, or null if not found.
    • match

      protected boolean match(String s, int index)