class Nasl::Expression

Attributes

lhs[R]
op[R]
rhs[R]

Public Class Methods

new(tree, *tokens) click to toggle source
Calls superclass method
# File lib/nasl/parser/expression.rb, line 33
def initialize(tree, *tokens)
  super

  @children << :op

  if @tokens.first.is_a?(Token) && @tokens.first.type == :LPAREN
    @op = '()'
    @lhs = nil
    @rhs = @tokens[1]
  elsif @tokens.length == 2
    @op = @tokens.first
    @lhs = nil
    @rhs = @tokens.last
  else
    @children << :lhs
    @lhs = @tokens[0]
    @op = @tokens[1]
    @rhs = @tokens[2]
  end

  @children << :rhs
end