Sha256: d941c39b0cfffad7bc266d889c437164dbe30a3106e8603b3a3f83643a1ac9f4
Contents?: true
Size: 494 Bytes
Versions: 2
Compression:
Stored size: 494 Bytes
Contents
# Matches a string of characters. # # Example: # # str('foo') # matches 'foo' # class Parslet::Atoms::Str < Parslet::Atoms::Base attr_reader :str def initialize(str) @str = str end def try(io) old_pos = io.pos s = io.read(str.size) error(io, "Premature end of input") unless s && s.size==str.size error(io, "Expected #{str.inspect}, but got #{s.inspect}", old_pos) \ unless s==str return s end def to_s_inner(prec) "'#{str}'" end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
parslet-0.11.0 | lib/parslet/atoms/str.rb |
parslet-0.10.1 | lib/parslet/atoms/str.rb |