/
krpano.YAML-tmLanguage
168 lines (143 loc) · 12.1 KB
/
krpano.YAML-tmLanguage
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# [PackageDev] target_format: plist, ext: tmLanguage
---
name: Krpano Markup Language
scopeName: source.xml
fileTypes: [kml, xml]
firstLineMatch: '^\<krpano'
uuid: afea28a6-82c1-4bdf-aa15-24933d9811a2
# XML comments
patterns:
#comment tag
- begin: <[!%]--
captures:
'0': {name: punctuation.definition.comment.xml}
end: --%?>
name: comment.block.xml
# XML Tags
# (</?)([-_a-zA-Z0-9:]+)
- begin: (</?)
captures:
'1': {name: punctuation.definition.tag.begin.xml}
end: (/?>)
endCaptures:
'1': {name: punctuation.definition.tag.end.xml}
name: meta.tag.xml
patterns:
# Predefined Objects
- {include: '#krpanoElement'}
# parameter-value pairs
- {include: '#tagStuff'}
- {include: '#krpanoInstructionWords'}
- {include: '#krpanoElement'}
- {include: '#krpanoElementProperties'}
- {include: '#krpanoOperators'}
- {include: '#krpanoConstants'}
- {include: '#krpanoGlobalVariables'}
- {include: '#krpanoFunctions'}
- {include: '#krpanoDecimalNumber'}
- {include: '#krpanoHexNumber'}
- {include: '#krpanoFunctionArgument'}
- {include: '#singleLineComments'}
- {include: '#multiLineComments'}
- {include: '#singlequotedString'}
repository:
# Only single-line strings are supported
doublequotedString:
match: \".*?\"
name: string.quoted.double.xml
singlequotedString:
begin: \'
end: \'
name: string.quoted.single.xml
# Event handler
# e.g.
# onclick="
# any code
# "
# old end pattern: [\n+?\t??\s??]\"
handlerString:
begin: (\"[\n+?\t??\s??]?)
beginCaptures:
'0': {name: punctuation.definition.string.begin.xml}
end: ([\n\t\s]??\")
endCaptures:
'0': {name: punctuation.definition.string.end.xml}
name: meta.function
patterns:
- {include: '#krpanoInstructionWords'}
- {include: '#krpanoElement'}
- {include: '#krpanoElementProperties'}
- {include: '#krpanoOperators'}
- {include: '#krpanoConstants'}
- {include: '#krpanoGlobalVariables'}
- {include: '#krpanoFunctions'}
- {include: '#krpanoDecimalNumber'}
- {include: '#krpanoHexNumber'}
- {include: '#krpanoFunctionArgument'}
- {include: '#singleLineComments'}
- {include: '#multiLineComments'}
- {include: '#singlequotedString'}
# Recognized property values
tagStuff:
patterns:
- {include: '#doublequotedString'}
- {include: '#singlequotedString'}
- {include: '#handlerString'}
- {include: '#krpanoElement'}
- {include: '#krpanoElementProperties'}
- {include: '#singleLineComments'}
- {include: '#multiLineComments'}
- captures:
'1': {name: entity.other.attribute-name.localname.xml}
match: ([-_a-zA-Z0-9]+)=
# Single-line comments
singleLineComments:
begin: \/\/
end: \n
name: comment.line.double-slash
# Multi-line comments
multiLineComments:
begin: \/\*
end: \*\/
name: comment.line.double-slash
# Operators
krpanoOperators:
match: (\(|\)|\[|\]|\.(\.\.)?|;|,|\|\||\&\&|\s(==(=)?|!=(=)?|<(<)?|>(>)?|<=|>=|!|\+|\-|\*|\/|\^|\?|:|(B)?AND|(B|X)?OR|LT|GT|LE|GE|(L|R){1}SHT)\s)
name: keyword.operator.krpano
# Instruction words
krpanoInstructionWords:
match: \s?\b(set|get|copy|delete|if|ifnot|resolvecondition|(stop)?delayedcall|for|asyncfor|loop|async(loop|call){1}|switch|push|pop|stopall|breakall|callwith|events\.dispatch|calc|def|nexttick|callwhen|exitcall|(set|clear)interval|toggle|break|assignstyle|new|this|scope|parentscopeset|copyattributes|strict|caller|(stop)?callwhen|sortby|createarrayitem|removearrayitem)\b
name: keyword.control
# Global variables
krpanoGlobalVariables:
match: \b(device\.(normal|edge|flash|flashversion|html5|desktop|mobile|tablet|css3d|webgl|multiressupport|panovideosupport|fullscreensupport|pixelratio|mouse|touch|ios(version)?|iphone|ipod|ipad|retina|android(version|stock)?|androidstock|blackberry|chrome(version)?|firefox(version)?|ie(version)?|safari(version)?|opera(version)?|air|standalone|windows|mac|linux|fractionalscaling|chromemobile|handheld)?|%FIRSTXML%|%CURRENTXML%|%SWFPATH%|%HTMLPATH%|%BASEDIR%|%$VARIABLE%|keycode|version|xmlversion|build|mouse\.(x|y|stagex|stagey|downx|downy|click(x|y){1}){1}|wheeldelta(_(raw|touchscale))??|fullscreen|stagewidth|stageheight|stagescale|browser\.(useragent|platform|location|domain|protocol)|timertick|random|(hlookat|vlookat|fov){1}_moveforce|(lock)?multireslevel|downloadlockedlevel|xml\.(url|content|scene|view)|have(externalinterface|networkaccess){1}|(layer|hotspot|point|(text)?style){1}\.count|(M|m)ath\.PI|lasterror)\b
name: variable.parameter
# Pre-defined functions
krpanoFunctions:
match: \b(add|sub|mul|div|mod|pow|inc|dec|clamp|(m|M)ath\.(abs|acos|asin|atan|atan2|ceil|cos|exp|floor|log|max|min|pow|round|sin|sqrt|tan)?|roundval|tohex|tolower|toupper|txtadd|subtxt|indexoftxt|txt(replace|split)|fromcharcode|escape|unscape|tween|stoptween|load(pano|scene|panoscene|xml){1}|openurl|lookat|lookto(hotspot)?|moveto|zoomto|adjusthlookat|getlooktodistance|stoplookto|stopmovements|wait|oninterrupt|screentosphere|spheretoscreen|screentolayer|layertoscreen|remapfovtype|showtext|update(object|screen)?|invalidatescreen|(add|remove)?(layer|plugin|hotspot|lensflare)?|js(call|get)?|fscommand|showlog|trace|(fatal)?error|showtext|BLEND|warning|debug(var)?|grid)\b
name: support.function
# Named Constants
krpanoConstants:
match: \b(true|false|null|NaN|CUBE|CUBESTRIP|SPHERE|CYLINDER|FISHEYE|FLAT|VIDEO|default|on|off|[VHDM]{1}FOV|auto|lookat|range|fullrange|offrange|LOW|HIGH|BEST|HIGHSHARP|force|moveto|drag(2d|2dsmooth|3d)?|4way|8way|image|container|STAGE|BGLAYER|lefttop|left|leftbottom|top|center|bottom|righttop|right|rightbottom|KRPANO|FULLSCREEN|anonymous|use-credentials|none|linear|ease(((In|Out|InOut|OutIn){1}(Quad|Quart|Quint|Sine|Bounce|Circ|Cubic|Expo|){1})|((In|Out){1}Back)){1}|MERGE|IMAGEONLY|KEEP(IMAGE|VIEW|SCENES|DISPLAY|CONTROL|PLUGINS|HOTSPOTS|PROGRESS|BASE|ALL|MOVING){1}|NOPREVIEW|IGNOREKEEP|(NO|ZOOM)BLEND|_blank|_self|_parent|_top|LOAD|force|satellite|normal|hybrid|pan|zoom|maptype|scale|streetview|overviewmap|increase|decrease|REMOVESCENES|boolean|number|int(eger)?|string|object|array)\b
name: string constant
# Pre-defined elements
krpanoElement:
match: \b(krpano|include|preview|image|view|area|display|control|cursors|autorotate|plugin|layer|hotspot|style|events|action|contextmenu|item|progress|network|memory|security|crossdomainxml|allowdomain|textstyle|lensflare(set)??|flare|data|scene|sound|spot(style)?|radar|(position|maptype|zoom){1}control|encrypted|sphere|point|webvr|global|local|debug)\b
name: entity.name.class
# Pre-defined element properties
krpanoElementProperties:
name: entity.name.type
match: \b(loadstyle|(registercontent|reset)?size|updatepos|changeorigin|getfullpath|getcenter|(alt|video|poster|image|over|active|html5_)?url|type|(h|v|to){1}fov|tilesize|multires(threshold)?|progressive|(cube(strip)?|left|front|right|back|up|down|cylinder|){1}\.url|level|tiledimage(width|height){1}|(h|v){1}lookat(min|max|range)?|fov(min|max|friction|speed|type)?|maxpixelzoom|(edit)?mode|align|(o|pixel|stage|down|click)?x|(o|pixel|stage|down|click)?y|(min|max|image|pixel|video|auto)?width|(min|max|image|pixel|video|auto)?height|top|right|bottom|fps|display\.(currentfps|frame){1}|tessmode|movequality(10)?|stillquality(10)?|flash10|sharpen|stilltime|showpolys|hardwarelimit|usedesktopimages|mipmapping|loadwhilemoving|usercontrol|(mouse|touch){1}type|zoom(to|out|in){1}cursor|mouse(speed|accelerate|friction|fovchange)?|mouseyfriction|keyb(accelerate|speed|friction|fovchange|invert){1}|movetocursor|cursorsize|head(ingoffset|(sw)?ing){1}|camrollreset|keycodes(left|right|up|down|in|out){1}|bouncinglimits|touchfriction|touchzoom|move|moving|drag(relative|inertia|friction|_oldmode)?|moveto(relative|accelerate|speed|friction)|standard|arrow_(l|r|u|d|lu|ru|ld|rd){1}|enabled|waittime|accel|speed(variance)?|horizon|visible|alpha|layer|name|(base){1}index|type|keep|handcursor|maskchildren|zorder(2)?|capture|(scale)?(children)?|preload|blendmode|style|align|(round)?edge|rotate|pixelhittest|smoothing|accuracy|(auto)?alpha|usecontentsize|scale9grid|(onover|ondown)?crop|parent|devices|mask|effect|bg(color|alpha|border|roundedge|capture|shadow)?|(text)?shadow(range|angle|color|alpha)?|txtshadow|mergedalpha|loading|loaded(url)?|hovering|pressed|on((h)?over|over|out|(single|double)?click|down|up|loaded|(enter|exit)fullscreen|(xml)?(complete|error)|previewcomplete|loadcomplete|newpano|remove(pano|all(spots)?|arrayitem){1}|newscene|(load|video){1}error|keydown(repeat)?|keyup|mousedown|mouseup|mousewheel|idle|viewchange|viewchanged|autorotate(start|stop|oneround|change)|resize|start|video(ready|play|paused|complete)|autosized|scroll|available|change|map(ready|typechanged|moved|zoomed)|error|unavailable|enable|disable|unknowndevice|(enter|exit){1}vr|done|contextmenu|(need|got)touch){1}|gyro_on((un)?available|enable|disable){1}|loader|sprite|loadstyle|registercontentsize|resetsize|updatepos|changeorigin|getfullpath|at(h|v){1}|zoom|distorted|(r|t){1}(x|y|z){1}|details|inverserotation|flying|fill(color|alpha){1}|border(width|color|alpha){1}|fullscreen(_mirroring)?|autofullscreen|anaglyph|caption|show(load|wait|reloads){1}|downloadqueues|decodequeues|retrycount|caching|cachesize|maxmem|cors|font(size)?|bold|italic|text(color|align){1}|origin|(x|y|v){1}offset|(show|fade){1}time|noclip|pix(size|upos|vpos){1}|color|pos|set(center|maptype|zoom|)?|content|url\.(flash|html5){1}|pausedonstart|loop(s)?|volume|play(backrate|sinline)|preferredformat|buffertime|ignoremetadata|directionalsound|range(falloff)?|outofrangevolume|is(videoready|(auto)?paused|seeking|waiting|complete|3d|available|enabled|(web|mobile|gear){1}vr|fake)|havesettings|device(name|size){1}|(total)?time|(loaded|total){1}bytes|(play|close){1}video|(toggle)?pause|seek|(auto)?resume|html|css|vcenter|padding|wordwrap|selectable|embeddedfonts|background(color|alpha)?|border(color|alpha|width)?|rootpath|mute|preloadsound|playsound(2D|3D(h|HS)?)?|pausesound(toggle)?|stopsound|stopallsounds|pan(by|to)?|flakes|floor|spreading|shake|wind(dir)?|rain(width|alpha){1}|fadeintime|direction|drag(g)?able|mwheel|onhover_autoscrolling|overscroll|(return)?acceleration|momentum|scrolltocenter|scrollby|stopscrolling|line(width|color|alpha)|invert|camroll|velastic|vrelative|dropdownwidth|rowcount|native|cb(designscale|font(size|style)?|padding|toosmallfix|){1}|item(font(style|size)?|padding|customstyle){1}|(add|select){1}(Id)?Item|(open|close){1}List|key|map(type|sapi|handcursor){1}|culturecode|lat|lng|activespotenabled|dragging|scrollwheel|dbclicking|(activate|panto|add(image)?|remove)?spot|getstagepos|glow(color|width|strength)?|hasscrolltrack|buttonalign|buttontexts|addspotstyle|addstylespot|zoomtospotsextent|language|tilt|controls|poi|versioninfo|(enter|exit)fs{1}|customstyle|showerrors|limitview|mfovratio|fisheye(fovlink)?|stereographic|pannini|architectural(onlymiddle)?|touch|separator|showif|count|mobile|cube|if|protect|basedir|idletime|colorcorrection|logkey|strict|debugmode|stereo(labels|format|overlap)?|lenscp|left|frame(bufferscale|s)?|domain|start|stop|interrupt|value|flash|html5(controls|preload)?|panovideo|interactivecontent|(movetoy)?friction|touch_mode|sensor_mode|autocalibration|image(scale|url)|play|normal|prealign|aspreview|distortion(fovlink)?|interruptionevents|renderer|blind(curve)?|(auto)?pause(d)?|worldscale|oversampling|headtracking|mobilevr(_database_url|(_touch|_fake)?_support|_ipd|_screensize|_lens(_overlap|_fov|_dist|_dist2|_ca|_vign)?|_webvr(_dist|_firefox)?|_orientationlock|_wakelock|_sensor(_mode)?|_autocalibration)?|vr_cursor(_enabled|_onover|_onout)?|(enter|exit|toggle){1}(vr|VR){1}|resetSensor|calibrate|resetCalibration|(load|save){1}Settings|depth|needtouch|zoom(withmap|in|out){1}|mapping|premultiplyalpha|scaleflying|autorun|secure|(l|r|t|b|w|h){1}overflow|muted|striporder|stereoscale|safearea|multireslock|monoside|hotspotvrrendering|(iphone|touch)workarounds|videoerror|webvr_on(available|unavailable|unknowndevice|entervr|exitvr|scope))\b
# keydownrepeat - ?
# Function arguments, %1, %2...
krpanoFunctionArgument:
match: (%)(\$)?[0-9a-zA-Z]+(%)?
name: variable.parameter
# Hex numbers
krpanoHexNumber:
match: (\-)?(0x|#)[0-9A-Fa-f]+%?
name: constant.numeric
# Decimal Numbers
krpanoDecimalNumber:
match: (\-)?\b\d+(\.\d*)?\b%?
name: constant.numeric