Created
July 19, 2017 20:16
-
-
Save requinix/32565e4ceb77a532f1c03772dab4ea04 to your computer and use it in GitHub Desktop.
VS Code syntax highlighting for Papyrus (Skyrim version)
This file contains 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
{ | |
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", | |
"name": "Papyrus (Skyrim)", | |
"scopeName": "source.papyrus-skyrim", | |
"foldingStartMarker": "(?i)\\b(event|function|property|state)\\b", | |
"foldingStopMarker": "(?i)\\b(endevent|endfunction|endproperty|endstate)\\b", | |
"patterns": [ | |
{ "include": "#comments" }, | |
{ "include": "#events" }, | |
{ "include": "#flags" }, | |
{ "include": "#functions" }, | |
{ "include": "#known-types" }, | |
{ "include": "#literals" }, | |
{ "include": "#imports" }, | |
{ "include": "#operators" }, | |
{ "include": "#properties" }, | |
{ "include": "#scriptname" }, | |
{ "include": "#statements" }, | |
{ "include": "#states" }, | |
{ "include": "#strings" }, | |
{ "include": "#variables" } | |
], | |
"repository": { | |
"comments": { | |
"patterns": [ | |
{ | |
"begin": ";/", | |
"end": "/;", | |
"name": "comment.block.papyrus.skyrim" | |
}, | |
{ | |
"match": "((?<!/);|;(?!/)).*", | |
"name": "comment.line.semicolon.papyrus.skyrim" | |
}, | |
{ | |
"begin": "\\{", | |
"end": "\\}", | |
"name": "comment.block.documentation.papyrus.skyrim" | |
} | |
] | |
}, | |
"events": { | |
"patterns": [ | |
{ | |
"match": "(?i)\\b(event)\\s+(\\w+)|\\b(endevent)\\b", | |
"name": "meta.event.papyrus.skyrim", | |
"captures": { | |
"1": { | |
"name": "storage.type.event.papyrus.skyrim" | |
}, | |
"2": { | |
"name": "entity.name.event.papyrus.skyrim" | |
}, | |
"3": { | |
"name": "storage.type.event.papyrus.skyrim" | |
} | |
} | |
} | |
] | |
}, | |
"flags": { | |
"patterns": [ | |
{ | |
"match": "(?i)\\b(?:(auto)|(autoreadonly)|(conditional)|(global)|(hidden)|(native))\\b", | |
"name": "storage.modifier.papyrus.skyrim", | |
"captures": { | |
"1": { | |
"name": "storage.modifier.auto.papyrus.skyrim" | |
}, | |
"2": { | |
"name": "storage.modifier.autoreadonly.papyrus.skyrim" | |
}, | |
"3": { | |
"name": "storage.modifier.conditional.papyrus.skyrim" | |
}, | |
"4": { | |
"name": "storage.modifier.global.papyrus.skyrim" | |
}, | |
"5": { | |
"name": "storage.modifier.hidden.papyrus.skyrim" | |
}, | |
"6": { | |
"name": "storage.modifier.native.papyrus.skyrim" | |
} | |
} | |
} | |
] | |
}, | |
"functions": { | |
"patterns": [ | |
{ | |
"match": "(?i)\\b(function)\\s+(\\w+)|\\b(endfunction)\\b", | |
"name": "meta.function.papyrus.skyrim", | |
"captures": { | |
"1": { | |
"name": "storage.type.function.papyrus.skyrim" | |
}, | |
"2": { | |
"name": "entity.name.function.papyrus.skyrim" | |
}, | |
"3": { | |
"name": "storage.type.function.papyrus.skyrim" | |
} | |
} | |
} | |
] | |
}, | |
"imports": { | |
"patterns": [ | |
{ | |
"match": "(?i)\\b(import)\\s+(\\w+)", | |
"name": "meta.preprocessor.import.papyrus.skyrim", | |
"captures": { | |
"1": { | |
"name": "keyword.control.import.papyrus.skyrim" | |
}, | |
"2": { | |
"patterns": [ | |
{ | |
"include": "#known-types" | |
}, | |
{ | |
"name": "entity.name.type.papyrus.skyrim" | |
} | |
] | |
} | |
} | |
} | |
] | |
}, | |
"known-types": { | |
"patterns": [ | |
{ | |
"match": "(?i)\\b(self|parent)\\b", | |
"name": "variable.language.papyrus.skyrim" | |
}, | |
{ | |
"match": "(?i)\\b(bool|int|float|string)\\b", | |
"name": "storage.type.papyrus.skyrim" | |
}, | |
{ | |
"match": "(?i)\\b(?:debug|game|math|utility)\\b", | |
"name": "support.type.root.other.papyrus.skyrim" | |
}, | |
{ | |
"match": "(?i)\\bactivemagiceffect\\b", | |
"name": "support.type.root.activemagiceffect.papyrus.skyrim" | |
}, | |
{ | |
"match": "(?i)\\b(?:location|reference)?alias\\b", | |
"name": "support.type.root.alias.papyrus.skyrim" | |
}, | |
{ | |
"match": "(?i)\\bform\\b", | |
"name": "support.type.root.form.papyrus.skyrim" | |
}, | |
{ | |
"match": "(?i)\\b(?:colorcomponent|formtype|gamedata|input|modevent|netimmerse|skse|spawnertask|stringutil|ui|uicallback|wornobject)\\b", | |
"name": "support.type.skse.root.papyrus.skyrim" | |
}, | |
{ | |
"match": "(?i)\\b(?:action|(?:talking)?activator|flora|furniture|actorbase|ammo|armor|associationtype|book|cell|class|container|door|effectshader|enchantment|encounterzone|explosion|faction|formlist|globalvariable|hazard|idle|imagespacemodifier|impactdataset|ingredient|keyword|locationreftype|leveled(?:actor|item|spell)|light|location|magiceffect|message|miscobject|apparatus|constructibleobject|key|soulgem|musictype|objectreference|actor|outfit|package|perk|potion|projectile|quest|race|scene|scroll|shout|sound|soundcategory|spell|static|textureset|topic|topicinfo|visualeffect|voicetype|weapon|weather|wordofpower|worldspace)\\b", | |
"name": "support.type.form.papyrus.skyrim" | |
}, | |
{ | |
"match": "(?i)\\b(?:actorvalueinfo|armoraddon|colorform|combatstyle|defaultobjectmanager|equipslot|headpart|sounddescriptor|treeobject)\\b", | |
"name": "support.type.skse.form.papyrus.skyrim" | |
} | |
] | |
}, | |
"literals": { | |
"patterns": [ | |
{ | |
"begin": "\"", | |
"end": "\"", | |
"name": "string.quoted.double.papyrus.skyrim", | |
"patterns": [ | |
{ | |
"match": "\\\\.", | |
"name": "constant.character.escape.papyrus.skyrim" | |
} | |
] | |
}, | |
{ | |
"match": "(?<![\\w.])\\d*(\\d\\.|\\.\\d)\\d*(?![\\w.])", | |
"name": "constant.numeric.float.papyrus.skyrim" | |
}, | |
{ | |
"match": "\\b0[Xx][a-fA-F0-9]+\\b", | |
"name": "constant.numeric.hex.papyrus.skyrim" | |
}, | |
{ | |
"match": "(?<![\\w.])\\d+(?![\\w.])", | |
"name": "constant.numeric.integer.papyrus.skyrim" | |
}, | |
{ | |
"match": "(?i)\\b(?:false|none|true)\\b", | |
"name": "constant.language.papyrus.skyrim" | |
} | |
] | |
}, | |
"operators": { | |
"patterns": [ | |
{ | |
"match": "&&|\\|\\|[-+*/%=.!]?=|[-+*/%.!]|[<>]=?|\\b[Aa][Ss]\\b", | |
"name": "keyword.operator.papyrus.skyrim" | |
}, | |
{ | |
"match": "(\\[)(\\d*)(\\])", | |
"name": "meta.brackets.array.papyrus.skyrim", | |
"captures": { | |
"1": { | |
"name": "punctuation.section.brackets.begin.array.papyrus.skyrim" | |
}, | |
"2": { | |
"name": "constant.numeric.integer.papyrus.skyrim" | |
}, | |
"3": { | |
"name": "punctuation.section.brackets.end.array.papyrus.skyrim" | |
} | |
} | |
} | |
] | |
}, | |
"properties": { | |
"patterns": [ | |
{ | |
"match": "(?i)\\b(property)\\s+(\\w+)", | |
"name": "meta.property.papyrus.skyrim", | |
"captures": { | |
"1": { | |
"name": "storage.type.property.papyrus.skyrim" | |
}, | |
"2": { | |
"name": "variable.name.papyrus.skyrim" | |
} | |
} | |
} | |
] | |
}, | |
"scriptname": { | |
"patterns": [ | |
{ | |
"match": "(?i)\\b(scriptname)\\s+(\\w+)(?:\\s+(extends)\\s+(\\w+))?", | |
"name": "meta.type.papyrus.skyrim", | |
"captures": { | |
"1": { | |
"name": "storage.type.script.papyrus.skyrim" | |
}, | |
"2": { | |
"name": "entity.name.type.papyrus.skyrim" | |
}, | |
"3": { | |
"name": "keyword.other.extends.papyrus.skyrim" | |
}, | |
"4": { | |
"patterns": [ | |
{ | |
"include": "#known-types" | |
}, | |
{ | |
"name": "entity.name.type.papyrus.skyrim" | |
} | |
] | |
} | |
} | |
} | |
] | |
}, | |
"statements": { | |
"patterns": [ | |
{ | |
"match": "(?i)\\b(if|else|elseif|endif|while|endwhile|return)\\b", | |
"name": "keyword.control.papyrus.skyrim" | |
} | |
] | |
}, | |
"states": { | |
"patterns": [ | |
{ | |
"match": "(?i)\\b(state)\\s+(\\w+)", | |
"name": "meta.state.papyrus.skyrim", | |
"captures": { | |
"1": { | |
"name": "storage.type.state.papyrus.skyrim" | |
}, | |
"2": { | |
"name": "entity.name.state.papyrus.skyrim" | |
} | |
} | |
} | |
] | |
}, | |
"strings": { | |
"patterns": [ | |
{ | |
"begin": "\"", | |
"end": "\"", | |
"name": "string.quoted.double.papyrus.skyrim", | |
"patterns": [ | |
{ | |
"match": "\\\\.", | |
"name": "constant.character.escape.papyrus.skyrim" | |
} | |
] | |
} | |
] | |
}, | |
"variables": { | |
"patterns": [ | |
{ | |
"match": "\\b(\\w+)\\s+(\\w+)", | |
"name": "meta.variable.papyrus.skyrim", | |
"captures": { | |
"1": { | |
"patterns": [ | |
{ | |
"include": "#known-types" | |
}, | |
{ | |
"name": "variable.name.papyrus.skyrim" | |
} | |
] | |
}, | |
"2": { | |
"name": "variable.name.papyrus.skyrim" | |
} | |
} | |
} | |
] | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment