Module: Xmk

Defined in:
lib/xmk.rb

Class Method Summary collapse

Class Method Details

.error(msg, l) ⇒ Object



62
63
64
65
# File 'lib/xmk.rb', line 62

def self.error(msg, l)
  puts "#{msg} on line #{l}"
  exit(65)
end

.labelsObject



71
72
73
# File 'lib/xmk.rb', line 71

def self.labels
  @@labels
end

.mainObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/xmk.rb', line 17

def self.main()
  @@targets = Array.new
  @@platforms = Array.new
  @@labels = Array.new
  options = {}
  options[:verbose] = false
  options[:skipcomp] = false
  options[:disable_cmd] = false
  optparse = OptionParser.new do|opts|
    opts.banner = "Usage: xmk [options]"
    opts.on('-h', '--help', 'Display this screen') do
      puts opts
      exit
    end

    opts.on('-t', '--target TARGET', 'Target') do |arg|
      @@targets.push(arg)
    end

    opts.on('-p', '--platform PLATFORM', 'Platform') do |arg|
      @@platforms.push(arg)
    end

    opts.on('-l', '--label LABEL', 'Label') do |arg|
      @@labels.push(arg)
    end

    opts.on('-v', '--verbose', 'Verbose mode') do
      options[:verbose] = true
    end
    opts.on('-s', '--skip-compilation', 'Skip compilation') do
      options[:skipcomp] = true
    end
    opts.on('-d', '--disable-commands', 'Disable commands') do
      options[:disable_cmd] = true
    end
  end
  optparse.parse!

  @@options = options

  lexer = Lexer.new
  Parser.new(lexer.scan).parse
end

.optionsObject



67
68
69
# File 'lib/xmk.rb', line 67

def self.options
  @@options
end

.platformsObject



75
76
77
# File 'lib/xmk.rb', line 75

def self.platforms
  @@platforms
end


83
84
85
# File 'lib/xmk.rb', line 83

def self.print(msg)
  puts "xmk: #{msg}"
end

.targetsObject



79
80
81
# File 'lib/xmk.rb', line 79

def self.targets
  @@targets
end