nasl 0.0.8 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +5 -0
  3. data/README.md +11 -16
  4. data/Rakefile +38 -0
  5. data/bin/nasl-parse +1 -1
  6. data/lib/nasl.rb +1 -1
  7. data/lib/nasl/cli.rb +1 -1
  8. data/lib/nasl/command.rb +1 -1
  9. data/lib/nasl/commands/benchmark.rb +1 -1
  10. data/lib/nasl/commands/parse.rb +1 -1
  11. data/lib/nasl/commands/test.rb +1 -1
  12. data/lib/nasl/commands/tokenize.rb +1 -1
  13. data/lib/nasl/commands/xml.rb +1 -1
  14. data/lib/nasl/context.rb +5 -5
  15. data/lib/nasl/grammar.racc +104 -16
  16. data/lib/nasl/parser.rb +1 -1
  17. data/lib/nasl/parser/argument.rb +1 -1
  18. data/lib/nasl/parser/array.rb +51 -0
  19. data/lib/nasl/parser/assigment.rb +1 -1
  20. data/lib/nasl/parser/block.rb +7 -1
  21. data/lib/nasl/parser/break.rb +2 -2
  22. data/lib/nasl/parser/call.rb +3 -2
  23. data/lib/nasl/parser/comment.rb +2 -2
  24. data/lib/nasl/parser/continue.rb +2 -2
  25. data/lib/nasl/parser/decrement.rb +1 -1
  26. data/lib/nasl/parser/empty.rb +2 -2
  27. data/lib/nasl/parser/export.rb +1 -1
  28. data/lib/nasl/parser/expression.rb +1 -1
  29. data/lib/nasl/parser/for.rb +2 -2
  30. data/lib/nasl/parser/foreach.rb +4 -4
  31. data/lib/nasl/parser/function.rb +1 -1
  32. data/lib/nasl/parser/global.rb +1 -1
  33. data/lib/nasl/parser/identifier.rb +7 -2
  34. data/lib/nasl/parser/if.rb +2 -2
  35. data/lib/nasl/parser/import.rb +1 -1
  36. data/lib/nasl/parser/include.rb +2 -2
  37. data/lib/nasl/parser/increment.rb +1 -1
  38. data/lib/nasl/parser/integer.rb +7 -2
  39. data/lib/nasl/parser/ip.rb +2 -2
  40. data/lib/nasl/parser/key_value_pair.rb +43 -0
  41. data/lib/nasl/parser/list.rb +41 -0
  42. data/lib/nasl/parser/local.rb +1 -1
  43. data/lib/nasl/parser/lvalue.rb +1 -1
  44. data/lib/nasl/parser/node.rb +2 -2
  45. data/lib/nasl/parser/parameter.rb +43 -0
  46. data/lib/nasl/parser/reference.rb +41 -0
  47. data/lib/nasl/parser/repeat.rb +1 -1
  48. data/lib/nasl/parser/repetition.rb +1 -1
  49. data/lib/nasl/parser/return.rb +2 -2
  50. data/lib/nasl/parser/string.rb +7 -2
  51. data/lib/nasl/parser/tree.rb +2 -2
  52. data/lib/nasl/parser/undefined.rb +2 -2
  53. data/lib/nasl/parser/while.rb +1 -1
  54. data/lib/nasl/test.rb +1 -1
  55. data/lib/nasl/token.rb +2 -2
  56. data/lib/nasl/tokenizer.rb +7 -4
  57. data/lib/nasl/version.rb +27 -1
  58. data/nasl.gemspec +35 -8
  59. data/test/unit/parser/test_array.rb +174 -0
  60. data/test/unit/parser/test_assignment.rb +75 -4
  61. data/test/unit/parser/test_blank.rb +1 -1
  62. data/test/unit/parser/test_block.rb +29 -1
  63. data/test/unit/parser/test_call.rb +57 -5
  64. data/test/unit/parser/test_comment.rb +1 -1
  65. data/test/unit/parser/test_constant.rb +1 -1
  66. data/test/unit/parser/test_empty.rb +1 -1
  67. data/test/unit/parser/test_expressions.rb +8 -1
  68. data/test/unit/parser/test_foreach.rb +43 -0
  69. data/test/unit/parser/test_function.rb +147 -51
  70. data/test/unit/parser/test_global.rb +49 -0
  71. data/test/unit/parser/test_if.rb +3 -3
  72. data/test/unit/parser/test_include.rb +1 -1
  73. data/test/unit/parser/test_incr_decr.rb +1 -1
  74. data/test/unit/parser/test_ip.rb +1 -1
  75. data/test/unit/parser/test_list.rb +42 -0
  76. data/test/unit/parser/test_local.rb +49 -0
  77. data/test/unit/parser/test_return.rb +7 -3
  78. data/test/unit/parser/test_string.rb +1 -1
  79. data/test/unit/parser/test_whitespace.rb +1 -1
  80. data/test/unit/test_context.rb +1 -1
  81. data/test/unit/tokenizer/test_comment.rb +1 -1
  82. data/test/unit/tokenizer/test_empty.rb +1 -1
  83. data/test/unit/tokenizer/test_integer.rb +1 -1
  84. data/test/unit/tokenizer/test_references.rb +41 -0
  85. data/test/unit/tokenizer/test_string.rb +2 -1
  86. metadata +49 -86
