Class: Nasl::Expression
Instance Attribute Summary collapse
-
#lhs ⇒ Object
readonly
Returns the value of attribute lhs.
-
#op ⇒ Object
readonly
Returns the value of attribute op.
-
#rhs ⇒ Object
readonly
Returns the value of attribute rhs.
Attributes inherited from Node
Instance Method Summary collapse
-
#initialize(tree, *tokens) ⇒ Expression
constructor
A new instance of Expression.
Methods inherited from Node
Constructor Details
#initialize(tree, *tokens) ⇒ Expression
Returns a new instance of Expression.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# 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 |
Instance Attribute Details
#lhs ⇒ Object (readonly)
Returns the value of attribute lhs.
31 32 33 |
# File 'lib/nasl/parser/expression.rb', line 31 def lhs @lhs end |
#op ⇒ Object (readonly)
Returns the value of attribute op.
31 32 33 |
# File 'lib/nasl/parser/expression.rb', line 31 def op @op end |
#rhs ⇒ Object (readonly)
Returns the value of attribute rhs.
31 32 33 |
# File 'lib/nasl/parser/expression.rb', line 31 def rhs @rhs end |