Boost logo

Boost Users :

From: Aaron (yilu_at_[hidden])
Date: 2005-10-16 02:22:37


I'm writting a program which could evaluate macros in a c++ header
file, like this:

#define CMD_IS_BASE 0x00001000
#define CMD_GET_ALL_DOMAINNAME (CMD_IS_BASE+0x1) /* Get all
domain name from clients*/

After parsing is done, if you input a value(int), the program could
tell you the symbol name, symbol meaning (if there is) corresponding
to the valude. As to the above example, when you input 1025(or
0x00010001), the program should tell you it's correspond to symbol
CMD_GET_ALL_DOMAINNAME, with it's detail comments "get all domain name
from clients".

I want also this program could parse the following paragraph too:
//
// MessageId: GL_CAT_SUMMARY
//
// MessageText:
//
// Summary%0
//
#define GL_CAT_SUMMARY 0x00000002L

It's easy to define a regex pattern, then call boost::regex_grep to
got all these symbols and their meaning. But what if two formats exist
in one header file? I wrote two grepper plug-ins(one is called
singleline.dll, the other is McHearder.dll) to find these symbols,
which re pattern contains more lines has the high pirioty to be
called, then after it's called, the matched string should be erased or
be filled with meaningless chars to prevent the later greppers to work
on it. See example:

The original string:
//
// MessageId: GL_CAT_SUMMARY
//
// MessageText:
//
// Summary%0
//
#define GL_CAT_SUMMARY 0x00000002L

#define CMD_IS_BASE 0x00001000

First we call McHeader.dll to work on this string, then it grepped:
symble:GL_CAT_SUMMARY
value: 2
comments:Summary

Then the string should be only one lines, ie:
#define CMD_IS_BASE 0x00001000

So, how could I achieve that? Could I still use boost::regex_grep?

Thanks in advance!


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net