Module: Qcmd::Parser

Defined in:
lib/qcmd/parser.rb

Class Method Summary collapse

Class Method Details

.generate(sexp) ⇒ Object



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

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

.parse(string) ⇒ Object



11
12
13
14
15
16
17
18
# 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 ParseException => ex
    puts "Command parser failed with exception: #{ ex.message }"
  end
end

.parserObject



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

def parser
  @parser ||= Sexpistol.new
end