Class: SbuilderSexp::AbstractSetExpression
- Inherits:
-
AbstactExpression
- Object
- Treetop::Runtime::SyntaxNode
- Root
- AbstactExpression
- SbuilderSexp::AbstractSetExpression
- Defined in:
- lib/parser/parser_nodes.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#binds_node ⇒ BoundInExpression|nil
Return set generator ( x in Set ) for set constructor.
-
#expression_val ⇒ Object
AbstactExpression.traverse calls in yield.
-
#lhs_node ⇒ Object
AbstactExpression.traverse quit traversing the expression.
-
#name ⇒ String
For documentation purposes symbol table context needs a name (For procedures, and macros name is ovbious. For a set expression we define name set a string “Set+<generator set>”.
-
#set_elements ⇒ Object
Elements defined on constructore.
- #set_expression ⇒ Object
-
#symbol_definitions ⇒ Hash:Array
Some variables in ‘set_expression’ (most likely) refer to variable defined in set constructor generate.
Methods inherited from AbstactExpression
#expression_postfix, #expression_prefix, #expressions, #has_rhs, #node_value, #rhs_node, #traverse
Methods inherited from Treetop::Runtime::SyntaxNode
#node_type, #node_value, #recursive_inject, #recursive_inject_parent, #recursive_select, #value
Instance Method Details
#binds_node ⇒ BoundInExpression|nil
Return set generator ( x in Set ) for set constructor
generator variable and set
619 620 621 622 623 624 625 |
# File 'lib/parser/parser_nodes.rb', line 619 def binds_node ret = recursive_select( SbuilderSexp::BoundInExpression ).first return nil unless ret ret = ret.recursive_select( SbuilderSexp::BoundInExpression ).first # puts ret ret end |
#expression_val ⇒ Object
AbstactExpression.traverse calls in yield
611 612 613 |
# File 'lib/parser/parser_nodes.rb', line 611 def expression_val true end |
#lhs_node ⇒ Object
AbstactExpression.traverse quit traversing the expression
606 607 608 |
# File 'lib/parser/parser_nodes.rb', line 606 def lhs_node nil end |
#name ⇒ String
For documentation purposes symbol table context needs a name (For procedures, and macros name is ovbious. For a set expression we define name set a string “Set+<generator set>”
647 648 649 |
# File 'lib/parser/parser_nodes.rb', line 647 def name "Set-#{binds_node.bind_set.text_value}" end |
#set_elements ⇒ Object
Elements defined on constructore
637 638 639 640 |
# File 'lib/parser/parser_nodes.rb', line 637 def set_elements elems = recursive_select( SbuilderSexp::Expression ) elems end |
#set_expression ⇒ Object
627 628 629 630 631 632 633 634 |
# File 'lib/parser/parser_nodes.rb', line 627 def set_expression deffi = recursive_select( SbuilderSexp::SetExpressionDef ) return nil unless deffi && deffi.any? ret = deffi.first.elements[0] # # ret = deffi.first.recursive_select( SbuilderSexp::SetExpression ).first # puts "set_expression=#{ret.inspect}" ret end |
#symbol_definitions ⇒ Hash:Array
Some variables in ‘set_expression’ (most likely) refer to variable defined in set constructor generate. Return name of this variables.
655 656 657 658 |
# File 'lib/parser/parser_nodes.rb', line 655 def symbol_definitions return [] unless binds_node [ { :node_type => node_type, :value => binds_node.bind_var.expression_val, :tree=>binds_node } ] end |