Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: lace |
| 3 | " Maintainer: Jocelyn Fiat <utilities@eiffel.com> |
| 4 | " Last Change: 2001 May 09 |
| 5 | |
| 6 | " Copyright Interactive Software Engineering, 1998 |
| 7 | " You are free to use this file as you please, but |
| 8 | " if you make a change or improvement you must send |
| 9 | " it to the maintainer at <utilities@eiffel.com> |
| 10 | |
| 11 | |
| 12 | " For version 5.x: Clear all syntax items |
| 13 | " For version 6.x: Quit when a syntax file was already loaded |
| 14 | if version < 600 |
| 15 | syntax clear |
| 16 | elseif exists("b:current_syntax") |
| 17 | finish |
| 18 | endif |
| 19 | |
| 20 | " LACE is case insensitive, but the style guide lines are not. |
| 21 | |
| 22 | if !exists("lace_case_insensitive") |
| 23 | syn case match |
| 24 | else |
| 25 | syn case ignore |
| 26 | endif |
| 27 | |
| 28 | " A bunch of useful LACE keywords |
| 29 | syn keyword laceTopStruct system root default option visible cluster |
| 30 | syn keyword laceTopStruct external generate end |
| 31 | syn keyword laceOptionClause collect assertion debug optimize trace |
| 32 | syn keyword laceOptionClause profile inline precompiled multithreaded |
| 33 | syn keyword laceOptionClause exception_trace dead_code_removal |
| 34 | syn keyword laceOptionClause array_optimization |
| 35 | syn keyword laceOptionClause inlining_size inlining |
| 36 | syn keyword laceOptionClause console_application dynamic_runtime |
| 37 | syn keyword laceOptionClause line_generation |
| 38 | syn keyword laceOptionMark yes no all |
| 39 | syn keyword laceOptionMark require ensure invariant loop check |
| 40 | syn keyword laceClusterProp use include exclude |
| 41 | syn keyword laceAdaptClassName adapt ignore rename as |
| 42 | syn keyword laceAdaptClassName creation export visible |
| 43 | syn keyword laceExternal include_path object makefile |
| 44 | |
| 45 | " Operators |
| 46 | syn match laceOperator "\$" |
| 47 | syn match laceBrackets "[[\]]" |
| 48 | syn match laceExport "[{}]" |
| 49 | |
| 50 | " Constants |
| 51 | syn keyword laceBool true false |
| 52 | syn keyword laceBool True False |
| 53 | syn region laceString start=+"+ skip=+%"+ end=+"+ contains=laceEscape,laceStringError |
| 54 | syn match laceEscape contained "%[^/]" |
| 55 | syn match laceEscape contained "%/\d\+/" |
| 56 | syn match laceEscape contained "^[ \t]*%" |
| 57 | syn match laceEscape contained "%[ \t]*$" |
| 58 | syn match laceStringError contained "%/[^0-9]" |
| 59 | syn match laceStringError contained "%/\d\+[^0-9/]" |
| 60 | syn match laceStringError "'\(%[^/]\|%/\d\+/\|[^'%]\)\+'" |
| 61 | syn match laceCharacter "'\(%[^/]\|%/\d\+/\|[^'%]\)'" contains=laceEscape |
| 62 | syn match laceNumber "-\=\<\d\+\(_\d\+\)*\>" |
| 63 | syn match laceNumber "\<[01]\+[bB]\>" |
| 64 | syn match laceNumber "-\=\<\d\+\(_\d\+\)*\.\(\d\+\(_\d\+\)*\)\=\([eE][-+]\=\d\+\(_\d\+\)*\)\=" |
| 65 | syn match laceNumber "-\=\.\d\+\(_\d\+\)*\([eE][-+]\=\d\+\(_\d\+\)*\)\=" |
| 66 | syn match laceComment "--.*" contains=laceTodo |
| 67 | |
| 68 | |
| 69 | syn case match |
| 70 | |
| 71 | " Case sensitive stuff |
| 72 | |
| 73 | syn keyword laceTodo TODO XXX FIXME |
| 74 | syn match laceClassName "\<[A-Z][A-Z0-9_]*\>" |
| 75 | syn match laceCluster "[a-zA-Z][a-zA-Z0-9_]*\s*:" |
| 76 | syn match laceCluster "[a-zA-Z][a-zA-Z0-9_]*\s*(\s*[a-zA-Z][a-zA-Z0-9_]*\s*)\s*:" |
| 77 | |
| 78 | " Catch mismatched parentheses |
| 79 | syn match laceParenError ")" |
| 80 | syn match laceBracketError "\]" |
| 81 | syn region laceGeneric transparent matchgroup=laceBrackets start="\[" end="\]" contains=ALLBUT,laceBracketError |
| 82 | syn region laceParen transparent start="(" end=")" contains=ALLBUT,laceParenError |
| 83 | |
| 84 | " Should suffice for even very long strings and expressions |
| 85 | syn sync lines=40 |
| 86 | |
| 87 | " Define the default highlighting. |
| 88 | " For version 5.7 and earlier: only when not done already |
| 89 | " For version 5.8 and later: only when an item doesn't have highlighting yet |
| 90 | if version >= 508 || !exists("did_lace_syntax_inits") |
| 91 | if version < 508 |
| 92 | let did_lace_syntax_inits = 1 |
| 93 | command -nargs=+ HiLink hi link <args> |
| 94 | else |
| 95 | command -nargs=+ HiLink hi def link <args> |
| 96 | endif |
| 97 | |
| 98 | HiLink laceTopStruct PreProc |
| 99 | |
| 100 | HiLink laceOptionClause Statement |
| 101 | HiLink laceOptionMark Constant |
| 102 | HiLink laceClusterProp Label |
| 103 | HiLink laceAdaptClassName Label |
| 104 | HiLink laceExternal Statement |
| 105 | HiLink laceCluster ModeMsg |
| 106 | |
| 107 | HiLink laceEscape Special |
| 108 | |
| 109 | HiLink laceBool Boolean |
| 110 | HiLink laceString String |
| 111 | HiLink laceCharacter Character |
| 112 | HiLink laceClassName Type |
| 113 | HiLink laceNumber Number |
| 114 | |
| 115 | HiLink laceOperator Special |
| 116 | HiLink laceArray Special |
| 117 | HiLink laceExport Special |
| 118 | HiLink laceCreation Special |
| 119 | HiLink laceBrackets Special |
| 120 | HiLink laceConstraint Special |
| 121 | |
| 122 | HiLink laceComment Comment |
| 123 | |
| 124 | HiLink laceError Error |
| 125 | HiLink laceStringError Error |
| 126 | HiLink laceParenError Error |
| 127 | HiLink laceBracketError Error |
| 128 | HiLink laceTodo Todo |
| 129 | |
| 130 | delcommand HiLink |
| 131 | endif |
| 132 | |
| 133 | let b:current_syntax = "lace" |
| 134 | |
| 135 | " vim: ts=4 |