Class: Yaparc::Tokenize
- Inherits:
-
Object
- Object
- Yaparc::Tokenize
- 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
-
#postfix ⇒ Object
writeonly
Sets the attribute postfix.
-
#prefix ⇒ Object
writeonly
Sets the attribute prefix.
Instance Method Summary collapse
-
#initialize(parser, prefix: nil, postfix: nil) ⇒ Tokenize
constructor
A new instance of Tokenize.
Methods included from Parsable
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
7 8 9 |
# File 'lib/yaparc/tokenize.rb', line 7 def postfix=(value) @postfix = value end |
#prefix=(value) ⇒ Object (writeonly)
Sets the attribute prefix
7 8 9 |
# File 'lib/yaparc/tokenize.rb', line 7 def prefix=(value) @prefix = value end |