public class

TokenExtractor

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

Class Overview

A customizable string token extractor. Standard delimiters are provided: see DF_xxx objects.

Summary

Nested Classes
interface TokenExtractor.IDelimiterFinder Definition of a delimiter. 
Fields
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
  • 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
  • public static final TokenExtractor.IDelimiterFinder DF_NonAlphaNum Delimiter= any character that is neither a letter for a digit
    public static final TokenExtractor.IDelimiterFinder DF_WhiteSpace Delimiter= whitespace character
    Public Constructors
    TokenExtractor(TokenExtractor.IDelimiterFinder delimiterFinder)
    Create a token extractor.
    Public Methods
    String extract(String s, int o)
    Extract 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> getGenericTokenList()
    Retrieve the generic list of Token Extractor, based on DF_* TokenExtractor.IDelimiterFinder.
    [Expand]
    Inherited Methods
    From class java.lang.Object

    Fields

    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
  • 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

  • public static final TokenExtractor.IDelimiterFinder DF_NonAlphaNum

    Delimiter= any character that is neither a letter for a digit

    public static final TokenExtractor.IDelimiterFinder DF_WhiteSpace

    Delimiter= whitespace character

    Public Constructors

    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_*

    Public Methods

    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.

    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.

    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