module ABNFGrammar::Alternation2

Public Instance Methods

ast() click to toggle source
# File lib/abnfgrammar.rb, line 533
def ast
                                                     conc2 = elements[1].elements.map {|x| x.concatenation}
                                                     # warn ["alt!!!", concatenation, conc2].inspect
                                                     e = [elements[0], *conc2].map {|e| e.ast}.compact
                                                     e.size == 1 ? e[0] : ["alt", *e]
                                                   end