Class Lexer


  • public class Lexer
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      Lexer()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.Deque<Token> tokenize​(java.lang.String input)
      This Lexer will generate tokens for our string matcher.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Lexer

        public Lexer()
    • Method Detail

      • tokenize

        public static java.util.Deque<Token> tokenize​(java.lang.String input)
                                               throws CompilationException
        This Lexer will generate tokens for our string matcher. For example given the expression: (foobar||endsWith(baz) && !qux) we would get the tokens: {LEFT_PAREN, STRING_VALUE("foobar"), OPERATOR_OR("||"), FUNCTION_CALL("endsWith"), LEFT_PAREN("())") STRING_VALUE("baz"), OPERATOR_AND("&&"), OPERATOR_NOT("!"), RIGHT_PAREN(")")}
        Parameters:
        input - The expression to be tokenized
        Throws:
        CompilationException - with clear error message