2 symtable.cc -- implement Symbol_table
4 source file of the GNU LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
15 #include "assoc-iter.hh"
16 #include "symtable.hh"
18 Symtables::Symtables()
22 Symtables::Symtables (Symtables const &s)
24 for (Assoc_iter<String, Symtable*> i (s); i.ok(); i++)
26 add (i.key(), new Symtable (*i.val ()));
30 Symtables::~Symtables()
32 for (Assoc_iter<String, Symtable*> i (*this); i.ok(); i++)
39 Symtable::lookup (String s) const
45 warning ("Symtable `" + id_str+ "\': unknown symbol `" +s+"'\n");
52 Symtables::operator()(String s)
54 return Assoc<String, Symtable*>::operator[](s);
57 Symtables::print() const
59 for (Assoc_iter<String, Symtable*> i (*this); i.ok(); i++)
61 DOUT << "table \'" << i.key() << "\' {\n";
67 Symtable::print() const
69 for (Assoc_iter<String, Symbol> i (*this); i.ok(); i++)
71 DOUT << "\'" << i.key() << "\'->" << i.val ().str () << "\n";
76 Symtables::add (String s, Symtable*p)
79 Assoc<String, Symtable*>::add (s,p);