Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: PL/M |
| 3 | " Maintainer: Philippe Coulonges <cphil@cphil.net> |
| 4 | " Last change: 2003 May 11 |
| 5 | |
| 6 | " For version 5.x: Clear all syntax items |
| 7 | " For version 6.x: Quit when a syntax file was already loaded |
| 8 | if version < 600 |
| 9 | syntax clear |
| 10 | elseif exists("b:current_syntax") |
| 11 | finish |
| 12 | endif |
| 13 | |
| 14 | " PL/M is a case insensitive language |
| 15 | syn case ignore |
| 16 | |
| 17 | syn keyword plmTodo contained TODO FIXME XXX |
| 18 | |
| 19 | " String |
| 20 | syn region plmString start=+'+ end=+'+ |
| 21 | |
| 22 | syn match plmOperator "[@=\+\-\*\/\<\>]" |
| 23 | |
| 24 | syn match plmIdentifier "\<[a-zA-Z_][a-zA-Z0-9_]*\>" |
| 25 | |
| 26 | syn match plmDelimiter "[();,]" |
| 27 | |
| 28 | syn region plmPreProc start="^\s*\$\s*" skip="\\$" end="$" |
| 29 | |
| 30 | " FIXME : No Number support for floats, as I'm working on an embedded |
| 31 | " project that doesn't use any. |
| 32 | syn match plmNumber "-\=\<\d\+\>" |
| 33 | syn match plmNumber "\<[0-9a-fA-F]*[hH]*\>" |
| 34 | |
| 35 | " If you don't like tabs |
| 36 | "syn match plmShowTab "\t" |
| 37 | "syn match plmShowTabc "\t" |
| 38 | |
| 39 | "when wanted, highlight trailing white space |
| 40 | if exists("c_space_errors") |
| 41 | syn match plmSpaceError "\s*$" |
| 42 | syn match plmSpaceError " \+\t"me=e-1 |
| 43 | endif |
| 44 | |
| 45 | " |
| 46 | " Use the same control variable as C language for I believe |
| 47 | " users will want the same behavior |
| 48 | if exists("c_comment_strings") |
| 49 | " FIXME : don't work fine with c_comment_strings set, |
| 50 | " which I don't care as I don't use |
| 51 | |
| 52 | " A comment can contain plmString, plmCharacter and plmNumber. |
| 53 | " But a "*/" inside a plmString in a plmComment DOES end the comment! So we |
| 54 | " need to use a special type of plmString: plmCommentString, which also ends on |
| 55 | " "*/", and sees a "*" at the start of the line as comment again. |
| 56 | syntax match plmCommentSkip contained "^\s*\*\($\|\s\+\)" |
| 57 | syntax region plmCommentString contained start=+"+ skip=+\\\\\|\\"+ end=+"+ end=+\*/+me=s-1 contains=plmSpecial,plmCommentSkip |
| 58 | syntax region plmComment2String contained start=+"+ skip=+\\\\\|\\"+ end=+"+ end="$" contains=plmSpecial |
| 59 | syntax region plmComment start="/\*" end="\*/" contains=plmTodo,plmCommentString,plmCharacter,plmNumber,plmFloat,plmSpaceError |
| 60 | syntax match plmComment "//.*" contains=plmTodo,plmComment2String,plmCharacter,plmNumber,plmSpaceError |
| 61 | else |
| 62 | syn region plmComment start="/\*" end="\*/" contains=plmTodo,plmSpaceError |
| 63 | syn match plmComment "//.*" contains=plmTodo,plmSpaceError |
| 64 | endif |
| 65 | |
| 66 | syntax match plmCommentError "\*/" |
| 67 | |
| 68 | syn keyword plmReserved ADDRESS AND AT BASED BY BYTE CALL CASE |
| 69 | syn keyword plmReserved DATA DECLARE DISABLE DO DWORD |
| 70 | syn keyword plmReserved ELSE ENABLE END EOF EXTERNAL |
| 71 | syn keyword plmReserved GO GOTO HALT IF INITIAL INTEGER INTERRUPT |
| 72 | syn keyword plmReserved LABEL LITERALLY MINUS MOD NOT OR |
| 73 | syn keyword plmReserved PLUS POINTER PROCEDURE PUBLIC |
| 74 | syn keyword plmReserved REAL REENTRANT RETURN SELECTOR STRUCTURE |
| 75 | syn keyword plmReserved THEN TO WHILE WORD XOR |
| 76 | syn keyword plm386Reserved CHARINT HWORD LONGINT OFFSET QWORD SHORTINT |
| 77 | |
| 78 | syn keyword plmBuiltIn ABS ADJUSTRPL BLOCKINPUT BLOCKINWORD BLOCKOUTPUT |
| 79 | syn keyword plmBuiltIn BLOCKOUTWORD BUILPTR CARRY CAUSEINTERRUPT CMPB |
| 80 | syn keyword plmBuiltIn CMPW DEC DOUBLE FINDB FINDRB FINDRW FINDW FIX |
| 81 | syn keyword plmBuiltIn FLAGS FLOAT GETREALERROR HIGH IABS INITREALMATHUNIT |
| 82 | syn keyword plmBuiltIn INPUT INT INWORD LAST LOCKSET LENGTH LOW MOVB MOVE |
| 83 | syn keyword plmBuiltIn MOVRB MOVRW MOVW NIL OUTPUT OUTWORD RESTOREREALSTATUS |
| 84 | syn keyword plmBuiltIn ROL ROR SAL SAVEREALSTATUS SCL SCR SELECTOROF SETB |
| 85 | syn keyword plmBuiltIn SETREALMODE SETW SHL SHR SIGN SIGNED SIZE SKIPB |
| 86 | syn keyword plmBuiltIn SKIPRB SKIPRW SKIPW STACKBASE STACKPTR TIME SIZE |
| 87 | syn keyword plmBuiltIn UNSIGN XLAT ZERO |
| 88 | syn keyword plm386BuiltIn INTERRUPT SETINTERRUPT |
| 89 | syn keyword plm286BuiltIn CLEARTASKSWITCHEDFLAG GETACCESSRIGHTS |
| 90 | syn keyword plm286BuiltIn GETSEGMENTLIMIT LOCALTABLE MACHINESTATUS |
| 91 | syn keyword plm286BuiltIn OFFSETOF PARITY RESTOREGLOBALTABLE |
| 92 | syn keyword plm286BuiltIn RESTOREINTERRUPTTABLE SAVEGLOBALTABLE |
| 93 | syn keyword plm286BuiltIn SAVEINTERRUPTTABLE SEGMENTREADABLE |
| 94 | syn keyword plm286BuiltIn SEGMENTWRITABLE TASKREGISTER WAITFORINTERRUPT |
| 95 | syn keyword plm386BuiltIn CONTROLREGISTER DEBUGREGISTER FINDHW |
| 96 | syn keyword plm386BuiltIn FINDRHW INHWORD MOVBIT MOVRBIT MOVHW MOVRHW |
| 97 | syn keyword plm386BuiltIn OUTHWORD SCANBIT SCANRBIT SETHW SHLD SHRD |
| 98 | syn keyword plm386BuiltIn SKIPHW SKIPRHW TESTREGISTER |
| 99 | syn keyword plm386w16BuiltIn BLOCKINDWORD BLOCKOUTDWORD CMPD FINDD |
| 100 | syn keyword plm386w16BuiltIn FINDRD INDWORD MOVD MOVRD OUTDWORD |
| 101 | syn keyword plm386w16BuiltIn SETD SKIPD SKIPRD |
| 102 | |
| 103 | syn sync lines=50 |
| 104 | |
| 105 | " Define the default highlighting. |
| 106 | " For version 5.7 and earlier: only when not done already |
| 107 | " For version 5.8 and later: only when an item doesn't have highlighting yet |
| 108 | if version >= 508 || !exists("did_plm_syntax_inits") |
| 109 | if version < 508 |
| 110 | let did_plm_syntax_inits = 1 |
| 111 | command -nargs=+ HiLink hi link <args> |
| 112 | else |
| 113 | command -nargs=+ HiLink hi def link <args> |
| 114 | endif |
| 115 | |
| 116 | " The default methods for highlighting. Can be overridden later |
| 117 | " HiLink plmLabel Label |
| 118 | " HiLink plmConditional Conditional |
| 119 | " HiLink plmRepeat Repeat |
| 120 | HiLink plmTodo Todo |
| 121 | HiLink plmNumber Number |
| 122 | HiLink plmOperator Operator |
| 123 | HiLink plmDelimiter Operator |
| 124 | "HiLink plmShowTab Error |
| 125 | "HiLink plmShowTabc Error |
| 126 | HiLink plmIdentifier Identifier |
| 127 | HiLink plmBuiltIn Statement |
| 128 | HiLink plm286BuiltIn Statement |
| 129 | HiLink plm386BuiltIn Statement |
| 130 | HiLink plm386w16BuiltIn Statement |
| 131 | HiLink plmReserved Statement |
| 132 | HiLink plm386Reserved Statement |
| 133 | HiLink plmPreProc PreProc |
| 134 | HiLink plmCommentError plmError |
| 135 | HiLink plmCommentString plmString |
| 136 | HiLink plmComment2String plmString |
| 137 | HiLink plmCommentSkip plmComment |
| 138 | HiLink plmString String |
| 139 | HiLink plmComment Comment |
| 140 | |
| 141 | delcommand HiLink |
| 142 | endif |
| 143 | |
| 144 | let b:current_syntax = "plm" |
| 145 | |
| 146 | " vim: ts=8 sw=2 |
| 147 | |