Method: Racc::LogFileGenerator#output_token

Defined in:
lib/racc/logfilegenerator.rb

#output_token(out) ⇒ Object

Tokens



184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
# File 'lib/racc/logfilegenerator.rb', line 184

def output_token(out)
  out.print "------- Symbols -------\n\n"

  out.print "**Nonterminals, with rules where they appear\n\n"
  @grammar.each_nonterminal do |t|
    tmp = <<SRC
  %s (%d)
on right: %s
on left : %s
SRC
    out.printf tmp, t.to_s, t.ident,
               symbol_locations(t.locate).join(' '),
               symbol_locations(t.heads).join(' ')
  end

  out.print "\n**Terminals, with rules where they appear\n\n"
  @grammar.each_terminal do |t|
    out.printf "  %s (%d) %s\n",
               t.to_s, t.ident, symbol_locations(t.locate).join(' ')
  end
end