Fortran 90/95 syntax highlighting in NEdit 5.5 ?

  • Follow


I'm trying to get colored syntax highlighting to work in NEdit
5.5 (Sep 30, 2004) (for a collegue of mine).

I added .f90 and .f95 to the File extensions under

  Preferences -> Default Settings -> Language Modes -> Fortran

but all I get is some black/white/italic syntax highlighting, no
colours at all.

Does anybody in this group has experience with colored syntax
highlighting for Fortran 90/95 code in NEdit?

Thanks,
Bart

-- 
	"Share what you know.  Learn what you don't."
0
Reply MyFirstName.MyLastName (522) 6/16/2009 8:26:40 AM

Bart Vandewoestyne wrote:
> I'm trying to get colored syntax highlighting to work in NEdit
> 5.5 (Sep 30, 2004) (for a collegue of mine).
> 
> I added .f90 and .f95 to the File extensions under
> 
>   Preferences -> Default Settings -> Language Modes -> Fortran
> 
> but all I get is some black/white/italic syntax highlighting, no
> colours at all.
> 
> Does anybody in this group has experience with colored syntax
> highlighting for Fortran 90/95 code in NEdit?
> 
> Thanks,
> Bart
> 

Check with nedit.org:  from _someone_ (there, I think) I got the set
of f90 highlight patterns below.

-- Carlie Coats

---------------  cut here for extract from nedit.rc  -------------
nedit.highlightPatterns:
	Fortran90:1:30{\n\
		Comment:"!":"$"::Comment::\n\
		Continuation:"&":::Flag::\n\
		String:"'":"'":"\\n([^ \\t]| [^ \\t]|  [^ \\t]|   [^ \\t]|    [^ \\t]| 
     [ \\t0]| *\\t[^1-9])":String::\n\
	 
Keywords:"<(ACCEPT|[Aa]ccept|ASSIGN|[Aa]ssign|AUTOMATIC|[Aa]utomatic|BACKSPACE|[Bb]ackspace|BLOCK|[Bb]lock|CALL|[Cc]all|CLOSE|[Cc]lose|COMMON|[Cc]ommon|CONTINUE|[Cc]ontinue|DATA|[Dd]ata|DECODE|[Dd]ecode|DELETE|[Dd]elete|DIMENSION|[Dd]imension|DO|[Dd]o|ELSE|[Ee]lse|ELSEIF|[Ee]lseif|ENCODE|[Ee]ncode|END 
*FILE|[Ee]nd 
*[Ff]ile|ENDFILE|[Ee]ndfile|END|[Ee]nd|ENDIF|[Ee]ndif|ENTRY|[Ee]ntry|EQUIVALENCE|[Ee]quivalence|EXIT|[Ee]xit|EXTERNAL|[Ee]xternal|FORMAT|[Ff]ormat|FUNCTION|[Ff]unction|GOTO|[Gg]oto|IF|[Ii]f|IMPLICIT|[Ii]mplicit|INCLUDE|[Ii]nclude|INQUIRE|[Ii]nquire|INTRINSIC|[Ii]ntrinsic|LOGICAL|[Ll]ogical|MAP|[Mm]ap|NONE|[Nn]one|ON|[Oo]n|OPEN|[Oo]pen|PARAMETER|[Pp]arameter|PAUSE|[Pp]ause|POINTER|[Pp]ointer|PRINT|[Pp]rint|PROGRAM|[Pp]rogram|READ|[Rr]ead|RECORD|[Rr]ecord|RETURN|[Rr]eturn|REWIND|[Rr]ewind|SAVE|[Ss]ave|STATIC|[Ss]tatic|STOP|[Ss]top|STRUCTURE|[Ss]tructure|SUBROUTINE|[Ss]ubroutine|SYSTEM|[Ss]ystem|THEN|[Tt]hen|TO|[Tt]o|TYPE|[Tt]ype|UNION|[Uu]nion|UNLOCK|[Uu]nlock|VIRTUAL|[Vv]irtual|VOLATILE|[Vv]olatile|WHILE|[Ww]hile|WRITE|[Ww]rite)>":::Keyword::D\n\
		Data 
