Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Parsing a CPP file

Reply
Thread Tools

Parsing a CPP file

 
 
JKG
Guest
Posts: n/a
 
      05-15-2006
Hi friends,

Does any body knows about the following module.

use matchpairs ('('=>')', '{'=>'}'; '['=>']', '"'=>'"', "'"=>"'",
'<'=>'>');

I want to parse a balance parenthesis using a single regular
expression. For this I wanted to use this module.

 
Reply With Quote
 
 
 
 
A. Sinan Unur
Guest
Posts: n/a
 
      05-15-2006
"JKG" <(E-Mail Removed)> wrote in news:(E-Mail Removed) oups.com:

> Re: Parsing a CPP file


I see nothing in your post about either the C preprocessor or
C++ source files, so please explain what your subject is about.


> Does any body knows about the following module.
>
> use matchpairs ('('=>')', '{'=>'}'; '['=>']', '"'=>'"', "'"=>"'",
> '<'=>'>');


I did not, but a Google search resulted in:

http://dev.perl.org/perl6/rfc/145.pod

> I want to parse a balance parenthesis using a single regular
> expression. For this I wanted to use this module.


Please formulate a concrete question following the posting guidelines
for this group.

See also:

http://search.cpan.org/~abigail/Rege...on/balanced.pm

Sinan
--
A. Sinan Unur <(E-Mail Removed)>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://augustmail.com/~tadmc/clpmisc...uidelines.html

 
Reply With Quote
 
 
 
 
JKG
Guest
Posts: n/a
 
      05-16-2006
Hi,
Thanks for replying.
I am sorry as I was not able to formulate my question well, at the same
time I appreciate your effort for figuring out what I wanted. Thanks
again as your reply solved my query. I have lots of other things
regarding CPP file parsing. First I will clear what I wanted to do:
I have a large CPP file with lots of functions like:
MyClass::myFunction(int a, int b) const
{
....
}
I want to write a tool in Perl that automatically add a debug statement
at the start of the function:
int* MyClass::myFunction(int a, int b) const
{
cout << "Begin of myFunc()" << endl << flush;
....
}
My approach is as follows (assuming the syntax of the CPP file is
correct):
(1). Remove all the comments (both C and C++ style comments) from the
CPP file.
< Referring http://faq.perl.org/perlfaq6.html#How_do_I_use_a_regul >
(2). Now identify all the function implementations in the CPP file and
put the debug statements:
This is also not a very straight forward task as I can't relay on the
type or format for the function implementation. Here are few of them:
int globalFun() { ... }
int MyClass::classMember() { ... }
(3) Place the comment back to the proper position.
< Open for discussion >

 
Reply With Quote
 
JKG
Guest
Posts: n/a
 
      05-16-2006
Any takers....

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Snippet for XML parsing using MFC/CPP adiideas@gmail.com XML 0 12-03-2007 06:21 PM
Free online test in C, CPP / Placement papers / CPP,C Interview Questions www.hitechskill.com C++ 0 04-09-2006 10:53 AM
when i compile the cpp file(cmdargs.cpp) int main(int argc, wchar_t* argv[]) Vinu C++ 9 05-05-2005 04:11 AM
Method inlined in source1.cpp and called in source2.cpp Alex Vinokur C++ 7 11-15-2004 09:14 PM
What is better /standard for creating files. a cpp file with header or cpp and seperate file for header DrUg13 C++ 1 02-10-2004 09:20 AM



Advertisments