C++ Function Signature string Parser

K

krbyxtrm

Any knows of a Function Signature string Parser?


typically one that can parse string:
"unsigned int const * __cdecl MyFunction(int,void const *)"

into:
0 : 'unsigned int const *'
1 : '__cdecl'
2 : 'MyFunction'
3 : 'int'
4 : 'void const *'
 
P

Pavel Vozenilek

krbyxtrm said:
Any knows of a Function Signature string Parser?


typically one that can parse string:
"unsigned int const * __cdecl MyFunction(int,void const *)"

into:
0 : 'unsigned int const *'
1 : '__cdecl'
2 : 'MyFunction'
3 : 'int'
4 : 'void const *'

If such tool exists it is compiler dependent.

For VC++ you may try Win32 API function UnDecorateSymbolName().

/Pavel
 
I

Ira Baxter

krbyxtrm said:
Any knows of a Function Signature string Parser?

typically one that can parse string:
"unsigned int const * __cdecl MyFunction(int,void const *)"

into:
0 : 'unsigned int const *'
1 : '__cdecl'
2 : 'MyFunction'
3 : 'int'
4 : 'void const *'

You essentially have to parse the entire C++ language to do this.
(Consider a function signature involving a template defined in terms of
typedefs using macros ....)

The DMS Software Reengineering Toolkit has a full C++ parser
that can be used to extract function signatures.
See http://www.semanticdesigns.com/Products/FrontEnds/CppFrontEnd.html
 
S

Sven Heyll

Ira said:
You essentially have to parse the entire C++ language to do this.
(Consider a function signature involving a template defined in terms of
typedefs using macros ....)

The DMS Software Reengineering Toolkit has a full C++ parser
that can be used to extract function signatures.
See http://www.semanticdesigns.com/Products/FrontEnds/CppFrontEnd.html
Hi,
You could also use ANTLR, I think a pretty good C++
grammar exists for antlr.

WBR,
Sven Heyll
 
I

Ira Baxter

Sven Heyll said:
Hi,
You could also use ANTLR, I think a pretty good C++
grammar exists for antlr.

WBR,
Sven Heyll

To understand a function signature in detail, you need type information.
I don't beleive that the ANTLR implementation provides any of this.
DMS provides complete type information.

-- IDB
 
K

krbyxtrm

Hi,
what i'm trying to build is some sort of storage of the involved
'types' ; as to the types in the function signature string.

--krby

Ayon kay Ira Baxter:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top