class
Crystal::MacroInterpreter
Defined in:
compiler/crystal/macros/interpreter.crcompiler/crystal/macros/methods.cr
Constructors
- .new(program, scope : Type, path_lookup : Type, a_macro : Macro, call, a_def : Def | Nil = nil, in_macro = false)
- .new(program : Program, scope : Type, path_lookup : Type, location : Location | Nil, vars : Hash(String, Crystal::ASTNode) = {} of String => ASTNode, block : Block | Nil = nil, def __arg3 : Def | Nil = nil, in_macro : Bool = false, call : Call | Nil = nil)
Instance Method Summary
- #accept(node)
- #define_var(name : String, value : ASTNode) : Nil
- #free_vars : Hash(String, TypeVar) | Nil
- #free_vars=(free_vars : Hash(String, TypeVar) | Nil)
- #interpret_compare_versions(node)
- #interpret_debug(node)
- #interpret_env(node)
- #interpret_file_exists?(node)
- #interpret_flag?(node)
- #interpret_p(node)
- #interpret_parse_type(node)
- #interpret_pp!(node)
- #interpret_print(node)
- #interpret_puts(node)
- #interpret_raise(node)
- #interpret_read_file(node, nilable = false)
- #interpret_run(node)
- #interpret_skip_file(node)
- #interpret_system(node)
- #interpret_top_level_call(node)
- #interpret_top_level_call?(node)
- #interpret_warning(node)
-
#interpreted_hook(node : ASTNode, *, location custom_location : Location | Nil = nil) : ASTNode
Calls the program's
interpreted_node_hookhook with the macro ASTNode that was interpreted. - #last : ASTNode
- #macro_expansion_pragmas : Hash(Int32, Array(Lexer::LocPragma)) | Nil
- #macro_expansion_pragmas=(macro_expansion_pragmas : Hash(Int32, Array(Lexer::LocPragma)) | Nil)
-
#not_interpreted_hook(node : ASTNode, use_significant_node : Bool = false, *, location custom_location : Location | Nil = nil) : ASTNode
Calls the program's
interpreted_node_hookhook with the macro ASTNode that was not interpreted. - #replace_block_vars(body, vars)
- #resolve(node : Path)
- #resolve(node : Generic | Metaclass | ProcNotation)
- #resolve(node : Union)
- #resolve(node : ASTNode | Nil)
- #resolve?(node : Path)
- #resolve?(node : Generic | Metaclass | ProcNotation)
- #resolve?(node : Union)
- #resolve?(node : ASTNode)
-
#to_s : String
Returns a nicely readable and concise string representation of this object, typically intended for users.
- #visit(node : Expressions)
- #visit(node : MacroExpression)
- #visit(node : MacroLiteral)
- #visit(node : MacroVerbatim)
- #visit(node : Var)
- #visit(node : StringInterpolation)
- #visit(node : MacroIf)
- #visit(node : MacroFor)
- #visit(node : MacroVar)
- #visit(node : Assign)
- #visit(node : OpAssign)
- #visit(node : MultiAssign)
- #visit(node : And)
- #visit(node : Or)
- #visit(node : Not)
- #visit(node : If)
- #visit(node : Unless)
- #visit(node : Call)
- #visit(node : Yield)
- #visit(node : Path)
- #visit(node : Generic)
- #visit(node : SizeOf)
- #visit(node : AlignOf)
- #visit(node : Splat)
- #visit(node : DoubleSplat)
- #visit(node : IsA)
- #visit(node : InstanceVar)
- #visit(node : TupleLiteral)
- #visit(node : ArrayLiteral)
- #visit(node : HashLiteral)
- #visit(node : NamedTupleLiteral)
- #visit(node : Nop | NilLiteral | BoolLiteral | NumberLiteral | CharLiteral | StringLiteral | SymbolLiteral | RangeLiteral | RegexLiteral | MacroId | TypeNode | Def)
- #visit(node : ASTNode)
- #visit_macro_for_array_like(node, exp)
- #visit_macro_for_array_like(node, exp, entries, &)
- #visit_macro_for_hash_like(node, exp, entries, &)
- #warnings(*args, **options)
- #warnings(*args, **options, &)
Instance methods inherited from class Crystal::Visitor
accept(node)
accept,
end_visit(node)
end_visit,
end_visit_any(node)
end_visit_any,
visit_any(node)
visit_any
Instance methods inherited from class Reference
==(other : self)==(other : JSON::Any)
==(other : YAML::Any)
==(other) ==, dup dup, hash(hasher) hash, initialize initialize, inspect(io : IO) : Nil inspect, object_id : UInt64 object_id, pretty_print(pp) : Nil pretty_print, same?(other : Reference) : Bool
same?(other : Nil) same?, to_s(io : IO) : Nil to_s
Constructor methods inherited from class Reference
new
new,
unsafe_construct(address : Pointer, *args, **opts) : self
unsafe_construct
Class methods inherited from class Reference
pre_initialize(address : Pointer)
pre_initialize
Instance methods inherited from class Object
! : Bool
!,
!=(other)
!=,
!~(other)
!~,
==(other)
==,
===(other : JSON::Any)===(other : YAML::Any)
===(other) ===, =~(other) =~, as(type : Class) as, as?(type : Class) as?, class class, dup dup, hash(hasher)
hash hash, in?(collection : Object) : Bool
in?(*values : Object) : Bool in?, inspect(io : IO) : Nil
inspect : String inspect, is_a?(type : Class) : Bool is_a?, itself itself, nil? : Bool nil?, not_nil!(message)
not_nil! not_nil!, pretty_inspect(width = 79, newline = "\n", indent = 0) : String pretty_inspect, pretty_print(pp : PrettyPrint) : Nil pretty_print, responds_to?(name : Symbol) : Bool responds_to?, tap(&) tap, to_json(io : IO) : Nil
to_json : String to_json, to_pretty_json(indent : String = " ") : String
to_pretty_json(io : IO, indent : String = " ") : Nil to_pretty_json, to_s(io : IO) : Nil
to_s : String to_s, to_yaml(io : IO) : Nil
to_yaml : String to_yaml, try(&) try, unsafe_as(type : T.class) forall T unsafe_as
Class methods inherited from class Object
from_json(string_or_io : String | IO, root : String)from_json(string_or_io : String | IO) from_json, from_yaml(string_or_io : String | IO) from_yaml
Macros inherited from class Object
class_getter(*names, &block)
class_getter,
class_getter!(*names)
class_getter!,
class_getter?(*names, &block)
class_getter?,
class_property(*names, &block)
class_property,
class_property!(*names)
class_property!,
class_property?(*names, &block)
class_property?,
class_setter(*names)
class_setter,
def_clone
def_clone,
def_equals(*fields)
def_equals,
def_equals_and_hash(*fields)
def_equals_and_hash,
def_hash(*fields)
def_hash,
delegate(*methods, to object)
delegate,
forward_missing_to(delegate)
forward_missing_to,
getter(*names, &block)
getter,
getter!(*names)
getter!,
getter?(*names, &block)
getter?,
property(*names, &block)
property,
property!(*names)
property!,
property?(*names, &block)
property?,
setter(*names)
setter
Constructor Detail
def self.new(program, scope : Type, path_lookup : Type, a_macro : Macro, call, a_def : Def | Nil = nil, in_macro = false)
#
def self.new(program : Program, scope : Type, path_lookup : Type, location : Location | Nil, vars : Hash(String, Crystal::ASTNode) = {} of String => ASTNode, block : Block | Nil = nil, def __arg3 : Def | Nil = nil, in_macro : Bool = false, call : Call | Nil = nil)
#
Instance Method Detail
def interpreted_hook(node : ASTNode, *, location custom_location : Location | Nil = nil) : ASTNode
#
Calls the program's interpreted_node_hook hook with the macro ASTNode that was interpreted.
def macro_expansion_pragmas=(macro_expansion_pragmas : Hash(Int32, Array(Lexer::LocPragma)) | Nil)
#
def not_interpreted_hook(node : ASTNode, use_significant_node : Bool = false, *, location custom_location : Location | Nil = nil) : ASTNode
#
Calls the program's interpreted_node_hook hook with the macro ASTNode that was not interpreted.
Description copied from class Object
Returns a nicely readable and concise string representation of this object, typically intended for users.
This method should usually not be overridden. It delegates to
#to_s(IO) which can be overridden for custom implementations.
Also see #inspect.
def visit(node : Nop | NilLiteral | BoolLiteral | NumberLiteral | CharLiteral | StringLiteral | SymbolLiteral | RangeLiteral | RegexLiteral | MacroId | TypeNode | Def)
#