Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: XS (Perl extension interface language) |
| 3 | " Maintainer: Michael W. Dodge <sarge@pobox.com> |
| 4 | " Last Change: 2001 May 09 |
| 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 | " Read the C syntax to start with |
| 15 | if version < 600 |
| 16 | source <sfile>:p:h/c.vim |
| 17 | else |
| 18 | runtime! syntax/c.vim |
| 19 | endif |
| 20 | |
| 21 | " XS extentions |
| 22 | " TODO: Figure out how to look for trailing '='. |
| 23 | syn keyword xsKeyword MODULE PACKAGE PREFIX |
| 24 | syn keyword xsKeyword OUTPUT: CODE: INIT: PREINIT: INPUT: |
| 25 | syn keyword xsKeyword PPCODE: REQUIRE: CLEANUP: BOOT: |
| 26 | syn keyword xsKeyword VERSIONCHECK: PROTOTYPES: PROTOTYPE: |
| 27 | syn keyword xsKeyword ALIAS: INCLUDE: CASE: |
| 28 | " TODO: Figure out how to look for trailing '('. |
| 29 | syn keyword xsMacro SV EXTEND PUSHs |
| 30 | syn keyword xsVariable RETVAL NO_INIT |
| 31 | "syn match xsCast "\<\(const\|static\|dynamic\|reinterpret\)_cast\s*<"me=e-1 |
| 32 | "syn match xsCast "\<\(const\|static\|dynamic\|reinterpret\)_cast\s*$" |
| 33 | |
| 34 | " Define the default highlighting. |
| 35 | " For version 5.7 and earlier: only when not done already |
| 36 | " For version 5.8 and later: only when an item doesn't have highlighting yet |
| 37 | if version >= 508 || !exists("did_xs_syntax_inits") |
| 38 | if version < 508 |
| 39 | let did_xs_syntax_inits = 1 |
| 40 | command -nargs=+ HiLink hi link <args> |
| 41 | else |
| 42 | command -nargs=+ HiLink hi def link <args> |
| 43 | endif |
| 44 | |
| 45 | HiLink xsKeyword Keyword |
| 46 | HiLink xsMacro Macro |
| 47 | HiLink xsVariable Identifier |
| 48 | |
| 49 | delcommand HiLink |
| 50 | endif |
| 51 | |
| 52 | let b:current_syntax = "xs" |
| 53 | |
| 54 | " vim: ts=8 |