Sha256: 475ea1ad7c95a5c41bdbc05285c2561efd53f2a5c32378f0d62176ff93671a8f
Contents?: true
Size: 768 Bytes
Versions: 2
Compression:
Stored size: 768 Bytes
Contents
class StringParser attr_reader :line, :eos, :i, :len def initialize(line) raise NilValue if line.nil? raise ExpectedString unless String === line # raise NullString if line.empty? @line = line @len = @line.length @eos = @len == 0 ? true : false @i = 0 end def next return nil if @eos char = @line[@i] @i += 1 @eos = true if @i > @len char end def last? @i > @len - 1 end def eos? @eos = true if last? # duh? @eos end def peek return nil if @eos @line[@i] end def skip_spaces loop do break if peek != " " break if eos? self.next end end end =begin skip next! skip! peek!(?) expect_alpha expect_number skip_spaces expect_eos =end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
livetext-0.9.14 | lib/parser/string.rb |
livetext-0.9.13 | lib/parser/string.rb |