octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #60712] Editor : highlight statements that are


From: PIERRE LABRECHE
Subject: [Octave-bug-tracker] [bug #60712] Editor : highlight statements that are not terminated by semicolon
Date: Mon, 7 Jun 2021 15:36:21 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36

Follow-up Comment #8, bug #60712 (project octave):

Unfortunately I cannot help for the implementation. 


I found that Matlab has checkcode and mlint for detecting potentially
unintended side-effets. 
https://www.mathworks.com/help/matlab/ref/checkcode.html
https://www.mathworks.com/help/matlab/ref/mlint.html

mlint finds warnings such as :
"L 49 (C 17): Terminate statement with semicolon to suppress output (in
functions)."

Checkcode example:
L 48 (C 17): Terminate statement with semicolon to suppress output (in
functions).


Another interesting environment, Matclipse, is found here:
https://undocumentedmatlab.com/blog_old/matclipse-eclipse-matlab-interface
Its Xtext-based editor might be useful for implementing built-in checks on the
fly.

[comment #7 commentaire #7 :]
> 
> This regexpr has a lot of false finds, such as statements broken on multiple
lines, if and switch statements with their else and case clauses, functions
and endfunctions, classdefs and properties, ... and so on ! 
> 
> 
> Maybe this job could be done semi-reliably with some ad-hoc parsing built
directly into the editor, I don't know.  But that approach seems like a lot of
work and probably unreliable.
> 
> My guess is that unless it is hooked into Octave's parser, the editor will
have the same problem identifying expressions that are not terminated with
semicolons.
> 
> If it is hooked into Octave's parser, then how often will the parser have to
run?  Does it have to parse the entire text from the beginning of the file
each time a character is added to the file?  If there are any syntax errors in
the file, the results could be wildly wrong until all the syntax errors are
corrected.
> 
> As a related issue, Octave's parser currently just fails at the first error.
 It doesn't perform error recovery and attempt to find a new good point to
resume parsing.  That could probably be fixed, but is no small task.
> 
> I'm not disagreeing that this feature would be nice to have, but it seems to
me that implementing it well represents a significant amount of work.
> 
> We are all volunteers here.  If you are interested in this feature, can you
help to implement it?

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?60712>

_______________________________________________
  Message posté via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]