Class: Nasl::CommandTokenize

Inherits:
Command
  • Object
show all
Defined in:
lib/nasl/commands/tokenize.rb

Class Method Summary collapse

Methods inherited from Command

all, banner, find, inherited, initialize!, run

Class Method Details

.analyze(cfg, path, args) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/nasl/commands/tokenize.rb', line 33

def self.analyze(cfg, path, args)
  contents = File.open(path, "rb").read

  begin
    Tokenizer.new(contents, path).get_tokens.each do |t|
      puts "[#{(t.first.to_s + ',').ljust(10)}#{t.last.region.to_s.rjust(20)}]"
    end
  rescue TokenException => e
    puts "The tokenizer raised the following exceptions when processing #{path}:"
    puts e.message
    puts e.backtrace
    puts
  end
end

.bindingObject



29
30
31
# File 'lib/nasl/commands/tokenize.rb', line 29

def self.binding
  'tokenize'
end