#include #include "lexer.h" #include "list.h" using namespace std; void ctiSeznam (Lexer & f, List & v); void ctiPrvek (Lexer & f, List & v) { string name = f.readIdent (); Item * p = new Item (name); v.linkLast (p); if (f.kind == text) { p->info = f.token; f.nextToken(); } if (f.isSeparator('{')) ctiSeznam (f, p->inner); } void ctiSeznam (Lexer & f, List & v) { f.checkSeparator('{'); if (! f.isSeparator('}')) { ctiPrvek (f, v); while (f.isSeparator (',')) { f.nextToken (); // skip ',' ctiPrvek (f, v); } } f.checkSeparator('}'); } int main() { List a; Lexer f ("../lexer03/abc.txt"); ctiSeznam (f, a); // a.print(); ofstream g ("../lexer03/output.html"); a.html (g); /*while (f.kind != eos) { cout << f.token << endl; f.nextToken (); }*/ /* List a; a.insertFirst ("Mikes"); a.insertLast ("Bobes"); a.insertFirst ("Pasik"); a.print (); List b; b.insert ("Vochumurka"); b.insert ("Kremilek"); b.insert ("Racochejl"); b.print (); // Item * t = b.getFirst(); // b.unlink (t); // a.linkFirst (t); a.move (b); // a --> b a.transfer (b); // a <-- b a.print (); b.print (); // b.reverse(); // b.print (); */ return 0; }