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