Module: Flexr::Regexp::AST::Formatting

Defined in:
lib/flexr/regexp/ast.rb

Instance Method Summary collapse

Instance Method Details

#to_sObject



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/flexr/regexp/ast.rb', line 20

def to_s
  name = self.class.name.split("::").last
  case name
  when "Empty", "Fail" then name
  when "ByteRange" then "ByteRange(#{lo}..#{hi})"
  when "CodepointRange" then "CodepointRange(#{lo}..#{hi})"
  when "Anchor" then "Anchor(#{kind})"
  when "Star" then "Star(#{child})"
  when "Repeat" then "Repeat(#{child}, #{minimum}, #{maximum || ''})"
  when "Seq", "Alt" then "#{name}(#{children.join(', ')})"
  else super
  end
end