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