1 | " Vim syntax file |
---|
2 | " Language: Refal |
---|
3 | " Maintainer: Andrey Slepuhin <pooh@msu.ru> |
---|
4 | " Last Change: $Date: 2007-02-05 14:02:32 +0000 (Mon, 05 Feb 2007) $ by Anton Orlov <orlov@mccme.ru> |
---|
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 | if version >= 600 |
---|
15 | setlocal iskeyword=a-z,A-Z,48-57,-,.,?,! |
---|
16 | else |
---|
17 | set iskeyword=a-z,A-Z,48-57,-,.,?,! |
---|
18 | endif |
---|
19 | |
---|
20 | syn match Directive "\$\(use\|import\|func\|box\|const\|table\)?\=" |
---|
21 | syn match Directive "\$\(vector\|string\|channel\)?\=" |
---|
22 | syn match Directive "\$\(traceall\|trace\|extern\)?\=" |
---|
23 | syn match Operator "\$\(r\|l\|iter\)" |
---|
24 | syn match Operator "\$\(fail\|error\|trap\|with\)" |
---|
25 | syn match Symbol "[A-Z?!][A-Za-z0-9_\-?!]*" |
---|
26 | syn region Symbol start="\"" end="\"" skip="\\." |
---|
27 | syn region Symbol start="\'" end="\'" skip="\\." |
---|
28 | syn match Variable "[estv]\.\=[A-Za-z0-9_\-?!]*" contains=VarType |
---|
29 | syn match VarType "[estv]" contained nextgroup=VarName |
---|
30 | syn match VarName "[A-Za-z0-9_\-?]*" contained |
---|
31 | syn match VarName "\.[A-Za-z0-9_\-?]*"hs=s+1 contained |
---|
32 | |
---|
33 | syn match ParenError ")" |
---|
34 | syn match FunError ">" |
---|
35 | syn match BlockError "}" |
---|
36 | syn match CommentError "*/" |
---|
37 | |
---|
38 | if exists("refal_space_errors") |
---|
39 | syn match SpaceError "\s*$" |
---|
40 | endif |
---|
41 | |
---|
42 | syn match Comment "//.*" contains=SpaceError |
---|
43 | syn match Comment "\*.*" contains=SpaceError |
---|
44 | syn region Comment start="/\*" end="\*/" |
---|
45 | |
---|
46 | syn region ObjExpression start="(" end=")" contains=@ObjExpression2 |
---|
47 | syn region FunExpression matchgroup=Funcall start="<[A-Z?!][A-Za-z0-9_\-?!]*"hs=s+1 matchgroup=FunExpression end=">" contains=@FunExpression2 |
---|
48 | syn region FunExpression matchgroup=Funcall start="<\"[A-Za-z0-9_\-?\+\*\/\\\ \.\,\:\!<>=]*\""hs=s+1 matchgroup=FunExpression end=">" contains=@FunExpression2 |
---|
49 | syn region Block start="{" end="}" contains=@Block2 |
---|
50 | syn cluster ObjExpression2 contains=Symbol,Variable,ObjExpression,FunExpression,FunError,SpaceError,Operator,Comment |
---|
51 | syn cluster FunExpression2 contains=Symbol,Variable,ObjExpression,FunExpression,ParenError,SpaceError,Operator,Comment |
---|
52 | syn cluster Block2 contains=Symbol,Variable,ObjExpression,FunExpression,Block,ParenError,FunError,SpaceError,Operator,Comment |
---|
53 | |
---|
54 | syntax sync ccomment |
---|
55 | syntax sync lines=200 |
---|
56 | |
---|
57 | " Define the default highlighting. |
---|
58 | " For version 5.7 and earlier: only when not done already |
---|
59 | " For version 5.8 and later: only when an item doesn't have highlighting yet |
---|
60 | if version >= 508 || !exists("did_refal_syntax_inits") |
---|
61 | if version < 508 |
---|
62 | let did_refal_syntax_inits = 1 |
---|
63 | command -nargs=+ HiLink hi link <args> |
---|
64 | else |
---|
65 | command -nargs=+ HiLink hi def link <args> |
---|
66 | endif |
---|
67 | |
---|
68 | HiLink Directive Include |
---|
69 | HiLink Symbol Identifier |
---|
70 | " HiLink Variable Type |
---|
71 | " HiLink VarType Type |
---|
72 | HiLink VarType Operator |
---|
73 | HiLink VarName Type |
---|
74 | HiLink ParenError Error |
---|
75 | HiLink FunError Error |
---|
76 | HiLink BlockError Error |
---|
77 | HiLink SpaceError Error |
---|
78 | HiLink FunCall Statement |
---|
79 | " HiLink ObjExpression Error |
---|
80 | |
---|
81 | delcommand HiLink |
---|
82 | endif |
---|
83 | |
---|
84 | let b:current_syntax = "refal" |
---|