Types:"<(BYTE|[Bb]yte|CHARACTER|[Cc]haracter|COMPLEX|[Cc]omplex|DOUBLE 
*COMPLEX|[Dd]ouble *[Cc]omplex|DOUBLE *PRECISION|[Dd]ouble 
*[Pp]recision|DOUBLE|[Dd]ouble|INTEGER|[Ii]nteger|REAL|[Rr]eal)(\\*[0-9]+)?>":::Keyword::D\n\
		F90 
Keywords:"<(ALLOCATABLE|[Aa]llocatable|ALLOCATE|[Aa]llocate|CASE|[Cc]ase|CASE|[Cc]ase|CONTAINS|[Cc]ontains|CYCLE|[Cc]ycle|DEALLOCATE|[Dd]eallocate|ELSEWHERE|[Ee]lsewhere|ENDWHERE|[Ee]ndwhere|INTENT|[Ii]ntent|INTERFACE|[Ii]nterface|MODULE|[Mm]odule|NAMELIST|[Nn]amelist|OPTIONAL|[Oo]ptional|PRIVATE|[Pp]rivate|PROCEDURE|[Pp]rocedure|PUBLIC|[Pp]ublic|REWRITE|[Rr]ewrite|SELECT|[Ss]elect|USE|[Uu]se|WHERE|[Ww]here)>":::Keyword::D\n\
		Numeric 
const:"<[0-9]+(\\.[0-9]*)?([DEde][-+]?[0-9]*)?|\\.[0-9]+([DEde][-+]?[0-9]*)?>":::Numeric 
Const::D\n\
	}\n\
nedit.languageModes:
	Fortran90:.f90 .F90:::None::::\n\
0
Reply carlie (79) 6/16/2009 11:08:25 AM


