Class: Nasl::Switch

Inherits:
Node
  • Object
show all
Defined in:
lib/nasl/parser/switch.rb

Instance Attribute Summary collapse

Attributes inherited from Node

#ctx, #tokens

Instance Method Summary collapse

Methods inherited from Node

#context, #region, #to_xml

Constructor Details

#initialize(tree, *tokens) ⇒ Switch

Returns a new instance of Switch.



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/nasl/parser/switch.rb', line 33

def initialize(tree, *tokens)
  super

  if @tokens.length == 5
    @switch_op = nil
    @switch_expr = @tokens[2]
    @body = @tokens[4]
  else
    @switch_op = @tokens[2] 
    @switch_expr = @tokens[5]
    @body = @tokens[7]
  end

  @children << :switch_op
  @children << :switch_expr
  @children << :body
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



31
32
33
# File 'lib/nasl/parser/switch.rb', line 31

def body
  @body
end

#switch_exprObject (readonly)

Returns the value of attribute switch_expr.



31
32
33
# File 'lib/nasl/parser/switch.rb', line 31

def switch_expr
  @switch_expr
end

#switch_opObject (readonly)

Returns the value of attribute switch_op.



31
32
33
# File 'lib/nasl/parser/switch.rb', line 31

def switch_op
  @switch_op
end