@@ -1,5 +1,5 @@
1
1
  ################################################################################
2
- # Copyright (c) 2011-2012, Mak Kolybabi
2
+ # Copyright (c) 2011-2014, Tenable Network Security
3
3
  # All rights reserved.
4
4
  #
5
5
  # Redistribution and use in source and binary forms, with or without
@@ -1,5 +1,5 @@
1
1
  ################################################################################
2
- # Copyright (c) 2011-2012, Mak Kolybabi
2
+ # Copyright (c) 2011-2014, Tenable Network Security
3
3
  # All rights reserved.
4
4
  #
5
5
  # Redistribution and use in source and binary forms, with or without
@@ -0,0 +1,51 @@
1
+ ################################################################################
2
+ # Copyright (c) 2011-2014, Tenable Network Security
3
+ # All rights reserved.
4
+ #
5
+ # Redistribution and use in source and binary forms, with or without
6
+ # modification, are permitted provided that the following conditions are met:
7
+ #
8
+ # 1. Redistributions of source code must retain the above copyright notice, this
9
+ # list of conditions and the following disclaimer.
10
+ #
11
+ # 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ # this list of conditions and the following disclaimer in the documentation
13
+ # and/or other materials provided with the distribution.
14
+ #
15
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
+ # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
19
+ # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20
+ # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21
+ # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22
+ # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23
+ # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24
+ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
+ ################################################################################
26
+
27
+ require 'nasl/parser/node'
28
+
29
+ module Nasl
30
+ class Array < Node
31
+ attr_reader :keys, :pairs
32
+
33
+ def initialize(tree, *tokens)
34
+ super
35
+
36
+ @pairs = if @tokens[1].is_a? ::Array then @tokens[1] else [] end
37
+
38
+ @keys = Hash[@pairs.map do |p|
39
+ if p.key.is_a? String
40
+ k = p.key.text
41
+ else
42
+ k = p.key.value
43
+ end
44
+
45
+ [k, p.value]
46
+ end]
47
+
48
+ @children << :pairs
49
+ end
50
+ end
51
+ end
@@ -1,5 +1,5 @@
1
1
  ################################################################################
2
- # Copyright (c) 2011-2012, Mak Kolybabi
2
+ # Copyright (c) 2011-2014, Tenable Network Security
3
3
  # All rights reserved.
4
4
  #
5
5
  # Redistribution and use in source and binary forms, with or without
@@ -1,5 +1,5 @@
1
1
  ################################################################################
2
- # Copyright (c) 2011-2012, Mak Kolybabi
2
+ # Copyright (c) 2011-2014, Tenable Network Security
3
3
  # All rights reserved.
4
4
  #
5
5
  # Redistribution and use in source and binary forms, with or without
@@ -30,6 +30,8 @@ module Nasl
30
30
  class Block < Node
31
31
  attr_reader :body
32
32
 
33
+ include Enumerable
34
+
33
35
  def initialize(tree, *tokens)
34
36
  super
35
37
 
@@ -37,5 +39,9 @@ module Nasl
37
39
 
38
40
  @children << :body
39
41
  end
42
+
43
+ def each
44
+ @body.each{ |stmt| yield stmt }
45
+ end
40
46
  end
41
47
  end
@@ -1,5 +1,5 @@
1
- !################################################################################
2
- # Copyright (c) 2011-2012, Mak Kolybabi
1
+ ################################################################################
2
+ # Copyright (c) 2011-2014, Tenable Network Security
3
3
  # All rights reserved.
