nasl 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -33,7 +33,7 @@ module Nasl
33
33
  def initialize(tree, *tokens)
34
34
  super
35
35
 
36
- @body = if @tokens.length == 3 then @tokens[1] else nil end
36
+ @body = if @tokens.length == 3 then @tokens[1] else [] end
37
37
 
38
38
  @attributes << :body
39
39
  end
@@ -26,7 +26,7 @@
26
26
 
27
27
  module Nasl
28
28
  class Node
29
- attr_reader :tokens
29
+ attr_reader :ctx, :tokens
30
30
 
31
31
  def initialize(tree, *tokens)
32
32
  # Register new node in the tree.
@@ -38,10 +38,13 @@ module Nasl
38
38
 
39
39
  # Store all of the tokens that made up this node.
40
40
  @tokens = tokens
41
+
42
+ # Extract the context object from the first token.
43
+ @ctx = @tokens.first.ctx
41
44
  end
42
45
 
43
46
  def context(*args)
44
- @tokens.first.context(args.shift, region, *args)
47
+ @ctx.context(region, *args)
45
48
  end
46
49
 
47
50
  def region
@@ -33,11 +33,11 @@ module Nasl
33
33
  def initialize(tree, *tokens)
34
34
  super
35
35
 
36
- @cond = @tokens[1]
37
- @body = @tokens[3]
36
+ @body = @tokens[1]
37
+ @cond = @tokens[3]
38
38
 
39
- @attributes << :cond
40
39
  @attributes << :body
40
+ @attributes << :cond
41
41
  end
42
42
  end
43
43
  end
data/lib/nasl/token.rb CHANGED
@@ -26,7 +26,7 @@
26
26
 
27
27
  module Nasl
28
28
  class Token
29
- attr_reader :body, :name, :region, :type
29
+ attr_reader :body, :ctx, :name, :region, :type
30
30
 
31
31
  def initialize(type, body, region, ctx)
32
32
  @type = type
data/lib/nasl/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Nasl
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nasl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-25 00:00:00.000000000Z
12
+ date: 2011-12-28 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
16
- requirement: &17197461360 !ruby/object:Gem::Requirement
16
+ requirement: &17197216020 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *17197461360
24
+ version_requirements: *17197216020
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: builder
27
- requirement: &17197460940 !ruby/object:Gem::Requirement
27
+ requirement: &17197215600 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *17197460940
35
+ version_requirements: *17197215600
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: racc
38
- requirement: &17197460520 !ruby/object:Gem::Requirement
38
+ requirement: &17197215180 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *17197460520
46
+ version_requirements: *17197215180
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rainbow
49
- requirement: &17197460100 !ruby/object:Gem::Requirement
49
+ requirement: &17197214760 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *17197460100
57
+ version_requirements: *17197214760
58
58
  description:
59
59
  email:
60
60
  - mak@kolybabi.com