Created
July 12, 2015 03:33
kOS Syntax Highlight
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>fileTypes</key> | |
<array> | |
<string>ks</string> | |
</array> | |
<key>name</key> | |
<string>kOS Script</string> | |
<key>patterns</key> | |
<array> | |
<dict> | |
<key>comment</key> | |
<string>comments</string> | |
<key>match</key> | |
<string>\/\/(.*)</string> | |
<key>name</key> | |
<string>comment.line.ks</string> | |
</dict> | |
<dict> | |
<key>comment</key> | |
<string>strings</string> | |
<key>match</key> | |
<string>(["])(?:(?=(\\?))\2.)*?\1</string> | |
<key>name</key> | |
<string>string.quoted.double.ks</string> | |
</dict> | |
<dict> | |
<key>comment</key> | |
<string>flow control</string> | |
<key>match</key> | |
<string>(?<![\w\d])(?i)(break|if|else|lock|unlock|until|for|wait|when|then|on|preserve|)(?![\w\d])</string> | |
<key>name</key> | |
<string>keyword.control.ks</string> | |
</dict> | |
<dict> | |
<key>comment</key> | |
<string>terminal</string> | |
<key>match</key> | |
<string>(?<![\w\d])(?i)(clearscreen|print|at|reboot|shutdown)(?![\w\d])</string> | |
<key>name</key> | |
<string>keyword.other.ks</string> | |
</dict> | |
<dict> | |
<key>comment</key> | |
<string>build-in basic functions</string> | |
<key>match</key> | |
<string>(?<![\w\d])(?i)(abs|ceiling|floor|ln|log|mod|min|max|round|sqrt)(?![\w\d])</string> | |
<key>name</key> | |
<string>entity.function.kos</string> | |
</dict> | |
<dict> | |
<key>comment</key> | |
<string>build-in trig functions</string> | |
<key>match</key> | |
<string>(?<![\w\d])(?i)(sin|cos|tan|arcsin|arccos|arctan|arctan2)(?![\w\d])</string> | |
<key>name</key> | |
<string>entity.function.kos</string> | |
</dict> | |
<dict> | |
<key>comment</key> | |
<string>build-in vector functions</string> | |
<key>match</key> | |
<string>(?<![\w\d])(?i)(vdot|vcrs|vxcl|vang)(?![\w\d])</string> | |
<key>name</key> | |
<string>entity.function.kos</string> | |
</dict> | |
<dict> | |
<key>comment</key> | |
<string>atmosphere structure</string> | |
<key>match</key> | |
<string>\:(?<![\w\d])(?i)(body|exists|oxygen|scale|sealevelpressure|height)(?![\w\d])</string> | |
<key>name</key> | |
<string>support.variable.kos</string> | |
</dict> | |
<dict> | |
<key>comment</key> | |
<string>color structure</string> | |
<key>match</key> | |
<string>\:(?<![\w\d])(?i)(red|green|blue|yellow|cyan|magenta|white|black)(?![\w\d])</string> | |
<key>name</key> | |
<string>support.variable.kos</string> | |
</dict> | |
<dict> | |
<key>comment</key> | |
<string>config structure</string> | |
<key>match</key> | |
<string>\:(?<![\w\d])(?i)(config|ipu|ucp|stat|rt2|arch|safe|verbose)(?![\w\d])</string> | |
<key>name</key> | |
<string>support.variable.kos</string> | |
</dict> | |
<dict> | |
<key>comment</key> | |
<string>control structure</string> | |
<key>match</key> | |
<string>\:(?<![\w\d])(?i)(yaw|pitch|roll|vector|yawtrim|pitchtrim|rolltrim|rotation|fore|starboard|top|translation|mainthrottle|wheelsteer|wheelsteertrim|wheelthrottle|wheelthrottletrim|neutral|neutralize|pilotyaw|pilotpitch|pilotroll|pilotyawtrim|pilotpitchtrim|pilotrolltrim|pilotfore|pilotstarboard|pilottop|pilottranslation|pilotmainthrottle|pilotwheelthrottle|pilotwheelthrottletrim|pilotwheelsteer|pilotwheelsteeltrim|pilotneutral)(?![\w\d])</string> | |
<key>name</key> | |
<string>support.variable.kos</string> | |
</dict> | |
<dict> | |
<key>comment</key> | |
<string>file structure</string> | |
<key>match</key> | |
<string>\:(?<![\w\d])(?i)(name|filetype|size|modified|created)(?![\w\d])</string> | |
<key>name</key> | |
<string>support.variable.kos</string> | |
</dict> | |
<dict> | |
<key>comment</key> | |
<string>geocoordinates structure</string> | |
<key>match</key> | |
<string>\:(?<![\w\d])(?i)(lat|lng|distance|heading|bearing)(?![\w\d])</string> | |
<key>name</key> | |
<string>support.variable.kos</string> | |
</dict> | |
<dict> | |
<key>comment</key> | |
<string>list structure</string> | |
<key>match</key> | |
<string>\:(?<![\w\d])(?i)(add|insert|remove|clear|length|iterator|copy|contains|sublist|empty|dump)(?![\w\d])</string> | |
<key>name</key> | |
<string>support.variable.kos</string> | |
</dict> | |
<dict> | |
<key>comment</key> | |
<string>node structure</string> | |
<key>match</key> | |
<string>\:(?<![\w\d])(?i)(deltav|burnvector|eta|prograde|radialout|normal|orbit)(?![\w\d])</string> | |
<key>name</key> | |
<string>support.variable.kos</string> | |
</dict> | |
<dict> | |
<key>comment</key> | |
<string>orbit structure</string> | |
<key>match</key> | |
<string>\:(?<![\w\d])(?i)(name|apoapsis|periapsis|body|period|inclination|eccentricity|semimajoraxis|semiminoraxis|lan|longitudeofascendingnode|argumentofperiapsis|trueanomaly|meananomalyaepoch|transition|position|velocity|nextpatch|hasnextpatch|patches)(?![\w\d])</string> | |
<key>name</key> | |
<string>support.variable.kos</string> | |
</dict> | |
<dict> | |
<key>comment</key> | |
<string>orbitablevelocity structure</string> | |
<key>match</key> | |
<string>\:(?<![\w\d])(?i)(orbit|surface)(?![\w\d])</string> | |
<key>name</key> | |
<string>support.variable.kos</string> | |
</dict> | |
<dict> | |
<key>comment</key> | |
<string>resource structure</string> | |
<key>match</key> | |
<string>\:(?<![\w\d])(?i)(name|amount|capacity)(?![\w\d])</string> | |
<key>name</key> | |
<string>support.variable.kos</string> | |
</dict> | |
<dict> | |
<key>comment</key> | |
<string>time structure</string> | |
<key>match</key> | |
<string>\:(?<![\w\d])(?i)(clock|calendar|second|minute|hour|day|year|seconds)(?![\w\d])</string> | |
<key>name</key> | |
<string>support.variable.kos</string> | |
</dict> | |
<dict> | |
<key>comment</key> | |
<string>vecrdaw structure</string> | |
<key>match</key> | |
<string>\:(?<![\w\d])(?i)(start|vec|color|colour|label|scale|show)(?![\w\d])</string> | |
<key>name</key> | |
<string>support.variable.kos</string> | |
</dict> | |
<dict> | |
<key>comment</key> | |
<string>vector structure</string> | |
<key>match</key> | |
<string>\:(?<![\w\d])(?i)(x|y|z|mag|normalized|sqrmagnitude|direction|vec)(?![\w\d])</string> | |
<key>name</key> | |
<string>support.variable.kos</string> | |
</dict> | |
<dict> | |
<key>comment</key> | |
<string>named vessels and bodies</string> | |
<key>match</key> | |
<string>(?<![\w\d])(?i)(ship|target|body)(?![\w\d])</string> | |
<key>name</key> | |
<string>entity.name.tag.ks</string> | |
</dict> | |
<dict> | |
<key>comment</key> | |
<string>ship fields</string> | |
<key>match</key> | |
<string>(?<![\w\d])(?i)(heading|prograde|retrograde|facing|maxthrust|veolcity|geoposition|latitude|longitude|up|north|body|angularmomentum|angularvel|angularvelocity|commrange|mass|verticalspeed|surfacespeed|airspeed|vesselname|altitude|apoapsis|periapsis|sensor|srfprograde|srfretrograde|obt|status|vesselname|part)(?![\w\d])</string> | |
<key>name</key> | |
<string>variable.parameter.ks</string> | |
</dict> | |
<dict> | |
<key>comment</key> | |
<string>ship resources</string> | |
<key>match</key> | |
<string>(?<![\w\d])(?i)(liquidfuel|oxidizer|electriccharge|monopropellant|intakeair|solidfuel)(?![\w\d])</string> | |
<key>name</key> | |
<string>variable.parameter.ks</string> | |
</dict> | |
<dict> | |
<key>comment</key> | |
<string>special variables</string> | |
<key>match</key> | |
<string>(?<![\w\d])(?i)(alt|eta)(?![\w\d])</string> | |
<key>name</key> | |
<string>variable.other.ks</string> | |
</dict> | |
<dict> | |
<key>comment</key> | |
<string>boolean variables</string> | |
<key>match</key> | |
<string>(?<![\w\d])(?i)(sas|rcs|gear|legs|chutes|lights|panels|brakes|abort|ag1|ag2|ag3|ag4|ag5|ag6|ag7|ag8|ag9|ag10)(?![\w\d])</string> | |
<key>name</key> | |
<string>variable.parameters.ks</string> | |
</dict> | |
<dict> | |
<key>comment</key> | |
<string>system variables</string> | |
<key>match</key> | |
<string>(?<![\w\d])(?i)(version|sessiontime|config)(?![\w\d])</string> | |
<key>name</key> | |
<string>variable.other.ks</string> | |
</dict> | |
<dict> | |
<key>comment</key> | |
<string>game state</string> | |
<key>match</key> | |
<string>(?<![\w\d])(?i)(time|mapview)(?![\w\d])</string> | |
<key>name</key> | |
<string>variable.parameter.ks</string> | |
</dict> | |
<dict> | |
<key>comment</key> | |
<string>build-in known constants</string> | |
<key>match</key> | |
<string>(?<![\w\d])(?i)(g|e|pi)(?![\w\d])</string> | |
<key>name</key> | |
<string>constant.numeric.kos</string> | |
</dict> | |
<dict> | |
<key>comment</key> | |
<string>bool constant</string> | |
<key>match</key> | |
<string>(?<![\w\d])(?i)(true|false)(?![\w\d])</string> | |
<key>name</key> | |
<string>constant.language.kos</string> | |
</dict> | |
<dict> | |
<key>comment</key> | |
<string>boolean operators</string> | |
<key>match</key> | |
<string>\=|\<|\>|\<\></string> | |
<key>name</key> | |
<string>keyword.operator.ks</string> | |
</dict> | |
<dict> | |
<key>comment</key> | |
<string>math operators</string> | |
<key>match</key> | |
<string>\^|\+|\-|\*|\/</string> | |
<key>name</key> | |
<string>keyword.operator.ks</string> | |
</dict> | |
<dict> | |
<key>comment</key> | |
<string>assignment operators</string> | |
<key>match</key> | |
<string>(?<![\w\d])(?i)(set|to|run|declare parameter)(?![\w\d])</string> | |
<key>name</key> | |
<string>storage.modifier.ks</string> | |
</dict> | |
</array> | |
<key>scopeName</key> | |
<string>source.ks</string> | |
<key>uuid</key> | |
<string>c169c6f1-ed7f-4e23-8ec5-1562e2e9934d</string> | |
</dict> | |
</plist> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# [PackageDev] target_format: plist, ext: tmLanguage | |
# More info about kOS Script at https://ksp-kos.github.io/KOS_DOC | |
--- | |
name: kOS Script | |
scopeName: source.ks | |
fileTypes: [ks] | |
uuid: c169c6f1-ed7f-4e23-8ec5-1562e2e9934d | |
patterns: | |
- match: \/\/(.*) | |
name: comment.line.ks | |
comment: comments | |
- match: (["])(?:(?=(\\?))\2.)*?\1 | |
name: string.quoted.double.ks | |
comment: strings | |
- match: (?<![\w\d])(?i)(break|if|else|lock|unlock|until|for|wait|when|then|on|preserve|)(?![\w\d]) | |
name: keyword.control.ks | |
comment: flow control | |
- match: (?<![\w\d])(?i)(clearscreen|print|at|reboot|shutdown)(?![\w\d]) | |
name: keyword.other.ks | |
comment: terminal | |
- match: (?<![\w\d])(?i)(abs|ceiling|floor|ln|log|mod|min|max|round|sqrt)(?![\w\d]) | |
name: entity.function.kos | |
comment: build-in basic functions | |
- match: (?<![\w\d])(?i)(sin|cos|tan|arcsin|arccos|arctan|arctan2)(?![\w\d]) | |
name: entity.function.kos | |
comment: build-in trig functions | |
- match: (?<![\w\d])(?i)(vdot|vcrs|vxcl|vang)(?![\w\d]) | |
name: entity.function.kos | |
comment: build-in vector functions | |
- match: \:(?<![\w\d])(?i)(body|exists|oxygen|scale|sealevelpressure|height)(?![\w\d]) | |
name: support.variable.kos | |
comment: atmosphere structure | |
- match: \:(?<![\w\d])(?i)(red|green|blue|yellow|cyan|magenta|white|black)(?![\w\d]) | |
name: support.variable.kos | |
comment: color structure | |
- match: \:(?<![\w\d])(?i)(config|ipu|ucp|stat|rt2|arch|safe|verbose)(?![\w\d]) | |
name: support.variable.kos | |
comment: config structure | |
- match: \:(?<![\w\d])(?i)(yaw|pitch|roll|vector|yawtrim|pitchtrim|rolltrim|rotation|fore|starboard|top|translation|mainthrottle|wheelsteer|wheelsteertrim|wheelthrottle|wheelthrottletrim|neutral|neutralize|pilotyaw|pilotpitch|pilotroll|pilotyawtrim|pilotpitchtrim|pilotrolltrim|pilotfore|pilotstarboard|pilottop|pilottranslation|pilotmainthrottle|pilotwheelthrottle|pilotwheelthrottletrim|pilotwheelsteer|pilotwheelsteeltrim|pilotneutral)(?![\w\d]) | |
name: support.variable.kos | |
comment: control structure | |
- match: \:(?<![\w\d])(?i)(name|filetype|size|modified|created)(?![\w\d]) | |
name: support.variable.kos | |
comment: file structure | |
- match: \:(?<![\w\d])(?i)(lat|lng|distance|heading|bearing)(?![\w\d]) | |
name: support.variable.kos | |
comment: geocoordinates structure | |
- match: \:(?<![\w\d])(?i)(add|insert|remove|clear|length|iterator|copy|contains|sublist|empty|dump)(?![\w\d]) | |
name: support.variable.kos | |
comment: list structure | |
- match: \:(?<![\w\d])(?i)(deltav|burnvector|eta|prograde|radialout|normal|orbit)(?![\w\d]) | |
name: support.variable.kos | |
comment: node structure | |
- match: \:(?<![\w\d])(?i)(name|apoapsis|periapsis|body|period|inclination|eccentricity|semimajoraxis|semiminoraxis|lan|longitudeofascendingnode|argumentofperiapsis|trueanomaly|meananomalyaepoch|transition|position|velocity|nextpatch|hasnextpatch|patches)(?![\w\d]) | |
name: support.variable.kos | |
comment: orbit structure | |
# Skip - orbitable | |
- match: \:(?<![\w\d])(?i)(orbit|surface)(?![\w\d]) | |
name: support.variable.kos | |
comment: orbitablevelocity structure | |
# Skip - part | |
- match: \:(?<![\w\d])(?i)(name|amount|capacity)(?![\w\d]) | |
name: support.variable.kos | |
comment: resource structure | |
- match: \:(?<![\w\d])(?i)(clock|calendar|second|minute|hour|day|year|seconds)(?![\w\d]) | |
name: support.variable.kos | |
comment: time structure | |
- match: \:(?<![\w\d])(?i)(start|vec|color|colour|label|scale|show)(?![\w\d]) | |
name: support.variable.kos | |
comment: vecrdaw structure | |
- match: \:(?<![\w\d])(?i)(x|y|z|mag|normalized|sqrmagnitude|direction|vec)(?![\w\d]) | |
name: support.variable.kos | |
comment: vector structure | |
- match: (?<![\w\d])(?i)(ship|target|body)(?![\w\d]) | |
name: entity.name.tag.ks | |
comment: named vessels and bodies | |
- match: (?<![\w\d])(?i)(heading|prograde|retrograde|facing|maxthrust|veolcity|geoposition|latitude|longitude|up|north|body|angularmomentum|angularvel|angularvelocity|commrange|mass|verticalspeed|surfacespeed|airspeed|vesselname|altitude|apoapsis|periapsis|sensor|srfprograde|srfretrograde|obt|status|vesselname|part)(?![\w\d]) | |
name: variable.parameter.ks | |
comment: ship fields | |
- match: (?<![\w\d])(?i)(liquidfuel|oxidizer|electriccharge|monopropellant|intakeair|solidfuel)(?![\w\d]) | |
name: variable.parameter.ks | |
comment: ship resources | |
- match: (?<![\w\d])(?i)(alt|eta)(?![\w\d]) | |
name: variable.other.ks | |
comment: special variables | |
- match: (?<![\w\d])(?i)(sas|rcs|gear|legs|chutes|lights|panels|brakes|abort|ag1|ag2|ag3|ag4|ag5|ag6|ag7|ag8|ag9|ag10)(?![\w\d]) | |
name: variable.parameters.ks | |
comment: boolean variables | |
- match: (?<![\w\d])(?i)(version|sessiontime|config)(?![\w\d]) | |
name: variable.other.ks | |
comment: system variables | |
- match: (?<![\w\d])(?i)(time|mapview)(?![\w\d]) | |
name: variable.parameter.ks | |
comment: game state | |
- match: (?<![\w\d])(?i)(g|e|pi)(?![\w\d]) | |
name: constant.numeric.kos | |
comment: build-in known constants | |
- match: (?<![\w\d])(?i)(true|false)(?![\w\d]) | |
name: constant.language.kos | |
comment: bool constant | |
- match: \=|\<|\>|\<\> | |
name: keyword.operator.ks | |
comment: boolean operators | |
- match: \^|\+|\-|\*|\/ | |
name: keyword.operator.ks | |
comment: math operators | |
- match: (?<![\w\d])(?i)(set|to|run|declare parameter)(?![\w\d]) | |
name: storage.modifier.ks | |
comment: assignment operators | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment