42 lines
2.4 KiB
C
42 lines
2.4 KiB
C
static void highlight_fortran (void) {
|
|
char * separators = ",:<=>+-*/&()[]\"\' \t\r\n";
|
|
|
|
char * keywords [] = {
|
|
"allocatable", "allocate", "associate", "backspace", "block", "call", "case", "common",
|
|
"contains", "cycle", "data", "deallocate", "d0", "do", "else", "elseif",
|
|
"end", "enddo", "endfile", "endif", "entry", "equivalence", "exit", "external",
|
|
"forall", "format", "function", "goto", "if", "implicit", "inquire", "intent",
|
|
"intrinsic", "module", "namelist", "none", "nullify", "only", "open", "optional",
|
|
"parameter", "pointer", "print", "private", "program", "public", "read", "recursive",
|
|
"return", "rewind", "save", "select", "sequence", "stop", "subroutine", "target",
|
|
"then", "to", "type", "use", "where", "write"
|
|
};
|
|
|
|
char * constants [] = {
|
|
".and.", ".or.", ".not.", ".true.", ".false.", "in", "out", "character",
|
|
"integer", "logical", "real", "complex", "dimension", "modulo", "len", "advance"
|
|
};
|
|
|
|
int word;
|
|
|
|
syntax_define (false, false, "!", "\n", '\0', (int) 0xff777777, 0);
|
|
syntax_define (false, false, "'", "'", '\\', (int) 0xff7733cc, 0);
|
|
syntax_define (false, false, "\"", "\"", '\\', (int) 0xffcc3377, 0);
|
|
|
|
for (word = 0; word != (int) (sizeof (keywords) / sizeof (keywords [0])); ++word) {
|
|
syntax_define (false, true, keywords [word], separators, '\0', (int) 0xff33ccee, 0);
|
|
}
|
|
|
|
for (word = 0; word != (int) (sizeof (constants) / sizeof (constants [0])); ++word) {
|
|
syntax_define (false, true, constants [word], separators, '\0', (int) 0xff55aacc, 0);
|
|
}
|
|
|
|
syntax_define (true, false, "()[]", "", '\0', (int) 0xffee5533, 0);
|
|
syntax_define (true, false, ",:<=>+-*/&", "", '\0', (int) 0xffeeaa33, 0);
|
|
|
|
syntax_define (true, true, "0123456789", separators, '\0', (int) 0xffee33aa, 0);
|
|
syntax_define (true, true, "abcdefghijklmnopqrstuvwxyz", separators, '\0', (int) 0xffcccccc, 0);
|
|
syntax_define (true, true, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", separators, '\0', (int) 0xffeeeeee, 0);
|
|
syntax_define (true, true, "_", separators, '\0', (int) 0xffaaaaaa, 0);
|
|
}
|