class Axal::Parser

Defined in:

lang/parser.cr

Constant Summary

BINARY_OPERATORS = [TokenKind::PLUS, TokenKind::HYPHEN, TokenKind::ASTERISK, TokenKind::FORWARD_SLASH, TokenKind::DOUBLE_EQUALS, TokenKind::NOT_EQUAL, TokenKind::GREATER_THAN, TokenKind::LESS_THAN, TokenKind::GREATER_THAN_OR_EQUAL, TokenKind::LESS_THAN_OR_EQUAL]
LOGICAL_OPERATORS = [TokenKind::OR, TokenKind::AND]
LOWEST_PRECEDENCE = 0
OPERATOR_PRECEDENCE = {TokenKind::OR => 1, TokenKind::AND => 2, TokenKind::DOUBLE_EQUALS => 3, TokenKind::NOT_EQUAL => 3, TokenKind::GREATER_THAN => 4, TokenKind::LESS_THAN => 4, TokenKind::GREATER_THAN_OR_EQUAL => 4, TokenKind::LESS_THAN_OR_EQUAL => 4, TokenKind::PLUS => 5, TokenKind::HYPHEN => 5, TokenKind::ASTERISK => 6, TokenKind::FORWARD_SLASH => 6, TokenKind::LEFT_PAREN => 8}
PREFIX_PRECEDENCE = 7
UNARY_OPERATORS = [TokenKind::EXCLAMATION, TokenKind::HYPHEN]

Constructors

Instance Method Summary

Constructor Detail

def self.new(tokens : Array(Axal::Token)) #

[View source]

Instance Method Detail

def ast : AST::Program #

[View source]
def build_token(kind : TokenKind, lexeme, location) #

[View source]
def chain : AST::FunctionChain | Nil #

[View source]
def check_syntax_compliance(ast_node) #

[View source]
def consume(offset = 1) #

[View source]
def consume_if_nxt_is(expected_kind) #

[View source]
def current #

[View source]
def current_precedence #

[View source]
def errors : Array(Exception) #

[View source]
def lookahead(offset = 1) #

[View source]
def next_p : Int32 #

[View source]
def nxt #

[View source]
def nxt_not_terminator? #

[View source]
def nxt_precedence #

[View source]
def parse #

[View source]
def parse_array #

[View source]
def parse_array_content #

[View source]
def parse_binary_operator(left) #

[View source]
def parse_block #

[View source]
def parse_boolean #

[View source]
def parse_conditional #

[View source]
def parse_describe #

[View source]
def parse_expr_recursively(precedence = LOWEST_PRECEDENCE) #

ameba:disable Metrics/CyclomaticComplexity


[View source]
def parse_external_code #

[View source]
def parse_fget #

[View source]
def parse_function_call(identifier) #

[View source]
def parse_function_call_args #

[View source]
def parse_function_definition #

[View source]
def parse_function_params #

[View source]
def parse_grouped_expr #

[View source]
def parse_identifier #

[View source]
def parse_it #

[View source]
def parse_json #

[View source]
def parse_json_content #

[View source]
def parse_json_pair #

[View source]
def parse_module_definition #

[View source]
def parse_nil #

[View source]
def parse_number #

[View source]
def parse_qualified_identifier #

[View source]
def parse_repetition #

[View source]
def parse_return #

[View source]
def parse_string #

[View source]
def parse_terminator #

[View source]
def parse_unary_operator #

[View source]
def parse_var_binding #

[View source]
def pending_tokens? #

[View source]
def previous #

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

[View source]
def unexpected_token_error(expected_kind = nil) #

[View source]
def unrecognized_token_error #

[View source]