Module: Qcmd::Parser

Defined in:
lib/qcmd/parser.rb

Class Method Summary collapse

Class Method Details

.generate(sexp) ⇒ Object



21
22
23
# File 'lib/qcmd/parser.rb', line 21

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

.parse(string) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/qcmd/parser.rb', line 11

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

.parserObject



7
8
9
# File 'lib/qcmd/parser.rb', line 7

def parser
  @parser ||= Sexpistol.new
end