Determine whether the next token has the specified type, but don't process that token.
Determine whether the next code point in the input is a digit according to the Scala Language Specification, Chapter 1.
Determine whether a given code point can be an operator character according to the Scala Language Specification, Chapter 1
Determine whether the next code point in the input is an operator character according to the Scala Language Specification, Chapter 1.
Determine whether the next token has the specified type, and process it if it does.
Process the next token if it has the specified type, and throw an error if it doesn't.
Determine whether the given code point is a digit according to the Scala Language Specification, Chapter 1.
Determine whether the given code point is a letter according to the Scala Language Specification, Chapter 1.
Determine whether the given code point is an operator character according to the Scala Language Specification, Chapter 1.
next code point in input string, after current position
next code point after the next code point after the current position
Turns a stream of characters into a stream of tokens.
To create a lexer, use the companion object’s
forFile
orforString
methods.The lexer is the first main componenent in the language implementation. It reads a stream of characters from a file, or for testing, from a string. It produces a stream of tokens which is further processed by the parser.
The lexer classifies tokens according to their token type. The token type of the next token in the token stream is available from nextTokenType.
The lexer keeps track of line and column positions inside the source code. The first character of the source code is line 1 and column 1. The location of the beginning of the next token is available from startLine and startColumn. The location of the first character after the next token is available from currentLine and currentColumn.
Most token types classify a fixed string such as an operator or keyword. The following token types are special: