Class: Idl::ParenExpressionAst

Inherits:
AstNode
  • Object
show all
Includes:
Rvalue
Defined in:
lib/idl/ast.rb

Overview

represents a parenthesized expression

for example:

(a + b)

Instance Method Summary collapse

Constructor Details

#initialize(input, interval, exp) ⇒ ParenExpressionAst

Returns a new instance of ParenExpressionAst.



3023
# File 'lib/idl/ast.rb', line 3023

def initialize(input, interval, exp) = super(input, interval, [exp])

Instance Method Details

#expressionObject



3025
# File 'lib/idl/ast.rb', line 3025

def expression = @children[0]

#invert(symtab) ⇒ Object



3027
# File 'lib/idl/ast.rb', line 3027

def invert(symtab) = expression.invert(symtab)

#to_idlString

Return valid IDL representation of the node (and its subtree)

Returns:

  • (String)

    IDL code for the node



3039
# File 'lib/idl/ast.rb', line 3039

def to_idl = "(#{expression.to_idl})"

#type(symtab) ⇒ Type

Given a specific symbol table, return the type of this node.

Should not be called until #type_check is called with the same arguments

Parameters:

Returns:

  • (Type)

    The type of the node

Raises:



3033
# File 'lib/idl/ast.rb', line 3033

def type(symtab) = expression.type(symtab)

#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

Parameters:

Raises:



3030
# File 'lib/idl/ast.rb', line 3030

def type_check(symtab) = expression.type_check(symtab)

#value(symtab) ⇒ Object

Return the compile-time-known value of the node



3036
# File 'lib/idl/ast.rb', line 3036

def value(symtab) = expression.value(symtab)

#values(symtab) ⇒ Array<Integer>, ... Originally defined in module Rvalue

Return a complete list of possible compile-time-known values of the node, or raise a ValueError if the full list cannot be determined

For most AstNodes, this will just be a single-entry array

Parameters:

  • symtab (SymbolTable)

    The context for the evaulation

Returns:

  • (Array<Integer>)

    The complete list of compile-time-known values, when they are integral

  • (Array<Boolean>)

    The complete list of compile-time-known values, when they are booleans

  • (AstNode::ValueError)

    if the list of values is not knowable at compile time