Discussion:
Fortran code folding
Kyle Horne
2014-01-15 01:30:49 UTC
Permalink
Hi all,

I have an updated version of LexFortran.cxx that correctly handles the new
abstract types and interfaces from the 2003 standard. I have tested it
through geany, and it seems to correct the problem of folding an abstract
type or interface folding the remainder of the document instead of just the
block. The new version is attached to this message.
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/groups/opt_out.
Neil Hodgson
2014-01-15 03:53:23 UTC
Permalink
I have an updated version of LexFortran.cxx that correctly handles the new abstract types and interfaces from the 2003 standard.
This change has no effect since the previous line accepts any occurrence of the “interface” keyword:
|| strcmp(s, "function") == 0 || strcmp(s, "interface") == 0

The Fortran folder has some quite bad problems including writing outside of allocated memory for ‘do <label>’ loops, potentially crashing. The labels used for do loops are tracked in the *static* doLabels array using the posLabel index. Since these variables are static, they are shared between all loaded Fortran documents so one document may interfere with another. The life of the array elements is also a mess: if the ‘do’ and the label are far enough apart so that the label is off-screen and its folding not updated with the ‘do’ line then all changes to the ‘do’ line will increment posLabel, eventually overflowing doLabels.

Neil
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/groups/opt_out.
Neil Hodgson
2014-01-31 22:16:17 UTC
Permalink
The Fortran folder has some quite bad problems including writing outside of allocated memory for 'do <label>' loops, potentially crashing.
Fixing this properly is complex, requiring a memory of the do-label loops that are active. This would be best done by converting the Fortran lexer to an object lexer but that would require more effort. It might be possible to use the per-line state for this but, again, this is tricky.

The easiest approach to fixing the bug will be to remove all folding of do-label loops. If no one else wants to work on Fortran folding, I will remove this code soon.

Neil
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/groups/opt_out.
Neil Hodgson
2014-02-05 22:11:56 UTC
Permalink
Fortran do-label folding has been removed with this commit:
https://sourceforge.net/p/scintilla/code/ci/02c8d916484f8026f69daf2232315d9dc5ae78bc/

Neil
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/groups/opt_out.
Continue reading on narkive:
Loading...