wsy4665 / ulipad

Automatically exported from code.google.com/p/ulipad
0 stars 0 forks source link

Syntax check does not work #192

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
To Reproduce:
1. Create a new python file or edit existing script
2. Use the following code:
[code=python]
def test_func(a, b):
    print a, b

test_func(, "Test")
[/code]
3. Use the built-in syntax check (with or without PEP-8 check)
4. SyntaxError does not get caught.  Attempting to Run with F5 causes
Message window to open reporting SyntaxError.

I would expect this be caught by the built in syntax checker.

My Versions:
UliPad version 3.9 on Windows XP SP2
Python 2.5.2, wx 2.8.8.0 (msw-ansi), comtypes 0.6.0

Original issue reported on code.google.com by JamesLMatthewsIII on 2 Jul 2009 at 12:46

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Update:
Installed latest stable version of wx - '2.8.10.1 (msw-unicode)' and pulled 
down the
SVN trunk of UliPad.

Using the previous repro steps shows that the issue is resolved with the latest
versions of wx and UliPad.  However a new issue has cropped up, which appears 
to be
an issue with the PEP-8 checking module.

New Repro steps:
1. Create a new python file
2. Create any code with either a missing closing parenthesis or quote:
For example,
 print '1
or 
 print ( '1', 
3. Perform a syntax check with PEP-8

This causes no action (no messages about a failure, which at the very least 
should
happen), checking the error.txt you see the following traceback:

[Traceback]Traceback (most recent call last):
  File "C:\Documents and Settings\Administrator\Desktop\UliSVN\mixins\Import.py",
line 7955, in OnPythonCheck
    SyntaxCheck.Check(win, win.document)
  File "C:\Documents and
Settings\Administrator\Desktop\UliSVN\mixins\SyntaxCheck.py", line 67, in Check
    pep8check(document, message)
  File "C:\Documents and
Settings\Administrator\Desktop\UliSVN\mixins\SyntaxCheck.py", line 197, in 
pep8check
    MyPep8(editor.getFilename()).check_all()
  File "C:\Documents and Settings\Administrator\Desktop\UliSVN\modules\pep8.py", line
620, in check_all
    for token in tokenize.generate_tokens(self.readline_check_physical):
  File "C:\Python25\lib\tokenize.py", line 283, in generate_tokens
    raise TokenError, ("EOF in multi-line statement", (lnum, 0))
TokenError: ('EOF in multi-line statement', (659, 0))

Looks like the PEP8 checker can't handle this type of error; however if we turn 
off
PEP-8 checking, the basic syntax checker (tab Nanny??) does catch the error.  
Perhaps
the code should be modified to not run PEP-8 checker unless the basic syntax is
solid...  

Original comment by JamesLMatthewsIII on 2 Jul 2009 at 5:26

GoogleCodeExporter commented 8 years ago
For print ( '1', pep8 can't parse it correctly, so it'll complain errors. And 
I've 
tried:

{{{
def test_func(a, b):
    print a, b

test_func(, "Test")
}}}

It'll complain syntax error.

Original comment by limo...@gmail.com on 30 Jul 2009 at 2:22

GoogleCodeExporter commented 8 years ago

Original comment by limo...@gmail.com on 3 Dec 2009 at 10:27