4
4
  #
5
5
  # Redistribution and use in source and binary forms, with or without
@@ -1,5 +1,5 @@
1
1
  ################################################################################
2
- # Copyright (c) 2011-2012, Mak Kolybabi
2
+ # Copyright (c) 2011-2014, Tenable Network Security
3
3
  # All rights reserved.
4
4
  #
5
5
  # Redistribution and use in source and binary forms, with or without
@@ -34,7 +34,8 @@ module Nasl
34
34
  super
35
35
 
36
36
  @name = @tokens[0]
37
- @args = if @tokens[2].is_a? Array then @tokens[2] else [] end
37
+
38
+ @args = if @tokens[2].is_a? ::Array then @tokens[2] else [] end
38
39
 
39
40
  @arg = {}
40
41
  @args.select { |a| a.type == :named }.each do |a|
@@ -1,5 +1,5 @@
1
- !################################################################################
2
- # Copyright (c) 2011-2012, Mak Kolybabi
1
+ ################################################################################
2
+ # Copyright (c) 2011-2014, Tenable Network Security
3
3
  # All rights reserved.
4
4
  #
5
5
  # Redistribution and use in source and binary forms, with or without
@@ -1,5 +1,5 @@
1
- !################################################################################
2
- # Copyright (c) 2011-2012, Mak Kolybabi
1
+ ################################################################################
2
+ # Copyright (c) 2011-2014, Tenable Network Security
3
3
  # All rights reserved.
4
4
  #
5
5
  # Redistribution and use in source and binary forms, with or without
@@ -1,5 +1,5 @@
1
1
  ################################################################################
2
- # Copyright (c) 2011-2012, Mak Kolybabi
2
+ # Copyright (c) 2011-2014, Tenable Network Security
3
3
  # All rights reserved.
4
4
  #
5
5
  # Redistribution and use in source and binary forms, with or without
@@ -1,5 +1,5 @@
1
- !################################################################################
2
- # Copyright (c) 2011-2012, Mak Kolybabi
1
+ ################################################################################
2
+ # Copyright (c) 2011-2014, Tenable Network Security
3
3
  # All rights reserved.
4
4
  #
5
5
  # Redistribution and use in source and binary forms, with or without
@@ -1,5 +1,5 @@
1
1
  ################################################################################
2
- # Copyright (c) 2011-2012, Mak Kolybabi
2
+ # Copyright (c) 2011-2014, Tenable Network Security
3
3
  # All rights reserved.
4
4
  #
5
5
  # Redistribution and use in source and binary forms, with or without
@@ -1,5 +1,5 @@
1
1
  ################################################################################
2
- # Copyright (c) 2011-2012, Mak Kolybabi
2
+ # Copyright (c) 2011-2014, Tenable Network Security
3
3
  # All rights reserved.
4
4
  #
5
5
  # Redistribution and use in source and binary forms, with or without
@@ -1,5 +1,5 @@
1
- !################################################################################
2
- # Copyright (c) 2011-2012, Mak Kolybabi
1
+ ################################################################################
2
+ # Copyright (c) 2011-2014, Tenable Network Security
3
3
  # All rights reserved.
4
4
  #
5
5
  # Redistribution and use in source and binary forms, with or without
@@ -1,5 +1,5 @@
1
1
  ################################################################################
2
- # Copyright (c) 2011-2012, Mak Kolybabi
2
+ # Copyright (c) 2011-2014, Tenable Network Security
3
3
  # All rights reserved.
4
4
  #
5
5
  # Redistribution and use in source and binary forms, with or without
@@ -33,9 +33,9 @@ module Nasl
33
33
  def initialize(tree, *tokens)
34
34
  super
35
35
 
36
- @iter = @tokens[1]
37
- @expr = @tokens[3]
38
- @body = @tokens[5]
36
+ @iter = @tokens[0]
37
+ @expr = @tokens[1]
38
+ @body = @tokens[2]
39
39
 
40
40
  @children << :iter
41
41
  @children << :expr
@@ -1,5 +1,5 @@
1
1
  ################################################################################
2
- # Copyright (c) 2011-2012, Mak Kolybabi
2
+ # Copyright (c) 2011-2014, Tenable Network Security
3
3
  # All rights reserved.
4
4
  #
