Class: Yaparc::Tokenize

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

Constant Summary

Constants included from Parsable

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Parsable

#parse

Constructor Details

#initialize(parser, prefix: nil, postfix: nil) ⇒ Tokenize

Returns a new instance of Tokenize.



9
10
11
12
13
14
15
16
# File 'lib/yaparc/tokenize.rb', line 9

def initialize(parser, prefix: nil, postfix: nil)
  @parser = lambda do |_input|
    @prefix = prefix || WhiteSpace.new
    @postfix = postfix || WhiteSpace.new
    block_given? and yield self
    Seq.new(@prefix, parser, @postfix) { |_, vs, _| vs }
  end
end

Instance Attribute Details

#postfix=(value) ⇒ Object (writeonly)

Sets the attribute postfix

Parameters:

  • value

    the value to set the attribute postfix to.



7
8
9
# File 'lib/yaparc/tokenize.rb', line 7

def postfix=(value)
  @postfix = value
end

#prefix=(value) ⇒ Object (writeonly)

Sets the attribute prefix

Parameters:

  • value

    the value to set the attribute prefix to.



7
8
9
# File 'lib/yaparc/tokenize.rb', line 7

def prefix=(value)
  @prefix = value
end