Class STLexer

  • All Implemented Interfaces:
    org.antlr.runtime.TokenSource


    public class STLexer
    extends Object
    implements org.antlr.runtime.TokenSource
    This class represents the tokenizer for templates. It operates in two modes: inside and outside of expressions. It implements the TokenSource interface so it can be used with ANTLR parsers. Outside of expressions, we can return these token types: TEXT, INDENT, LDELIM (start of expression), RCURLY (end of subtemplate), and NEWLINE. Inside of an expression, this lexer returns all of the tokens needed by STParser. From the parser's point of view, it can treat a template as a simple stream of elements.

    This class defines the token types and communicates these values to STParser.g via STLexer.tokens file (which must remain consistent).