{"name":"Papyrus - Skyrim","scopeName":"source.papyrus.skyrim","patterns":[{"name":"meta.emptyline.papyrus","match":"^\\s*$"},{"include":"#commentDocumentation"},{"include":"#commentBlock"},{"include":"#commentLine"},{"include":"#scriptHeader"},{"include":"#import"},{"include":"#state"},{"include":"#endState"},{"include":"#event"},{"include":"#endEvent"},{"include":"#return"},{"include":"#if"},{"include":"#elseif"},{"include":"#else"},{"include":"#endIf"},{"include":"#while"},{"include":"#endWhile"},{"include":"#property"},{"include":"#endProperty"},{"include":"#function"},{"include":"#endFunction"},{"include":"#variable"},{"include":"#assign"},{"include":"#expression"},{"include":"#whitespace"},{"include":"#unmatched"}],"repository":{"addExpression":{"patterns":[{"name":"keyword.operator.papyrus","match":"(\\+|\\-)"},{"include":"#multExpression"}]},"andExpression":{"patterns":[{"name":"keyword.operator.papyrus","match":"\\\u0026\\\u0026"},{"include":"#boolExpression"}]},"arrayAtom":{"patterns":[{"name":"meta.array.papyrus","begin":"\\[","end":"\\]","patterns":[{"include":"#expression"}]},{"include":"#atom"}]},"arrayFuncOrId":{"patterns":[{"include":"#funcOrId"},{"name":"meta.arrayelement.papyrus","begin":"\\[","end":"\\]","patterns":[{"include":"#expression"}]}]},"assign":{"patterns":[{"name":"meta.assign.papyrus","begin":"^\\s*","end":"([\\n\\r])","patterns":[{"include":"#assignmentOperators"},{"include":"#expression"},{"include":"#endOfLine"}]}]},"assignmentOperators":{"patterns":[{"name":"keyword.operator.papyrus","match":"(\\=|\\+\\=|\\-\\=|\\*\\=|\\/\\=|\\%\\=)"}]},"atom":{"patterns":[{"name":"meta.newarray.papyrus","begin":"(?i)\\b(new)\\s+([_a-z][0-9_a-z]*)\\[","end":"\\]","patterns":[{"include":"#integer"}],"beginCaptures":{"1":{"name":"keyword.operator.papyrus"},"2":{"name":"storage.type.papyrus"}}},{"name":"meta.parenthesis.papyrus","begin":"\\(","end":"(\\)|[\\n\\r])","patterns":[{"include":"#expression"}]},{"include":"#funcOrId"}]},"baseTypes":{"patterns":[{"name":"storage.type.papyrus","match":"(?i)\\b(bool|float|int|string)\\b"}]},"bool":{"patterns":[{"name":"constant.language.boolean.papyrus","match":"(?i)\\b(true|false|none)\\b"}]},"boolExpression":{"patterns":[{"name":"keyword.operator.papyrus","match":"(\\=\\=|\\!\\=|\\\u003c\\=|\\\u003e\\=|\\\u003c|\\\u003e)"},{"include":"#addExpression"}]},"brackets":{"patterns":[{"name":"meta.array.papyrus","match":"\\[\\]"}]},"castAtom":{"patterns":[{"name":"meta.cast.papyrus","match":"(?i)\\b(as)\\s+([_a-z][0-9_a-z]*)\\b","captures":{"1":{"name":"keyword.operator.papyrus"},"2":{"name":"storage.type.papyrus"}}},{"include":"#dotAtom"}]},"comma":{"patterns":[{"name":"meta.comma.papyrus","match":"\\,"}]},"commentBlock":{"patterns":[{"name":"comment.block.papyrus","begin":";/","end":"/;"}]},"commentDocumentation":{"patterns":[{"name":"comment.documentation.papyrus","begin":"^\\s*\\{","end":"\\}"}]},"commentLine":{"patterns":[{"name":"comment.line.papyrus","match":";.*$"}]},"comments":{"patterns":[{"include":"#commentBlock"},{"include":"#commentLine"},{"include":"#commentDocumentation"}]},"constants":{"patterns":[{"include":"#bool"},{"include":"#float"},{"include":"#integer"},{"include":"#string"}]},"dotAtom":{"patterns":[{"name":"keyword.operator.papyrus","match":"\\."},{"include":"#constants"},{"include":"#arrayAtom"},{"include":"#arrayFuncOrId"}]},"else":{"patterns":[{"name":"meta.else.papyrus","begin":"(?i)^\\s*(else)\\b","end":"([\\n\\r])","patterns":[{"include":"#endOfLine"}],"beginCaptures":{"1":{"name":"keyword.other.papyrus"}}}]},"elseif":{"patterns":[{"name":"meta.elseif.papyrus","begin":"(?i)^\\s*(elseif)\\b","end":"([\\n\\r])","patterns":[{"include":"#expression"},{"include":"#endOfLine"}],"beginCaptures":{"1":{"name":"keyword.other.papyrus"}}}]},"endEvent":{"patterns":[{"name":"meta.endevent.papyrus","begin":"(?i)^\\s*(endevent)\\b","end":"([\\n\\r])","patterns":[{"include":"#endOfLine"}],"beginCaptures":{"1":{"name":"keyword.other.papyrus"}}}]},"endFunction":{"patterns":[{"name":"meta.endfunction.papyrus","begin":"(?i)^\\s*(endfunction)\\b","end":"([\\n\\r])","patterns":[{"include":"#endOfLine"}],"beginCaptures":{"1":{"name":"keyword.other.papyrus"}}}]},"endIf":{"patterns":[{"name":"meta.endif.papyrus","begin":"(?i)^\\s*(endif)\\b","end":"([\\n\\r])","patterns":[{"include":"#endOfLine"}],"beginCaptures":{"1":{"name":"keyword.other.papyrus"}}}]},"endOfLine":{"patterns":[{"include":"#commentBlock"},{"include":"#commentLine"},{"include":"#whitespace"},{"include":"#multiline"},{"include":"#unmatched"}]},"endProperty":{"patterns":[{"name":"meta.endproperty.papyrus","begin":"(?i)^\\s*(endproperty)\\b","end":"([\\n\\r])","patterns":[{"include":"#endOfLine"}],"beginCaptures":{"1":{"name":"keyword.other.papyrus"}}}]},"endState":{"patterns":[{"name":"meta.endstate.papyrus","begin":"(?i)^\\s*(endstate)\\b","end":"([\\n\\r])","patterns":[{"include":"#endOfLine"}],"beginCaptures":{"1":{"name":"keyword.other.papyrus"}}}]},"endWhile":{"patterns":[{"name":"meta.endwhile.papyrus","begin":"(?i)^\\s*(endwhile)\\b","end":"([\\n\\r])","patterns":[{"include":"#endOfLine"}],"beginCaptures":{"1":{"name":"keyword.other.papyrus"}}}]},"event":{"patterns":[{"name":"meta.event.papyrus","begin":"(?i)^\\s*(event)\\s+","end":"([\\n\\r])","patterns":[{"include":"#eventParameters"},{"include":"#eventFlags"},{"include":"#illegalKeywords"},{"include":"#illegalSpecialVariables"},{"include":"#illegalBaseTypes"},{"include":"#functionIdentifier"},{"include":"#endOfLine"}],"beginCaptures":{"1":{"name":"keyword.control.eventstart.papyrus"},"2":{"name":"entity.name.function.papyrus"}}}]},"eventFlags":{"patterns":[{"name":"keyword.other.papyrus","match":"(?i)(?\u003c=\\))\\s*(native)\\b"}]},"eventParameter":{"patterns":[{"include":"#eventParameterIdentifier"},{"include":"#typeIdentifier"},{"include":"#brackets"}]},"eventParameterIdentifier":{"patterns":[{"name":"variable.parameter.papyrus","match":"(?i)\\b([_a-z][0-9_a-z]*)\\s*(?=(\\,|\\)))"}]},"eventParameters":{"patterns":[{"name":"meta.eventparameters.papyrus","begin":"\\(","end":"\\)","patterns":[{"include":"#illegalKeywords"},{"include":"#illegalSpecialVariables"},{"include":"#eventParameter"},{"include":"#comma"},{"include":"#multiline"},{"include":"#whitespace"},{"include":"#unmatched"}]}]},"expression":{"patterns":[{"name":"keyword.operator.papyrus","match":"\\|\\|"},{"include":"#andExpression"},{"include":"#endOfLine"}]},"float":{"patterns":[{"include":"#unaryMinus"},{"name":"constant.numeric.float.papyrus","match":"\\b(\\d+\\.\\d+)\\b"}]},"funcOrId":{"patterns":[{"name":"keyword.other.papyrus","match":"(?i)\\b(length)\\b"},{"include":"#functionCall"},{"include":"#illegalKeywords"},{"include":"#illegalBaseTypes"},{"include":"#specialVariables"},{"include":"#identifier"}]},"function":{"patterns":[{"name":"meta.function.papyrus","begin":"(?i)^\\s*(?:([_a-z][0-9_a-z]*)(?:\\[\\])?\\s+)?(function)\\s+","end":"([\\n\\r])","patterns":[{"include":"#functionParameters"},{"include":"#functionFlags"},{"include":"#illegalKeywords"},{"include":"#illegalSpecialVariables"},{"include":"#illegalBaseTypes"},{"include":"#functionIdentifier"},{"include":"#endOfLine"}],"beginCaptures":{"1":{"name":"storage.type.papyrus"},"2":{"name":"keyword.control.functionstart.papyrus"},"3":{"name":"entity.name.function.papyrus"}}}]},"functionCall":{"patterns":[{"name":"meta.functioncall.papyrus","begin":"(?i)\\b([_a-z][0-9_a-z]*)\\(","end":"\\)","patterns":[{"include":"#functionCallParameters"}],"beginCaptures":{"1":{"name":"variable.other.papyrus"}}}]},"functionCallParameter":{"patterns":[{"name":"meta.functioncallparameter.papyrus","match":"(?i)\\b(?:([_a-z][0-9_a-z]*)\\s*(\\=)(?!\\=))?","captures":{"1":{"name":"variable.parameter.papyrus"},"2":{"name":"keyword.operator.papyrus"}}},{"include":"#expression"}]},"functionCallParameters":{"patterns":[{"include":"#comma"},{"include":"#functionCallParameter"}]},"functionFlags":{"patterns":[{"name":"keyword.other.papyrus","match":"(?i)\\b(native|global)\\b"}]},"functionIdentifier":{"patterns":[{"name":"entity.name.function.papyrus","match":"(?i)\\b([_a-z][0-9_a-z]*)\\s*(?=\\()"}]},"functionParameter":{"patterns":[{"include":"#functionParameterIdentifier"},{"include":"#typeIdentifier"},{"include":"#brackets"}]},"functionParameterIdentifier":{"patterns":[{"name":"variable.parameter.papyrus","match":"(?i)\\b([_a-z][0-9_a-z]*)\\s*(?=(\\,|\\)|\\=))"}]},"functionParameters":{"patterns":[{"name":"meta.functionparameters.papyrus","begin":"\\(","end":"\\)","patterns":[{"name":"keyword.operator.assignment.papyrus","match":"(\\=)"},{"include":"#constants"},{"include":"#illegalKeywords"},{"include":"#illegalSpecialVariables"},{"include":"#functionParameter"},{"include":"#comma"},{"include":"#multiline"},{"include":"#whitespace"},{"include":"#unmatched"}]}]},"identifier":{"patterns":[{"name":"variable.other.papyrus","match":"(?i)\\b([_a-z][0-9_a-z]*)\\b"}]},"if":{"patterns":[{"name":"meta.if.papyrus","begin":"(?i)^\\s*(if)\\b","end":"([\\n\\r])","patterns":[{"include":"#expression"},{"include":"#endOfLine"}],"beginCaptures":{"1":{"name":"keyword.other.papyrus"}}}]},"illegalBaseTypes":{"patterns":[{"name":"meta.invalid.papyrus","match":"(?i)\\b(bool|float|int|string)\\b"}]},"illegalKeywords":{"patterns":[{"name":"meta.invalid.papyrus","match":"(?i)\\b(as|auto|autoreadonly|else|elseif|endevent|endfunction|endif|endproperty|endstate|endwhile|event|extends|false|function|global|if|import|length|native|new|none|property|return|scriptname|state|true|while)\\b"}]},"illegalSpecialVariables":{"patterns":[{"name":"meta.invalid.papyrus","match":"(?i)\\b(parent|self)\\b"}]},"import":{"patterns":[{"name":"meta.import.papyrus","begin":"(?i)^\\s*(import)\\s+","end":"([\\n\\r])","patterns":[{"include":"#illegalKeywords"},{"include":"#illegalSpecialVariables"},{"include":"#illegalBaseTypes"},{"include":"#typeIdentifier"},{"include":"#endOfLine"}],"beginCaptures":{"1":{"name":"keyword.other.papyrus"}}}]},"integer":{"patterns":[{"include":"#unaryMinus"},{"name":"constant.numeric.integer.papyrus","match":"(?i)\\b(0x[0-9a-f]+|\\d+)\\b"}]},"keywords":{"patterns":[{"name":"keyword.other.papyrus","match":"(?i)\\b(as|auto|autoreadonly|else|elseif|endevent|endfunction|endif|endproperty|endstate|endwhile|event|extends|false|function|global|if|import|length|native|new|none|property|return|scriptname|state|true|while)\\b"}]},"multExpression":{"patterns":[{"name":"keyword.operator.papyrus","match":"(\\*|/|\\%)"},{"include":"#unaryExpression"}]},"multiline":{"patterns":[{"name":"meta.multiline.papyrus","begin":"\\\\","end":"([\\n\\r])","patterns":[{"include":"#commentBlock"},{"include":"#commentLine"},{"include":"#whitespace"},{"include":"#unmatched"}],"beginCaptures":{"0":{"name":"keyword.operator.papyrus"}}}]},"parameterIdentifier":{"patterns":[{"name":"variable.parameter.papyrus","match":"(?i)\\b([_a-z][0-9_a-z]*)\\b"}]},"property":{"patterns":[{"name":"meta.property.papyrus","begin":"(?i)^\\s*([_a-z][0-9_a-z]*)(?:\\[\\])?\\s+(property)\\s+","end":"([\\n\\r])","patterns":[{"name":"keyword.operator.assignment.papyrus","match":"(\\=)"},{"include":"#constants"},{"include":"#propertyFlags"},{"include":"#illegalKeywords"},{"include":"#illegalSpecialVariables"},{"include":"#illegalBaseTypes"},{"include":"#identifier"},{"include":"#endOfLine"}],"beginCaptures":{"1":{"name":"storage.type.papyrus"},"2":{"name":"keyword.other.papyrus"}}}]},"propertyFlags":{"patterns":[{"name":"keyword.other.papyrus","match":"(?i)\\b(auto|autoreadonly|conditional|hidden)\\b"}]},"return":{"patterns":[{"name":"meta.return.papyrus","begin":"(?i)^\\s*(return)\\b","end":"([\\n\\r])","patterns":[{"include":"#expression"},{"include":"#endOfLine"}],"beginCaptures":{"1":{"name":"keyword.other.papyrus"}}}]},"scriptHeader":{"patterns":[{"name":"meta.scriptheader.papyrus","begin":"(?i)^\\s*(scriptname)\\s+","end":"([\\n\\r])","patterns":[{"name":"keyword.other.papyrus","match":"(?i)\\b(extends)\\b"},{"name":"keyword.other.papyrus","match":"(?i)\\b(hidden|conditional)\\b"},{"include":"#illegalKeywords"},{"include":"#illegalSpecialVariables"},{"include":"#illegalBaseTypes"},{"include":"#typeIdentifier"},{"include":"#endOfLine"}],"beginCaptures":{"1":{"name":"keyword.other.papyrus"}}}]},"specialVariables":{"patterns":[{"name":"keyword.other.papyrus","match":"(?i)\\b(parent|self)\\b"}]},"state":{"patterns":[{"name":"meta.state.papyrus","begin":"(?i)^\\s*(?:(auto)\\s+)?(state)\\s+","end":"([\\n\\r])","patterns":[{"include":"#illegalKeywords"},{"include":"#illegalSpecialVariables"},{"include":"#illegalBaseTypes"},{"include":"#identifier"},{"include":"#endOfLine"}],"beginCaptures":{"1":{"name":"keyword.other.papyrus"},"2":{"name":"keyword.other.papyrus"}}}]},"string":{"patterns":[{"name":"string.quoted.double","begin":"\\\"","end":"\\\"","patterns":[{"name":"constant.character.escape.papyrus","match":"(\\\\.)"}]}]},"typeIdentifier":{"patterns":[{"name":"storage.type.papyrus","match":"(?i)\\b([_a-z][0-9_a-z]*)\\b"}]},"unaryExpression":{"patterns":[{"name":"keyword.operator.papyrus","match":"(\\-|\\!)"},{"include":"#castAtom"}]},"unaryMinus":{"patterns":[{"name":"keyword.operator.papyrus","match":"\\-(?=\\d)"}]},"unmatched":{"patterns":[{"name":"meta.invalid.papyrus","match":"([^\\n\\r])"}]},"variable":{"patterns":[{"name":"meta.variable.papyrus","begin":"(?i)^\\s*([_a-z][0-9_a-z]*)(?:\\[\\])?\\s+([_a-z][0-9_a-z]*)(?:\\s*(\\=)\\s*)","end":"([\\n\\r])","patterns":[{"include":"#constants"},{"name":"keyword.other.papyrus","match":"(?i)(?:\\b(conditional)\\b)"},{"include":"#expression"},{"include":"#endOfLine"}],"beginCaptures":{"1":{"name":"storage.type.papyrus"},"2":{"name":"variable.other.papyrus"},"3":{"name":"keyword.operator.papyrus"}}},{"name":"meta.variable.papyrus","begin":"(?i)^\\s*([_a-z][0-9_a-z]*)(?:\\[\\])?\\s+([_a-z][0-9_a-z]*)(?:\\s+(conditional)\\b)?","end":"([\\n\\r])","patterns":[{"include":"#endOfLine"}],"beginCaptures":{"1":{"name":"storage.type.papyrus"},"2":{"name":"variable.other.papyrus"},"3":{"name":"keyword.other.papyrus"}}}]},"while":{"patterns":[{"name":"meta.while.papyrus","begin":"(?i)^\\s*(while)\\b","end":"([\\n\\r])","patterns":[{"include":"#expression"},{"include":"#endOfLine"}],"beginCaptures":{"1":{"name":"keyword.other.papyrus"}}}]},"whitespace":{"patterns":[{"name":"meta.whitespace.papyrus","match":"([ \\t])"}]}}}