Bram Moolenaar | 5555acc | 2006-04-07 21:33:12 +0000 | [diff] [blame] | 1 | "%% SiSU Vim syntax file |
Bram Moolenaar | 5555acc | 2006-04-07 21:33:12 +0000 | [diff] [blame] | 2 | " SiSU Maintainer: Ralph Amissah <ralph@amissah.com> |
Bram Moolenaar | b21e584 | 2006-04-16 18:30:08 +0000 | [diff] [blame] | 3 | " SiSU Markup: SiSU (sisu-0.38) |
Bram Moolenaar | 5555acc | 2006-04-07 21:33:12 +0000 | [diff] [blame] | 4 | " (originally looked at Ruby Vim by Mirko Nasato) |
| 5 | if version < 600 |
| 6 | syntax clear |
| 7 | elseif exists("b:current_syntax") |
Bram Moolenaar | 5555acc | 2006-04-07 21:33:12 +0000 | [diff] [blame] | 8 | finish |
| 9 | else |
| 10 | endif |
Bram Moolenaar | c6fe919 | 2006-04-09 21:54:49 +0000 | [diff] [blame] | 11 | "% 11 Errors? |
Bram Moolenaar | 551dbcc | 2006-04-25 22:13:59 +0000 | [diff] [blame] | 12 | syn match sisu_error contains=sisu_link,sisu_error_wspace "<![^ei]\S\+!>" |
Bram Moolenaar | 5555acc | 2006-04-07 21:33:12 +0000 | [diff] [blame] | 13 | "% 10 Markers: Endnote Identifiers, Pagebreaks etc.: |
| 14 | if !exists("sisu_no_identifiers") |
Bram Moolenaar | d8fc5c0 | 2006-04-29 21:55:22 +0000 | [diff] [blame] | 15 | syn match sisu_mark_endnote "\~^" |
| 16 | syn match sisu_contain contains=@NoSpell "</\?sub>" |
| 17 | syn match sisu_break contains=@NoSpell "<br>\|<br />" |
| 18 | syn match sisu_control contains=@NoSpell "<p>\|</p>\|<p />\|<:p[bn]>" |
| 19 | syn match sisu_html "<center>\|</center>" |
| 20 | syn match sisu_marktail "[~-]#" |
| 21 | syn match sisu_html contains=@NoSpell "<td>\|<td \|<tr>\|</td>\|</tr>\|<table>\|<table \|</table>" |
| 22 | syn match sisu_control "\"" |
| 23 | syn match sisu_underline "\(^\| \)_[a-zA-Z0-9]\+_\([ .,]\|$\)" |
| 24 | syn match sisu_number contains=@NoSpell "[0-9a-f]\{32\}\|[0-9a-f]\{64\}" |
Bram Moolenaar | d68071d | 2006-05-02 22:08:30 +0000 | [diff] [blame] | 25 | syn match sisu_link contains=@NoSpell "\(https\?://\|\.\.\/\)\S\+" |
Bram Moolenaar | 5555acc | 2006-04-07 21:33:12 +0000 | [diff] [blame] | 26 | "metaverse specific |
Bram Moolenaar | d8fc5c0 | 2006-04-29 21:55:22 +0000 | [diff] [blame] | 27 | syn match sisu_ocn contains=@NoSpell "<\~\d\+;\w\d\+;\w\d\+>" |
| 28 | syn match sisu_marktail "<\~#>" |
| 29 | syn match sisu_markpara contains=@NoSpell "<:i[12]>" |
| 30 | syn match sisu_link " \*\~\S\+" |
| 31 | syn match sisu_action "^<:insert\d\+>" |
| 32 | syn match sisu_contain "<:e>" |
Bram Moolenaar | 5555acc | 2006-04-07 21:33:12 +0000 | [diff] [blame] | 33 | endif |
| 34 | "% 9 URLs Numbers: and ASCII Codes |
Bram Moolenaar | d8fc5c0 | 2006-04-29 21:55:22 +0000 | [diff] [blame] | 35 | syn match sisu_number "\<\(0x\x\+\|0b[01]\+\|0\o\+\|0\.\d\+\|0\|[1-9][\.0-9_]*\)\>" |
| 36 | syn match sisu_number "?\(\\M-\\C-\|\\c\|\\C-\|\\M-\)\=\(\\\o\{3}\|\\x\x\{2}\|\\\=\w\)" |
Bram Moolenaar | 5555acc | 2006-04-07 21:33:12 +0000 | [diff] [blame] | 37 | "% 8 Tuned Error - is error if not already matched |
Bram Moolenaar | d8fc5c0 | 2006-04-29 21:55:22 +0000 | [diff] [blame] | 38 | syn match sisu_error contains=sisu_error "[\~/\*!_]{\|}[\~/\*!_]" |
| 39 | syn match sisu_error contains=sisu_error "<a href\|</a>]" |
Bram Moolenaar | 5555acc | 2006-04-07 21:33:12 +0000 | [diff] [blame] | 40 | "% 7 Simple Enclosed Markup: |
| 41 | " Simple Markup: |
Bram Moolenaar | 551dbcc | 2006-04-25 22:13:59 +0000 | [diff] [blame] | 42 | "% url/link |
Bram Moolenaar | 551dbcc | 2006-04-25 22:13:59 +0000 | [diff] [blame] | 43 | syn region sisu_link contains=sisu_error,sisu_error_wspace matchgroup=sisu_action start="^<<\s*|[a-zA-Z0-9^._-]\+|@|[a-zA-Z0-9^._-]\+|"rs=s+2 end="$" |
Bram Moolenaar | 5555acc | 2006-04-07 21:33:12 +0000 | [diff] [blame] | 44 | "% header |
Bram Moolenaar | c6fe919 | 2006-04-09 21:54:49 +0000 | [diff] [blame] | 45 | syn region sisu_header_content contains=sisu_error,sisu_error_wspace,sisu_content_alt,sisu_link,sisu_linked,sisu_break matchgroup=sisu_header start="^0\~\(\S\+\|[^-]\)" end="$" |
Bram Moolenaar | b21e584 | 2006-04-16 18:30:08 +0000 | [diff] [blame] | 46 | syn region sisu_header_content contains=sisu_error,sisu_error_wspace,sisu_content_alt,sisu_link,sisu_linked,sisu_break matchgroup=sisu_header start="^0\~\(tags\?\|date\)\s\+"rs=e-1 end="\n$" |
| 47 | syn region sisu_header_content contains=sisu_error,sisu_error_wspace,sisu_content_alt,sisu_link,sisu_linked,sisu_break matchgroup=sisu_header start="^@\S\+:[+-]\?\s"rs=e-1 end="$" |
| 48 | syn region sisu_header_content contains=sisu_error,sisu_error_wspace,sisu_content_alt,sisu_link,sisu_linked,sisu_break matchgroup=sisu_header start="^@\(tags\?\|date\):\s\+"rs=e-1 end="\n$" |
Bram Moolenaar | 5555acc | 2006-04-07 21:33:12 +0000 | [diff] [blame] | 49 | "% headings |
Bram Moolenaar | d8fc5c0 | 2006-04-29 21:55:22 +0000 | [diff] [blame] | 50 | syn region sisu_heading contains=sisu_mark_endnote,sisu_content_endnote,sisu_marktail,sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_ocn,sisu_error,sisu_error_wspace matchgroup=sisu_structure start="^\([1-8]\|:\?[A-C]\)\~\(\S\+\|[^-]\)" end="$" |
Bram Moolenaar | 5555acc | 2006-04-07 21:33:12 +0000 | [diff] [blame] | 51 | "% grouped text |
Bram Moolenaar | d8fc5c0 | 2006-04-29 21:55:22 +0000 | [diff] [blame] | 52 | syn region sisu_content_alt contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_contain start="table{.\+" end="}table" |
| 53 | syn region sisu_content_alt contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_contain start="{t\~h}" end="$$" |
| 54 | syn region sisu_content_alt contains=sisu_mark_endnote,sisu_content_endnote,sisu_link,sisu_mark,sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_contain start="^\(alt\|group\|poem\){" end="^}\(alt\|group\|poem\)" |
Bram Moolenaar | 5555acc | 2006-04-07 21:33:12 +0000 | [diff] [blame] | 55 | syn region sisu_content_alt contains=sisu_error matchgroup=sisu_contain start="^code{" end="^}code" |
| 56 | "% endnotes |
Bram Moolenaar | d8fc5c0 | 2006-04-29 21:55:22 +0000 | [diff] [blame] | 57 | syn region sisu_content_endnote contains=sisu_link,sisu_strikeout,sisu_underline,sisu_number,sisu_control,sisu_identifier,sisu_error,sisu_error_wspace,sisu_mark,sisu_break matchgroup=sisu_mark_endnote start="\~{" end="}\~" skip="\n" |
| 58 | syn region sisu_content_endnote contains=sisu_strikeout,sisu_number,sisu_control,sisu_link,sisu_identifier,sisu_error,sisu_error_wspace,sisu_mark,sisu_break matchgroup=sisu_mark_endnote start="\^\~" end="\n\n" |
Bram Moolenaar | 5555acc | 2006-04-07 21:33:12 +0000 | [diff] [blame] | 59 | "% images |
Bram Moolenaar | d68071d | 2006-05-02 22:08:30 +0000 | [diff] [blame] | 60 | syn region sisu_linked contains=sisu_fontface,sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_link start="{" end="}\(\(https\?://\|\.\./\)\S\+\|image\)" oneline |
Bram Moolenaar | 551dbcc | 2006-04-25 22:13:59 +0000 | [diff] [blame] | 61 | "% some line operations |
Bram Moolenaar | d8fc5c0 | 2006-04-29 21:55:22 +0000 | [diff] [blame] | 62 | syn region sisu_control contains=sisu_strikeout,sisu_identifier,sisu_content_endnote,sisu_mark_endnote,sisu_error,sisu_error_wspace matchgroup=sisu_control start="\(\(^\| \)!_ \|<:b>\)" end="$" |
| 63 | syn region sisu_normal contains=sisu_strikeout,sisu_identifier,sisu_content_endnote,sisu_mark_endnote,sisu_link,sisu_linked,sisu_error,sisu_error_wspace matchgroup=sisu_markpara start="^_\([12*]\|[12]\*\) " end="$" |
| 64 | syn region sisu_normal contains=sisu_strikeout,sisu_identifier,sisu_content_endnote,sisu_mark_endnote,sisu_link,sisu_linked,sisu_error,sisu_error_wspace matchgroup=sisu_markpara start="^\(#[ 1]\|_# \)" end="$" |
| 65 | syn region sisu_comment matchgroup=sisu_comment start="^%\{1,2\} " end="$" |
Bram Moolenaar | 5555acc | 2006-04-07 21:33:12 +0000 | [diff] [blame] | 66 | "% font face curly brackets |
Bram Moolenaar | d8fc5c0 | 2006-04-29 21:55:22 +0000 | [diff] [blame] | 67 | syn region sisu_control contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="\*{" end="}\*" |
| 68 | syn region sisu_control contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="!{" end="}!" |
| 69 | syn region sisu_underline contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="_{" end="}_" |
| 70 | syn region sisu_identifier contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="/{" end="}/" |
| 71 | syn region sisu_underline contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="+{" end="}+" |
| 72 | syn region sisu_identifier contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="\^{" end="}\^" |
| 73 | syn region sisu_identifier contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start=",{" end="}," |
Bram Moolenaar | 5555acc | 2006-04-07 21:33:12 +0000 | [diff] [blame] | 74 | syn region sisu_strikeout contains=sisu_error matchgroup=sisu_fontface start="-{" end="}-" |
Bram Moolenaar | 5555acc | 2006-04-07 21:33:12 +0000 | [diff] [blame] | 75 | syn region sisu_html contains=sisu_error contains=sisu_strikeout matchgroup=sisu_contain start="<a href=\".\{-}\">" end="</a>" oneline |
| 76 | "% single words bold italicise etc. "workon |
| 77 | syn region sisu_control contains=sisu_error matchgroup=sisu_control start="\([ (]\|^\)\*[^\|{\n\~\\]"hs=e-1 end="\*"he=e-0 skip="[a-zA-Z0-9']" oneline |
| 78 | syn region sisu_identifier contains=sisu_error matchgroup=sisu_content_alt start="\([ ]\|^\)/[^{ \|\n\\]"hs=e-1 end="/\[ \.\]" skip="[a-zA-Z0-9']" oneline |
Bram Moolenaar | 5555acc | 2006-04-07 21:33:12 +0000 | [diff] [blame] | 79 | "% misc |
Bram Moolenaar | c6fe919 | 2006-04-09 21:54:49 +0000 | [diff] [blame] | 80 | syn region sisu_identifier contains=sisu_error matchgroup=sisu_fontface start="\^[^ {\|\n\\]"rs=s+1 end="\^[ ,.;:'})\\\n]" skip="[a-zA-Z0-9']" oneline |
Bram Moolenaar | d8fc5c0 | 2006-04-29 21:55:22 +0000 | [diff] [blame] | 81 | "% metaverse html (flagged as errors for filetype sisu) |
| 82 | syn region sisu_control contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error,sisu_mark matchgroup=sisu_html start="<b>" end="</b>" skip="\n" oneline |
| 83 | syn region sisu_control contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error,sisu_mark matchgroup=sisu_html start="<em>" end="</em>" skip="\n" oneline |
| 84 | syn region sisu_content_alt contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error,sisu_mark matchgroup=sisu_html start="<i>" end="</i>" skip="\n" oneline |
| 85 | syn region sisu_content_alt contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error,sisu_mark matchgroup=sisu_html start="<u>" end="</u>" skip="\n" oneline |
| 86 | syn region sisu_identifier contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error,sisu_mark matchgroup=sisu_html start="<ins>" end="</ins>" skip="\\\\\|\\'" oneline |
Bram Moolenaar | 551dbcc | 2006-04-25 22:13:59 +0000 | [diff] [blame] | 87 | syn region sisu_identifier contains=sisu_error matchgroup=sisu_html start="<del>" end="</del>" oneline |
| 88 | "% metaverse <:> |
Bram Moolenaar | d8fc5c0 | 2006-04-29 21:55:22 +0000 | [diff] [blame] | 89 | syn region sisu_content_alt contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_contain start="<:Table.\{-}>" end="<:Table[-_]end>" |
Bram Moolenaar | 5555acc | 2006-04-07 21:33:12 +0000 | [diff] [blame] | 90 | syn region sisu_content_alt contains=sisu_error matchgroup=sisu_contain start="<:code>" end="<:code[-_]end>" |
Bram Moolenaar | d8fc5c0 | 2006-04-29 21:55:22 +0000 | [diff] [blame] | 91 | syn region sisu_content_alt contains=sisu_mark_endnote,sisu_content_endnote,sisu_link,sisu_mark,sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_contain start="<:alt>" end="<:alt[-_]end>" |
| 92 | syn region sisu_content_alt contains=sisu_mark_endnote,sisu_content_endnote,sisu_link,sisu_mark,sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_contain start="<:poem>" end="<:poem[-_]end>" |
Bram Moolenaar | 5555acc | 2006-04-07 21:33:12 +0000 | [diff] [blame] | 93 | "% 6 Expensive Mode |
| 94 | " Expensive Mode: |
| 95 | if !exists("sisu_no_expensive") |
| 96 | else " not Expensive |
| 97 | syn region sisu_content_alt matchgroup=sisu_control start="^\s*def\s" matchgroup=NONE end="[?!]\|\>" skip="\.\|\(::\)" oneline |
| 98 | endif " Expensive? |
| 99 | "% 5 Headers: and Headings (Document Instructions) |
Bram Moolenaar | d8fc5c0 | 2006-04-29 21:55:22 +0000 | [diff] [blame] | 100 | syn match sisu_control contains=sisu_error,sisu_error_wspace "4\~! \S\+" |
Bram Moolenaar | 5555acc | 2006-04-07 21:33:12 +0000 | [diff] [blame] | 101 | syn region sisu_markpara contains=sisu_error,sisu_error_wspace start="^=begin" end="^=end.*$" |
| 102 | "% 4 Errors? |
| 103 | syn match sisu_error_wspace contains=sisu_error_wspace "^\s\+" |
| 104 | syn match sisu_error_wspace contains=sisu_error_wspace "\s\s\+" |
| 105 | syn match sisu_error_wspace contains=sisu_error_wspace " \s*$" |
Bram Moolenaar | d68071d | 2006-05-02 22:08:30 +0000 | [diff] [blame] | 106 | syn match sisu_error contains=sisu_error,sisu_error_wspace "[^ (}]https\?:\S\+" |
Bram Moolenaar | c6fe919 | 2006-04-09 21:54:49 +0000 | [diff] [blame] | 107 | syn match sisu_error contains=sisu_error_wspace "\t\+" |
Bram Moolenaar | d68071d | 2006-05-02 22:08:30 +0000 | [diff] [blame] | 108 | syn match sisu_error contains=sisu_error "https\?:\S\+[}><]" |
Bram Moolenaar | 5555acc | 2006-04-07 21:33:12 +0000 | [diff] [blame] | 109 | syn match sisu_error contains=sisu_error "\([!*/_\+,^]\){\([^(\}\1)]\)\{-}\n\n" |
| 110 | syn match sisu_error contains=sisu_error "^[\-\~]{[^{]\{-}\n\n" |
| 111 | syn match sisu_error contains=sisu_error "\s\+.{{" |
| 112 | syn match sisu_error contains=sisu_error "^\~\s*$" |
| 113 | syn match sisu_error contains=sisu_error "^[0-9]\~\s*$" |
| 114 | syn match sisu_error contains=sisu_error "^[0-9]\~\S\+\s*$" |
| 115 | syn match sisu_error contains=sisu_error "[^{]\~\^[^ \)]" |
| 116 | syn match sisu_error contains=sisu_error "\~\^\s\+\.\s*" |
Bram Moolenaar | b21e584 | 2006-04-16 18:30:08 +0000 | [diff] [blame] | 117 | syn match sisu_error contains=sisu_error "{\~^\S\+" |
Bram Moolenaar | 5555acc | 2006-04-07 21:33:12 +0000 | [diff] [blame] | 118 | syn match sisu_error contains=sisu_error "[_/\*!^]{[ .,:;?><]*}[_/\*!^]" |
| 119 | syn match sisu_error contains=sisu_error "[^ (\"'(\[][_/\*!]{\|}[_/\*!][a-zA-Z0-9)\]\"']" |
| 120 | syn match sisu_error contains=sisu_error "<dir>" |
Bram Moolenaar | d8fc5c0 | 2006-04-29 21:55:22 +0000 | [diff] [blame] | 121 | "errors for filetype sisu, though not error in 'metaverse': |
Bram Moolenaar | 5555acc | 2006-04-07 21:33:12 +0000 | [diff] [blame] | 122 | syn match sisu_error contains=sisu_error,sisu_match,sisu_strikeout,sisu_contain,sisu_content_alt,sisu_mark,sisu_break,sisu_number "<[a-zA-Z\/]\+>" |
| 123 | syn match sisu_error "/\?<\([biu]\)>[^(</\1>)]\{-}\n\n" |
| 124 | "% 3 Error Exceptions? |
| 125 | syn match sisu_control "\n\n" "contains=ALL |
| 126 | syn match sisu_control " //" |
| 127 | syn match sisu_error "%{" |
Bram Moolenaar | d68071d | 2006-05-02 22:08:30 +0000 | [diff] [blame] | 128 | syn match sisu_error "<br>https\?:\S\+\|https\?:\S\+<br>" |
| 129 | syn match sisu_error "[><]https\?:\S\+\|https\?:\S\+[><]" |
Bram Moolenaar | 5555acc | 2006-04-07 21:33:12 +0000 | [diff] [blame] | 130 | "% 2 Definitions - Define the default highlighting. |
| 131 | if version >= 508 || !exists("did_sisu_syntax_inits") |
| 132 | if version < 508 |
| 133 | let did_sisu_syntax_inits = 1 |
| 134 | command -nargs=+ HiLink hi link <args> |
| 135 | else |
| 136 | command -nargs=+ HiLink hi def link <args> |
| 137 | endif |
| 138 | "% 1 Defined |
Bram Moolenaar | c6fe919 | 2006-04-09 21:54:49 +0000 | [diff] [blame] | 139 | HiLink sisu_normal Normal |
Bram Moolenaar | 5555acc | 2006-04-07 21:33:12 +0000 | [diff] [blame] | 140 | HiLink sisu_header PreProc |
Bram Moolenaar | c6fe919 | 2006-04-09 21:54:49 +0000 | [diff] [blame] | 141 | HiLink sisu_header_content Statement |
Bram Moolenaar | 5555acc | 2006-04-07 21:33:12 +0000 | [diff] [blame] | 142 | HiLink sisu_heading Title |
Bram Moolenaar | c6fe919 | 2006-04-09 21:54:49 +0000 | [diff] [blame] | 143 | HiLink sisu_structure Operator |
Bram Moolenaar | 5555acc | 2006-04-07 21:33:12 +0000 | [diff] [blame] | 144 | HiLink sisu_contain Include |
| 145 | HiLink sisu_mark_endnote Include |
| 146 | HiLink sisu_link NonText |
| 147 | HiLink sisu_linked String |
| 148 | HiLink sisu_fontface Include |
| 149 | HiLink sisu_strikeout DiffDelete |
| 150 | HiLink sisu_content_alt Special |
| 151 | HiLink sisu_content_endnote Special |
| 152 | HiLink sisu_control Define |
| 153 | HiLink sisu_ocn Include |
Bram Moolenaar | 5555acc | 2006-04-07 21:33:12 +0000 | [diff] [blame] | 154 | HiLink sisu_number Number |
| 155 | HiLink sisu_identifier Function |
| 156 | HiLink sisu_underline Underlined |
| 157 | HiLink sisu_markpara Include |
| 158 | HiLink sisu_marktail Include |
| 159 | HiLink sisu_mark Identifier |
| 160 | HiLink sisu_break Structure |
| 161 | HiLink sisu_html Type |
| 162 | HiLink sisu_action Identifier |
| 163 | HiLink sisu_comment Comment |
Bram Moolenaar | 5555acc | 2006-04-07 21:33:12 +0000 | [diff] [blame] | 164 | HiLink sisu_error_wspace Error |
| 165 | HiLink sisu_error Error |
Bram Moolenaar | 5555acc | 2006-04-07 21:33:12 +0000 | [diff] [blame] | 166 | delcommand HiLink |
| 167 | endif |
| 168 | let b:current_syntax = "sisu" |