Module: SFRP::Mono::DSL

Defined in:
lib/sfrp/mono/dsl.rb

Defined Under Namespace

Classes: CaseProxy, FuncProxy, NodeDepProxy

Instance Method Summary collapse

Instance Method Details

#call_e(type_str, func_str, *arg_exps) ⇒ Object



33
34
35
# File 'lib/sfrp/mono/dsl.rb', line 33

def call_e(type_str, func_str, *arg_exps)
  FuncCallExp.new(type_str, func_str, arg_exps)
end

#func(type_str, func_str, &block) ⇒ Object



20
21
22
23
24
25
# File 'lib/sfrp/mono/dsl.rb', line 20

def func(type_str, func_str, &block)
  fp = FuncProxy.new
  block.call(fp) if block
  ftype = fp.ftype(type_str)
  Function.new(func_str, fp.param_strs, ftype, fp.exp, fp.ffi_str)
end

#match_e(type_str, left_exp, &block) ⇒ Object



27
28
29
30
31
# File 'lib/sfrp/mono/dsl.rb', line 27

def match_e(type_str, left_exp, &block)
  cp = CaseProxy.new
  block.call(cp) if block
  MatchExp.new(type_str, left_exp, cp.to_a)
end

#node(type_str, node_str, eval_func_str, init_func_str = nil, &block) ⇒ Object



14
15
16
17
18
# File 'lib/sfrp/mono/dsl.rb', line 14

def node(type_str, node_str, eval_func_str, init_func_str = nil, &block)
  px = NodeDepProxy.new
  block.call(px) if block
  Node.new(node_str, type_str, px.to_a, eval_func_str, init_func_str)
end

#pany(type_str, ref_var_str = nil) ⇒ Object



53
54
55
# File 'lib/sfrp/mono/dsl.rb', line 53

def pany(type_str, ref_var_str = nil)
  Pattern.new(type_str, nil, ref_var_str, [])
end

#pat(type_str, vconst_str, *arg_patterns) ⇒ Object



45
46
47
# File 'lib/sfrp/mono/dsl.rb', line 45

def pat(type_str, vconst_str, *arg_patterns)
  Pattern.new(type_str, vconst_str, nil, arg_patterns)
end

#pref(type_str, vconst_str, ref_var_str, *arg_patterns) ⇒ Object



49
50
51
# File 'lib/sfrp/mono/dsl.rb', line 49

def pref(type_str, vconst_str, ref_var_str, *arg_patterns)
  Pattern.new(type_str, vconst_str, ref_var_str, arg_patterns)
end

#type(type_str, vconst_strs = nil, static = false, native_str = nil) ⇒ Object



6
7
8
# File 'lib/sfrp/mono/dsl.rb', line 6

def type(type_str, vconst_strs = nil, static = false, native_str = nil)
  Type.new(type_str, vconst_strs, static, native_str)
end

#v_e(type_str, var_str) ⇒ Object



41
42
43
# File 'lib/sfrp/mono/dsl.rb', line 41

def v_e(type_str, var_str)
  VarRefExp.new(type_str, var_str)
end

#vc_call_e(type_str, vconst_str, *arg_exps) ⇒ Object



37
38
39
# File 'lib/sfrp/mono/dsl.rb', line 37

def vc_call_e(type_str, vconst_str, *arg_exps)
  VConstCallExp.new(type_str, vconst_str, arg_exps)
end

#vconst(type_str, vconst_str, arg_type_strs, native_str = nil) ⇒ Object



10
11
12
# File 'lib/sfrp/mono/dsl.rb', line 10

def vconst(type_str, vconst_str, arg_type_strs, native_str = nil)
  VConst.new(vconst_str, type_str, arg_type_strs, native_str)
end