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) #

[View source]

Instance Method Detail

def advance_token #

Move to a new token with a new buffer.


[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_string #

[View source]
def consume_symbol_or_colon #

[View source]
def consume_whitespace #

[View source]
def current_char : Char #

[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 read_char : Char #

Consume a single character from the source.


[View source]
def read_token : Token #

Consume and store a single token from the source.


[View source]
def reader : Reader #

Source code being lexed.


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

Source code being lexed.


[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 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 tokens : Array(Token) #

List of tokens already parsed.


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

List of tokens already parsed.


[View source]