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++) {
25 add(i.key(), new Symtable(*i.val()));
29 Symtables::~Symtables()
31 for (Assoc_iter<String, Symtable*> i(*this); i.ok(); i++) {
37 Symtable::lookup(String s) const
42 warning( "Symtable `" + id_str+ "\': unknown symbol `" +s+"'\n");
49 Symtables::operator()(String s)
51 return Assoc<String, Symtable*>::operator[](s);
54 Symtables::print() const
56 for (Assoc_iter<String, Symtable*> i(*this); i.ok(); i++) {
57 mtor << "table \'" << i.key() << "\' {\n";
63 Symtable::print() const
65 for (Assoc_iter<String, Symbol> i(*this); i.ok(); i++) {
66 mtor << "\'" << i.key() << "\'->" << i.val().str() << "\n";
71 Symtables::add(String s, Symtable*p)
74 Assoc<String, Symtable*>::add(s,p);