Re: Re: Re: Re: [code] Proposal: Change to Python/Ruby syntax checking commands

From: Mitchell <m.att.foicica.com>
Date: Tue, 15 Sep 2015 10:43:56 -0400 (EDT)

Hi Arnel,

On Tue, 15 Sep 2015, Arnel wrote:

> On 9/14/2015 10:55 AM, Mitchell wrote:
>> Hi Arnel,
>>
>> On Fri, 11 Sep 2015, Arnel wrote:
>>
>>> On 9/9/2015 7:30 AM, Mitchell wrote:
>>>> Hi Arnel,
>>>>
>>>> On Tue, 8 Sep 2015, Arnel wrote:
>>>>
>>>>> On 9/8/2015 1:43 AM, Mitchell wrote:
>>>>>> Hi Arnel,
>>>>>>
>>>>>> On Mon, 7 Sep 2015, jalespring.att.gmail.com wrote:
>>>>>>
>>>>>>> Hi Mitchell,
>>>>>>>
>>>>>>> Attached is a change I would like to propose to the Python syntax
>>>>>>> checking command and the Ruby syntax error pattern. This change is
>>>>>>> done against revision cd5906e1c812.
>>>>>>>
>>>>>>> I noticed the syntax checking process change did not work for some
>>>>>>> reason with Python and Ruby files in the new TA version (v8.2 and the
>>>>>>> nightly version).
>>>>>>>
>>>>>>> For Python, I initially tried replacing the single quotation marks
>>>>>>> with doubles, which partly fixed the issue, but was giving me errors
>>>>>>> with the shebang line. Bringing it back to using the 'py_compile'
>>>>>>> module worked fine.
>>>>>>>
>>>>>>> For Ruby, the new pattern was not taking the source filename into
>>>>>>> account. So I just added it.
>>>>>>>
>>>>>>> My current workaround is to set the following in my init.lua:
>>>>>>>
>>>>>>> textadept.run.syntax_commands.python = [[python -m py_compile "%f"]]
>>>>>>> textadept.run.syntax_error_patterns.ruby = '.+:(%d+):
>>>>>>> ([^\r\n]+).-[\r\n]+(%s*)'
>>>>>>>
>>>>>>> I hope the change will be considered.
>>>>>>
>>>>>> Thanks for your report. Which version of Python were you using?
>>>>>> What was
>>>>>> the filename? The reason against using py_compile is that Python2 and
>>>>>> Python3 report different error messages, whereas Textadept's existing
>>>>>> command outputs the same message regardless of version.
>>>>>
>>>>> I was using Python 3 (v3.4.3, to be exact).
>>>>>
>>>>> I'm sorry - what "filename" are you referring to? If you meant the one
>>>>> for Python, on Windows, that would just be "python.exe," same as for
>>>>> Python 2.x.
>>>>
>>>> Sorry for the confusion. The name of the Python source file you were
>>>> saving, the one being syntax checked. I thought maybe it had some odd
>>>> character in it that was interfering with the quotes in the syntax
>>>> checking command.
>>>
>>> Sorry for the trouble. No, the filenames I use consist of vanilla
>>> ASCII characters (/a-zA-Z0-9/ plus the odd hyphen or underscore).
>>
>> It is quite odd that you would have a problem with such standard
>> filenames. If you can still reproduce this with the latest nightly, some
>> more details would be quite helpful in tracking this down.
>
> Hi Mitchell,
>
> The Ruby issue appears fixed with the new nightly build (2015-09-13).
> The Python one still recurs with this minimal script:
>
> #!/usr/bin/env python
>
> def f(x):
> if x ~= 5:
> print('not equal to 5')
>
> I deliberately entered the tilde character beside the equals sign there to
> induce the error, but no "syntax error" message still appears with the new
> nightly. I tested this already with a blank 'init.lua' in my ~/.textadept
> directory in Windows 8.1. The filename I used is simply 'ex.py.'
>
> I currently have Python 3.5 installed, no Python 2.7.x.
>
> If I put in the following line in the otherwise empty 'init.lua':
>
> textadept.run.syntax_commands.python = [[python -m py_compile "%f"]]
>
> The syntax-checking works fine.
>
> Is there any other information you need me to get to you? I'm not familiar
> with debugging Lua code (other than the usual "print" statements).

I only have Python 3.4.0 installed. Will you please open a terminal in the
directory with your Python file and run this command:

   python -c 'compile(open("%f").read(),"%f","exec",0,1)'

Let me know what output you get. If that command does not work in the
Windows terminal, then open Textadept's command entry (Ctrl+E) and type
(all on one line):

   textadept.run.compile_commands.python = textadept.run.syntax_commands.python

Then run the Tools->Compile command and report your output. (Restarting
or resetting Textadept will revert this change you just made; it's not
permanent.)

Thanks a lot.

Cheers,
Mitchell

>
> Thanks for looking further into this.
>
> --Arnel
>

Mitchell

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Tue 15 Sep 2015 - 10:43:56 EDT

This archive was generated by hypermail 2.2.0 : Wed 16 Sep 2015 - 06:32:26 EDT