module ABNFGrammar::RepeatC1

Public Instance Methods

ast_wrap(a) click to toggle source
# File lib/abnfgrammar.rb, line 805
def ast_wrap(a)
                                                   s = 1
                                                   e = 1
                                                   el = elements.map {|e| e.text_value}
                                                   if el != []
                                                     el[2] = el[0] = el.join if el[1] != "*"
                                                     s = if el[0] != ""
                                                           el[0].to_i
                                                         else
                                                           0
                                                         end
                                                     e = if el[2] != ""
                                                           el[2].to_i
                                                         else
                                                           true
                                                         end
                                                   end
                                                   occ = [s, e]
                                                   if occ == [1, 1]
                                                     a
                                                   else
                                                     ["rep", s, e, a]
                                                   end
                                               end