Class: Idl::StatementAst
- Includes:
- Executable
- Defined in:
- lib/idl/ast.rb
Overview
represents a simple, one-line statement
for example:
Bits<64> new_variable;
new_variable = 4;
func();
Instance Method Summary collapse
- #action ⇒ Object
-
#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, action) ⇒ StatementAst
constructor
A new instance of StatementAst.
-
#to_idl ⇒ String
Return valid IDL representation of the node (and its subtree).
-
#type_check(symtab) ⇒ void
type check this node and all children.
Constructor Details
#initialize(input, interval, action) ⇒ StatementAst
Returns a new instance of StatementAst.
3752 3753 3754 |
# File 'lib/idl/ast.rb', line 3752 def initialize(input, interval, action) super(input, interval, [action]) end |
Instance Method Details
#action ⇒ Object
3750 |
# File 'lib/idl/ast.rb', line 3750 def action = @children[0] |
#execute(symtab) ⇒ void
This method returns an undefined value.
“execute” the statement by updating the variables in the symbol table
3762 3763 3764 3765 3766 3767 3768 3769 |
# File 'lib/idl/ast.rb', line 3762 def execute(symtab) if action.is_a?(Declaration) action.add_symbol(symtab) end if action.is_a?(Executable) action.execute(symtab) 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.
3772 3773 3774 3775 3776 3777 3778 3779 |
# File 'lib/idl/ast.rb', line 3772 def execute_unknown(symtab) if action.is_a?(Declaration) action.add_symbol(symtab) end if action.is_a?(Executable) action.execute_unknown(symtab) end end |
#to_idl ⇒ String
Return valid IDL representation of the node (and its subtree)
3782 |
# File 'lib/idl/ast.rb', line 3782 def to_idl = "#{action.to_idl};" |
#type_check(symtab) ⇒ void
This method returns an undefined value.
type check this node and all children
Calls to #type and/or #value may depend on type_check being called first with the same symtab. If not, those functions may raise an AstNode::InternalError
3757 3758 3759 |
# File 'lib/idl/ast.rb', line 3757 def type_check(symtab) action.type_check(symtab) end |