Sha256: bc08c710c0d2a3fb53f2a06ae62e32bffdc7364edaae3a0c771c367ac0b1c9b6

Contents?: true

Size: 616 Bytes

Versions: 14

Compression:

Stored size: 616 Bytes

Contents

# -*- encoding: utf-8 -*-
module SXP; class Reader
  ##
  # An extended S-expression parser.
  class Extended < Basic
    LPARENS  = [?(, ?[]
    RPARENS  = [?), ?]]
    ATOM     = /^[^\s()\[\]]+/

    ##
    # @return [Object]
    def read_token
      case peek_char
        when ?[, ?] then [:list, read_char]
        else super
      end
    end

    ##
    # @return [void]
    def skip_comments
      until eof?
        case (char = peek_char).chr
          when /\s+/ then skip_char
          when /;/   then skip_line
          else break
        end
      end
    end
  end # Extended
end; end # SXP::Reader

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
sxp-2.0.0 lib/sxp/reader/extended.rb
sxp-1.3.0 lib/sxp/reader/extended.rb
sxp-1.2.4 lib/sxp/reader/extended.rb
sxp-1.2.3 lib/sxp/reader/extended.rb
sxp-1.2.2 lib/sxp/reader/extended.rb
sxp-1.2.1 lib/sxp/reader/extended.rb
sxp-1.2.0 lib/sxp/reader/extended.rb
sxp-1.1.0 lib/sxp/reader/extended.rb
sxp-1.0.2 lib/sxp/reader/extended.rb
sxp-1.0.1 lib/sxp/reader/extended.rb
sxp-1.0.0 lib/sxp/reader/extended.rb
sxp-1.0.0.beta1 lib/sxp/reader/extended.rb
sxp-0.1.5 lib/sxp/reader/extended.rb
sxp-0.1.4 lib/sxp/reader/extended.rb