Class: Idl::PostDecrementExpressionAst
- Includes:
- Executable
- Defined in:
- lib/idl/ast.rb
Overview
represents a post-decrement expression
for example:
i--
Instance Method Summary collapse
-
#execute(symtab) ⇒ void
“execute” the statement by updating the variables in the symbol table.
-
#execute_unknown(symtab) ⇒ void
“execute” the statement, forcing any variable assignments to an unknown state This is used down unknown conditional paths.
-
#initialize(input, interval, rval) ⇒ PostDecrementExpressionAst
constructor
A new instance of PostDecrementExpressionAst.
- #rval ⇒ Object
- #to_idl ⇒ Object
- #type(symtab) ⇒ Object
- #type_check(symtab) ⇒ Object
Constructor Details
#initialize(input, interval, rval) ⇒ PostDecrementExpressionAst
Returns a new instance of PostDecrementExpressionAst.
3199 3200 3201 |
# File 'lib/idl/ast.rb', line 3199 def initialize(input, interval, rval) super(input, interval, [rval]) end |
Instance Method Details
#execute(symtab) ⇒ void
This method returns an undefined value.
“execute” the statement by updating the variables in the symbol table
3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 |
# File 'lib/idl/ast.rb', line 3213 def execute(symtab) var = symtab.get(rval.text_value) value_result = value_try do internal_error "No symbol #{rval.text_value}" if var.nil? value_error "value of variable '#{rval.text_value}' not know" if var.value.nil? var.value = var.value - 1 end value_else(value_result) do var.value = nil value_error "value of variable '#{rval.text_value}' not know" end end |
#execute_unknown(symtab) ⇒ void
This method returns an undefined value.
“execute” the statement, forcing any variable assignments to an unknown state This is used down unknown conditional paths.
3229 3230 3231 |
# File 'lib/idl/ast.rb', line 3229 def execute_unknown(symtab) symtab.get(rval.text_value).value = nil end |
#rval ⇒ Object
3197 |
# File 'lib/idl/ast.rb', line 3197 def rval = @children[0] |
#to_idl ⇒ Object
3233 |
# File 'lib/idl/ast.rb', line 3233 def to_idl = "#{rval.to_idl}--" |
#type(symtab) ⇒ Object
3208 3209 3210 |
# File 'lib/idl/ast.rb', line 3208 def type(symtab) rval.type(symtab) end |
#type_check(symtab) ⇒ Object
3203 3204 3205 3206 |
# File 'lib/idl/ast.rb', line 3203 def type_check(symtab) rval.type_check(symtab) type_error "Post decement must be integral" unless rval.type(symtab).integral? end |