Class: Yaparc::Tokenize

Inherits:
Object
  • Object
show all
Includes:
Parsable
Defined in:
lib/yaparc.rb

Constant Summary

Constants included from Parsable

Parsable::IS_ALPHANUM, Parsable::IS_DIGIT, Parsable::IS_LOWER, Parsable::IS_SPACE, Parsable::IS_WHITESPACE

Instance Attribute Summary collapse

Attributes included from Parsable

#tree

Instance Method Summary collapse

Methods included from Parsable

#eval, included, #parse

Constructor Details

#initialize(parser, args = { }, &block) ⇒ Tokenize

Returns a new instance of Tokenize.



393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
# File 'lib/yaparc.rb', line 393

def initialize(parser, args = { }, &block)
  @parser = lambda do |input|
    @prefix = args[:prefix] ? args[:prefix] : WhiteSpace.new 
    @postfix = args[:postfix] ? args[:postfix] : WhiteSpace.new
    if block_given?
      yield self
      Seq.new(@prefix, parser, @postfix) do |_, vs, _|
        vs
      end
    else
      Seq.new(@prefix, parser, @postfix) do |_, vs, _|
        vs
      end
    end
  end
end

Instance Attribute Details

#postfixObject

Returns the value of attribute postfix.



391
392
393
# File 'lib/yaparc.rb', line 391

def postfix
  @postfix
end

#prefixObject

Returns the value of attribute prefix.



391
392
393
# File 'lib/yaparc.rb', line 391

def prefix
  @prefix
end