Class: Kapusta::Compiler::MacroExpander

Inherits:
Object
  • Object
show all
Defined in:
lib/kapusta/compiler/macro_expander.rb

Defined Under Namespace

Classes: Error

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path: nil, loading: nil) ⇒ MacroExpander

Returns a new instance of MacroExpander.



22
23
24
25
26
# File 'lib/kapusta/compiler/macro_expander.rb', line 22

def initialize(path: nil, loading: nil)
  @macros = {}
  @path = path
  @loading = loading || []
end

Class Method Details

.fresh_gensym(prefix) ⇒ Object



13
14
15
# File 'lib/kapusta/compiler/macro_expander.rb', line 13

def fresh_gensym(prefix)
  MacroGensym.fresh_gensym(prefix)
end

.fresh_local_gensym(prefix) ⇒ Object



17
18
19
# File 'lib/kapusta/compiler/macro_expander.rb', line 17

def fresh_local_gensym(prefix)
  MacroGensym.fresh_local_gensym(prefix)
end

Instance Method Details

#expand_all(forms) ⇒ Object



28
29
30
# File 'lib/kapusta/compiler/macro_expander.rb', line 28

def expand_all(forms)
  forms.flat_map { |form| expand_top(form) }
end