From: stephan b. <st...@wa...> - 2003-09-03 00:28:05
|
i started to learn lex yesterday and i've got a basic parser for the STre= e=20 text format underway. It doesn't handle strings with spaces in them, but=20 here's what it does to the top of gev.map: stephan@ludo:~/cvs/elib/lex >make && ./ltest < gev.map | head Generating C_DEPS rules for *.cpp *.c *.c++ *.C *.cc *.moc toc_atparse_file: test.flex is up to date. Building C[++] binary [ltest]. + cc -I. -I../include -o ltest main.cpp test.flex.cpp -lstdc++=20 =2E./lib/elib/libessentials.a -lfl main.cpp:46 : Opening node [fun::HexMap] main.cpp:38 : [fun::HexMap] add_property(gameboxName,G.E.V.) main.cpp:38 : [fun::HexMap] add_property(gameboxVers,0.1) main.cpp:38 : [fun::HexMap] add_property(asiz,529) main.cpp:46 : Opening node [GEVHex] main.cpp:38 : [GEVHex] add_property(name,0101) main.cpp:38 : [GEVHex] add_property(id,0) main.cpp:46 : Opening node [GEVHex] main.cpp:38 : [GEVHex] add_property(name,0102) (If you're wondering why i at-parse the lex file, it's because @WORD@ is = much=20 asier to read and write than ([_a-zA-Z0-9]+), an @CLASSNAME@ can now be=20 mapped to: (@WORD@\:\:)?@WORD@ (i just added the ability to recursively @-parse tokens, so @-tokens can = now=20 expand to other @-tokens.) i don't yet know enough about lex to know if i'll need to also use yacc/b= ison=20 to properly handle keys like: foo "this is a quoted string, \ possibly multi-line." --=20 ----- st...@wa... http://qub.sourceforge.net http://libfunutil.sourceforge.net =20 http://toc.sourceforge.net http://countermoves.sourceforge.net http://stephan.rootonfire.org |