Class: Parslet::Parser::Visitors::Citrus

### Home Classes Methods

### In Files

- lib/parslet/export.rb

### Parent

Object

### Methods

- ::new
- #visit_alternative
- #visit_entity
- #visit_lookahead
- #visit_named
- #visit_re
- #visit_repetition
- #visit_sequence
- #visit_str

### Files

- README

### Class/Module Index

Quicksearch

- Parslet
- Parslet::Atoms
- Parslet::Atoms::Alternative
- Parslet::Atoms::Base
- Parslet::Atoms::CanFlatten
- Parslet::Atoms::Capture
- Parslet::Atoms::Context
- Parslet::Atoms::DSL
- Parslet::Atoms::Dynamic
- Parslet::Atoms::Entity
- Parslet::Atoms::Lookahead
- Parslet::Atoms::Named
- Parslet::Atoms::Precedence
- Parslet::Atoms::Re
- Parslet::Atoms::Repetition
- Parslet::Atoms::Scope
- Parslet::Atoms::Sequence
- Parslet::Atoms::Str
- Parslet::Cause
- Parslet::ClassMethods
- Parslet::DelayedMatchConstructor
- Parslet::ErrorReporter
- Parslet::ErrorReporter::Deepest
- Parslet::ErrorReporter::Tree
- Parslet::Expression
- Parslet::Expression::Treetop
- Parslet::Expression::Treetop::Parser
- Parslet::Expression::Treetop::Transform
- Parslet::ParseFailed
- Parslet::Parser
- Parslet::Parser::PrettyPrinter
- Parslet::Parser::Visitors
- Parslet::Parser::Visitors::Citrus
- Parslet::Parser::Visitors::Treetop
- Parslet::Pattern
- Parslet::Pattern::SequenceBind
- Parslet::Pattern::SimpleBind
- Parslet::Pattern::SubtreeBind
- Parslet::Scope
- Parslet::Scope::Binding
- Parslet::Scope::NotFound
- Parslet::Slice
- Parslet::Source
- Parslet::Source::LineCache
- Parslet::Source::RangeSearch
- Parslet::Transform
- Parslet::Transform::Context

No matching classes.

# Parslet::Parser::Visitors::Citrus

### Attributes

context[R]
output[R]

### Public Class Methods

new(context) click to toggle source

    # File lib/parslet/export.rb, line 10
    def initialize(context)
      @context = context
    end

### Public Instance Methods

visit_alternative(alternatives) click to toggle source

    # File lib/parslet/export.rb, line 40
    def visit_alternative(alternatives)
      '(' <<
      alternatives.
        map { |el| el.accept(self) }.
        join(' | ') <<
      ')'
    end

visit_entity(name, block) click to toggle source

    # File lib/parslet/export.rb, line 21
    def visit_entity(name, block)
      context.deferred(name, block)

      "(#{context.mangle_name(name)})"
    end

visit_lookahead(positive, bound_parslet) click to toggle source

    # File lib/parslet/export.rb, line 48
    def visit_lookahead(positive, bound_parslet)
      (positive ? '&' : '!') <<
      bound_parslet.accept(self)
    end

visit_named(name, parslet) click to toggle source

    # File lib/parslet/export.rb, line 26
    def visit_named(name, parslet)
      parslet.accept(self)
    end

visit_re(match) click to toggle source

    # File lib/parslet/export.rb, line 17
    def visit_re(match)
      match.to_s
    end

visit_repetition(tag, min, max, parslet) click to toggle source

    # File lib/parslet/export.rb, line 37
    def visit_repetition(tag, min, max, parslet)
      parslet.accept(self) << "#{min}*#{max}"
    end

visit_sequence(parslets) click to toggle source

    # File lib/parslet/export.rb, line 30
    def visit_sequence(parslets)
      '(' <<
      parslets.
        map { |el| el.accept(self) }.
        join(' ') <<
      ')'
    end

visit_str(str) click to toggle source

    # File lib/parslet/export.rb, line 14
    def visit_str(str)
      "\"#{str.inspect[1..-2]}\""
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.