Constants
AtomicWithMethodCheck = [:IDENT, :CONST, :+, :-, :*, :/, ://, :%, :|, :&, :^, :~, :!, :**, :<<, :<, :<=, :==, :!=, :=~, :!~, :>>, :>, :>=, :<=>, :===, :[], :[]=, :[]?, :"[", :&+, :&-, :&*, :&**]
ConstOrDoubleColon = [:CONST, :"::"]
DefOrMacroCheck1 = [:IDENT, :CONST, :"`", :<<, :<, :<=, :==, :===, :!=, :=~, :!~, :>>, :>, :>=, :+, :-, :*, :/, ://, :!, :~, :%, :&, :|, :^, :**, :[], :[]?, :[]=, :<=>, :&+, :&-, :&*, :&**]
DefOrMacroCheck2 = [:<<, :<, :<=, :==, :===, :!=, :=~, :!~, :>>, :>, :>=, :+, :-, :*, :/, ://, :!, :~, :%, :&, :|, :^, :**, :[], :[]?, :[]=, :<=>, :&+, :&-, :&*, :&**]
IdentOrConst = [:IDENT, :CONST]
SemicolonOrNewLine = [:";", :NEWLINE]
Instance methods
add_when_exp(when_exps, exp)
Adds an expression to all when expressions and error on duplicates
Sourcecheck_macro_expression_end
Sourcecheck_macro_skip_whitespace
Sourcecheck_not_inside_def(message, &)
Sourcecheck_not_pipe_before_proc_literal_body
Sourcecheck_valid_exhaustive_expression(exp)
Sourcecheck_void_expression_keyword
Sourcecheck_void_value(exp, location)
Sourcecompute_block_arg_yields(block_arg)
Sourceconsume_def_equals_sign_skip_space
Sourceconsume_def_or_macro_name
Sourceconsume_delimiter(pieces, delimiter_state, has_interpolation)
Sourceconsume_heredoc(delimiter_state, node)
Sourcedelimiter_or_type_suffix?
Sourceinvalid_internal_name?(keyword)
Sourcemake_named_tuple_type(named_args)
Sourcemake_nilable_expression(type)
Sourcemake_static_array_type(type, size)
Sourcemulti_assign_middle?(exp)
Sourcemulti_assign_target?(exp)
Sourcemultiassign_left_hand(exp)
Sourceneeds_heredoc_indent_removed?(delimiter_state)
Sourcenew_hash_literal(entries, line, column, end_location, allow_of = true)
Sourcenew_node_check_type_declaration(klass)
Sourcenew_node_check_type_declaration(klass, &)
Sourcenew_range(exp, location, exclusive)
Sourcenext_comes_plus_or_minus?
Sourcenode_and_next_token(node)
Sourceopen(symbol, location = @token.location, &)
Sourceparse_as(atomic, klass = Cast)
Sourceparse_atomic_method_suffix(atomic, location)
Sourceparse_atomic_method_suffix_special(call, location)
Sourceparse_atomic_type_with_suffix
Sourceparse_atomic_with_method
Sourceparse_atomic_without_location
Sourceparse_bare_proc_type
Parse a bare proc type like A, B, C -> D.
Generally it is entry point of type parsing and
it is used on the context expected type (e.g. type restrictions, rhs of alias and more)
Sourceparse_block(block, stop_on_do = false)
Sourceparse_c_struct_or_union_body
Sourceparse_c_struct_or_union_fields(exps)
Sourceparse_call_arg(found_double_splat = false)
Sourceparse_call_args(stop_on_do_after_space = false, allow_curly = false, control = false)
Sourceparse_call_args_named_args(location, args, first_name, allow_newline)
Sourceparse_call_args_space_consumed(check_plus_and_minus = true, allow_curly = false, control = false, end_token = :")", allow_beginless_range = false)
Sourceparse_call_block_arg(args, check_paren, named_args = nil)
Sourceparse_call_block_arg_after_dot(obj)
Sourceparse_class_def(is_abstract = false, is_struct = false, doc = nil)
Sourceparse_control_expression(klass)
Sourceparse_curly_block(block)
Sourceparse_custom_literal(type)
Sourceparse_def(is_abstract = false, is_macro_def = false, doc = nil)
Sourceparse_def_helper(is_abstract = false)
Sourceparse_delimiter(want_skip_space = true)
Sourceparse_empty_array_literal
Sourceparse_exception_handler(exp, implicit = false, begin_location = nil)
Sourceparse_expression_inside_macro
Sourceparse_expression_suffix(atomic, location)
Sourceparse_expression_suffix(location, &)
Sourceparse_expressions_internal
Sourceparse_fun_def(top_level, require_body = false)
Sourceparse_generic(global, location, expression)
Sourceparse_generic(expression = false)
Parse generic type path like A::B(C, D)?.
This method is used to parse not only a type, but also an expression represents type.
And it also consumes prefix :: to specify global path.
Sourceparse_generic_or_custom_literal
Sourceparse_generic_or_global_call
Sourceparse_hash_literal(first_key, location, allow_of)
Sourceparse_hash_or_tuple_literal(allow_of = true)
Sourceparse_if(check_end = true)
Sourceparse_if_after_condition(cond, location, check_end)
Sourceparse_include_or_extend(klass)
Sourceparse_lib_body_exp_without_location
Sourceparse_macro_body(start_location, macro_state = Token::MacroState.default)
Sourceparse_macro_control(start_location, macro_state = Token::MacroState.default)
Sourceparse_macro_if(start_location, macro_state, check_end = true, is_unless = false)
Sourceparse_named_args(location, first_name = nil, allow_newline = false)
Sourceparse_named_tuple(location, first_key)
Sourceparse_named_tuple(location)
Sourceparse_named_type_args(end_token)
Sourceparse_negation_suffix(atomic)
Sourceparse_op_assign(allow_ops = true, allow_suffix = true)
Sourceparse_op_assign_no_control(allow_ops = true, allow_suffix = true)
Sourceparse_parenthesized_expression
Sourceparse_path(global, location)
Sourceparse_path
Parse type path.
It also consumes prefix :: to specify global path.
Sourceparse_percent_macro_control
Sourceparse_percent_macro_expression
Sourceparse_responds_to(atomic)
Sourceparse_string_or_symbol_array(klass, elements_type)
Sourceparse_string_without_interpolation(context, want_skip_space = true)
Sourceparse_tuple(first_exp, location)
Sourceparse_type_declaration(var)
Sourceparse_union_types(end_token, *, allow_splats = false)
Sourceparse_unless_after_condition(cond, location)
Sourceparse_var_or_call(global = false, force_call = false)
Sourceparse_visibility_modifier(modifier)
Sourceparse_when_expression(cond, single, exhaustive)
Sourceparse_while_or_until(klass)
Sourceparse_yield(scope = nil, location = @token.location)
Sourcepreserve_stop_on_do(new_value :
Bool = false, &)
Sourcepush_var(var : Var | Arg)
Sourcepush_var(var : TypeDeclaration)
Sourceremove_heredoc_from_line(line, indent, line_number)
Sourcetype_start?(*, consume_newlines)
Looks ahead next tokens to check whether they indicate type.
Sourceunexpected_token(msg :
String |
Nil = nil, token :
Token = @token)
Sourceunexpected_token_in_atomic
Sourcevalid_select_when?(node)
Sourcevisibility=(visibility : Visibility | Nil)
Sourcewhen_exp_constant?(exp)
Only error on constant values, because calls might have side-effects:
a first call might return one value and not match the case
value, but the second same call returns something different
and matches it.
Sourcewith_isolated_var_scope(create_scope = true, &)
If create_scope is true, creates an isolated variable scope and returns
the yield result, resetting the scope afterwards. Otherwise simply returns
the yield result without touching the scopes.
Sourcewith_lexical_var_scope
Creates a new variable scope with the same variables as the current scope,
and then returns the yield result, resetting the scope afterwards.
Source