Module: Pione::Lang::DeclarationParser
- Includes:
- Parslet
- Included in:
- DocumentParser, PNML::Parser
- Defined in:
- lib/pione/lang/declaration-parser.rb
Overview
DeclarationParser is a set of parsers for PIONE declaration setences and blocks.
Constant Summary collapse
- SENTENCES =
SENTENCES is a list of declarative sentences in PIONE language.
[ :variable_binding_sentence, :package_binding_sentence, :param_sentence, :rule_binding_sentence, :constituent_rule_sentence, :input_sentence, :output_sentence, :feature_sentence, :constraint_sentence, :annotation_sentence, :expr_sentence ]
- BLOCKS =
BLOCKS is a list of declaration blocks in PIONE language.
[ :param_block, :flow_rule_block, :action_rule_block, :empty_rule_block ]
Instance Method Summary collapse
-
#binding_sentence(declarator, operator, omittable) ⇒ Object
Make a parser for binding sentences.
Instance Method Details
#binding_sentence(declarator, operator, omittable) ⇒ Object
Make a parser for binding sentences.
53 54 55 56 57 58 59 60 61 |
# File 'lib/pione/lang/declaration-parser.rb', line 53 def binding_sentence(declarator, operator, omittable) binding = expr.as(:expr1) >> padded?(operator) >> expr!.as(:expr2) if omittable line((declarator.as(:declarator) >> pad).maybe >> binding) else line(declarator.as(:declarator) >> pad >> binding) end end |