5
5
  # Redistribution and use in source and binary forms, with or without
@@ -1,5 +1,5 @@
1
1
  ################################################################################
2
- # Copyright (c) 2011-2012, Mak Kolybabi
2
+ # Copyright (c) 2011-2014, Tenable Network Security
3
3
  # All rights reserved.
4
4
  #
5
5
  # Redistribution and use in source and binary forms, with or without
@@ -1,5 +1,5 @@
1
- !################################################################################
2
- # Copyright (c) 2011-2012, Mak Kolybabi
1
+ ################################################################################
2
+ # Copyright (c) 2011-2014, Tenable Network Security
3
3
  # All rights reserved.
4
4
  #
5
5
  # Redistribution and use in source and binary forms, with or without
@@ -28,6 +28,7 @@ require 'nasl/parser/node'
28
28
 
29
29
  module Nasl
30
30
  class Identifier < Node
31
+ include Comparable
31
32
  attr_reader :name
32
33
 
33
34
  def initialize(tree, *tokens)
@@ -36,6 +37,10 @@ module Nasl
36
37
  @name = @tokens.first.body
37
38
  end
38
39
 
40
+ def <=>(other)
41
+ self.name <=> other.name
42
+ end
43
+
39
44
  def to_xml(xml)
40
45
  xml.identifier(:name=>@name)
41
46
  end
@@ -1,5 +1,5 @@
1
- !################################################################################
2
- # Copyright (c) 2011-2012, Mak Kolybabi
1
+ ################################################################################
2
+ # Copyright (c) 2011-2014, Tenable Network Security
3
3
  # All rights reserved.
4
4
  #
5
5
  # Redistribution and use in source and binary forms, with or without
@@ -1,5 +1,5 @@
1
1
  ################################################################################
2
- # Copyright (c) 2011-2012, Mak Kolybabi
2
+ # Copyright (c) 2011-2014, Tenable Network Security
3
3
  # All rights reserved.
4
4
  #
5
5
  # Redistribution and use in source and binary forms, with or without
@@ -1,5 +1,5 @@
1
- !################################################################################
2
- # Copyright (c) 2011-2012, Mak Kolybabi
1
+ ################################################################################
2
+ # Copyright (c) 2011-2014, Tenable Network Security
3
3
  # All rights reserved.
4
4
  #
5
5
  # Redistribution and use in source and binary forms, with or without
@@ -1,5 +1,5 @@
1
1
  ################################################################################
2
- # Copyright (c) 2011-2012, Mak Kolybabi
2
+ # Copyright (c) 2011-2014, Tenable Network Security
3
3
  # All rights reserved.
4
4
  #
5
5
  # Redistribution and use in source and binary forms, with or without
@@ -1,5 +1,5 @@
1
- !################################################################################
2
- # Copyright (c) 2011-2012, Mak Kolybabi
1
+ ################################################################################
2
+ # Copyright (c) 2011-2014, Tenable Network Security
3
3
  # All rights reserved.
4
4
  #
5
5
  # Redistribution and use in source and binary forms, with or without
@@ -28,6 +28,7 @@ require 'nasl/parser/node'
28
28
 
29
29
  module Nasl
30
30
  class Integer < Node
31
+ include Comparable
31
32
  attr_reader :base, :value
32
33
 
33
34
  def initialize(tree, *tokens)
@@ -56,6 +57,10 @@ module Nasl
56
57
  end
57
58
  end
58
59
 
60
+ def <=>(other)
61
+ self.value <=> other.value
62
+ end
63
+
59
64
  def to_xml(xml)
60
65
  case @tokens.first.type
61
66
  when :FALSE
@@ -1,5 +1,5 @@
1
- !################################################################################
2
- # Copyright (c) 2011-2012, Mak Kolybabi
1
+ ################################################################################
2
+ # Copyright (c) 2011-2014, Tenable Network Security
3
3
  # All rights reserved.
4
4
  #
5
5
  # Redistribution and use in source and binary forms, with or without
