class List::Matcher::SymbolPattern

Attributes

char[RW]
left[RW]
pat[RW]
right[RW]
symbol[RW]
var[RW]

Public Class Methods

new(engine, char, var, pat, atomic: (var.is_a?(Regexp) && pat.nil?), left: nil, right: nil) click to toggle source
Calls superclass method List::Matcher::Node::new
# File lib/list_matcher.rb, line 523
def initialize(engine, char, var, pat, atomic: (var.is_a?(Regexp) && pat.nil?), left: nil, right: nil)
  super(engine, nil)
  @char   = char
  @symbol = var.to_s
  @var    = var.is_a?(String) || var.is_a?(Symbol) ? Regexp.new(Regexp.quote(var.to_s)) : var
  @pat    = pat || var.to_s
  @atomic = !!atomic
  @left   = left
  @right  = right
end

Public Instance Methods

atomic?() click to toggle source
# File lib/list_matcher.rb, line 538
def atomic?
  @atomic
end
convert() click to toggle source
# File lib/list_matcher.rb, line 546
def convert
  rx = @pat
  finalize rx
end
dup() click to toggle source
# File lib/list_matcher.rb, line 534
def dup
  self.class.new engine, char, var, pat, atomic: atomic?, left: left, right: right
end
optionalize(bool) click to toggle source
# File lib/list_matcher.rb, line 551
def optionalize(bool)
  n = self
  if bool
    n = n.dup
    n.optional = bool
  end
  n
end
to_s() click to toggle source
# File lib/list_matcher.rb, line 542
def to_s
  self.char
end