Class: Yaparc::String
Constant Summary
Constants included from Parsable
Parsable::IS_ALPHANUM, Parsable::IS_DIGIT, Parsable::IS_LOWER, Parsable::IS_SPACE, Parsable::IS_WHITESPACE
Instance Attribute Summary
Attributes included from Parsable
Instance Method Summary collapse
-
#initialize(string) ⇒ String
constructor
A new instance of String.
Methods included from Parsable
Constructor Details
#initialize(string) ⇒ String
Returns a new instance of String.
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 |
# File 'lib/yaparc.rb', line 264 def initialize(string) @parser = lambda do |input| case result = Item.new.parse(string) when Result::OK Seq.new( Char.new(result.value), Yaparc::String.new(result.input), Succeed.new(result.value + result.input) ) do |char_result, string_result, succeed_result| succeed_result end else Succeed.new(result) # Is it OK? end end end |