1 (edited by JohnWasilewski 2013-06-30 05:27:34)

Topic: Editor text colour anomalies

I often notice the editor making mistakes in the colours used in the text.
I've sent an email to Jeff with attachments illustrating this.

I adopt a convention of putting debug statements between two identifying lines like this:

C--debug--------------------------------------------------------------\-
     DEBUG CODE
     GOES IN HERE
C--debug--------------------------------------------------------------/-

This is so that I can easily find and remove the debug code after I no longer need it.
The editing colour anomalies seem to happen when I do this.

Here is one of the examples I've emailed to Jeff, which I am reproducing here using 'BBCode', :

C--debug--------------------------------------------------------------\-
      write(F%O%LU,'(2(''\par ''),
     +            ''VECTR('',I2,'','',I2,'') ='',F10.2,''\par '',
     +              ''RSTIF('',I2,'') ='',F10.0,''\par '',
     +              ''VECTR('',I2,'',1) ='',F10.2)')
     +            ILCAS,IDOFG(J), VECTR(ILCAS,IDOFG(J)),
     +            JR+1, RSTIF(JR+1),
     +            ILCAS, VECTR(ILCAS,1)
C--debug--------------------------------------------------------------/-

It is not caused by my use of the backslash character in text strings, by the way, because it also happens in code that does not contain a backslash.  (In case anyone wants to know, I use backslash in text strings when generating output to .RTF files.  In the above example, "\par " produces a CR/LF in an .RTF file).
----
John

Re: Editor text colour anomalies

John,

I've found the culprit.  Basically, the lexing engine for colorizing Fortran always assumes strings that don't close before the end of a line are an error, and this fact is certainly true in Fortran 90 and higher.  However, in fixed-format Fortran, your example is perfectly valid.  I just added some checks to see if we've reached the end of a line and we're in fixed-format mode. If so, the lexer is told that we're still in string mode until it doesn't encounter a continuation character.  Here's how it renders now:

http://i.imgur.com/khVGoEL.png


Good bug you've found there!

Jeff Armstrong
Approximatrix, LLC

3 (edited by JohnWasilewski 2014-08-10 06:52:29)

Re: Editor text colour anomalies

This is not an important point but you might be interested to see it, Jeff.
Please see this screenshot.

http://i.imgur.com/ANl4q6I.jpg

Note how, (i) in the first 'Debug' line that can be seen in the screenshot, the word 'program' is incorrectly coloured red, and, (ii) in the second 'Debug' line, beginning with the word, "only", the text colour changes wrongly into blue, signifying incorrectly that the editor is misinterpreting it as Fortran code, not a comment string.
---
John

4 (edited by JohnWasilewski 2014-08-04 22:07:42)

Re: Editor text colour anomalies

CORRECTION.

I've just realised my own mistake.

The 'Debug' lines are not marked with a 'C' in the first character position, so the editor won't know that they are comments.  I do this on purpose when I come to the end of a session.  When I resume, which might be an hour later or a month later or anything in between, I use the compiler to find my messages I've left for myself, which it flags up as errors, obviously.  I then insert a 'C' in front of each error line and, reminded of where I had left off and what I was trying to solve, I am able to continue debugging.

Sorry about the incorrect post but people might find this interesting nonetheless.
---
John

Re: Editor text colour anomalies

John,

It's no problem, and it's an honest mistake.  However, the colorization engine is far from perfect, so please do post any inconsistencies you see.

Jeff Armstrong
Approximatrix, LLC