Class: Kapusta::Compiler::MacroExpander
- Inherits:
-
Object
- Object
- Kapusta::Compiler::MacroExpander
- Defined in:
- lib/kapusta/compiler/macro_expander.rb
Defined Under Namespace
Class Method Summary collapse
Instance Method Summary collapse
- #expand_all(forms) ⇒ Object
-
#initialize(path: nil) ⇒ MacroExpander
constructor
A new instance of MacroExpander.
Constructor Details
#initialize(path: nil) ⇒ MacroExpander
Returns a new instance of MacroExpander.
22 23 24 25 |
# File 'lib/kapusta/compiler/macro_expander.rb', line 22 def initialize(path: nil) @macros = {} @path = path end |
Class Method Details
.fresh_gensym(prefix) ⇒ Object
11 12 13 14 |
# File 'lib/kapusta/compiler/macro_expander.rb', line 11 def fresh_gensym(prefix) @gensym_counter += 1 GeneratedSym.new("#{prefix}_g#{@gensym_counter}", @gensym_counter) end |
.fresh_local_gensym(prefix) ⇒ Object
16 17 18 19 |
# File 'lib/kapusta/compiler/macro_expander.rb', line 16 def fresh_local_gensym(prefix) @gensym_counter += 1 GeneratedSym.new("#{prefix}_local_#{@gensym_counter}", @gensym_counter) end |
Instance Method Details
#expand_all(forms) ⇒ Object
27 28 29 |
# File 'lib/kapusta/compiler/macro_expander.rb', line 27 def (forms) forms.flat_map { |form| (form) } end |