Sha256: de0b4eb634e90ef8e582f41ea222da33436c487cf3c9a6322258ebbfe5305efd

Contents?: true

Size: 529 Bytes

Versions: 6

Compression:

Stored size: 529 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 ParseException => ex
          puts "Command parser failed with exception: #{ ex.message }"
        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.2.0 lib/qcmd/parser.rb
qcmd-0.1.16 lib/qcmd/parser.rb
qcmd-0.1.16.pre2 lib/qcmd/parser.rb
qcmd-0.1.16.pre lib/qcmd/parser.rb
qcmd-0.1.15 lib/qcmd/parser.rb
qcmd-0.1.14 lib/qcmd/parser.rb