Fork me on GitHub

Lexer

core/lexer# Lexer

new Lexer(s: string)private

Given a LaTeX expression represented as a character string, the Lexer class will scan and return Tokens for the lexical units in the string.

s : string

A string of LaTeX

Methods

end(): booleanprivate

: boolean   

True if we reached the end of the stream

get(): string

Return the next char and advance

: string   

isWhiteSpace()private

Return true if next char is white space. Does not advance.

See Stackoverflow

makeToken(): Tokenprivate

Return a single token, or null, created from the lexer.

: Token   

peek(): stringprivate

Return the next char, but do not advance

: string   

scan(regEx: RegEx): nullable stringprivate

Return the next substring matching regEx and advance.

regEx : RegEx
: string