class Myst::Parser

Defined in:

myst/syntax/parser.cr

Constructors

Class Method Summary

Instance Method Summary

Instance methods inherited from class Myst::Lexer

advance_token advance_token, brace_stack : Array(Char) brace_stack, brace_stack=(brace_stack : Array(Char)) brace_stack=, check_for_keyword check_for_keyword, col : Int32 col, col=(col : Int32) col=, consume_comment consume_comment, consume_constant consume_constant, consume_identifier consume_identifier, consume_numeric consume_numeric, consume_symbol_or_colon consume_symbol_or_colon, consume_whitespace consume_whitespace, context_stack : Array(Context) context_stack, context_stack=(context_stack : Array(Context)) context_stack=, current_brace : Char current_brace, current_char : Char current_char, current_context current_context, current_location current_location, current_token : Token current_token, current_token=(current_token : Token) current_token=, finalize_token finalize_token, finished? : Bool finished?, last_char : Char last_char, last_char=(last_char : Char) last_char=, lex_all lex_all, peek_char : Char peek_char, pop_brace(type : Symbol) pop_brace, pop_context pop_context, push_brace(type : Symbol) push_brace, push_context(context : Context) push_context, read_char(save_to_buffer = true) : Char read_char, read_normal_token read_normal_token, read_string_interp_token read_string_interp_token, read_string_token read_string_token, read_token read_token, reader : Reader reader, reader=(reader : Reader) reader=, replace_escape_characters(raw) replace_escape_characters, row : Int32 row, row=(row : Int32) row=, skip_char : Char skip_char, source_file : String source_file, source_file=(source_file : String) source_file=, token_is_empty? token_is_empty?, tokens : Array(Token) tokens, tokens=(tokens : Array(Token)) tokens=

Constructor methods inherited from class Myst::Lexer

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

Constructor Detail

def self.new(source : IO, source_file : String) #

[View source]

Class Method Detail

def self.for_file(source_file) #

[View source]

Instance Method Detail

def accept(*types : Token::Type) #

[View source]
def accept_delimiter #

[View source]
def expect(*types : Token::Type) #

[View source]
def expect_delimiter #

[View source]
def expect_delimiter_or_eof #

[View source]
def is_local_var?(name : String) #

[View source]
def modified_ident?(ident : String) #

Returns true if the given identifier is modified (i.e., ends with a ? or !).


[View source]
def parse #

Parse the entirety of the given source. Currently, this assumes valid input and will only end when an EOF is encountered.


[View source]
def parse_additive(left = nil) #

Arithmetic is left-associative. 1 - 1 - 1 must be parsed as ((1 - 1) - 1) to follow mathematic precedence and give the right result of -2, rather than (1 - (1 - 1)), which would yield 0.


[View source]
def parse_anonymous_function #

[View source]
def parse_assign #

[View source]
def parse_code_block(*terminators) #

A code block is a set of expressions contained by some other expression. For example, the body of a method definition.


[View source]
def parse_comparative #

[View source]
def parse_conditional #

[View source]
def parse_def #

[View source]
def parse_def_name #

[View source]
def parse_equality #

[View source]
def parse_exception_handler #

[View source]
def parse_expression #

[View source]
def parse_extend #

[View source]
def parse_flow_control #

[View source]
def parse_function_capture #

[View source]
def parse_include #

[View source]
def parse_instantiation #

[View source]
def parse_list_literal #

[View source]
def parse_literal #

[View source]
def parse_logical_and #

[View source]
def parse_logical_or #

[View source]
def parse_loop #

[View source]
def parse_magic_constant #

[View source]
def parse_map_key #

[View source]
def parse_map_literal #

[View source]
def parse_module_def #

[View source]
def parse_multiplicative(left = nil) #

[View source]
def parse_optional_block #

[View source]
def parse_param(allow_splat = true) #

[View source]
def parse_param_list(into target : Def, require_parens = false) #

If a Def has parameters, they must be parenthesized. If the token after the opening parenthesis is a closing one, then there are no parameters.


[View source]
def parse_postfix(receiver = nil) #

[View source]
def parse_primary #

[View source]
def parse_require #

[View source]
def parse_string_literal #

[View source]
def parse_type_def #

[View source]
def parse_unary #

[View source]
def parse_value_interpolation #

[View source]
def parse_var_or_call(receiver = nil) #

[View source]
def pop_var_scope #

[View source]
def push_local_var(name : String) #

[View source]
def push_var_scope(scope = Set(String).new) #

[View source]
def skip_space #

Skip through whitespace tokens, but only if the current token is already a whitespace token.


[View source]
def skip_space_and_newlines #

[View source]