Class: Pione::Lang::RuleTable

Inherits:
DelegatableTable show all
Defined in:
lib/pione/lang/environment.rb

Overview

RuleTable is a table for recording rule names and rule definitions.

Instance Method Summary collapse

Methods inherited from DelegatableTable

#bound?, #dumpable, #get, #get!, #get_value, #initialize, #inspect, #keys, #select_names_by, #set, #set!

Constructor Details

This class inherits a constructor from Pione::Lang::DelegatableTable

Instance Method Details

#evaluate_value(env, expr) ⇒ Object

Evaluate table value, but we get the referent recuirsively if the value is a referential rule expression.



143
144
145
146
147
148
149
150
# File 'lib/pione/lang/environment.rb', line 143

def evaluate_value(env, expr)
  if expr.is_a?(RuleExpr)
    definition = get(env, env.setup_package_id(expr))
    definition.set(param_sets: definition.param_sets.merge(expr.param_sets))
  else
    expr
  end
end

#make_reference(package_id, name) ⇒ Object

Make a rule expression as a reference.



153
154
155
# File 'lib/pione/lang/environment.rb', line 153

def make_reference(package_id, name)
  RuleExpr.new(name, package_id)
end