Class: ABNF::Compiler::Grammar::Rule
- Inherits:
-
Object
- Object
- ABNF::Compiler::Grammar::Rule
- Includes:
- Compiler
- Defined in:
- lib/abnf/compiler/grammar/rule.rb
Constant Summary collapse
- DELIMITER =
%r{=/?}n
Instance Attribute Summary
Attributes included from Compiler
Instance Method Summary collapse
Methods included from Compiler
Instance Method Details
#call ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/abnf/compiler/grammar/rule.rb', line 9 def call reference = Rulename.compile stream return unless reference rulename = reference.rulename stream.match C_WSP alternative_form = extract_delimiter stream.match C_WSP alternative = Alternative.compile stream stream.match C_NL RuleList::Entry.new rulename, alternative, alternative_form end |
#extract_delimiter ⇒ Object
23 24 25 26 27 |
# File 'lib/abnf/compiler/grammar/rule.rb', line 23 def extract_delimiter match_data = stream.match DELIMITER return unless match_data match_data.to_s == '=/'.freeze end |