class

Myst::Lexer

Inherits Reference / Object

Constructors

new(source : IO, source_file : String, row_start : Int32 = 1, col_start : Int32 = 0)
Source

Instance methods

advance_token

Move to a new token with a new buffer.

Source
brace_stack

List of currently-unmatched braces in the source.

Source
brace_stack=(brace_stack : Array(Char))

List of currently-unmatched braces in the source.

Source
check_for_keyword

Attempt to lex the current buffer as a keyword. If one is found, the token type will be set appropriately. If not, the token type will not be changed.

Source
col

Current column number in the source.

Source
col=(col : Int32)

Current column number in the source.

Source
consume_comment
Source
consume_constant
Source
consume_identifier
Source
consume_numeric
Source
consume_symbol_or_colon
Source
consume_whitespace
Source
context_stack

Stack of contexts that the lexer is within.

Source
context_stack=(context_stack : Array(Context))

Stack of contexts that the lexer is within.

Source
current_brace
Source
current_char
Source
current_context
Source
current_location
Source
current_token

Token currently being parsed.

Source
current_token=(current_token : Token)

Token currently being parsed.

Source
finalize_token

Assign the tokens final value and add it to the consumed tokens list.

Source
finished?
Source
last_char

Current character in the source.

Source
last_char=(last_char : Char)

Current character in the source.

Source
lex_all
Source
peek_char
Source
pop_brace(type : Symbol)

Attempts to pop the top bracing character from the stack, but only if it matches the given type. Returns false if the type does not match.

Source
pop_context
Source
push_brace(type : Symbol)
Source
push_context(context : Context)
Source
read_char(save_to_buffer = true) : Char

Consume a single character from the source.

Source
read_normal_token

Consume and store a single token from the source.

Source
read_string_interp_token
Source
read_string_token
Source
read_token
Source
reader

Source code being lexed.

Source
reader=(reader : Reader)

Source code being lexed.

Source
replace_escape_characters(raw)
Source
row

Current line number in the source.

Source
row=(row : Int32)

Current line number in the source.

Source
skip_char
Source
source_file

Full path to the source file used by this lexer. For STDIN and other non-local input methods, this will be nil.

Source
source_file=(source_file : String)

Full path to the source file used by this lexer. For STDIN and other non-local input methods, this will be nil.

Source
token_is_empty?
Source
tokens

List of tokens already parsed.

Source
tokens=(tokens : Array(Token))

List of tokens already parsed.

Source

Nested types