Class: Yaparc::Tokenize
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
Returns the value of attribute postfix.
-
#prefix ⇒ Object
Returns the value of attribute prefix.
Attributes included from Parsable
Instance Method Summary collapse
-
#initialize(parser, args = {}, &block) ⇒ Tokenize
constructor
A new instance of Tokenize.
Methods included from Parsable
Constructor Details
#initialize(parser, args = {}, &block) ⇒ Tokenize
Returns a new instance of Tokenize.
386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 |
# File 'lib/yaparc.rb', line 386 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
#postfix ⇒ Object
Returns the value of attribute postfix.
384 385 386 |
# File 'lib/yaparc.rb', line 384 def postfix @postfix end |
#prefix ⇒ Object
Returns the value of attribute prefix.
384 385 386 |
# File 'lib/yaparc.rb', line 384 def prefix @prefix end |