aboutsummaryrefslogtreecommitdiff
path: root/runtime/syntax
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/syntax')
-rw-r--r--runtime/syntax/tutor.vim83
-rw-r--r--runtime/syntax/vimnormal.vim16
-rw-r--r--runtime/syntax/zimbu.vim64
3 files changed, 146 insertions, 17 deletions
diff --git a/runtime/syntax/tutor.vim b/runtime/syntax/tutor.vim
new file mode 100644
index 0000000000..99bcb78270
--- /dev/null
+++ b/runtime/syntax/tutor.vim
@@ -0,0 +1,83 @@
+if exists("b:current_syntax")
+ finish
+endif
+
+syn include @VIM syntax/vim.vim
+unlet b:current_syntax
+syn include @TUTORSHELL syntax/sh.vim
+unlet b:current_syntax
+syn include @VIMNORMAL syntax/vimnormal.vim
+
+syn match tutorLink /\[.\{-}\](.\{-})/ contains=tutorInlineNormal
+syn match tutorLinkBands /\[\|\]\|(\|)/ contained containedin=tutorLink,tutorLinkAnchor conceal
+syn match tutorLinkAnchor /(.\{-})/ contained containedin=tutorLink conceal
+syn match tutorURL /\(https\?\|file\):\/\/[[:graph:]]\+\>\/\?/
+syn match tutorEmail /\<[[:graph:]]\+@[[:graph:]]\+\>/
+syn match tutorInternalAnchor /\*[[:alnum:]-]\+\*/ contained conceal containedin=tutorSection
+
+syn match tutorSection /^#\{1,6}\s.\+$/ fold
+syn match tutorSectionBullet /#/ contained containedin=tutorSection
+
+syn match tutorTOC /\ctable of contents:/
+
+syn match tutorConcealedEscapes /\\[`*!\[\]()«»:$-]\@=/ conceal
+
+syn region tutorEmphasis matchgroup=Delimiter start=/[\*]\@<!\*\*\@!/ end=/[\*]\@<!\*\*\@!/
+ \ concealends contains=tutorInlineCommand,tutorInlineNormal
+syn region tutorBold matchgroup=Delimiter start=/\*\{2}/ end=/\*\{2}/
+ \ concealends contains=tutorInlineCommand,tutorInlineNormal
+
+syn keyword tutorMarks TODO NOTE IMPORTANT TIP ATTENTION EXERCISE
+syn keyword tutorMarks todo note tip attention exercise
+syn keyword tutorMarks Todo Note Tip Excersise
+
+syn match tutorTextMark /\\\@<!--->/ conceal cchar=→
+syn region tutorSampleText start=/^\(--->\)\@=/ end=/$/ keepend contains=@SPELL
+syn match tutorSampleTextMark /^--->/ contained containedin=tutorSampleText conceal cchar=→
+syn match tutorSampleTextExpect /\}\@<! {expect:.\+}\s*$/ contained containedin=tutorSampleText conceal
+syn match tutorSampleTextExpect /|\@<! |expect:.\+|\s*$/ contained containedin=tutorSampleText conceal
+
+syn region tutorCodeblock matchgroup=Delimiter start=/^\~\{3}.*$/ end=/^\~\{3}/
+
+syn region tutorShell matchgroup=Delimiter start=/^\~\{3} sh\s*$/ end=/^\~\{3}/ keepend contains=@TUTORSHELL concealends
+syn match tutorShellPrompt /\(^\s*\)\@<=[$#]/ contained containedin=tutorShell
+
+syn region tutorInlineCode matchgroup=Delimiter start=/\\\@<!`/ end=/\\\@<!\(`{\@!\|`\s\)/ concealends
+
+syn region tutorCommand matchgroup=Delimiter start=/^\~\{3} cmd\( :\)\?\s*$/ end=/^\~\{3}/ keepend contains=@VIM concealends
+syn region tutorInlineCommand matchgroup=Delimiter start=/\\\@<!`\(.*{vim}\)\@=/ end=/\\\@<!`\({vim}\)\@=/ nextgroup=tutorInlineType contains=@VIM concealends
+
+syn region tutorNormal matchgroup=Delimiter start=/^\~\{3} norm\(al\?\)\?\s*$/ end=/^\~\{3}/ contains=@VIMNORMAL concealends
+syn region tutorInlineNormal matchgroup=Delimiter start=/\\\@<!`\(\S*{normal}\)\@=/ end=/\\\@<!`\({normal}\)\@=/ nextgroup=tutorInlineType contains=@VIMNORMAL concealends
+
+syn match tutorInlineType /{\(normal\|vim\)}/ contained conceal
+
+syn match tutorInlineOK /✓/
+syn match tutorInlineX /✗/
+
+hi! tutorLink cterm=underline gui=underline ctermfg=lightblue guifg=#0088ff
+hi! link tutorLinkBands Delimiter
+hi! link tutorLinkAnchor Underlined
+hi! link tutorInternalAnchor Underlined
+hi! link tutorURL tutorLink
+hi! link tutorEmail tutorLink
+
+hi! link tutorSection Title
+hi! link tutorSectionBullet Delimiter
+
+hi! link tutorTOC Directory
+
+hi! tutorMarks cterm=bold gui=bold
+
+hi! tutorEmphasis gui=italic cterm=italic
+hi! tutorBold gui=bold cterm=bold
+
+hi! link tutorSampleText Special
+hi! tutorOK ctermfg=green guifg=#00ff88 cterm=bold gui=bold
+hi! tutorX ctermfg=red guifg=#ff2000 cterm=bold gui=bold
+hi! link tutorInlineOK tutorOK
+hi! link tutorInlineX tutorX
+
+hi! link tutorShellPrompt Delimiter
+
+let b:current_syntax = "tutor"
diff --git a/runtime/syntax/vimnormal.vim b/runtime/syntax/vimnormal.vim
new file mode 100644
index 0000000000..df672c5236
--- /dev/null
+++ b/runtime/syntax/vimnormal.vim
@@ -0,0 +1,16 @@
+syn match normalOp /[dcrypoaxv!"#%&.-\/:<>=?@ABCDGHIJKLMNOPQRSUVWXYZgmqstz~iu]/ nextgroup=normalMod
+syn match normalMod /m\@<![ia]/
+syn match normalObject /["'()<>BW\[\]`bstweE{}ftFT;,$]/
+syn match normalCount /[0-9]/
+syn region normalSearch start=/[/?]\@<=./ end=/.<CR>\@=/ contains=normalKey keepend
+syn region normalChange start=/\([cr][wWbBeE()\[\]{}pst]\)\@<=./ end=/.\@=/ contains=normalKey keepend
+syn match normalCharSearch /\c[ftr]\@<=\w/
+syn match normalMark /\(f\@<!m\)\@<=[a-zA-Z0-9]/
+syn match normalKey /<'\@!.\{-}>'\@!/
+
+hi! link normalOp Operator
+hi! link normalMod PreProc
+hi! link normalObject Structure
+hi! link normalCount Number
+hi! link normalMark Identifier
+hi! link normalKey Special
diff --git a/runtime/syntax/zimbu.vim b/runtime/syntax/zimbu.vim
index c859a2f815..1a7a485e6f 100644
--- a/runtime/syntax/zimbu.vim
+++ b/runtime/syntax/zimbu.vim
@@ -1,7 +1,7 @@
" Vim syntax file
" Language: Zimbu
" Maintainer: Bram Moolenaar
-" Last Change: 2012 Jun 01
+" Last Change: 2014 Nov 23
if exists("b:current_syntax")
finish
@@ -12,7 +12,10 @@ syn include @Ccode syntax/c.vim
syn keyword zimbuTodo TODO FIXME XXX contained
syn match zimbuNoBar "|" contained
syn match zimbuParam "|[^| ]\+|" contained contains=zimbuNoBar
-syn match zimbuComment "#.*$" contains=zimbuTodo,zimbuParam,@Spell
+syn match zimbuNoBacktick "`" contained
+syn match zimbuCode "`[^`]\+`" contained contains=zimbuNoBacktick
+syn match zimbuComment "#.*$" contains=zimbuTodo,zimbuParam,zimbuCode,@Spell
+syn match zimbuComment "/\*.\{-}\*/" contains=zimbuTodo,zimbuParam,zimbuCode,@Spell
syn match zimbuChar "'\\\=.'"
@@ -28,27 +31,32 @@ syn keyword zimbuBasicType fixed1 fixed2 fixed3 fixed4 fixed5 fixed6
syn keyword zimbuBasicType fixed7 fixed8 fixed9 fixed10 fixed11 fixed12
syn keyword zimbuBasicType fixed13 fixed14 fixed15
-syn keyword zimbuCompType string stringval cstring varstring
-syn keyword zimbuCompType bytes varbytes
-syn keyword zimbuCompType tuple array list dict multiDict set multiSet
+syn keyword zimbuCompType string varString
+syn keyword zimbuCompType byteString varByteString
+syn keyword zimbuCompType tuple array list dict dictList set callback
+syn keyword zimbuCompType sortedList multiDict multiDictList multiSet
syn keyword zimbuCompType complex complex32 complex64 complex80 complex128
syn keyword zimbuCompType proc func def thread evalThread lock cond pipe
-syn keyword zimbuType VAR ANY USE GET
+syn keyword zimbuType VAR dyn type USE GET
syn match zimbuType "IO.File"
syn match zimbuType "IO.Stat"
-syn keyword zimbuStatement IF ELSE ELSEIF WHILE REPEAT FOR IN TO STEP
+syn keyword zimbuStatement IF ELSE ELSEIF IFNIL WHILE REPEAT FOR IN TO STEP
syn keyword zimbuStatement DO UNTIL SWITCH WITH
syn keyword zimbuStatement TRY CATCH FINALLY
syn keyword zimbuStatement GENERATE_IF GENERATE_ELSE GENERATE_ELSEIF
+syn keyword zimbuStatement GENERATE_ERROR
+syn keyword zimbuStatement BUILD_IF BUILD_ELSE BUILD_ELSEIF
syn keyword zimbuStatement CASE DEFAULT FINAL ABSTRACT VIRTUAL DEFINE REPLACE
syn keyword zimbuStatement IMPLEMENTS EXTENDS PARENT LOCAL
-syn keyword zimbuStatement PART ALIAS CONNECT WRAP
+syn keyword zimbuStatement PART ALIAS TYPE CONNECT WRAP
syn keyword zimbuStatement BREAK CONTINUE PROCEED
-syn keyword zimbuStatement RETURN EXIT THROW
+syn keyword zimbuStatement RETURN EXIT THROW DEFER
syn keyword zimbuStatement IMPORT AS OPTIONS MAIN
-syn keyword zimbuStatement INTERFACE MODULE ENUM BITS SHARED
+syn keyword zimbuStatement INTERFACE PIECE INCLUDE MODULE ENUM BITS
+syn keyword zimbuStatement SHARED STATIC
+syn keyword zimbuStatement LAMBDA
syn match zimbuStatement "\<\(FUNC\|PROC\|DEF\)\>"
syn match zimbuStatement "\<CLASS\>"
syn match zimbuStatement "}"
@@ -61,10 +69,13 @@ syn match zimbuAttribute "@default\>"
syn match zimbuAttribute "@define\>"
syn match zimbuAttribute "@replace\>"
syn match zimbuAttribute "@final\>"
+syn match zimbuAttribute "@primitive\>"
+syn match zimbuAttribute "@notOnExit\>"
syn match zimbuAttribute "@private\>"
syn match zimbuAttribute "@protected\>"
syn match zimbuAttribute "@public\>"
+syn match zimbuAttribute "@local\>"
syn match zimbuAttribute "@file\>"
syn match zimbuAttribute "@directory\>"
syn match zimbuAttribute "@read=private\>"
@@ -78,15 +89,22 @@ syn match zimbuAttribute "@items=public\>"
syn match zimbuAttribute "@items=file\>"
syn match zimbuAttribute "@items=directory\>"
-syn keyword zimbuMethod NEW EQUAL COPY COMPARE SIZE GET SET
+syn keyword zimbuMethod NEW EQUAL COPY COMPARE SIZE GET SET INIT EARLYINIT
syn keyword zimbuOperator IS ISNOT ISA ISNOTA
-syn keyword zimbuModule ARG CHECK E IO PROTO SYS HTTP ZC ZWT TIME THREAD
+syn keyword zimbuModule ARG CHECK E GC IO LOG PROTO SYS HTTP ZC ZWT T TIME THREAD
-syn match zimbuString +"\([^"\\]\|\\.\)*\("\|$\)+
+syn match zimbuImport "\.\zsPROTO"
+syn match zimbuImport "\.\zsCHEADER"
+
+"syn match zimbuString +"\([^"\\]\|\\.\)*\("\|$\)+ contains=zimbuStringExpr
+syn region zimbuString start=+"+ skip=+[^"\\]\|\\.+ end=+"\|$+ contains=zimbuStringExpr
syn match zimbuString +R"\([^"]\|""\)*\("\|$\)+
-syn region zimbuString start=+'''+ end=+'''+
+syn region zimbuLongString start=+''"+ end=+"''+
+syn match zimbuStringExpr +\\([^)]*)+hs=s+2,he=e-1 contained contains=zimbuString,zimbuParenPairOuter
+syn region zimbuParenPairOuter start=+(+ms=s+1 end=+)+me=e-1 contained contains=zimbuString,zimbuParenPair
+syn region zimbuParenPair start=+(+ end=+)+ contained contains=zimbuString,zimbuParenPair
syn keyword zimbuFixed TRUE FALSE NIL THIS THISTYPE FAIL OK
syn keyword zimbuError NULL
@@ -97,12 +115,18 @@ syn match zimbuSpaceError display excludenl "\S\s\+$"ms=s+1
syn match zimbuSpaceError display " \+\t"
syn match zimbuSpaceError display "\t\+ "
-syn match zimbuUses contained "uses([a-zA-Z_ ,]*)"
+syn match zimbuUses contained "\<uses([a-zA-Z_ ,]*)"
+syn match zimbuBlockgc contained "blockgc"
syn match zimbuBlockComment contained " #.*"
-syn region zimbuCregion matchgroup=zimbuCblock start="^>>>" end="^<<<.*" contains=@Ccode,zimbuUses,zimbuBlockComment keepend
+syn region zimbuCregion matchgroup=zimbuCblock start="^>>>" end="^<<<.*" contains=@Ccode,zimbuUses,zimbuBlockgc,zimbuBlockComment keepend
+
+" Assume long strings and C regions don't take more than 200 lines.
+syn sync minlines=200
-syn sync minlines=2000
+" When we find the start of a long string, without a # or " before it, we are
+" sure to be inside a long string.
+syn sync match zimbuLongStringSync grouphere zimbuLongString +^[^"#]*''\"+
hi def link zimbuBasicType Type
hi def link zimbuCompType Type
@@ -111,17 +135,23 @@ hi def link zimbuStatement Statement
hi def link zimbuOperator Statement
hi def link zimbuMethod PreProc
hi def link zimbuModule PreProc
+hi def link zimbuImport PreProc
hi def link zimbuUses PreProc
+hi def link zimbuBlockgc PreProc
hi def link zimbuAttribute PreProc
hi def link zimbuString Constant
+hi def link zimbuLongString Special
hi def link zimbuChar Constant
hi def link zimbuFixed Constant
hi def link zimbuComment Comment
+hi def link zimbuCommentStart zimbuComment
hi def link zimbuBlockComment Comment
hi def link zimbuCblock Comment
hi def link zimbuTodo Todo
hi def link zimbuParam Constant
+hi def link zimbuCode Statement
hi def link zimbuNoBar Ignore
+hi def link zimbuNoBacktick Ignore
hi def link zimbuSpaceError Error
hi def link zimbuError Error