class Myst::Lexer

Direct Known Subclasses

Defined in:

myst/syntax/lexer.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(source : IO, source_file : String, row_start : Int32 = 1, col_start : Int32 = 0) #

[View source]

Instance Method Detail

def advance_token #

Move to a new token with a new buffer.


[View source]
def brace_stack : Array(Char) #

List of currently-unmatched braces in the source.


[View source]
def brace_stack=(brace_stack : Array(Char)) #

List of currently-unmatched braces in the source.


[View source]
def 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.


[View source]
def col : Int32 #

Current column number in the source.


[View source]
def col=(col : Int32) #

Current column number in the source.


[View source]
def consume_comment #

[View source]
def consume_constant #

[View source]
def consume_identifier #

[View source]
def consume_numeric #

[View source]
def consume_symbol_or_colon #

[View source]
def consume_whitespace #

[View source]
def context_stack : Array(Context) #

Stack of contexts that the lexer is within.


[View source]
def context_stack=(context_stack : Array(Context)) #

Stack of contexts that the lexer is within.


[View source]
def current_brace : Char #

[View source]
def current_char : Char #

[View source]
def current_context #

[View source]
def current_location #

[View source]
def current_token : Token #

Token currently being parsed.


[View source]
def current_token=(current_token : Token) #

Token currently being parsed.


[View source]
def finalize_token #

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


[View source]
def finished? : Bool #

[View source]
def last_char : Char #

Current character in the source.


[View source]
def last_char=(last_char : Char) #

Current character in the source.


[View source]
def lex_all #

[View source]
def peek_char : Char #

[View source]
def 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.


[View source]
def pop_context #

[View source]
def push_brace(type : Symbol) #

[View source]
def push_context(context : Context) #

[View source]
def read_char(save_to_buffer = true) : Char #

Consume a single character from the source.


[View source]
def read_normal_token #

Consume and store a single token from the source.


[View source]
def read_string_interp_token #

[View source]
def read_string_token #

[View source]
def read_token #

[View source]
def reader : Reader #

Source code being lexed.


[View source]
def reader=(reader : Reader) #

Source code being lexed.


[View source]
def replace_escape_characters(raw) #

[View source]
def row : Int32 #

Current line number in the source.


[View source]
def row=(row : Int32) #

Current line number in the source.


[View source]
def skip_char : Char #

[View source]
def 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.


[View source]
def 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.


[View source]
def token_is_empty? #

[View source]
def tokens : Array(Token) #

List of tokens already parsed.


[View source]
def tokens=(tokens : Array(Token)) #

List of tokens already parsed.


[View source]