Class: ABNF::Parser::Compiler::Option

Inherits:
RuleBuilder show all
Defined in:
lib/abnf/parser/compiler/option.rb

Instance Attribute Summary collapse

Attributes inherited from RuleBuilder

#compiler

Instance Method Summary collapse

Methods inherited from RuleBuilder

#call, #initialize

Constructor Details

This class inherits a constructor from ABNF::Parser::Compiler::RuleBuilder

Instance Attribute Details

#ruleObject

Returns the value of attribute rule.



5
6
7
# File 'lib/abnf/parser/compiler/option.rb', line 5

def rule
  @rule
end

Instance Method Details

#option_stop(_) ⇒ Object



7
8
9
# File 'lib/abnf/parser/compiler/option.rb', line 7

def option_stop _
  compiler.pop rule
end

#start_rule(token) ⇒ Object



11
12
13
14
15
# File 'lib/abnf/parser/compiler/option.rb', line 11

def start_rule token
  compiler.push Alternation do |rule|
    self.rule = rule
  end
end