class ABNF::Elt

Public Instance Methods

*(n) click to toggle source
# File lib/abnf/grammar.rb, line 23
def *(n)
  case n
  when Integer
    rep(n, n)
  when Range
    rep(n.first, n.last - (n.exclude_end? ? 1 : 0))
  else
    raise TypeError.new("Integer or Range expected: #{n}")
  end
end
+(other) click to toggle source
# File lib/abnf/grammar.rb, line 15
def +(other)
  Seq.new(self, other)
end
empty_sequence?() click to toggle source

A variable is assumed as not empty sequence.

# File lib/abnf/grammar.rb, line 11
def empty_sequence?
  false
end
empty_set?() click to toggle source

A variable is assumed as not empty set.

# File lib/abnf/grammar.rb, line 6
def empty_set?
  false
end
remove_left_recursion(n) click to toggle source
# File lib/abnf/regexp.rb, line 168
def remove_left_recursion(n)
  nonrec, rest = split_left_recursion(n)
  Seq.new(nonrec, rest.rep)
end
remove_right_recursion(n) click to toggle source
# File lib/abnf/regexp.rb, line 173
def remove_right_recursion(n)
  nonrec, rest = split_right_recursion(n)
  Seq.new(rest.rep, nonrec)
end
rep(min=0, max=nil, greedy=true) click to toggle source
# File lib/abnf/grammar.rb, line 34
def rep(min=0, max=nil, greedy=true)
  Rep.new(self, min, max, greedy)
end
|(other) click to toggle source
# File lib/abnf/grammar.rb, line 19
def |(other)
  Alt.new(self, other)
end