Interface TokenDef

  • All Superinterfaces:
    Serializable, Tag
    All Known Implementing Classes:
    CommonTypes

    public interface TokenDef
    extends Tag, Serializable

    Defines a Tag and pattern representing a terminal token to be lexed. Variables (sub-tokens) can be defined using an anonymous capture group, i.e. (?<> ... ).

    Author:
    David B. Bracewell
    • Method Detail

      • getPattern

        String getPattern()
        Regular expression pattern for use in a Lexer
        Returns:
        the pattern
      • token

        static TokenDef token​(String tag,
                              String pattern)
        Constructs a simple token definition using a StringTag
        Parameters:
        tag - the tag
        pattern - the pattern
        Returns:
        the TokenDef