-
- while(lex.IsOK() && !error) {
-
- switch(lex.lex()){
- case LyXLex::LEX_FEOF :
- lyxerr[Debug::KBMAP] << "End of parsing of .cdef file"
- << endl;
- break;
- default:
- // Get Integer
- n=lex.GetInteger();
- if (n<0) {
- error=true;
- continue;
- }
-
- // Get String
- lex.next(true);
- str=lex.GetString();
-
- Cdef* tempc=new Cdef;
- tempc->str=str;
- tempc->ic=n;
- tempc->next=map_;
- map_=tempc;
-
+ string line;
+ // Ok, I'll be the first to admit that this is probably not
+ // the fastest way to parse the cdef files, but I though it
+ // was a bit neat. Anyway it is wrong to use the lyxlex parse
+ // without the use of a keyword table.
+ LRegex reg("^([12][0-9][0-9])[ \t]+\"([^ ]+)\".*");
+ while(getline(ifs, line)) {
+ if (reg.exact_match(line)) {
+ LRegex::SubMatches const & sub = reg.exec(line);
+ n = lyx::atoi(line.substr(sub[1].first,
+ sub[1].second));
+ str = LSubstring(line, sub[2].first, sub[2].second);