Class: Parslet::Parser::Visitors::Treetop

Inherits:
Citrus
  • Object
show all
Defined in:
lib/parslet/export.rb

Instance Attribute Summary

Attributes inherited from Citrus

#context, #output

Instance Method Summary collapse

Methods inherited from Citrus

#initialize, #visit_entity, #visit_lookahead, #visit_named, #visit_re, #visit_sequence, #visit_str

Constructor Details

This class inherits a constructor from Parslet::Parser::Visitors::Citrus

Instance Method Details

#visit_alternative(alternatives) ⇒ Object



59
60
61
62
63
64
65
# File 'lib/parslet/export.rb', line 59

def visit_alternative(alternatives)
  '(' <<
  alternatives.
    map { |el| el.accept(self) }.
    join(' / ') <<
  ')'
end

#visit_repetition(tag, min, max, parslet) ⇒ Object



55
56
57
# File 'lib/parslet/export.rb', line 55

def visit_repetition(tag, min, max, parslet)
  parslet.accept(self) << "#{min}..#{max}"
end