class ABNF::Parser::Compiler::Alternation
Public Instance Methods
alternation_slash(_)
click to toggle source
# File lib/abnf/parser/compiler/alternation.rb, line 5 def alternation_slash _ end
alternative(rule)
click to toggle source
# File lib/abnf/parser/compiler/alternation.rb, line 8 def alternative rule alternatives << rule end
alternatives()
click to toggle source
# File lib/abnf/parser/compiler/alternation.rb, line 12 def alternatives @alternatives ||= [] end
c_nl(token)
click to toggle source
# File lib/abnf/parser/compiler/alternation.rb, line 16 def c_nl token finished compiler.handle token end
c_wsp(_)
click to toggle source
# File lib/abnf/parser/compiler/alternation.rb, line 21 def c_wsp _ end
finished()
click to toggle source
# File lib/abnf/parser/compiler/alternation.rb, line 29 def finished if alternatives.size == 1 rule = alternatives[0] else abnf = alternatives.map &:abnf abnf *= ' / ' rule = Rules::Alternation.new alternatives, abnf end compiler.pop rule end
group_stop(token)
click to toggle source
# File lib/abnf/parser/compiler/alternation.rb, line 24 def group_stop token finished compiler.handle token end
option_stop(token)
click to toggle source
# File lib/abnf/parser/compiler/alternation.rb, line 41 def option_stop token finished compiler.handle token end
start_rule(token)
click to toggle source
# File lib/abnf/parser/compiler/alternation.rb, line 46 def start_rule token compiler.push Concatenation do |rule| alternative rule end end