class 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
Calls superclass method
# 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