Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
Bram Moolenaar | 5c73622 | 2010-01-06 20:54:52 +0100 | [diff] [blame] | 2 | " Language: Scheme (R5RS + some R6RS extras) |
Bram Moolenaar | 2685212 | 2016-05-24 20:02:38 +0200 | [diff] [blame] | 3 | " Last Change: 2016 May 23 |
Bram Moolenaar | 293ee4d | 2004-12-09 21:34:53 +0000 | [diff] [blame] | 4 | " Maintainer: Sergey Khorev <sergey.khorev@gmail.com> |
Bram Moolenaar | 21cf823 | 2004-07-16 20:18:37 +0000 | [diff] [blame] | 5 | " Original author: Dirk van Deun <dirk@igwe.vub.ac.be> |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 6 | |
| 7 | " This script incorrectly recognizes some junk input as numerals: |
| 8 | " parsing the complete system of Scheme numerals using the pattern |
| 9 | " language is practically impossible: I did a lax approximation. |
Bram Moolenaar | 5dc6252 | 2012-02-13 00:05:22 +0100 | [diff] [blame] | 10 | |
Bram Moolenaar | 21cf823 | 2004-07-16 20:18:37 +0000 | [diff] [blame] | 11 | " MzScheme extensions can be activated with setting is_mzscheme variable |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 12 | |
| 13 | " Suggestions and bug reports are solicited by the author. |
| 14 | |
| 15 | " Initializing: |
| 16 | |
Bram Moolenaar | 89bcfda | 2016-08-30 23:26:57 +0200 | [diff] [blame] | 17 | " quit when a syntax file was already loaded |
| 18 | if exists("b:current_syntax") |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 19 | finish |
| 20 | endif |
| 21 | |
Bram Moolenaar | 5dc6252 | 2012-02-13 00:05:22 +0100 | [diff] [blame] | 22 | let s:cpo_save = &cpo |
| 23 | set cpo&vim |
| 24 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 25 | syn case ignore |
| 26 | |
| 27 | " Fascist highlighting: everything that doesn't fit the rules is an error... |
| 28 | |
Bram Moolenaar | 5c73622 | 2010-01-06 20:54:52 +0100 | [diff] [blame] | 29 | syn match schemeError ![^ \t()\[\]";]*! |
| 30 | syn match schemeError ")" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 31 | |
| 32 | " Quoted and backquoted stuff |
| 33 | |
Bram Moolenaar | 21cf823 | 2004-07-16 20:18:37 +0000 | [diff] [blame] | 34 | syn region schemeQuoted matchgroup=Delimiter start="['`]" end=![ \t()\[\]";]!me=e-1 contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 35 | |
| 36 | syn region schemeQuoted matchgroup=Delimiter start="['`](" matchgroup=Delimiter end=")" contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc |
| 37 | syn region schemeQuoted matchgroup=Delimiter start="['`]#(" matchgroup=Delimiter end=")" contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc |
| 38 | |
| 39 | syn region schemeStrucRestricted matchgroup=Delimiter start="(" matchgroup=Delimiter end=")" contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc |
| 40 | syn region schemeStrucRestricted matchgroup=Delimiter start="#(" matchgroup=Delimiter end=")" contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc |
| 41 | |
Bram Moolenaar | 21cf823 | 2004-07-16 20:18:37 +0000 | [diff] [blame] | 42 | " Popular Scheme extension: |
| 43 | " using [] as well as () |
| 44 | syn region schemeStrucRestricted matchgroup=Delimiter start="\[" matchgroup=Delimiter end="\]" contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc |
| 45 | syn region schemeStrucRestricted matchgroup=Delimiter start="#\[" matchgroup=Delimiter end="\]" contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 46 | |
Bram Moolenaar | 21cf823 | 2004-07-16 20:18:37 +0000 | [diff] [blame] | 47 | syn region schemeUnquote matchgroup=Delimiter start="," end=![ \t\[\]()";]!me=e-1 contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc |
| 48 | syn region schemeUnquote matchgroup=Delimiter start=",@" end=![ \t\[\]()";]!me=e-1 contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc |
| 49 | |
| 50 | syn region schemeUnquote matchgroup=Delimiter start=",(" end=")" contains=ALL |
| 51 | syn region schemeUnquote matchgroup=Delimiter start=",@(" end=")" contains=ALL |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 52 | |
| 53 | syn region schemeUnquote matchgroup=Delimiter start=",#(" end=")" contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc |
| 54 | syn region schemeUnquote matchgroup=Delimiter start=",@#(" end=")" contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc |
| 55 | |
Bram Moolenaar | 21cf823 | 2004-07-16 20:18:37 +0000 | [diff] [blame] | 56 | syn region schemeUnquote matchgroup=Delimiter start=",\[" end="\]" contains=ALL |
| 57 | syn region schemeUnquote matchgroup=Delimiter start=",@\[" end="\]" contains=ALL |
| 58 | |
| 59 | syn region schemeUnquote matchgroup=Delimiter start=",#\[" end="\]" contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc |
| 60 | syn region schemeUnquote matchgroup=Delimiter start=",@#\[" end="\]" contains=ALLBUT,schemeStruc,schemeSyntax,schemeFunc |
| 61 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 62 | " R5RS Scheme Functions and Syntax: |
| 63 | |
Bram Moolenaar | 89bcfda | 2016-08-30 23:26:57 +0200 | [diff] [blame] | 64 | setlocal iskeyword=33,35-39,42-58,60-90,94,95,97-122,126,_ |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 65 | |
| 66 | syn keyword schemeSyntax lambda and or if cond case define let let* letrec |
| 67 | syn keyword schemeSyntax begin do delay set! else => |
| 68 | syn keyword schemeSyntax quote quasiquote unquote unquote-splicing |
| 69 | syn keyword schemeSyntax define-syntax let-syntax letrec-syntax syntax-rules |
Bram Moolenaar | 5c73622 | 2010-01-06 20:54:52 +0100 | [diff] [blame] | 70 | " R6RS |
| 71 | syn keyword schemeSyntax define-record-type fields protocol |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 72 | |
| 73 | syn keyword schemeFunc not boolean? eq? eqv? equal? pair? cons car cdr set-car! |
| 74 | syn keyword schemeFunc set-cdr! caar cadr cdar cddr caaar caadr cadar caddr |
| 75 | syn keyword schemeFunc cdaar cdadr cddar cdddr caaaar caaadr caadar caaddr |
| 76 | syn keyword schemeFunc cadaar cadadr caddar cadddr cdaaar cdaadr cdadar cdaddr |
| 77 | syn keyword schemeFunc cddaar cddadr cdddar cddddr null? list? list length |
| 78 | syn keyword schemeFunc append reverse list-ref memq memv member assq assv assoc |
| 79 | syn keyword schemeFunc symbol? symbol->string string->symbol number? complex? |
| 80 | syn keyword schemeFunc real? rational? integer? exact? inexact? = < > <= >= |
| 81 | syn keyword schemeFunc zero? positive? negative? odd? even? max min + * - / abs |
| 82 | syn keyword schemeFunc quotient remainder modulo gcd lcm numerator denominator |
| 83 | syn keyword schemeFunc floor ceiling truncate round rationalize exp log sin cos |
| 84 | syn keyword schemeFunc tan asin acos atan sqrt expt make-rectangular make-polar |
| 85 | syn keyword schemeFunc real-part imag-part magnitude angle exact->inexact |
| 86 | syn keyword schemeFunc inexact->exact number->string string->number char=? |
| 87 | syn keyword schemeFunc char-ci=? char<? char-ci<? char>? char-ci>? char<=? |
| 88 | syn keyword schemeFunc char-ci<=? char>=? char-ci>=? char-alphabetic? char? |
| 89 | syn keyword schemeFunc char-numeric? char-whitespace? char-upper-case? |
| 90 | syn keyword schemeFunc char-lower-case? |
| 91 | syn keyword schemeFunc char->integer integer->char char-upcase char-downcase |
| 92 | syn keyword schemeFunc string? make-string string string-length string-ref |
| 93 | syn keyword schemeFunc string-set! string=? string-ci=? string<? string-ci<? |
| 94 | syn keyword schemeFunc string>? string-ci>? string<=? string-ci<=? string>=? |
| 95 | syn keyword schemeFunc string-ci>=? substring string-append vector? make-vector |
| 96 | syn keyword schemeFunc vector vector-length vector-ref vector-set! procedure? |
| 97 | syn keyword schemeFunc apply map for-each call-with-current-continuation |
| 98 | syn keyword schemeFunc call-with-input-file call-with-output-file input-port? |
| 99 | syn keyword schemeFunc output-port? current-input-port current-output-port |
| 100 | syn keyword schemeFunc open-input-file open-output-file close-input-port |
| 101 | syn keyword schemeFunc close-output-port eof-object? read read-char peek-char |
| 102 | syn keyword schemeFunc write display newline write-char call/cc |
| 103 | syn keyword schemeFunc list-tail string->list list->string string-copy |
| 104 | syn keyword schemeFunc string-fill! vector->list list->vector vector-fill! |
| 105 | syn keyword schemeFunc force with-input-from-file with-output-to-file |
| 106 | syn keyword schemeFunc char-ready? load transcript-on transcript-off eval |
| 107 | syn keyword schemeFunc dynamic-wind port? values call-with-values |
| 108 | syn keyword schemeFunc scheme-report-environment null-environment |
| 109 | syn keyword schemeFunc interaction-environment |
Bram Moolenaar | 5c73622 | 2010-01-06 20:54:52 +0100 | [diff] [blame] | 110 | " R6RS |
| 111 | syn keyword schemeFunc make-eq-hashtable make-eqv-hashtable make-hashtable |
| 112 | syn keyword schemeFunc hashtable? hashtable-size hashtable-ref hashtable-set! |
| 113 | syn keyword schemeFunc hashtable-delete! hashtable-contains? hashtable-update! |
| 114 | syn keyword schemeFunc hashtable-copy hashtable-clear! hashtable-keys |
| 115 | syn keyword schemeFunc hashtable-entries hashtable-equivalence-function hashtable-hash-function |
Bram Moolenaar | 5dc6252 | 2012-02-13 00:05:22 +0100 | [diff] [blame] | 116 | syn keyword schemeFunc hashtable-mutable? equal-hash string-hash string-ci-hash symbol-hash |
Bram Moolenaar | 5c73622 | 2010-01-06 20:54:52 +0100 | [diff] [blame] | 117 | syn keyword schemeFunc find for-all exists filter partition fold-left fold-right |
| 118 | syn keyword schemeFunc remp remove remv remq memp assp cons* |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 119 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 120 | " ... so that a single + or -, inside a quoted context, would not be |
| 121 | " interpreted as a number (outside such contexts, it's a schemeFunc) |
| 122 | |
Bram Moolenaar | 5c73622 | 2010-01-06 20:54:52 +0100 | [diff] [blame] | 123 | syn match schemeDelimiter !\.[ \t\[\]()";]!me=e-1 |
| 124 | syn match schemeDelimiter !\.$! |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 125 | " ... and a single dot is not a number but a delimiter |
| 126 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 127 | " This keeps all other stuff unhighlighted, except *stuff* and <stuff>: |
| 128 | |
Bram Moolenaar | 5c73622 | 2010-01-06 20:54:52 +0100 | [diff] [blame] | 129 | syn match schemeOther ,[a-z!$%&*/:<=>?^_~+@#%-][-a-z!$%&*/:<=>?^_~0-9+.@#%]*, |
| 130 | syn match schemeError ,[a-z!$%&*/:<=>?^_~+@#%-][-a-z!$%&*/:<=>?^_~0-9+.@#%]*[^-a-z!$%&*/:<=>?^_~0-9+.@ \t\[\]()";]\+[^ \t\[\]()";]*, |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 131 | |
Bram Moolenaar | 5c73622 | 2010-01-06 20:54:52 +0100 | [diff] [blame] | 132 | syn match schemeOther "\.\.\." |
| 133 | syn match schemeError !\.\.\.[^ \t\[\]()";]\+! |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 134 | " ... a special identifier |
| 135 | |
Bram Moolenaar | 5c73622 | 2010-01-06 20:54:52 +0100 | [diff] [blame] | 136 | syn match schemeConstant ,\*[-a-z!$%&*/:<=>?^_~0-9+.@]\+\*[ \t\[\]()";],me=e-1 |
| 137 | syn match schemeConstant ,\*[-a-z!$%&*/:<=>?^_~0-9+.@]\+\*$, |
| 138 | syn match schemeError ,\*[-a-z!$%&*/:<=>?^_~0-9+.@]*\*[^-a-z!$%&*/:<=>?^_~0-9+.@ \t\[\]()";]\+[^ \t\[\]()";]*, |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 139 | |
Bram Moolenaar | 5c73622 | 2010-01-06 20:54:52 +0100 | [diff] [blame] | 140 | syn match schemeConstant ,<[-a-z!$%&*/:<=>?^_~0-9+.@]*>[ \t\[\]()";],me=e-1 |
| 141 | syn match schemeConstant ,<[-a-z!$%&*/:<=>?^_~0-9+.@]*>$, |
| 142 | syn match schemeError ,<[-a-z!$%&*/:<=>?^_~0-9+.@]*>[^-a-z!$%&*/:<=>?^_~0-9+.@ \t\[\]()";]\+[^ \t\[\]()";]*, |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 143 | |
| 144 | " Non-quoted lists, and strings: |
| 145 | |
| 146 | syn region schemeStruc matchgroup=Delimiter start="(" matchgroup=Delimiter end=")" contains=ALL |
| 147 | syn region schemeStruc matchgroup=Delimiter start="#(" matchgroup=Delimiter end=")" contains=ALL |
| 148 | |
Bram Moolenaar | 21cf823 | 2004-07-16 20:18:37 +0000 | [diff] [blame] | 149 | syn region schemeStruc matchgroup=Delimiter start="\[" matchgroup=Delimiter end="\]" contains=ALL |
| 150 | syn region schemeStruc matchgroup=Delimiter start="#\[" matchgroup=Delimiter end="\]" contains=ALL |
| 151 | |
| 152 | " Simple literals: |
Bram Moolenaar | 1aeaf8c | 2012-05-18 13:46:39 +0200 | [diff] [blame] | 153 | syn region schemeString start=+\%(\\\)\@<!"+ skip=+\\[\\"]+ end=+"+ contains=@Spell |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 154 | |
| 155 | " Comments: |
| 156 | |
Bram Moolenaar | 1aeaf8c | 2012-05-18 13:46:39 +0200 | [diff] [blame] | 157 | syn match schemeComment ";.*$" contains=@Spell |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 158 | |
Bram Moolenaar | 21cf823 | 2004-07-16 20:18:37 +0000 | [diff] [blame] | 159 | |
| 160 | " Writing out the complete description of Scheme numerals without |
| 161 | " using variables is a day's work for a trained secretary... |
| 162 | |
Bram Moolenaar | 5c73622 | 2010-01-06 20:54:52 +0100 | [diff] [blame] | 163 | syn match schemeOther ![+-][ \t\[\]()";]!me=e-1 |
| 164 | syn match schemeOther ![+-]$! |
Bram Moolenaar | 21cf823 | 2004-07-16 20:18:37 +0000 | [diff] [blame] | 165 | " |
| 166 | " This is a useful lax approximation: |
Bram Moolenaar | 5c73622 | 2010-01-06 20:54:52 +0100 | [diff] [blame] | 167 | syn match schemeNumber "[-#+.]\=[0-9][-#+/0-9a-f@i.boxesfdl]*" |
| 168 | syn match schemeError ![-#+0-9.][-#+/0-9a-f@i.boxesfdl]*[^-#+/0-9a-f@i.boxesfdl \t\[\]()";][^ \t\[\]()";]*! |
Bram Moolenaar | 21cf823 | 2004-07-16 20:18:37 +0000 | [diff] [blame] | 169 | |
Bram Moolenaar | 5c73622 | 2010-01-06 20:54:52 +0100 | [diff] [blame] | 170 | syn match schemeBoolean "#[tf]" |
| 171 | syn match schemeError !#[tf][^ \t\[\]()";]\+! |
Bram Moolenaar | 21cf823 | 2004-07-16 20:18:37 +0000 | [diff] [blame] | 172 | |
Bram Moolenaar | 5c73622 | 2010-01-06 20:54:52 +0100 | [diff] [blame] | 173 | syn match schemeCharacter "#\\" |
| 174 | syn match schemeCharacter "#\\." |
| 175 | syn match schemeError !#\\.[^ \t\[\]()";]\+! |
| 176 | syn match schemeCharacter "#\\space" |
| 177 | syn match schemeError !#\\space[^ \t\[\]()";]\+! |
| 178 | syn match schemeCharacter "#\\newline" |
| 179 | syn match schemeError !#\\newline[^ \t\[\]()";]\+! |
| 180 | |
| 181 | " R6RS |
| 182 | syn match schemeCharacter "#\\x[0-9a-fA-F]\+" |
| 183 | |
Bram Moolenaar | 21cf823 | 2004-07-16 20:18:37 +0000 | [diff] [blame] | 184 | |
| 185 | if exists("b:is_mzscheme") || exists("is_mzscheme") |
Bram Moolenaar | 293ee4d | 2004-12-09 21:34:53 +0000 | [diff] [blame] | 186 | " MzScheme extensions |
Bram Moolenaar | 21cf823 | 2004-07-16 20:18:37 +0000 | [diff] [blame] | 187 | " multiline comment |
Bram Moolenaar | 1aeaf8c | 2012-05-18 13:46:39 +0200 | [diff] [blame] | 188 | syn region schemeComment start="#|" end="|#" contains=@Spell |
Bram Moolenaar | 293ee4d | 2004-12-09 21:34:53 +0000 | [diff] [blame] | 189 | |
Bram Moolenaar | 21cf823 | 2004-07-16 20:18:37 +0000 | [diff] [blame] | 190 | " #%xxx are the special MzScheme identifiers |
Bram Moolenaar | 5c73622 | 2010-01-06 20:54:52 +0100 | [diff] [blame] | 191 | syn match schemeOther "#%[-a-z!$%&*/:<=>?^_~0-9+.@#%]\+" |
Bram Moolenaar | 21cf823 | 2004-07-16 20:18:37 +0000 | [diff] [blame] | 192 | " anything limited by |'s is identifier |
Bram Moolenaar | 5c73622 | 2010-01-06 20:54:52 +0100 | [diff] [blame] | 193 | syn match schemeOther "|[^|]\+|" |
Bram Moolenaar | 21cf823 | 2004-07-16 20:18:37 +0000 | [diff] [blame] | 194 | |
Bram Moolenaar | 5c73622 | 2010-01-06 20:54:52 +0100 | [diff] [blame] | 195 | syn match schemeCharacter "#\\\%(return\|tab\)" |
Bram Moolenaar | 21cf823 | 2004-07-16 20:18:37 +0000 | [diff] [blame] | 196 | |
| 197 | " Modules require stmt |
| 198 | syn keyword schemeExtSyntax module require dynamic-require lib prefix all-except prefix-all-except rename |
| 199 | " modules provide stmt |
| 200 | syn keyword schemeExtSyntax provide struct all-from all-from-except all-defined all-defined-except |
| 201 | " Other from MzScheme |
| 202 | syn keyword schemeExtSyntax with-handlers when unless instantiate define-struct case-lambda syntax-case |
| 203 | syn keyword schemeExtSyntax free-identifier=? bound-identifier=? module-identifier=? syntax-object->datum |
| 204 | syn keyword schemeExtSyntax datum->syntax-object |
| 205 | syn keyword schemeExtSyntax let-values let*-values letrec-values set!-values fluid-let parameterize begin0 |
Bram Moolenaar | 5dc6252 | 2012-02-13 00:05:22 +0100 | [diff] [blame] | 206 | syn keyword schemeExtSyntax error raise opt-lambda define-values unit unit/sig define-signature |
Bram Moolenaar | 21cf823 | 2004-07-16 20:18:37 +0000 | [diff] [blame] | 207 | syn keyword schemeExtSyntax invoke-unit/sig define-values/invoke-unit/sig compound-unit/sig import export |
| 208 | syn keyword schemeExtSyntax link syntax quasisyntax unsyntax with-syntax |
Bram Moolenaar | 21cf823 | 2004-07-16 20:18:37 +0000 | [diff] [blame] | 209 | |
| 210 | syn keyword schemeExtFunc format system-type current-extension-compiler current-extension-linker |
| 211 | syn keyword schemeExtFunc use-standard-linker use-standard-compiler |
| 212 | syn keyword schemeExtFunc find-executable-path append-object-suffix append-extension-suffix |
| 213 | syn keyword schemeExtFunc current-library-collection-paths current-extension-compiler-flags make-parameter |
| 214 | syn keyword schemeExtFunc current-directory build-path normalize-path current-extension-linker-flags |
| 215 | syn keyword schemeExtFunc file-exists? directory-exists? delete-directory/files delete-directory delete-file |
| 216 | syn keyword schemeExtFunc system compile-file system-library-subpath getenv putenv current-standard-link-libraries |
| 217 | syn keyword schemeExtFunc remove* file-size find-files fold-files directory-list shell-execute split-path |
| 218 | syn keyword schemeExtFunc current-error-port process/ports process printf fprintf open-input-string open-output-string |
| 219 | syn keyword schemeExtFunc get-output-string |
| 220 | " exceptions |
| 221 | syn keyword schemeExtFunc exn exn:application:arity exn:application:continuation exn:application:fprintf:mismatch |
| 222 | syn keyword schemeExtFunc exn:application:mismatch exn:application:type exn:application:mismatch exn:break exn:i/o:filesystem exn:i/o:port |
| 223 | syn keyword schemeExtFunc exn:i/o:port:closed exn:i/o:tcp exn:i/o:udp exn:misc exn:misc:application exn:misc:unsupported exn:module exn:read |
| 224 | syn keyword schemeExtFunc exn:read:non-char exn:special-comment exn:syntax exn:thread exn:user exn:variable exn:application:mismatch |
| 225 | syn keyword schemeExtFunc exn? exn:application:arity? exn:application:continuation? exn:application:fprintf:mismatch? exn:application:mismatch? |
| 226 | syn keyword schemeExtFunc exn:application:type? exn:application:mismatch? exn:break? exn:i/o:filesystem? exn:i/o:port? exn:i/o:port:closed? |
| 227 | syn keyword schemeExtFunc exn:i/o:tcp? exn:i/o:udp? exn:misc? exn:misc:application? exn:misc:unsupported? exn:module? exn:read? exn:read:non-char? |
| 228 | syn keyword schemeExtFunc exn:special-comment? exn:syntax? exn:thread? exn:user? exn:variable? exn:application:mismatch? |
| 229 | " Command-line parsing |
Bram Moolenaar | 5dc6252 | 2012-02-13 00:05:22 +0100 | [diff] [blame] | 230 | syn keyword schemeExtFunc command-line current-command-line-arguments once-any help-labels multi once-each |
Bram Moolenaar | 21cf823 | 2004-07-16 20:18:37 +0000 | [diff] [blame] | 231 | |
| 232 | " syntax quoting, unquoting and quasiquotation |
| 233 | syn region schemeUnquote matchgroup=Delimiter start="#," end=![ \t\[\]()";]!me=e-1 contains=ALL |
| 234 | syn region schemeUnquote matchgroup=Delimiter start="#,@" end=![ \t\[\]()";]!me=e-1 contains=ALL |
| 235 | syn region schemeUnquote matchgroup=Delimiter start="#,(" end=")" contains=ALL |
| 236 | syn region schemeUnquote matchgroup=Delimiter start="#,@(" end=")" contains=ALL |
| 237 | syn region schemeUnquote matchgroup=Delimiter start="#,\[" end="\]" contains=ALL |
| 238 | syn region schemeUnquote matchgroup=Delimiter start="#,@\[" end="\]" contains=ALL |
| 239 | syn region schemeQuoted matchgroup=Delimiter start="#['`]" end=![ \t()\[\]";]!me=e-1 contains=ALL |
| 240 | syn region schemeQuoted matchgroup=Delimiter start="#['`](" matchgroup=Delimiter end=")" contains=ALL |
Bram Moolenaar | 2685212 | 2016-05-24 20:02:38 +0200 | [diff] [blame] | 241 | |
| 242 | " Identifiers are very liberal in MzScheme/Racket |
| 243 | syn match schemeOther ![^()[\]{}",'`;#|\\ ]\+! |
| 244 | |
| 245 | " Language setting |
| 246 | syn match schemeLang "#lang [-+_/A-Za-z0-9]\+\>" |
| 247 | |
| 248 | " Various number forms |
| 249 | syn match schemeNumber "[-+]\=[0-9]\+\(\.[0-9]*\)\=\(e[-+]\=[0-9]\+\)\=\>" |
| 250 | syn match schemeNumber "[-+]\=\.[0-9]\+\(e[-+]\=[0-9]\+\)\=\>" |
| 251 | syn match schemeNumber "[-+]\=[0-9]\+/[0-9]\+\>" |
| 252 | syn match schemeNumber "\([-+]\=\([0-9]\+\(\.[0-9]*\)\=\(e[-+]\=[0-9]\+\)\=\|\.[0-9]\+\(e[-+]\=[0-9]\+\)\=\|[0-9]\+/[0-9]\+\)\)\=[-+]\([0-9]\+\(\.[0-9]*\)\=\(e[-+]\=[0-9]\+\)\=\|\.[0-9]\+\(e[-+]\=[0-9]\+\)\=\|[0-9]\+/[0-9]\+\)\=i\>" |
Bram Moolenaar | 21cf823 | 2004-07-16 20:18:37 +0000 | [diff] [blame] | 253 | endif |
| 254 | |
Bram Moolenaar | 3fdfa4a | 2004-10-07 21:02:47 +0000 | [diff] [blame] | 255 | |
| 256 | if exists("b:is_chicken") || exists("is_chicken") |
Bram Moolenaar | 293ee4d | 2004-12-09 21:34:53 +0000 | [diff] [blame] | 257 | " multiline comment |
Bram Moolenaar | 1aeaf8c | 2012-05-18 13:46:39 +0200 | [diff] [blame] | 258 | syntax region schemeMultilineComment start=/#|/ end=/|#/ contains=@Spell,schemeMultilineComment |
Bram Moolenaar | 293ee4d | 2004-12-09 21:34:53 +0000 | [diff] [blame] | 259 | |
Bram Moolenaar | 5c73622 | 2010-01-06 20:54:52 +0100 | [diff] [blame] | 260 | syn match schemeOther "##[-a-z!$%&*/:<=>?^_~0-9+.@#%]\+" |
| 261 | syn match schemeExtSyntax "#:[-a-z!$%&*/:<=>?^_~0-9+.@#%]\+" |
Bram Moolenaar | 3fdfa4a | 2004-10-07 21:02:47 +0000 | [diff] [blame] | 262 | |
| 263 | syn keyword schemeExtSyntax unit uses declare hide foreign-declare foreign-parse foreign-parse/spec |
Bram Moolenaar | 293ee4d | 2004-12-09 21:34:53 +0000 | [diff] [blame] | 264 | syn keyword schemeExtSyntax foreign-lambda foreign-lambda* define-external define-macro load-library |
| 265 | syn keyword schemeExtSyntax let-values let*-values letrec-values ->string require-extension |
| 266 | syn keyword schemeExtSyntax let-optionals let-optionals* define-foreign-variable define-record |
| 267 | syn keyword schemeExtSyntax pointer tag-pointer tagged-pointer? define-foreign-type |
| 268 | syn keyword schemeExtSyntax require require-for-syntax cond-expand and-let* receive argc+argv |
| 269 | syn keyword schemeExtSyntax fixnum? fx= fx> fx< fx>= fx<= fxmin fxmax |
Bram Moolenaar | 3fdfa4a | 2004-10-07 21:02:47 +0000 | [diff] [blame] | 270 | syn keyword schemeExtFunc ##core#inline ##sys#error ##sys#update-errno |
| 271 | |
| 272 | " here-string |
Bram Moolenaar | 1aeaf8c | 2012-05-18 13:46:39 +0200 | [diff] [blame] | 273 | syn region schemeString start=+#<<\s*\z(.*\)+ end=+^\z1$+ contains=@Spell |
Bram Moolenaar | 5dc6252 | 2012-02-13 00:05:22 +0100 | [diff] [blame] | 274 | |
Bram Moolenaar | 3fdfa4a | 2004-10-07 21:02:47 +0000 | [diff] [blame] | 275 | if filereadable(expand("<sfile>:p:h")."/cpp.vim") |
| 276 | unlet! b:current_syntax |
| 277 | syn include @ChickenC <sfile>:p:h/cpp.vim |
| 278 | syn region ChickenC matchgroup=schemeOther start=+(\@<=foreign-declare "+ end=+")\@=+ contains=@ChickenC |
| 279 | syn region ChickenC matchgroup=schemeComment start=+foreign-declare\s*#<<\z(.*\)$+hs=s+15 end=+^\z1$+ contains=@ChickenC |
| 280 | syn region ChickenC matchgroup=schemeOther start=+(\@<=foreign-parse "+ end=+")\@=+ contains=@ChickenC |
| 281 | syn region ChickenC matchgroup=schemeComment start=+foreign-parse\s*#<<\z(.*\)$+hs=s+13 end=+^\z1$+ contains=@ChickenC |
| 282 | syn region ChickenC matchgroup=schemeOther start=+(\@<=foreign-parse/spec "+ end=+")\@=+ contains=@ChickenC |
| 283 | syn region ChickenC matchgroup=schemeComment start=+foreign-parse/spec\s*#<<\z(.*\)$+hs=s+18 end=+^\z1$+ contains=@ChickenC |
| 284 | syn region ChickenC matchgroup=schemeComment start=+#>+ end=+<#+ contains=@ChickenC |
| 285 | syn region ChickenC matchgroup=schemeComment start=+#>?+ end=+<#+ contains=@ChickenC |
| 286 | syn region ChickenC matchgroup=schemeComment start=+#>!+ end=+<#+ contains=@ChickenC |
| 287 | syn region ChickenC matchgroup=schemeComment start=+#>\$+ end=+<#+ contains=@ChickenC |
| 288 | syn region ChickenC matchgroup=schemeComment start=+#>%+ end=+<#+ contains=@ChickenC |
| 289 | endif |
| 290 | |
Bram Moolenaar | a7241f5 | 2008-06-24 20:39:31 +0000 | [diff] [blame] | 291 | " suggested by Alex Queiroz |
Bram Moolenaar | 5c73622 | 2010-01-06 20:54:52 +0100 | [diff] [blame] | 292 | syn match schemeExtSyntax "#![-a-z!$%&*/:<=>?^_~0-9+.@#%]\+" |
Bram Moolenaar | 1aeaf8c | 2012-05-18 13:46:39 +0200 | [diff] [blame] | 293 | syn region schemeString start=+#<#\s*\z(.*\)+ end=+^\z1$+ contains=@Spell |
Bram Moolenaar | 3fdfa4a | 2004-10-07 21:02:47 +0000 | [diff] [blame] | 294 | endif |
| 295 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 296 | " Synchronization and the wrapping up... |
| 297 | |
| 298 | syn sync match matchPlace grouphere NONE "^[^ \t]" |
| 299 | " ... i.e. synchronize on a line that starts at the left margin |
| 300 | |
| 301 | " Define the default highlighting. |
Bram Moolenaar | 89bcfda | 2016-08-30 23:26:57 +0200 | [diff] [blame] | 302 | " Only when an item doesn't have highlighting yet |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 303 | |
Bram Moolenaar | f37506f | 2016-08-31 22:22:10 +0200 | [diff] [blame] | 304 | hi def link schemeSyntax Statement |
| 305 | hi def link schemeFunc Function |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 306 | |
Bram Moolenaar | f37506f | 2016-08-31 22:22:10 +0200 | [diff] [blame] | 307 | hi def link schemeString String |
| 308 | hi def link schemeCharacter Character |
| 309 | hi def link schemeNumber Number |
| 310 | hi def link schemeBoolean Boolean |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 311 | |
Bram Moolenaar | f37506f | 2016-08-31 22:22:10 +0200 | [diff] [blame] | 312 | hi def link schemeDelimiter Delimiter |
| 313 | hi def link schemeConstant Constant |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 314 | |
Bram Moolenaar | f37506f | 2016-08-31 22:22:10 +0200 | [diff] [blame] | 315 | hi def link schemeComment Comment |
| 316 | hi def link schemeMultilineComment Comment |
| 317 | hi def link schemeError Error |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 318 | |
Bram Moolenaar | f37506f | 2016-08-31 22:22:10 +0200 | [diff] [blame] | 319 | hi def link schemeExtSyntax Type |
| 320 | hi def link schemeExtFunc PreProc |
Bram Moolenaar | 2685212 | 2016-05-24 20:02:38 +0200 | [diff] [blame] | 321 | |
Bram Moolenaar | f37506f | 2016-08-31 22:22:10 +0200 | [diff] [blame] | 322 | hi def link schemeLang PreProc |
Bram Moolenaar | 2685212 | 2016-05-24 20:02:38 +0200 | [diff] [blame] | 323 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 324 | |
| 325 | let b:current_syntax = "scheme" |
Bram Moolenaar | 5dc6252 | 2012-02-13 00:05:22 +0100 | [diff] [blame] | 326 | |
| 327 | let &cpo = s:cpo_save |
| 328 | unlet s:cpo_save |