Class: Antelope::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/antelope/cli.rb

Instance Method Summary collapse

Instance Method Details

#compile(*files) ⇒ Object



11
12
13
14
15
# File 'lib/antelope/cli.rb', line 11

def compile(*files)
  files.each do |file|
    compile_file(file)
  end
end

#compile_file(file) ⇒ Object (private)



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/antelope/cli.rb', line 19

def compile_file(file)
  puts "Compiling #{file}... "

  grammar = Ace::Grammar.from_file(file)
  grammar.generate(options)

rescue => e
  $stderr.puts "Error while compiling: #{e.class}: #{e.message}"

  if options[:verbose]
    $stderr.puts e.backtrace[0..10].map { |_| "\t#{_}" }
  end
end