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.
3729 3730 3731 |
# File 'lib/idl/ast.rb', line 3729 def initialize(input, interval, action) super(input, interval, [action]) end |
Instance Method Details
#action ⇒ Object
3727 |
# File 'lib/idl/ast.rb', line 3727 def action = @children[0] |
#execute(symtab) ⇒ void
This method returns an undefined value.
“execute” the statement by updating the variables in the symbol table
3739 3740 3741 3742 3743 3744 3745 3746 |
# File 'lib/idl/ast.rb', line 3739 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.
3749 3750 3751 3752 3753 3754 3755 3756 |
# File 'lib/idl/ast.rb', line 3749 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)
3759 |
# File 'lib/idl/ast.rb', line 3759 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
3734 3735 3736 |
# File 'lib/idl/ast.rb', line 3734 def type_check(symtab) action.type_check(symtab) end |