Lexer class
The lexer creates tokens (see TokenType and Token) from an input string. The input string is expected to be in infix notation form. The lexer can convert an infix stream into a postfix stream (Reverse Polish Notation) for further processing by a Parser.
Constructors
- Lexer()
- Creates a new lexer.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- intBuffer ↔ String
-
Buffer for numbers
getter/setter pair
-
keywords
→ Map<
String, TokenType> -
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- varBuffer ↔ String
-
Buffer for variable and function names
getter/setter pair
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
shuntingYard(
List< Token> stream) → List<Token> -
Transforms the lexer's token stream into RPN using the Shunting-yard
algorithm. Returns a list of
Token
in RPN form. Throws an ArgumentError if the list is empty. -
tokenize(
String inputString) → List< Token> -
Tokenizes a given input string.
Returns a list of
Token
in infix notation. -
tokenizeToRPN(
String inputString) → List< Token> - This method invokes the createTokenStream methode to create an infix token stream and then invokes the shunting yard method to transform this stream into a RPN (reverse polish notation) token stream.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited