module SFRP::Low::DSL
Public Instance Methods
call_exp(callee_str, arg_exps)
click to toggle source
Expression (String)
# File lib/sfrp/low/dsl.rb, line 86 def call_exp(callee_str, arg_exps) "#{callee_str}(#{arg_exps.map { |e| "(#{e})" }.join(', ')})" end
function(name_str, type_str, static = false, &block)
click to toggle source
# File lib/sfrp/low/dsl.rb, line 15 def function(name_str, type_str, static = false, &block) fp = FuncProxy.new block.call(fp) if block Function.new(static, name_str, type_str, fp.params, fp.stmts) end
if_chain_exp(&block)
click to toggle source
# File lib/sfrp/low/dsl.rb, line 90 def if_chain_exp(&block) ip = IfChainProxy.new block.call(ip) ip.to_exp end
if_stmt(cond_exp, &block)
click to toggle source
# File lib/sfrp/low/dsl.rb, line 76 def if_stmt(cond_exp, &block) stmts = [] block.call(stmts) if block Block.new('if', cond_exp, stmts) end
include_ab(str)
click to toggle source
# File lib/sfrp/low/dsl.rb, line 7 def include_ab(str) Include.new("<#{str}>") end
include_dq(str)
click to toggle source
# File lib/sfrp/low/dsl.rb, line 11 def include_dq(str) Include.new('"' + str + '"') end
macro(str)
click to toggle source
# File lib/sfrp/low/dsl.rb, line 25 def macro(str) Macro.new(str) end
member(str)
click to toggle source
# File lib/sfrp/low/dsl.rb, line 41 def member(str) Member.new(str) end
member_structure(kind_str, var_str, &block)
click to toggle source
# File lib/sfrp/low/dsl.rb, line 35 def member_structure(kind_str, var_str, &block) members = [] block.call(members) if block MemberStructure.new(kind_str, var_str, members) end
stmt(line)
click to toggle source
struct(name_str, &block)
click to toggle source
# File lib/sfrp/low/dsl.rb, line 29 def struct(name_str, &block) members = [] block.call(members) if block Structure.new('struct', name_str, members) end
typedef(str)
click to toggle source
# File lib/sfrp/low/dsl.rb, line 21 def typedef(str) Typedef.new(str) end
while(cond_exp, &block)
click to toggle source
# File lib/sfrp/low/dsl.rb, line 70 def while(cond_exp, &block) stmts = [] block.call(stmts) if block Block.new('while', cond_exp, stmts) end