Class: Idl::AryAccessSyntaxNode
- Inherits:
-
Treetop::Runtime::SyntaxNode
- Object
- Treetop::Runtime::SyntaxNode
- Idl::AryAccessSyntaxNode
- Defined in:
- lib/idl/ast.rb
Overview
this is not used as an AST node; we use it split chained array accesses
For example, it helps us represent
X[rs1][31:0]
Instance Method Summary collapse
-
#to_ast ⇒ AstNode
fix up left recursion.
-
#to_idl ⇒ String
Return valid IDL representation of the node (and its subtree).
Instance Method Details
#to_ast ⇒ AstNode
fix up left recursion
1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 |
# File 'lib/idl/ast.rb', line 1462 def to_ast var = a.to_ast brackets.elements.each do |bracket| var = if bracket.msb.empty? AryElementAccessAst.new(input, interval, var, bracket.lsb.to_ast) else AryRangeAccessAst.new(input, interval, var, bracket.msb.expression.to_ast, bracket.lsb.to_ast) end end var end |
#to_idl ⇒ String
Return valid IDL representation of the node (and its subtree)
1478 1479 1480 1481 1482 1483 1484 |
# File 'lib/idl/ast.rb', line 1478 def to_idl if bracket.msb.empty? "#{a.to_idl}[#{brackets.lsb.to_idl}]" else "#{a.to_idl}[#{brackets.msb.to_idl}:#{brackets.lsb.to_idl}]" end end |