Class: SbuilderSexp::PrimaryExpression
- Inherits:
-
InfixExpression
- Object
- Treetop::Runtime::SyntaxNode
- Root
- AbstactExpression
- InfixExpression
- SbuilderSexp::PrimaryExpression
- Defined in:
- lib/parser/parser_nodes.rb
Instance Method Summary collapse
-
#attribute_accessors ⇒ AbstactExpression:Array
Access record by field name or by value.
-
#expression_postfix ⇒ Object
AbstactExpression.travers yield if non-nil.
-
#expressions ⇒ Object
AbstractExpression.traverse: postfix expression does not recurse to UnitExpressions, instead yield block iterates using ‘attribute_accessors’.
-
#has_attribute_accessors ⇒ boolean
True if expression defines record accessor.
Methods inherited from InfixExpression
Methods inherited from AbstactExpression
#expression_prefix, #expression_val, #has_rhs, #lhs_node, #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
#attribute_accessors ⇒ AbstactExpression:Array
Access record by field name or by value
197 198 199 200 201 202 |
# File 'lib/parser/parser_nodes.rb', line 197 def attribute_accessors deffi = elements.select{ |e| e.is_a?( SbuilderSexp::UnitExpression )}.first return unless deffi && !deffi.text_value.empty? deffi = deffi.recursive_select( SbuilderSexp::AbstactExpression ) return deffi end |
#expression_postfix ⇒ Object
AbstactExpression.travers yield if non-nil
191 192 193 |
# File 'lib/parser/parser_nodes.rb', line 191 def expression_postfix return "has-attribute-accessors" if has_attribute_accessors end |
#expressions ⇒ Object
AbstractExpression.traverse: postfix expression does not recurse to UnitExpressions, instead yield block iterates using ‘attribute_accessors’
185 186 187 188 |
# File 'lib/parser/parser_nodes.rb', line 185 def expressions # expressions = recursive_select( SbuilderSexp::AbstactExpression ) super.select { |e| !e.is_a?(SbuilderSexp::UnitExpression) } end |
#has_attribute_accessors ⇒ boolean
Returns true if expression defines record accessor.
206 207 208 |
# File 'lib/parser/parser_nodes.rb', line 206 def has_attribute_accessors attribute_accessors && attribute_accessors.any? end |