lib/pione/transformer/rule-definition-transformer.rb in pione-0.1.1 vs lib/pione/transformer/rule-definition-transformer.rb in pione-0.1.2
- old
+ new
@@ -1,53 +1,55 @@
module Pione
module Transformer
+ # RuleDefinitionTransformer is a transformer for syntax tree of rule definitions.
module RuleDefinitionTransformer
include TransformerModule
+ # @api private
def check_model_type(obj, pione_model_type)
pione_model_type.match(obj.pione_mode_type)
end
module_function :check_model_type
- # rule_definition
+ # Transform +:rule_definition+ as Model::Rule.
rule(:rule_definition => {
:rule_header => simple(:rule_expr),
:rule_conditions => sequence(:conditions),
:block => simple(:block) }) {
inputs = Naming::InputLine.values(conditions)
outputs = Naming::OutputLine.values(conditions)
params = Parameters.merge(*Naming::ParamLine.values(conditions))
features = Feature::AndExpr.new(*Naming::FeatureLine.values(conditions))
- condition = RuleCondition.new(inputs, outputs, params, features)
+ condition = RuleCondition.new(inputs, outputs, params, features, TicketExpr.empty, TicketExpr.empty)
case block
when ActionBlock
ActionRule
when FlowBlock
FlowRule
end.new(rule_expr, condition, block)
}
- # input_line
+ # Transform +:input_line+ as Naming::InputLine.
rule(:input_line => simple(:data_expr)) {
TypeDataExpr.check(data_expr)
Naming.InputLine(data_expr)
}
- # output_line
+ # Transform +:output_line+ as Naming::OutputLine.
rule(:output_line => simple(:data_expr)) {
TypeDataExpr.check(data_expr)
Naming.OutputLine(data_expr)
}
- # param_line
+ # Transform +:param_line+ as Naming::ParamLine.
rule(:param_line => simple(:param)) {
unless TypeAssignment.match(param) or TypeParameters.match(param)
raise PioneModelTypeError.new(param, TypeAssignment)
end
Naming.ParamLine(param)
}
- # feature_line
+ # Transform +:feature_line+ as Naming::FeatureLine.
rule(:feature_line => simple(:feature)) {
TypeFeature.check(feature)
Naming.FeatureLine(feature)
}
end