Sha256: 445bbf4fdb90f1de3d085cce385a9e701dcfc557e3bdc0d6946be13feb0ba8f2

Contents?: true

Size: 522 Bytes

Versions: 6

Compression:

Stored size: 522 Bytes

Contents

# require 'sxp'
require 'vendor/sexpistol/sexpistol'

module Qcmd
  module Parser
    class << self
      def parser
        @parser ||= Sexpistol.new
      end

      def parse(string)
        # make sure string is wrapped in parens to make the parser happy
        begin
          parser.parse_string "#{ string }"
        rescue => ex
          puts "parser FAILED WITH EXCEPTION: #{ ex.message }"
          raise
        end
      end

      def generate(sexp)
        parser.to_sexp(sexp)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
qcmd-0.1.13 lib/qcmd/parser.rb
qcmd-0.1.12 lib/qcmd/parser.rb
qcmd-0.1.11 lib/qcmd/parser.rb
qcmd-0.1.10 lib/qcmd/parser.rb
qcmd-0.1.9 lib/qcmd/parser.rb
qcmd-0.1.8 lib/qcmd/parser.rb