Discussion:
Fortran90 OpenMP directives -- syntax highlighting?
Carlie J. Coats
2009-09-22 16:15:45 UTC
Permalink
Fortran OpenMP directives look something like the following example:

!$OMP PARALLEL DO DEFAULT( NONE ), &
!$OMP& SHARED( C1, C2, R1, R2, DH, KH, SFCHEADRT ), &
!$OMP& PRIVATE( I, J, K, C, R ), &
!$OMP& SCHEDULE( DYNAMIC )

where a directive is started by a "!$OMP", and continued by a
"&\n!$OMP&". It would be nice to have them highlighted in some
fashion. I've tried to treat them as "Preprocessor" style by
adding a "Directive:"^!\$OMP":"$"::Preprocessor::\n\" line
to the Fortran90 "nedit.highlightPatterns" in my RC file (not
a full-strength description of the directives, but for a first
cut, it should help), and that didn't work for me. I'm probably
missing something obvious;-(

How *should* I do it?

-- Carlie J. Coats, Jr.
Baron Advanced Meteorological Systems, LLC.
--
NEdit Discuss mailing list - Discuss-***@public.gmane.org
http://www.nedit.org/mailman/listinfo/discuss
dantian
2009-09-22 17:33:58 UTC
Permalink
Hi,

here is what I do:

openmp:"!\\$omp":"$"::Identifier1::\n\

and for MPI ....

mpi:"call MPI_":"$"::Text Key1::\n\

Well here is the whole Fortran90 stuff:

Fortran90:1:30{\n\
openmp:"!\\$omp":"$"::Identifier1::\n\
mpi:"call MPI_":"$"::Text Key1::\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|ENDDO|[Ee]nddo|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\


Best,

Éric.
Post by Carlie J. Coats
!$OMP PARALLEL DO DEFAULT( NONE ), &
!$OMP& SHARED( C1, C2, R1, R2, DH, KH, SFCHEADRT ), &
!$OMP& PRIVATE( I, J, K, C, R ), &
!$OMP& SCHEDULE( DYNAMIC )
where a directive is started by a "!$OMP", and continued by a
"&\n!$OMP&". It would be nice to have them highlighted in some
fashion. I've tried to treat them as "Preprocessor" style by
adding a "Directive:"^!\$OMP":"$"::Preprocessor::\n\" line
to the Fortran90 "nedit.highlightPatterns" in my RC file (not
a full-strength description of the directives, but for a first
cut, it should help), and that didn't work for me. I'm probably
missing something obvious;-(
How *should* I do it?
-- Carlie J. Coats, Jr.
Baron Advanced Meteorological Systems, LLC.
--
/ Be the change you wish to see in the world
/ --- Mahatma Gandhi ---

dantian.free.fr <http://dantian.free.fr>

/gtalk/: aihaike-***@public.gmane.org
/msn/: aihaike-***@public.gmane.org
/skype/: aihaike

/ Please consider the environment before printing this email.
Considérez svp l'environnement avant d'imprimer cet email. /
--
NEdit Discuss mailing list - Discuss-***@public.gmane.org
http://www.nedit.org/mailman/listinfo/discuss
Tony Balinski
2009-09-23 04:31:33 UTC
Permalink
Post by Carlie J. Coats
!$OMP PARALLEL DO DEFAULT( NONE ), &
!$OMP& SHARED( C1, C2, R1, R2, DH, KH, SFCHEADRT ), &
!$OMP& PRIVATE( I, J, K, C, R ), &
!$OMP& SCHEDULE( DYNAMIC )
where a directive is started by a "!$OMP", and continued by a
"&\n!$OMP&". It would be nice to have them highlighted in some
fashion. I've tried to treat them as "Preprocessor" style by
adding a "Directive:"^!\$OMP":"$"::Preprocessor::\n\" line
to the Fortran90 "nedit.highlightPatterns" in my RC file (not
a full-strength description of the directives, but for a first
cut, it should help), and that didn't work for me. I'm probably
missing something obvious;-(
How *should* I do it?
Use the syntax highlighting dialog to do this instead of adding the line by
hand (or just put a second backslash in front of $OMP). In the neditrc file,
backslash is an escape character, so in your line, just makes $ explicit. But
what you want is to have backslash in your regex, so you need two. If you'd
used the dialog, you'd have typed ^!\$OMP as your start regex and it would
have been saved correctly when you save preferences.

Tony
--
NEdit Discuss mailing list - Discuss-***@public.gmane.org
http://www.nedit.org/mailman/listinfo/discuss
Loading...