Module: ABNF::RepeatC1

Defined in:
lib/abnf.rb

Instance Method Summary collapse

Instance Method Details

#ast_wrap(a) ⇒ Object



805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
# File 'lib/abnf.rb', line 805

def ast_wrap(a)
    s = 1
    e = 1
    el = elements.map {|e| e.text_value}
    if el[1] == "*"
      if el[0] != ""
        s = el[0].to_i
      else
        s = 0
      end
      if el[2] != ""
        e = el[2].to_i
      else
        e = true
      end
    end
    occ = [s, e]
    if occ == [1, 1]
      a
    else
      ["rep", s, e, a]
    end
end