.config/nvim/syntax/pikchr.vim (view raw)
1" Vim syntax file
2" Language: Pikchr
3" Mantainer: la-ninpre
4" Latest Revision: 14 Dec 2020
5
6" check if syntax highlighting is not in conflict
7if exists("b:current_syntax")
8 finish
9endif
10
11""" syntax block
12
13" keywords
14syntax keyword PikchrStatement print assert
15syntax keyword PikchrExprFunc abs cos dist int max min sin sqrt
16syntax keyword PikchrObject arc arrow box circle cylinder dot ellipse file line
17syntax keyword PikchrObject move oval spline text
18syntax keyword PikchrDirection right down left up
19syntax keyword PikchrDirection n north ne e east se s south sw w west nw
20syntax keyword PikchrPlace of in vertex
21syntax keyword PikchrAttribute dashed dotted color fill behind cw ccw
22syntax keyword PikchrAttribute thick thin solid chop fit
23syntax keyword PikchrTextAttr above aligned below big small bold italic
24syntax keyword PikchrTextAttr center ljust rjust
25syntax keyword PikchrLocAttr at with
26syntax keyword PikchrNumPropty diameter ht height rad radius thickness width wid
27syntax keyword PikchrNthObj last previous
28syntax keyword PikchrOperator + - * /
29
30" define stmt
31syntax match PikchrDefineStmt "^define\s\i\+" contains=PikchrCustomObject
32syntax keyword PikchrDefine define contained
33syntax match PikchrCustomObject "\i\+" contained
34
35" literals
36syntax match PikchrComment "\v(#.*$)|(/\*.*\*/)"
37syntax match PikchrString "\".*\""
38syntax match PikchrVariable "\v\i+\s?(\*|\+|-|/)?\="
39syntax match PikchrDollVar "\$\i\+"
40syntax match PikchrLabel "\u\w*"
41syntax match PikchrNumber "\v\.?\d+(\.\d+)?(\%|in|cm|px|pt|pc|mm)?"
42syntax match PikchrNumber "\v0x\x+"
43syntax match PikchrOrdinal "\v([^0]\d+(st|nd|rd|th))|first"
44
45" matches
46syntax match PikchrAttributeSup "\v<same(\sas)?>"
47syntax match PikchrAttributeSup "\v<invis(ible)?>"
48syntax match PikchrAttributeSup "\v\<-\>?|-\>"
49syntax match PikchrPosition "(((of\sthe\s)\?\sway\s)\?between)|and"
50syntax match PikchrDotEdgename "\v\.((n(orth)?)|(e(ast)?)|(s(outh)?)|(w(est)?)|se|se|nw|ne)"
51syntax match PikchrDotEdgename "\v\.(bot(tom)?|t(op)?|right|left|start|end|c(enter)?)"
52syntax match PikchrDotPropty "\v\.(color|dashed|diameter|dotted|fill|ht|height|rad(ius)?|thickness|wid(th)?)"
53syntax match PikchrPathElem "\v<(from|then|go|to|(until\s)?even\swith|heading|close)>"
54
55
56""" highlight block
57
58" keywords
59hi def link PikchrStatement Statement
60hi def link PikchrExprFunc Function
61hi def link PikchrObject Type
62hi def link PikchrDirection Function
63hi def link PikchrLocAttr Tag
64hi def link PikchrPlace Function
65hi def link PikchrTextAttr Identifier
66hi def link PikchrNumPropty Identifier
67hi def link PikchrNthObj Constant
68hi def link PikchrOperator Operator
69
70" define stmt
71hi def link PikchrDefine Define
72hi def link PikchrCustomObject Type
73
74" literals
75hi def link PikchrComment Comment
76hi def link PikchrString String
77hi def link PikchrVariable Identifier
78hi def link PikchrDollVar Identifier
79hi def link PikchrLabel Identifier
80hi def link PikchrNumber Number
81hi def link PikchrOrdinal Number
82
83" matches
84hi def link PikchrAttribute Tag
85hi def link PikchrAttributeSup Tag
86hi def link PikchrPosition Function
87hi def link PikchrDotEdgename Identifier
88hi def link PikchrDotPropty Identifier
89hi def link PikchrPathElem Statement