class ABNF::Var

Attributes

name[R]

Public Class Methods

new(name) click to toggle source
# File lib/abnf/grammar.rb, line 149
def initialize(name)
  @name = name
end

Public Instance Methods

each_var() { |name end| ... } click to toggle source
# File lib/abnf/grammar.rb, line 154
  def each_var(&block) yield @name end
  def subst_var(&block) yield(@name) || self end
end
recursion(syms, lhs) click to toggle source
# File lib/abnf/regexp.rb, line 354
def recursion(syms, lhs)
  if lhs == self.name
    JustRecursion | SelfRecursion
  elsif syms.include? self.name
    JustRecursion
  else
    NonRecursion
  end
end
remove_just_recursion(n) click to toggle source
# File lib/abnf/regexp.rb, line 364
def remove_just_recursion(n)
  if n == self.name
    EmptySet
  else
    self
  end
end
split_left_recursion(n) click to toggle source
# File lib/abnf/regexp.rb, line 372
def split_left_recursion(n)
  if n == self.name
    [EmptySet, EmptySequence]
  else
    [self, EmptySet]
  end
end
Also aliased as: split_right_recursion
split_recursion(n) click to toggle source
# File lib/abnf/regexp.rb, line 381
def split_recursion(n)
  if n == self.name
    [EmptySet, EmptySet, EmptySet]
  else
    [EmptySet, self, EmptySet]
  end
end
split_right_recursion(n)
subst_var() { |name| ... } click to toggle source
# File lib/abnf/grammar.rb, line 155
def subst_var(&block) yield(@name) || self end
useful?(useful_names) click to toggle source
# File lib/abnf/abnf.rb, line 123
def useful?(useful_names) useful_names[@name] end