Menu

#55 Parsing is not accurate or crashes

v1.0 (example)
closed-fixed
None
5
2013-07-02
2013-06-12
bgrupczy
No
# 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
1 Attachments

Related

Bugs: #55

Discussion

  • Jashua Cloutier

    Jashua Cloutier - 2013-06-12

    What version of CppHeaderParser are you using? Have you used the newest one in HG?

     
  • bgrupczy

    bgrupczy - 2013-06-12

    Hi, Version 2.3.1 and yes, I pulled from the HG repo.

     
  • bgrupczy

    bgrupczy - 2013-06-27

    Hi Jashua, I was wondering if you needed anything else from me to help. Thanks so much for your effort on this.

     
  • Jashua Cloutier

    Jashua Cloutier - 2013-06-27

    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: #55

  • bgrupczy

    bgrupczy - 2013-06-27

    You 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

     
  • Jashua Cloutier

    Jashua Cloutier - 2013-06-27

    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}
    }

     
  • Jashua Cloutier

    Jashua Cloutier - 2013-06-28

    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

     
  • bgrupczy

    bgrupczy - 2013-06-28

    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
  • Jashua Cloutier

    Jashua Cloutier - 2013-07-02

    Fixed in commit 113:6e51808272e6

     
  • Jashua Cloutier

    Jashua Cloutier - 2013-07-02

    closed/fixed

     
  • Jashua Cloutier

    Jashua Cloutier - 2013-07-02
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,4 +1,3 @@
    -
    
         :::python
         # Parsing is not accurate or crashes.
    
    • status: open --> closed-fixed
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.