@@ -0,0 +1,43 @@
1
+ ################################################################################
2
+ # Copyright (c) 2011-2014, Tenable Network Security
3
+ # All rights reserved.
4
+ #
5
+ # Redistribution and use in source and binary forms, with or without
6
+ # modification, are permitted provided that the following conditions are met:
7
+ #
8
+ # 1. Redistributions of source code must retain the above copyright notice, this
9
+ # list of conditions and the following disclaimer.
10
+ #
11
+ # 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ # this list of conditions and the following disclaimer in the documentation
13
+ # and/or other materials provided with the distribution.
14
+ #
15
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
+ # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
19
+ # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20
+ # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21
+ # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22
+ # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23
+ # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24
+ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
+ ################################################################################
26
+
27
+ require 'nasl/parser/node'
28
+
29
+ module Nasl
30
+ class KeyValuePair < Node
31
+ attr_reader :key, :value
32
+
33
+ def initialize(tree, *tokens)
34
+ super
35
+
36
+ @key = tokens[0]
37
+ @value = tokens[2]
38
+
39
+ @children << :key
40
+ @children << :value
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,41 @@
1
+ ################################################################################
2
+ # Copyright (c) 2011-2014, Tenable Network Security
3
+ # All rights reserved.
4
+ #
5
+ # Redistribution and use in source and binary forms, with or without
6
+ # modification, are permitted provided that the following conditions are met:
7
+ #
8
+ # 1. Redistributions of source code must retain the above copyright notice, this
9
+ # list of conditions and the following disclaimer.
10
+ #
11
+ # 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ # this list of conditions and the following disclaimer in the documentation
13
+ # and/or other materials provided with the distribution.
14
+ #
15
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
+ # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
19
+ # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20
+ # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21
+ # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22
+ # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23
+ # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24
+ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
+ ################################################################################
26
+
27
+ require 'nasl/parser/node'
28
+
29
+ module Nasl
30
+ class List < Node
31
+ attr_reader :elems
32
+
33
+ def initialize(tree, *tokens)
34
+ super
35
+
36
+ @elems = if @tokens[1].is_a? ::Array then @tokens[1] else [] end
37
+
38
+ @children << :elems
39
+ end
40
+ end
41
+ end
@@ -1,5 +1,5 @@
1
1
  ################################################################################
2
- # Copyright (c) 2011-2012, Mak Kolybabi
2
+ # Copyright (c) 2011-2014, Tenable Network Security
3
3
  # All rights reserved.
4
4
  #
5
5
  # Redistribution and use in source and binary forms, with or without
@@ -1,5 +1,5 @@
1
1
  ################################################################################
2
- # Copyright (c) 2011-2012, Mak Kolybabi
2
+ # Copyright (c) 2011-2014, Tenable Network Security
3
3
  # All rights reserved.
4
4
  #
5
5
  # Redistribution and use in source and binary forms, with or without
@@ -1,5 +1,5 @@
1
1
  ################################################################################
2
- # Copyright (c) 2011-2012, Mak Kolybabi
2
+ # Copyright (c) 2011-2014, Tenable Network Security
3
3
  # All rights reserved.
4
4
  #
5
5
  # Redistribution and use in source and binary forms, with or without
@@ -73,7 +73,7 @@ module Nasl
73
73
 
74
74
  # Handle objects that are arrays holding nodes, or basic types that
75
75
  # aren't nodes.
76
- if obj.is_a? Array
76
+ if obj.is_a? ::Array
77
77
  obj.each { |el| el.to_xml(xml) }
78
78
  elsif obj.is_a? Node
79
79
  obj.to_xml(xml)
@@ -0,0 +1,43 @@
1
+ ################################################################################
2
+ # Copyright (c) 2011-2014, Tenable Network Security
3
+ # All rights reserved.
4
+ #
5
+ # Redistribution and use in source and binary forms, with or without
6
+ # modification, are permitted provided that the following conditions are met:
7
+ #
8
+ # 1. Redistributions of source code must retain the above copyright notice, this
9
+ # list of conditions and the following disclaimer.
10
+ #
11
+ # 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ # this list of conditions and the following disclaimer in the documentation
13
+ # and/or other materials provided with the distribution.
14
+ #
15
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
+ # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
19
+ # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20
+ # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21
+ # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22
+ # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23
+ # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24
+ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
+ ################################################################################
26
+
27
+ require 'nasl/parser/node'
28
+
29
+ module Nasl
30
+ class Parameter < Node
31
+ attr_reader :name, :pass_by
32
+
33
+ def initialize(tree, *tokens)
34
+ super
35
+
36
+ @name = @tokens[0]
37
+ @pass_by = @tokens[1]
38
+
39
+ @children << :name
40
+ @children << :pass_by
41
+ end
42
+ end
43
+ end