From: Andre B. <and...@gm...> - 2003-04-28 03:05:43
|
Hello together, i have introduced a new test util class for declaration parsing called "keyedstring" it has the same idea as SourceBuilder but specific behaviour for declaration parsing, the same key can be used more than one time: addKeyed( keyword , text ) the "text" elements registered under the same keyword are stored as vector. Text that should not be keyed can be added by the "<<" operator. keyedstring s; s. addKeyed( "SPECIFIER", "short" ) << " "; s. addKeyed( "SPECIFIER", "int" ) << " "; s. addKeyed( "DECLARATOR", "* x" ) << ";"; will result in "short int * x;" keyed-string will be implicitly converted to std::string if needed. "Keyed" words can be accessed by "getWord(key,index)". s.getWord("SPECIFIER",1) will return "int" The tests look much nicer now and are easier to be extended. -- André |