Parsing is not accurate or crashes
Brought to you by:
senexcanis
# Parsing is not accurate or crashes. # # code1 - Parses class but then defines the method definition as a function. # code2 - Reverse order of code1. I think this is OK. Not sure about "'returns': 'int'". # code3 - Class methods returning pointers to classes. Crashes on namespace collision. # code4 - Reverse order of code3. Misunderstands but not sure how to explain. from CppHeaderParser import CppHeader code1 = """ # myClassB_1.h int * myClassB::myMethod( int * pInPtr ) { return pInPtr; } # myClassB_2.h class myClassB { int * myMethod( int * pInCurPtr ); } """ code2 = """ # myClassB_1.h class myClassB { int * myMethod( int * pInCurPtr ); } # myClassB_2.h int * myClassB::myMethod( int * pInPtr ) { return pInPtr; } """ code3 = """ # myClassB_1.h class myClassB { class myClassA * myMethod( class myClassA * pInCurPtr ); } # myClassB_2.h class myClassA * myClassB::myMethod( class myClassA * pInPtr ) { return pInPtr; } """ code4 = """ # myClassB_1.h class myClassA * myClassB::myMethod( class myClassA * pInPtr ) { return pInPtr; } # myClassB_2.h class myClassB { class myClassA * myMethod( class myClassA * pInCurPtr ); } """ cppheader = CppHeader(code<#>, argType="string") print cppheader
What version of CppHeaderParser are you using? Have you used the newest one in HG?
Hi, Version 2.3.1 and yes, I pulled from the HG repo.
Hi Jashua, I was wondering if you needed anything else from me to help. Thanks so much for your effort on this.
Thats a very nice way to say "Hurry up and fix it" :)
Sorry, I have just not had the energy to look into this after work. I will try tonight or tomorrow. Feel free to pester me so I dont forget :)
-Jash
From: bgrupczy bgrupczy@users.sf.net
To: [cppheaderparser:bugs] 55@bugs.cppheaderparser.p.re.sf.net
Sent: Thursday, June 27, 2013 8:34 AM
Subject: [cppheaderparser:bugs] #55 Parsing is not accurate or crashes
Hi Jashua, I was wondering if you needed anything else from me to help. Thanks so much for your effort on this.
[bugs:#55] Parsing is not accurate or crashes
Status: open
Created: Wed Jun 12, 2013 06:09 AM UTC by bgrupczy
Last Updated: Wed Jun 12, 2013 01:41 PM UTC
Owner: Jashua Cloutier
Parsing is not accurate or crashes. # # code1 - Parses class but then defines the method definition as a function. # code2 - Reverse order of code1. I think this is OK. Not sure about "'returns': 'int'". # code3 - Class methods returning pointers to classes. Crashes on namespace collision. # code4 - Reverse order of code3. Misunderstands but not sure how to explain. from CppHeaderParser import CppHeader code1 = """ # myClassB_1.h int * myClassB::myMethod( int * pInPtr ) { return pInPtr; } # myClassB_2.h class myClassB { int * myMethod( int * pInCurPtr ); } """ code2 = """ # myClassB_1.h class myClassB { int * myMethod( int * pInCurPtr ); } # myClassB_2.h int * myClassB::myMethod( int * pInPtr ) { return pInPtr; } """ code3 = """ # myClassB_1.h class myClassB { class myClassA * myMethod( class myClassA * pInCurPtr ); } # myClassB_2.h class myClassA * myClassB::myMethod( class myClassA * pInPtr ) { return pInPtr; } """ code4 = """ # myClassB_1.h class
myClassA * myClassB::myMethod( class myClassA * pInPtr ) { return pInPtr; } # myClassB_2.h class myClassB { class myClassA * myMethod( class myClassA * pInCurPtr ); } """ cppheader = CppHeader(code<#>, argType="string") print cppheader
Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/cppheaderparser/bugs/55/
To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/
Related
Bugs:
#55You have a good sense of humor sir! :)
Me too about work. If I had more time, I'd try to learn your code and contribute.
-Brad
code2 is working fine on the latest version of the library. Return is 'int *'.
class myClassB
{
public
protected
private
// Methods
{'line_number': 5, 'static': False, 'rtnType': 'int *', 'const': False, 'parameters': [{'line_number': 5, 'constant': 0, 'name': 'pInCurPtr', 'reference': 0, 'type': 'int *', 'static': 0, 'pointer': 1}], 'namespace': '', 'virtual': False, 'destructor': False, 'returns': 'int', 'template': False, 'friend': False, 'returns_class': False, 'extern': False, 'path': 'myClassB', 'returns_pointer': 1, 'class': None, 'name': 'myMethod', 'pure_virtual': False, 'explicit': False, 'returns_fundamental': True, 'constructor': False, 'debug': 'int * myMethod ( int * pInCurPtr ) ;', 'inline': False}
}
code1 & code4 are invalid C++. CppHeaderParser only handles valid code. Here is what g++ says about both:
test.cpp:43:18: error: ‘myClassB’ has not been declared
That makes sense. I posted it but never tried running it through a compiler, only the parser. I'll do that before I post in the future.
code 3 was my original culprit.
Last edit: bgrupczy 2013-06-28
Fixed in commit 113:6e51808272e6
closed/fixed
Diff: