Class: Parslet::Atoms::Scope

### Home Classes Methods

### In Files

- lib/parslet/atoms/scope.rb

### Parent

Parslet::Atoms::Base

### Methods

- ::new
- #apply
- #cached?
- #to_s_inner

### 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::Atoms::Scope

Starts a new scope in the parsing process. Please also see the captures method.

### Attributes

block[R]

### Public Class Methods

new(block) click to toggle source

    # File lib/parslet/atoms/scope.rb, line 6
    def initialize(block)
      super()

      @block = block
    end

### Public Instance Methods

apply(source, context, consume_all) click to toggle source

    # File lib/parslet/atoms/scope.rb, line 16
    def apply(source, context, consume_all)
      context.scope do
        parslet = block.call
        return parslet.apply(source, context, consume_all)
      end
    end

cached?() click to toggle source

    # File lib/parslet/atoms/scope.rb, line 12
    def cached?
      false
    end

to_s_inner(prec) click to toggle source

    # File lib/parslet/atoms/scope.rb, line 23
    def to_s_inner(prec)
      "scope { #{block.call.to_s(prec)} }"
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.