Carlie Coats wrote:
> Bart Vandewoestyne wrote:
>> I'm trying to get colored syntax highlighting to work in NEdit
>> 5.5 (Sep 30, 2004) (for a collegue of mine).
>>
>> I added .f90 and .f95 to the File extensions under
>>
>>   Preferences -> Default Settings -> Language Modes -> Fortran
>>
>> but all I get is some black/white/italic syntax highlighting, no
>> colours at all.
>>
>> Does anybody in this group has experience with colored syntax
>> highlighting for Fortran 90/95 code in NEdit?
>>
>> Thanks,
>> Bart
>>
> 
> Check with nedit.org:  from _someone_ (there, I think) I got the set
> of f90 highlight patterns below.
> 
> -- Carlie Coats
> 
> ---------------  cut here for extract from nedit.rc  -------------
> nedit.highlightPatterns:
>     Fortran90:1:30{\n\
>         Comment:"!":"$"::Comment::\n\
>         Continuation:"&":::Flag::\n\
>         String:"'":"'":"\\n([^ \\t]| [^ \\t]|  [^ \\t]|   [^ \\t]|    [^ 
> \\t]|     [ \\t0]| *\\t[^1-9])":String::\n\
>      
> Keywords:"<(ACCEPT|[Aa]ccept|ASSIGN|[Aa]ssign|AUTOMATIC|[Aa]utomatic|BACKSPACE|[Bb]ackspace|BLOCK|[Bb]lock|CALL|[Cc]all|CLOSE|[Cc]lose|COMMON|[Cc]ommon|CONTINUE|[Cc]ontinue|DATA|[Dd]ata|DECODE|[Dd]ecode|DELETE|[Dd]elete|DIMENSION|[Dd]imension|DO|[Dd]o|ELSE|[Ee]lse|ELSEIF|[Ee]lseif|ENCODE|[Ee]ncode|END 
> *FILE|[Ee]nd 
> *[Ff]ile|ENDFILE|[Ee]ndfile|END|[Ee]nd|ENDIF|[Ee]ndif|ENTRY|[Ee]ntry|EQUIVALENCE|[Ee]quivalence|EXIT|[Ee]xit|EXTERNAL|[Ee]xternal|FORMAT|[Ff]ormat|FUNCTION|[Ff]unction|GOTO|[Gg]oto|IF|[Ii]f|IMPLICIT|[Ii]mplicit|INCLUDE|[Ii]nclude|INQUIRE|[Ii]nquire|INTRINSIC|[Ii]ntrinsic|LOGICAL|[Ll]ogical|MAP|[Mm]ap|NONE|[Nn]one|ON|[Oo]n|OPEN|[Oo]pen|PARAMETER|[Pp]arameter|PAUSE|[Pp]ause|POINTER|[Pp]ointer|PRINT|[Pp]rint|PROGRAM|[Pp]rogram|READ|[Rr]ead|RECORD|[Rr]ecord|RETURN|[Rr]eturn|REWIND|[Rr]ewind|SAVE|[Ss]ave|STATIC|[Ss]tatic|STOP|[Ss]top|STRUCTURE|[Ss]tructure|SUBROUTINE|[Ss]ubroutine|SYSTEM|[Ss]ystem|THEN|[Tt]hen|TO|[Tt]o|TYPE|[Tt]ype|UNION|[Uu]nion|UNLOCK|[Uu]nlock|VIRTUAL|[Vv]irtual|VOLATILE|[Vv]olatile|WHILE|[Ww]hile|WRITE|[Ww]rite)>":::Keyword::D\n\ 
> 
>         Data 
> Types:"<(BYTE|[Bb]yte|CHARACTER|[Cc]haracter|COMPLEX|[Cc]omplex|DOUBLE 
> *COMPLEX|[Dd]ouble *[Cc]omplex|DOUBLE *PRECISION|[Dd]ouble 
> *[Pp]recision|DOUBLE|[Dd]ouble|INTEGER|[Ii]nteger|REAL|[Rr]eal)(\\*[0-9]+)?>":::Keyword::D\n\ 
> 
>         F90 
> Keywords:"<(ALLOCATABLE|[Aa]llocatable|ALLOCATE|[Aa]llocate|CASE|[Cc]ase|CASE|[Cc]ase|CONTAINS|[Cc]ontains|CYCLE|[Cc]ycle|DEALLOCATE|[Dd]eallocate|ELSEWHERE|[Ee]lsewhere|ENDWHERE|[Ee]ndwhere|INTENT|[Ii]ntent|INTERFACE|[Ii]nterface|MODULE|[Mm]odule|NAMELIST|[Nn]amelist|OPTIONAL|[Oo]ptional|PRIVATE|[Pp]rivate|PROCEDURE|[Pp]rocedure|PUBLIC|[Pp]ublic|REWRITE|[Rr]ewrite|SELECT|[Ss]elect|USE|[Uu]se|WHERE|[Ww]here)>":::Keyword::D\n\ 
> 
>         Numeric 
> const:"<[0-9]+(\\.[0-9]*)?([DEde][-+]?[0-9]*)?|\\.[0-9]+([DEde][-+]?[0-9]*)?>":::Numeric 
> Const::D\n\
>     }\n\
> nedit.languageModes:
>     Fortran90:.f90 .F90:::None::::\n\

And, just for grins, here's what I use to comment/uncomment blocks of Fortran code in my 
nedit.rc:

         Comment@Fortran:Alt+1::: {\n\
                 if ($selection_start == -1) {\n\
                     cur = $cursor\n\
                     beginning_of_line()\n\
                     select($cursor, $cursor + 1)\n\
                     replace_in_selection("^", "!", "regex")\n\
                     set_cursor_pos(cur)\n\
                     select(-1,-1)\n\
                 #    replace_all("^", "!", "regex")\n\
                 }\n\
                 else\n\
                     replace_in_selection("^", "!", "regex")\n\
         }\n\
         Uncomment@Fortran:Shift+Alt+1::: {\n\
                 if ($selection_start == -1) {\n\
                     cur = $cursor\n\
                     beginning_of_line()\n\
                     select($cursor, $cursor + 1)\n\
                     replace_in_selection("^!", "", "regex")\n\
                     set_cursor_pos(cur)\n\
                     select(-1,-1)\n\
                 #    replace_all("^!", "", "regex")\n\
                 }\n\
                 else\n\
                     replace_in_selection("^!", "", "regex")\n\
         }\n\

Select a block of text and "Alt+1" sticks a "!" in col 1. Shift+Alt+1 uncomments the block.

cheers,

paulv
0
Reply paul.vandelst (1947) 6/16/2009 5:12:45 PM

2 Replies
120 Views

(page loaded in 0.089 seconds)

Similiar Articles:




7/24/2012 7:20:53 AM


Reply: