Debian Codegraph @

core/miku/macro.rb

raw symbols SCIP
1 # -*- coding: utf-8 -*-
2 require_relative 'atom'
3
4 module MIKU
5 class Macro
6 include Atom
7 def initialize(args, list)
8 @args = args
9 @list = list
10 end
11
12 def macro_expand(*args)
13 if not(args.is_a? StaticCode) and args.car.is_a?(StaticCode)
14 args.extend(StaticCode).staticcode_copy_info(args.car.staticcode_dump) end
15 scope = MIKU::SymbolTable.new.miracle_binding(@args, args)
16 # @args.zip(args){ |k, v|
17 # scope[k] = [v] }
18 @list.inject(nil){ |last, operator|
19 scope[:last] = last
20 miku(operator, scope) } end
21
22 def inspect
23 "<macro #{@args.inspect} #{@list.inspect}>"
24 end
25 end
26 end