#229 Python parser fails on quoted triple strings

open-fixed
None
5
2008-06-11
2008-06-08
No

The Python parser fails to continue parsing a file once it got a triple string which is quoted.
Exmaple code:

#!/usr/bin/env python

def testFunc():
print 'The following works now' + '"""'
print 'This is another quoted triple string: """.'

def main():
print 'nothing'
return 0

Attached patch solves the problem.

Discussion

  • Enrico Tröger

    Enrico Tröger - 2008-06-08

    Possible fix

     
  • Enrico Tröger

    Enrico Tröger - 2008-06-08

    another test case

     
  • Enrico Tröger

    Enrico Tröger - 2008-06-08

    Logged In: YES
    user_id=1117045
    Originator: YES

    For a more complex, real example see quoted_triple_strings.py.

    The parser ignores anything after the function wiki_to_html() because of the quoted triple string in line 51.
    File Added: quoted_triple_strings.py

     
  • Elias Pschernig

    Elias Pschernig - 2008-06-11

    Logged In: YES
    user_id=32894
    Originator: NO

    Thanks, fixed as of revision 669. I didn't apply the patch but instead used the existing function to skip (single-quoted) strings - hopefully that covers now all cases the Python parser itself handles. Well, except raw strings, those will need further special dealing.

     
  • Elias Pschernig

    Elias Pschernig - 2008-06-11
    • assigned_to: nobody --> elias
    • status: open --> open-fixed
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks