class

Myst::Parser

Inherits Myst::Lexer / Reference / Object

Constructors

new(source : IO, source_file : String)
Source

Class methods

for_content(content)
Source
for_file(source_file)
Source

Instance methods

accept(*types : Token::Type)
Source
accept_delimiter
Source
expect(*types : Token::Type)
Source
expect_delimiter
Source
expect_delimiter_or_eof
Source
is_local_var?(name : String)
Source
modified_ident?(ident : String)

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

Source
parse

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

Source
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.

Source
parse_anonymous_function
Source
parse_assign
Source
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.

Source
parse_comparative
Source
parse_conditional
Source
parse_def
Source
parse_def_name
Source
parse_doc_comment
Source
parse_equality
Source
parse_exception_handler
Source
parse_expression
Source
parse_extend
Source
parse_flow_control
Source
parse_function_capture
Source
parse_include
Source
parse_instantiation
Source
parse_list_literal
Source
parse_literal
Source
parse_logical_and
Source
parse_logical_or
Source
parse_loop
Source
parse_magic_constant
Source
parse_map_key
Source
parse_map_literal
Source
parse_match
Source
parse_module_def
Source
parse_multiplicative(left = nil)
Source
parse_optional_block
Source
parse_optional_type_restriction(pipe_is_ambiguous = false)
Source
parse_param(allow_splat = true, is_block = false)
Source
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.

Source
parse_postfix(receiver = nil)
Source
parse_primary
Source
parse_require
Source
parse_single_type_path

This should use parse_type_path to avoid nested looping in this method.

Source
parse_string_literal
Source
parse_type_def
Source
parse_type_path
Source
parse_unary
Source
parse_value_interpolation
Source
parse_var_or_call(receiver = nil)
Source
pop_var_scope
Source
push_local_var(name : String)
Source
push_var_scope(scope = Set(String).new)
Source
skip_space

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

Source
skip_space_and_newlines
Source

Nested types