Class: Markdoc::Pseudocode::ExpressionLiteral

Inherits:
Treetop::Runtime::SyntaxNode
  • Object
show all
Defined in:
lib/markdoc/pseudocode.rb

Instance Method Summary collapse

Instance Method Details

#endsObject



90
91
92
93
94
95
96
97
98
99
100
# File 'lib/markdoc/pseudocode.rb', line 90

def ends
  ary = []
  elements.each do |node|
    if node.elements.empty?
      ary << node.id
    else
      ary << node.ends
    end
  end
  ary.flatten
end

#idObject



86
87
88
# File 'lib/markdoc/pseudocode.rb', line 86

def id
  elements.first.id
end

#out(file) ⇒ Object



72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/markdoc/pseudocode.rb', line 72

def out(file)
  prev = nil
  elements.each do |node|
    next if node.nil?
    node.out(file)
    unless prev.nil?
      prev.ends.each do |endid|
        file.write %Q(#{endid} -> #{node.id}\n)
      end
    end
    prev = node
  end
end