├── .gitignore ├── icon.png ├── preview1.png ├── preview2.png ├── .vscode └── launch.json ├── language-configuration.json ├── grammars ├── ogre-fontdef.json ├── ogre-overlay.json ├── ogre-particle.json ├── ogre-compositor.json ├── ogre-material.json └── ogre-common.json ├── LICENSE.md ├── snippets.json ├── README.md ├── package.json └── src └── extension.js /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | npm-debug.log 3 | node_modules 4 | -------------------------------------------------------------------------------- /icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGRECave/language-ogre-script/HEAD/icon.png -------------------------------------------------------------------------------- /preview1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGRECave/language-ogre-script/HEAD/preview1.png -------------------------------------------------------------------------------- /preview2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OGRECave/language-ogre-script/HEAD/preview2.png -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | // A launch configuration that launches the extension inside a new window 2 | { 3 | "version": "0.1.0", 4 | "configurations": [ 5 | { 6 | "name": "Launch Extension", 7 | "type": "extensionHost", 8 | "request": "launch", 9 | "runtimeExecutable": "${execPath}", 10 | "args": ["--extensionDevelopmentPath=${workspaceRoot}" ] 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /language-configuration.json: -------------------------------------------------------------------------------- 1 | { 2 | "comments": { 3 | "lineComment": "//", 4 | "blockComment": [ "/*", "*/" ] 5 | }, 6 | "brackets": [ 7 | ["{", "}"] 8 | ], 9 | "surroundingPairs": [ 10 | ["\"", "\""], 11 | ], 12 | "autoClosingPairs": [ 13 | ["{", "}"], 14 | { "open": "\"", "close": "\"", "notIn": ["string", "comment"] }, 15 | { "open": "/**", "close": " */", "notIn": ["string"] } 16 | ], 17 | } -------------------------------------------------------------------------------- /grammars/ogre-fontdef.json: -------------------------------------------------------------------------------- 1 | { 2 | "fileTypes": [ 3 | "fontdef" 4 | ], 5 | "name": "Ogre Font Definition Script", 6 | "scopeName": "source.ogre.fontdef", 7 | "patterns": [ 8 | { 9 | "match": "\\b(type|size|resolution|glyph|code_points)\\b", 10 | "name": "entity.name.function", 11 | "comment": "font attributes" 12 | }, 13 | { 14 | "match": "\\b(font)\\b", 15 | "name": "entity.name.tag" 16 | }, 17 | { 18 | "include": "source.ogre.script" 19 | } 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 Pavel Rojtberg 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /snippets.json: -------------------------------------------------------------------------------- 1 | { 2 | "Declare material": { 3 | "prefix": "material", 4 | "body": [ 5 | "material ${1:Name}\n{", 6 | "\ttechnique\n\t{", 7 | "\t\tpass\n\t\t{", 8 | "\t\t\t$2", 9 | "\t\t}", 10 | "\t}", 11 | "}" 12 | ] 13 | }, 14 | "Declare GPU Program": { 15 | "prefix": "program", 16 | "body": [ 17 | "${1|vertex_program,fragment_program,geometry_program,compute_program,tessellation_hull_program,tessellation_domain_program|} ${2:Name} ${3|glsl,hlsl,glsles,spirv,unified,metal|}\n{", 18 | "\tsource $4", 19 | "}" 20 | ] 21 | }, 22 | "Declare compositor": { 23 | "prefix": "compositor", 24 | "body": [ 25 | "compositor ${1:Name}\n{", 26 | "\ttechnique\n\t{", 27 | "\t\ttexture ${2:TargetName} target_width target_height PF_BYTE_RGBA", 28 | "\t\ttarget $2\n\t\t{", 29 | "\t\t\tinput previous", 30 | "\t\t}", 31 | "\t\ttarget_output\n\t\t{", 32 | "\t\t\t$3", 33 | "\t\t}", 34 | "\t}", 35 | "}" 36 | ] 37 | } 38 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Ogre Scripts support 2 | 3 | 4 | 5 | Syntax highlighting for [Ogre Scripts](https://ogrecave.github.io/ogre/api/latest/_scripts.html) in Atom and VSCode. 6 | 7 | Based on the [Sublime Plugin](https://github.com/TheSHEEEP/ST-OgreScripts). Extended for particle scripts. 8 | 9 | Supports symbol outline and colour picking for .material files on VSCode. 10 | 11 | **Ogre1 Materials** 12 | ![](https://raw.githubusercontent.com/paroj/language-ogre-script/master/preview1.png) 13 | 14 | **Ogre2 Materials** 15 | ![](https://raw.githubusercontent.com/paroj/language-ogre-script/master/preview2.png) 16 | 17 | ## Structure 18 | * ogre-common: grammar present in all ogre script files 19 | * ogre-material: material specific grammar 20 | * ogre-particle: particle specific grammar 21 | * ogre-compositor: compositor specific grammar 22 | * ogre-overlay: overlay specific grammar 23 | * ogre-fontdef: fontdef specific grammar 24 | 25 | ## TODO 26 | * refactor the plugin to work on tokens. Currently it tries to verify property values, which causes code duplication and does not cope with variables (`$foo`) 27 | * split more of ogre-common into script specific files to reduce false positives 28 | -------------------------------------------------------------------------------- /grammars/ogre-overlay.json: -------------------------------------------------------------------------------- 1 | { 2 | "fileTypes": [ 3 | "overlay" 4 | ], 5 | "name": "Ogre Overlay Script", 6 | "scopeName": "source.ogre.overlay", 7 | "patterns": [ 8 | { 9 | "begin": "\\b((template )?(element|container|overlay_element|overlay))\\b", 10 | "beginCaptures": { 11 | "1": { 12 | "name": "entity.name.tag" 13 | } 14 | }, 15 | "comment": "Top Level Tag Names", 16 | "end": "($|//|{)", 17 | "patterns": [ 18 | { 19 | "match": "\\b(Panel|BorderPanel|TextArea)\\b", 20 | "name": "storage.type" 21 | } 22 | ] 23 | }, 24 | { 25 | "match": "\\b(zorder|font_name|alignment|char_height|space_width|colour(_top|_bottom)?|width|height|metrics_mode|uv_coords|horz_align|vert_align|top|left|transparent|border_(material|size|top_uv|topright_uv|topleft_uv|left_uv|right_uv|bottomleft_uv|bottom_uv|bottomright_uv)|connect_output|execution_mask|overlays|rq_(first|last)|viewport_modifier_mask|num_splits|pssm_lambda)\\b", 26 | "name": "entity.name.function", 27 | "comment": "general properties" 28 | }, 29 | { 30 | "match": "\\b(pixels|center|right|left|bottom|top)\\b", 31 | "name": "constant.language" 32 | }, 33 | { 34 | "begin": "\\b(caption)\\b", 35 | "beginCaptures": { 36 | "1": { 37 | "name": "entity.name.function" 38 | } 39 | }, 40 | "end": "($|//)", 41 | "patterns": [ 42 | { 43 | "match": ".*", 44 | "name": "string" 45 | } 46 | ] 47 | }, 48 | { 49 | "include": "source.ogre.script" 50 | } 51 | ] 52 | } 53 | -------------------------------------------------------------------------------- /grammars/ogre-particle.json: -------------------------------------------------------------------------------- 1 | { 2 | "fileTypes": [ 3 | "particle" 4 | ], 5 | "name": "Ogre Particle Script", 6 | "scopeName": "source.ogre.particle", 7 | "patterns": [ 8 | { 9 | "begin": "\\b(particle_system|emitter|affector|target_output|pass|clear|texture_unit|vertex_program|fragment_program|vertex_program_ref|fragment_program_ref|default_params|shared_params)\\b", 10 | "beginCaptures": { 11 | "1": { 12 | "name": "entity.name.tag" 13 | } 14 | }, 15 | "comment": "Top Level Tag Names", 16 | "end": "($|//|{)", 17 | "patterns": [ 18 | { 19 | "match": "\\b(Point|Box|Rotator|Scaler|ColourInterpolator|ColourImage|ColourFader2?|LinearForce|DeflectorPlane|DirectionRandomiser)\\b", 20 | "name": "storage.type" 21 | } 22 | ] 23 | }, 24 | { 25 | "match": "\\b((emit_emitter_)?quota|particle_(width|height)|sorted|cull_each|billboard_(origin|rotation_type)|renderer|local_space|point_rendering|common_(direction|up_vector))\\b", 26 | "name": "entity.name.function", 27 | "comment": "particle system attributes" 28 | }, 29 | { 30 | "begin": "\\b(billboard_type)\\b", 31 | "beginCaptures": { 32 | "1": { 33 | "name": "entity.name.function" 34 | } 35 | }, 36 | "end": "($|//)", 37 | "patterns": [ 38 | { 39 | "match": "\\b(point|(oriented|perpendicular)_(self|common))\\b", 40 | "name": "constant.language" 41 | } 42 | ] 43 | }, 44 | { 45 | "match": "\\b(colour|rate|emission_rate|angle|position|direction|emit_emitter|name)\\b", 46 | "name": "entity.name.function", 47 | "comment": "general properties" 48 | }, 49 | { 50 | "match": "\\b(force_(application|vector)|state_change|randomness|bounce|plane_(normal|point)|image)\\b", 51 | "name": "entity.name.function", 52 | "comment": "affector properties" 53 | }, 54 | { 55 | "match": "\\b((red|green|blue|alpha)(1|2)?|width|height|depth)\\b", 56 | "name": "entity.name.function", 57 | "comment": "Dimensions" 58 | }, 59 | { 60 | "match": "\\b((time_to_live|duration|velocity|repeat_delay)(_min|_max)?)\\b", 61 | "name": "entity.name.function", 62 | "comment": "min/ max properties" 63 | }, 64 | { 65 | "match": "\\b((rotation_range|rotation_speed_range|colour_range)(_start|_end))\\b", 66 | "name": "entity.name.function", 67 | "comment": "range properties" 68 | }, 69 | { 70 | "include": "source.ogre.script" 71 | } 72 | ] 73 | } 74 | -------------------------------------------------------------------------------- /grammars/ogre-compositor.json: -------------------------------------------------------------------------------- 1 | { 2 | "fileTypes": [ 3 | "compositor" 4 | ], 5 | "name": "Ogre Compositor Script", 6 | "scopeName": "source.ogre.compositor", 7 | "patterns": [ 8 | { 9 | "begin": "\\b(compositor_node(_shadow)?|workspace|compositor|technique|target|target_output|pass|clear|texture_unit|default_params|shared_params)\\b", 10 | "beginCaptures": { 11 | "1": { 12 | "name": "entity.name.tag" 13 | } 14 | }, 15 | "comment": "Top Level Tag Names", 16 | "end": "($|//|{)", 17 | "patterns": [ 18 | { 19 | "match": "\\b(render_scene|render_quad|clear|stencil|render_custom|compute)\\b", 20 | "name": "storage.type" 21 | } 22 | ] 23 | }, 24 | { 25 | "match": "\\b(in|connect_output|execution_mask|overlays|rq_(first|last)|viewport_modifier_mask|num_splits|pssm_lambda)\\b", 26 | "name": "entity.name.function", 27 | "comment": "v2.1 general properties" 28 | }, 29 | { 30 | "comment": "Texture Creation", 31 | "begin": "\\b(texture|shadow_map)\\b", 32 | "beginCaptures": { 33 | "1": { 34 | "name": "entity.name.function" 35 | } 36 | }, 37 | "end": "($|//)", 38 | "patterns": [ 39 | { 40 | "match": "\\b(pooled|target_(width|height)(_scaled)?|cubic|2d_array|gamma|(no_)?fsaa|depth_pool|light|split|(local|chain|global)_scope)\\b", 41 | "name": "constant.language" 42 | }, 43 | { 44 | "include": "source.ogre.script#pixelformat" 45 | }, 46 | { 47 | "include": "source.ogre.script#numeric" 48 | } 49 | ] 50 | }, 51 | { 52 | "comment": "compute dimensions", 53 | "match": "\\bthread_groups\\b", 54 | "name": "entity.name.function" 55 | }, 56 | { 57 | "begin": "\\b(camera)\\b", 58 | "beginCaptures": { 59 | "1": { 60 | "name": "entity.name.function" 61 | } 62 | }, 63 | "end": "($|//)", 64 | "patterns": [ 65 | { 66 | "match": "\\balign_to_face\\b", 67 | "name": "constant.language" 68 | } 69 | ] 70 | }, 71 | { 72 | "begin": "\\b(colour_value)\\b", 73 | "beginCaptures": { 74 | "1": { 75 | "name": "entity.name.function" 76 | } 77 | }, 78 | "end": "($|//)", 79 | "patterns": [ 80 | { 81 | "match": "\\bauto\\b", 82 | "name": "constant.language" 83 | }, 84 | { 85 | "include": "source.ogre.script#numeric" 86 | } 87 | ] 88 | }, 89 | { 90 | "begin": "\\b(input)\\b", 91 | "beginCaptures": { 92 | "1": { 93 | "name": "entity.name.function" 94 | } 95 | }, 96 | "comment": "Input Directive", 97 | "end": "($|//)", 98 | "patterns": [ 99 | { 100 | "match": "\\b(none|previous)\\b", 101 | "name": "constant.language" 102 | }, 103 | { 104 | "include": "source.ogre.script#numeric" 105 | } 106 | ] 107 | }, 108 | { 109 | "begin": "\\b(fail_op|depth_fail_op|pass_op)\\b", 110 | "beginCaptures": { 111 | "1": { 112 | "name": "entity.name.function" 113 | } 114 | }, 115 | "comment": "Operations for stencil pass", 116 | "end": "($|//)", 117 | "patterns": [ 118 | { 119 | "match": "\\b(keep|zero|replace|increment|decrement|increment_wrap|decrement_wrap|invert)\\b", 120 | "name": "constant.language" 121 | } 122 | ] 123 | }, 124 | { 125 | "include": "source.ogre.script" 126 | } 127 | ] 128 | } 129 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "language-ogre-script", 3 | "displayName": "Syntax highlighting for Ogre Scripts", 4 | "icon": "icon.png", 5 | "version": "0.9.8", 6 | "publisher": "paroj", 7 | "description": "supports Material, Compositor, Overlay and Particle scripts", 8 | "repository": "https://github.com/OGRECave/language-ogre-script", 9 | "license": "MIT", 10 | "main": "./src/extension", 11 | "activationEvents": [ 12 | "onLanguage:ogre-material-script" 13 | ], 14 | "engines": { 15 | "atom": ">=0.174.0 <2.0.0", 16 | "vscode": "^1.5.0" 17 | }, 18 | "sponsor": { 19 | "url": "https://www.patreon.com/ogre1" 20 | }, 21 | "dependencies": {}, 22 | "contributes": { 23 | "languages": [ 24 | { 25 | "id": "ogre-script", 26 | "aliases": [ 27 | "Ogre Script", 28 | "Ogre" 29 | ], 30 | "extensions": [ 31 | ".os" 32 | ], 33 | "configuration": "./language-configuration.json" 34 | }, 35 | { 36 | "id": "ogre-material-script", 37 | "aliases": [ 38 | "Ogre Material Script", 39 | "Ogre" 40 | ], 41 | "extensions": [ 42 | ".material", 43 | ".program" 44 | ], 45 | "configuration": "./language-configuration.json" 46 | }, 47 | { 48 | "id": "ogre-compositor-script", 49 | "aliases": [ 50 | "Ogre Compositor Script", 51 | "Ogre" 52 | ], 53 | "extensions": [ 54 | ".compositor" 55 | ], 56 | "configuration": "./language-configuration.json" 57 | }, 58 | { 59 | "id": "ogre-overlay-script", 60 | "aliases": [ 61 | "Ogre Overlay Script", 62 | "Ogre" 63 | ], 64 | "extensions": [ 65 | ".overlay" 66 | ], 67 | "configuration": "./language-configuration.json" 68 | }, 69 | { 70 | "id": "ogre-particle-script", 71 | "aliases": [ 72 | "Ogre Particle Script", 73 | "Ogre" 74 | ], 75 | "extensions": [ 76 | ".particle" 77 | ], 78 | "configuration": "./language-configuration.json" 79 | }, 80 | { 81 | "id": "ogre-fontdef-script", 82 | "aliases": [ 83 | "Ogre Definition Script", 84 | "Ogre" 85 | ], 86 | "extensions": [ 87 | ".fontdef" 88 | ], 89 | "configuration": "./language-configuration.json" 90 | } 91 | ], 92 | "grammars": [ 93 | { 94 | "language": "ogre-script", 95 | "scopeName": "source.ogre.script", 96 | "path": "./grammars/ogre-common.json" 97 | }, 98 | { 99 | "language": "ogre-material-script", 100 | "scopeName": "source.ogre.material", 101 | "path": "./grammars/ogre-material.json" 102 | }, 103 | { 104 | "language": "ogre-compositor-script", 105 | "scopeName": "source.ogre.compositor", 106 | "path": "./grammars/ogre-compositor.json" 107 | }, 108 | { 109 | "language": "ogre-overlay-script", 110 | "scopeName": "source.ogre.overlay", 111 | "path": "./grammars/ogre-overlay.json" 112 | }, 113 | { 114 | "language": "ogre-particle-script", 115 | "scopeName": "source.ogre.particle", 116 | "path": "./grammars/ogre-particle.json" 117 | }, 118 | { 119 | "language": "ogre-fontdef-script", 120 | "scopeName": "source.ogre.fontdef", 121 | "path": "./grammars/ogre-fontdef.json" 122 | } 123 | ], 124 | "snippets": [ 125 | { 126 | "language": "ogre-material-script", 127 | "path": "./snippets.json" 128 | }, 129 | { 130 | "language": "ogre-compositor-script", 131 | "path": "./snippets.json" 132 | } 133 | ] 134 | } 135 | } 136 | -------------------------------------------------------------------------------- /src/extension.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | var vscode = require('vscode') 4 | 5 | const documentSelector = ["ogre-material-script", "ogre-compositor-script"] 6 | 7 | class SymbolProvider { 8 | provideDocumentSymbols(document, token) { 9 | var ret = new Array() 10 | var re = /\b(material|(?:geometry|vertex|fragment|compute|tessellation_hull|tessellation_domain|mesh|task)_program)\b\s+(".*"|\S+)/ 11 | var classid = "material" 12 | 13 | if(document.languageId == "ogre-compositor-script") 14 | { 15 | re = /\b(compositor)\b\s+(".*"|\S+)/ 16 | classid = "compositor" 17 | } 18 | 19 | for (var i = 0; i < document.lineCount; i++) { 20 | var line = document.lineAt(i) 21 | var end = line.text.indexOf("//") 22 | var match = line.text.substring(0, end == -1 ? line.text.length : end).match(re) 23 | if (match) { 24 | ret.push(new vscode.DocumentSymbol( 25 | match[2], 26 | match[1], 27 | match[1] == classid ? vscode.SymbolKind.Class : vscode.SymbolKind.Object, 28 | line.range, 29 | line.range 30 | )) 31 | } 32 | } 33 | return ret 34 | } 35 | } 36 | 37 | class ColorProvider { 38 | provideDocumentColors(document, token) { 39 | var ret = new Array() 40 | var re = /\b(ambient|diffuse|emissive|tex_border_colour|colour_value)\s+\b(.+)/ 41 | 42 | for (var i = 0; i < document.lineCount; i++) { 43 | var line = document.lineAt(i) 44 | var end = line.text.indexOf("//") 45 | var match = line.text.substring(0, end == -1 ? line.text.length : end).match(re) 46 | if (match) { 47 | var v = match[2].split(" ", 4).map(x => +x) 48 | if (v.length < 3) continue // e.g. vertexcolour 49 | if (v.length < 4) v.push(1) 50 | 51 | var range = new vscode.Range(i, match.index + match[1].length + 1, i, line.text.length) 52 | 53 | ret.push({ 54 | color: new vscode.Color(...v), 55 | range: range 56 | }) 57 | } 58 | } 59 | return ret 60 | } 61 | 62 | provideColorPresentations(c, context, token) { 63 | var vals = [c.red, c.green, c.blue, c.alpha].map(x => x.toFixed(2)) 64 | return [new vscode.ColorPresentation(vals.join(" "))] 65 | } 66 | } 67 | 68 | const deprecations = { 69 | "lod_distances": "lod_values", 70 | "cubic_texture": "texture cubic", 71 | "separateUV": "hardware cubic textures", 72 | "attach": "#include ", 73 | "set_texture_alias": "set $variable value", 74 | " texture_alias": "texture $variable", 75 | "shadow_receiver_vertex_program_ref": "shadow_receiver_material", 76 | "shadow_receiver_fragment_program_ref": "shadow_receiver_material", 77 | "shadow_caster_vertex_program_ref": "shadow_caster_material", 78 | "shadow_caster_fragment_program_ref": "shadow_caster_material", 79 | " Distance": "distance_box", 80 | " PixelCount": "pixel_count", 81 | "compare_func": "comp_func", 82 | "bool": "uint", 83 | "normalise_normals": "shaders" 84 | } 85 | 86 | function validate(editor, diagnostics) { 87 | if (!editor || !documentSelector.includes(editor.document.languageId)) { 88 | return 89 | } 90 | var result = new Array() 91 | for (var i = 0; i < editor.document.lineCount; i++) { 92 | var line = editor.document.lineAt(i) 93 | var end = line.text.indexOf("//") 94 | line = line.text.substring(0, end == -1 ? line.text.length : end) 95 | 96 | for (var [sym, rep] of Object.entries(deprecations)) { 97 | var pos = 0 98 | while ((pos = line.indexOf(sym, pos)) >= 0) { 99 | var len = sym.length 100 | var diag = new vscode.Diagnostic(new vscode.Range(i, pos, i, pos + len), `"${sym}" is deprecated, use "${rep}" instead.`) 101 | diag.severity = vscode.DiagnosticSeverity.Warning 102 | diag.tags = [vscode.DiagnosticTag.Deprecated] 103 | result.push(diag) 104 | pos += len 105 | } 106 | } 107 | } 108 | diagnostics.set(editor.document.uri, result) 109 | } 110 | 111 | function activate(ctx) { 112 | ctx.subscriptions.push( 113 | vscode.languages.registerDocumentSymbolProvider( 114 | documentSelector, new SymbolProvider())) 115 | ctx.subscriptions.push( 116 | vscode.languages.registerColorProvider( 117 | documentSelector, new ColorProvider())) 118 | 119 | var diagnostics = vscode.languages.createDiagnosticCollection('Deprecations') 120 | if (vscode.window.activeTextEditor) { 121 | validate(vscode.window.activeTextEditor, diagnostics) 122 | } 123 | ctx.subscriptions.push(vscode.window.onDidChangeActiveTextEditor(editor => { 124 | validate(editor, diagnostics) 125 | })) 126 | } 127 | 128 | Object.defineProperty(exports, "__esModule", { value: true }) 129 | exports.activate = activate -------------------------------------------------------------------------------- /grammars/ogre-material.json: -------------------------------------------------------------------------------- 1 | { 2 | "fileTypes": [ 3 | "material", 4 | "program" 5 | ], 6 | "name": "Ogre Material Script", 7 | "scopeName": "source.ogre.material", 8 | "patterns": [ 9 | { 10 | "comment": "Top Level Tag Names", 11 | "begin": "\\b(hlms|material|technique|pass|clear|texture_(unit|source)|sampler|rtshader_system|(geometry|vertex|fragment|compute|tessellation_hull|tessellation_domain|mesh|task)_program(_ref)?|default_params|shared_params|shadow_(caster|receiver)_(vertex|fragment)_program_ref)\\b", 12 | "beginCaptures": { 13 | "1": { 14 | "name": "entity.name.tag" 15 | } 16 | }, 17 | "end": "($|//|{)", 18 | "patterns": [ 19 | { 20 | "match": "\\b(pbs|hlsl|glsl|glsles|cg|unified|spirv|glslang)\\b", 21 | "name": "storage.type" 22 | } 23 | ] 24 | }, 25 | { 26 | "comment": "Keywords followed by strings", 27 | "begin": "\\b(source|entry_point|scheme)\\b", 28 | "beginCaptures": { 29 | "1": { 30 | "name": "entity.name.function" 31 | } 32 | }, 33 | "end": "($|//)", 34 | "patterns": [ 35 | { 36 | "match": ".*", 37 | "name": "string" 38 | } 39 | ] 40 | }, 41 | { 42 | "comment": "Texture declaration", 43 | "begin": "\\b(texture)\\b", 44 | "beginCaptures": { 45 | "1": { 46 | "name": "entity.name.function" 47 | } 48 | }, 49 | "end": "($|//)", 50 | "patterns": [ 51 | { 52 | "match": "\\b(gamma|1d|2d|3d|cubic|2d_array|alpha|unlimited)\\b", 53 | "name": "constant.language" 54 | }, 55 | { 56 | "include": "source.ogre.script#pixelformat" 57 | }, 58 | { 59 | "include": "source.ogre.script#variable" 60 | }, 61 | { 62 | "match": "\\S+", 63 | "name": "string" 64 | } 65 | ] 66 | }, 67 | { 68 | "match": "\\b(syntax|profiles|target)\\b", 69 | "name": "entity.name.function", 70 | "comment": "Program syntaxes. Could also detect the specific tokens here" 71 | }, 72 | { 73 | "match": "\\b(compute_group_dimensions)\\b", 74 | "name": "entity.name.function", 75 | "comment": "general properties" 76 | }, 77 | { 78 | "comment": "v2.1: Detail Blend Mode", 79 | "begin": "\\b(detail_blend_mode\\d)\\b", 80 | "beginCaptures": { 81 | "1": { 82 | "name": "entity.name.function" 83 | } 84 | }, 85 | "end": "($|//)", 86 | "patterns": [ 87 | { 88 | "match": "\\b(Overlay|Add|Multiply2x)\\b", 89 | "name": "constant.language" 90 | } 91 | ] 92 | }, 93 | { 94 | "comment": "other properties", 95 | "match": "\\b(detail_offset_scale\\d|lod_index|point_size|line_width|depth_bias|iteration_depth_bias|roughness|fresnel|first_render_queue|last_render_queue|visibility_mask|anim_texture|point_size_min|point_size_max|lod_bias|identifier|start_light|max_lights|colour_value|depth_value|stencil_value|ref_value|mask|tex_coord_set|tex_border_colour|max_anisotropy|mipmap_bias|scroll|scroll_anim|rotate|rotate_anim|scale|transform|preprocessor_defines|includes_pose_animation)\\b", 96 | "name": "entity.name.function" 97 | }, 98 | { 99 | "begin": "\\b(ambient|diffuse|specular|emissive)\\b", 100 | "beginCaptures": { 101 | "1": { 102 | "name": "entity.name.function" 103 | } 104 | }, 105 | "comment": "colour/ vertexcolour properties", 106 | "end": "($|//)", 107 | "patterns": [ 108 | { 109 | "match": "\\b(vertexcolour)\\b", 110 | "name": "constant.language" 111 | }, 112 | { 113 | "include": "source.ogre.script#numeric" 114 | } 115 | ] 116 | }, 117 | { 118 | "comment": "rtshader properties", 119 | "begin": "\\b(transform_stage|lighting_stage|light_count|triplanarTexturing|integrated_pssm4|layered_blend|source_modifier|hardware_skinning)\\b", 120 | "beginCaptures": { 121 | "1": { 122 | "name": "entity.name.function" 123 | } 124 | }, 125 | "end": "($|//)", 126 | "patterns": [ 127 | { 128 | "match": "\\b(instanced|linear|dual_quaternion|ffp|per_(pixel|vertex))\\b", 129 | "name": "constant.language" 130 | }, 131 | { 132 | "include": "source.ogre.script#boolean" 133 | }, 134 | { 135 | "include": "source.ogre.script#numeric" 136 | } 137 | ] 138 | }, 139 | { 140 | "comment": "v2.1 properties", 141 | "match": "\\b((detail|roughness|specular|normal|diffuse|detail_weight)_map|detail(_normal|_weight)?_map\\d)\\b", 142 | "name": "entity.name.function" 143 | }, 144 | { 145 | "include": "source.ogre.script" 146 | } 147 | ] 148 | } 149 | -------------------------------------------------------------------------------- /grammars/ogre-common.json: -------------------------------------------------------------------------------- 1 | { 2 | "scopeName": "source.ogre.script", 3 | "patterns": [ 4 | { 5 | "begin": "\\b(import)\\b", 6 | "beginCaptures": { 7 | "1": { 8 | "name": "keyword.control.import" 9 | } 10 | }, 11 | "comment": "Import statement", 12 | "patterns": [ 13 | { 14 | "match": "\\b(from)\\b", 15 | "name": "constant.language" 16 | } 17 | ], 18 | "end": "($|//)" 19 | }, 20 | { 21 | "match": "\\b(abstract)\\b", 22 | "name": "entity.name.tag" 23 | }, 24 | { 25 | "match": "\\b(set)\\b", 26 | "name": "entity.name.function" 27 | }, 28 | { 29 | "begin": "\\b(texture_ref)\\b", 30 | "beginCaptures": { 31 | "1": { 32 | "name": "entity.name.function" 33 | } 34 | }, 35 | "comment": "Texture Reference", 36 | "end": "($|//)" 37 | }, 38 | { 39 | "begin": "\\b((?:set_)?texture_alias)\\b\\s*(\\S+)\\b", 40 | "beginCaptures": { 41 | "1": { 42 | "name": "entity.name.function" 43 | }, 44 | "2": { 45 | "name": "variable.other" 46 | } 47 | }, 48 | "comment": "Texture Alias for materials", 49 | "end": "($|//)" 50 | }, 51 | { 52 | "begin": "\\b(buffers)\\b", 53 | "beginCaptures": { 54 | "1": { 55 | "name": "entity.name.function" 56 | } 57 | }, 58 | "comment": "Buffers Directive for clear pass", 59 | "end": "($|//)", 60 | "patterns": [ 61 | { 62 | "match": "\\b(colour|depth|stencil)\\b", 63 | "name": "constant.language" 64 | } 65 | ] 66 | }, 67 | { 68 | "begin": "\\b(lod_strategy)\\b", 69 | "beginCaptures": { 70 | "1": { 71 | "name": "entity.name.function" 72 | } 73 | }, 74 | "comment": "Lod strategy in materials", 75 | "end": "($|//)", 76 | "patterns": [ 77 | { 78 | "match": "\\b(distance_(box|sphere)|(screen_ratio_)?pixel_count)\\b", 79 | "name": "constant.language" 80 | }, 81 | { 82 | "include": "#numeric" 83 | } 84 | ] 85 | }, 86 | { 87 | "begin": "\\b(lod_values)\\b", 88 | "beginCaptures": { 89 | "1": { 90 | "name": "entity.name.function" 91 | } 92 | }, 93 | "comment": "Lod values in materials", 94 | "end": "($|//)", 95 | "patterns": [ 96 | { 97 | "include": "#numeric" 98 | } 99 | ] 100 | }, 101 | { 102 | "begin": "\\b(unordered_access_mip)\\b", 103 | "beginCaptures": { 104 | "1": { 105 | "name": "entity.name.function" 106 | } 107 | }, 108 | "comment": "Texture unit unordered access mip", 109 | "end": "($|//)", 110 | "patterns": [ 111 | { 112 | "include": "#numeric" 113 | } 114 | ] 115 | }, 116 | { 117 | "begin": "\\b(depth_func|comp_func)\\b", 118 | "beginCaptures": { 119 | "1": { 120 | "name": "entity.name.function" 121 | } 122 | }, 123 | "end": "($|//)", 124 | "patterns": [ 125 | { 126 | "match": "\\b(always_fail|always_pass|less|less_equal|not_equal|greater_equal|greater)\\b", 127 | "name": "constant.language" 128 | } 129 | ] 130 | }, 131 | { 132 | "begin": "\\b(gpu_vendor_rule)\\b", 133 | "beginCaptures": { 134 | "1": { 135 | "name": "entity.name.function" 136 | } 137 | }, 138 | "comment": "GPU vendor rules", 139 | "end": "($|//)", 140 | "patterns": [ 141 | { 142 | "match": "\\b(include|exclude)\\b", 143 | "name": "constant.language" 144 | } 145 | ] 146 | }, 147 | { 148 | "begin": "\\b(scene_blend|separate_scene_blend|colour_op_multipass_fallback)\\b", 149 | "beginCaptures": { 150 | "1": { 151 | "name": "entity.name.function" 152 | } 153 | }, 154 | "comment": "Scene blend rules for materials", 155 | "end": "($|//)", 156 | "patterns": [ 157 | { 158 | "match": "\\b(add|modulate|alpha_blend|colour_blend)\\b", 159 | "name": "constant.language" 160 | }, 161 | { 162 | "match": "\\b(one|zero|dest_colour|src_colour|one_minus_dest_colour|one_minus_src_colour|dest_alpha|src_alpha|one_minus_dest_alpha|one_minus_src_alpha)\\b", 163 | "name": "constant.language" 164 | } 165 | ] 166 | }, 167 | { 168 | "begin": "\\b(scene_blend_op|separate_scene_blend_op)\\b", 169 | "beginCaptures": { 170 | "1": { 171 | "name": "entity.name.function" 172 | } 173 | }, 174 | "comment": "Scene blend operations for materials", 175 | "end": "($|//)", 176 | "patterns": [ 177 | { 178 | "match": "\\b(add|subtract|reverse_subtract|min|max)\\b", 179 | "name": "constant.language" 180 | } 181 | ] 182 | }, 183 | { 184 | "begin": "\\b(cull_hardware|cull_software)\\b", 185 | "beginCaptures": { 186 | "1": { 187 | "name": "entity.name.function" 188 | } 189 | }, 190 | "comment": "Culling operations for materials", 191 | "end": "($|//)", 192 | "patterns": [ 193 | { 194 | "match": "\\b(clockwise|anticlockwise|none|back|front)\\b", 195 | "name": "constant.language" 196 | } 197 | ] 198 | }, 199 | { 200 | "begin": "\\b(shading)\\b", 201 | "beginCaptures": { 202 | "1": { 203 | "name": "entity.name.function" 204 | } 205 | }, 206 | "comment": "Shading operations for materials", 207 | "end": "($|//)", 208 | "patterns": [ 209 | { 210 | "match": "\\b(flat|gouraud|phong)\\b", 211 | "name": "constant.language" 212 | } 213 | ] 214 | }, 215 | { 216 | "begin": "\\b(polygon_mode)\\b", 217 | "beginCaptures": { 218 | "1": { 219 | "name": "entity.name.function" 220 | } 221 | }, 222 | "comment": "Polygon modes for materials", 223 | "end": "($|//)", 224 | "patterns": [ 225 | { 226 | "match": "\\b(solid|wireframe|points)\\b", 227 | "name": "constant.language" 228 | } 229 | ] 230 | }, 231 | { 232 | "begin": "\\b(env_map)\\b", 233 | "beginCaptures": { 234 | "1": { 235 | "name": "entity.name.function" 236 | } 237 | }, 238 | "comment": "Texture unit environment map", 239 | "end": "($|//)", 240 | "patterns": [ 241 | { 242 | "match": "\\b(off|spherical|planar|cubic_reflection|cubic_normal)\\b", 243 | "name": "constant.language" 244 | } 245 | ] 246 | }, 247 | { 248 | "begin": "\\b(cubic_texture)\\b", 249 | "beginCaptures": { 250 | "1": { 251 | "name": "entity.name.function" 252 | } 253 | }, 254 | "comment": "Cubic texture format", 255 | "end": "($|//)", 256 | "patterns": [ 257 | { 258 | "match": "\\b(combinedUVW|separateUV)\\b", 259 | "name": "constant.language" 260 | }, 261 | { 262 | "match": "\\S+", 263 | "name": "string" 264 | } 265 | ] 266 | }, 267 | { 268 | "begin": "\\b(binding_type)\\b", 269 | "beginCaptures": { 270 | "1": { 271 | "name": "entity.name.function" 272 | } 273 | }, 274 | "comment": "Texture binding type", 275 | "end": "($|//)", 276 | "patterns": [ 277 | { 278 | "match": "\\b(vertex|fragment)\\b", 279 | "name": "constant.language" 280 | } 281 | ] 282 | }, 283 | { 284 | "begin": "\\b(tex_address_mode)\\b", 285 | "beginCaptures": { 286 | "1": { 287 | "name": "entity.name.function" 288 | } 289 | }, 290 | "comment": "Texture address mode", 291 | "end": "($|//)", 292 | "patterns": [ 293 | { 294 | "match": "\\b(wrap|clamp|mirror|border)\\b", 295 | "name": "constant.language" 296 | } 297 | ] 298 | }, 299 | { 300 | "begin": "\\b(filtering)\\b", 301 | "beginCaptures": { 302 | "1": { 303 | "name": "entity.name.function" 304 | } 305 | }, 306 | "comment": "Texture filtering mode", 307 | "end": "($|//)", 308 | "patterns": [ 309 | { 310 | "match": "\\b(none|point|linear|bilinear|trilinear|anisotropic)\\b", 311 | "name": "constant.language" 312 | } 313 | ] 314 | }, 315 | { 316 | "begin": "\\b(colour_op|colour_op_ex|alpha_op_ex)\\b", 317 | "beginCaptures": { 318 | "1": { 319 | "name": "entity.name.function" 320 | } 321 | }, 322 | "comment": "Texture unit colour/alpha operations", 323 | "end": "($|//)", 324 | "patterns": [ 325 | { 326 | "match": "\\b(replace|blend_diffuse_alpha|blend_texture_alpha|blend_current_alpha|blend_manual|dotproduct|blend_diffuse_colour|src_current|src_texture|src_diffuse|src_specular|src_manual|add|add_signed|add_smooth|subtract|modulate|modulate_x2|modulate_x4|alpha_blend|source1|source2)\\b", 327 | "name": "constant.language" 328 | }, 329 | { 330 | "include": "#numeric" 331 | } 332 | ] 333 | }, 334 | { 335 | "begin": "\\b(param_indexed|param_named|shared_param_named)\\b", 336 | "beginCaptures": { 337 | "1": { 338 | "name": "entity.name.function" 339 | } 340 | }, 341 | "comment": "Shader program indexed/named parameters", 342 | "end": "($|//)", 343 | "patterns": [ 344 | { 345 | "match": "\\b(float[0-9]*|u?int[0-9]*|matrix[2-4]x[2-4])\\b", 346 | "name": "storage.type" 347 | }, 348 | { 349 | "include": "#numeric" 350 | } 351 | ] 352 | }, 353 | { 354 | "begin": "\\b(param_indexed_auto|param_named_auto)\\b", 355 | "beginCaptures": { 356 | "1": { 357 | "name": "entity.name.function" 358 | } 359 | }, 360 | "comment": "Shader program indexed/named auto parameters", 361 | "end": "($|//)", 362 | "patterns": [ 363 | { 364 | "match": "\\b((inverse_)?(transpose_)?(world|view|projection|worldview|viewproj|worldviewproj|texture)_matrix|(world|bone)_matrix_array_3x4|(world|bone)_dualquaternion_array_2x4|normal_matrix|render_target_flipping|light_(diffuse|specular)_colour(_power_scaled)?(_array)?|light_attenuation|spotlight_params|light_(position|direction)(_object_space|_view_space)?(_array)?|light_distance_object_space|light_power|light_number|light_attenuation_array|spotlight_params_array|light_distance_object_space_array|light_power_array|light_count|light_casts_shadows|ambient_light_colour|surface_(ambient|diffuse|specular|emissive)_colour|surface_shininess|surface_alpha_rejection_value|derived_ambient_light_colour|derived_scene_colour|derived_light_(diffuse|specular)_colour(_array)?|fog_colour|fog_params|(lod_)?camera_position(_object_space)?|(frame_)?time|(sin|cos|tan)?time_0_(x|1|2pi)|time_0_(x|1|2pi)_packed|fps|(inverse_)?viewport_(width|height)|viewport_size|texel_offsets|view_direction|view_side_vector|view_up_vector|fov|(near|far)_clip_distance|texture_(world)?viewproj_matrix(_array)?|spotlight_(world)?viewproj_matrix|scene_depth_range|shadow_scene_depth_range|shadow_colour|shadow_extrusion_distance|(inverse_|packed_)?texture_size|pass_number|pass_iteration_number|animation_parametric|(light_)?custom|point_params|material_lod_index)\\b", 365 | "name": "storage.type" 366 | }, 367 | { 368 | "include": "#numeric" 369 | } 370 | ] 371 | }, 372 | { 373 | "begin": "\\b(wave_xform)\\b", 374 | "beginCaptures": { 375 | "1": { 376 | "name": "entity.name.function" 377 | } 378 | }, 379 | "comment": "Texture unit wave_xform animation", 380 | "end": "($|//)", 381 | "patterns": [ 382 | { 383 | "match": "\\b(scroll_x|scroll_y|rotate|scale_x|scale_y|sine|triangle|square|sawtooth|inverse_sawtooth|)\\b", 384 | "name": "constant.language" 385 | }, 386 | { 387 | "include": "#numeric" 388 | } 389 | ] 390 | }, 391 | { 392 | "begin": "\\b(content_type)\\b", 393 | "beginCaptures": { 394 | "1": { 395 | "name": "entity.name.function" 396 | } 397 | }, 398 | "comment": "texture content type", 399 | "end": "($|//)", 400 | "patterns": [ 401 | { 402 | "match": "\\b(named|compositor|shadow)\\b", 403 | "name": "constant.language" 404 | }, 405 | { 406 | "include": "#numeric" 407 | } 408 | ] 409 | }, 410 | { 411 | "begin": "\\b(alpha_rejection)\\b", 412 | "beginCaptures": { 413 | "1": { 414 | "name": "entity.name.function" 415 | } 416 | }, 417 | "comment": "alpha functions for materials", 418 | "end": "($|//)", 419 | "patterns": [ 420 | { 421 | "match": "\\b(always_fail|always_pass|less|less_equal|equal|not_equal|greater_equal|greater)\\b", 422 | "name": "constant.language" 423 | }, 424 | { 425 | "include": "#numeric" 426 | } 427 | ] 428 | }, 429 | { 430 | "begin": "\\b(optimisation_level)\\b", 431 | "beginCaptures": { 432 | "1": { 433 | "name": "entity.name.function" 434 | } 435 | }, 436 | "comment": "HLSL optimization level", 437 | "end": "($|//)", 438 | "patterns": [ 439 | { 440 | "match": "\\b(none|default)\\b", 441 | "name": "constant.language" 442 | }, 443 | { 444 | "match": "\\b([0-3])\\b", 445 | "name": "constant.numeric" 446 | } 447 | ] 448 | }, 449 | { 450 | "begin": "\\b(input_operation_type|output_operation_type|max_output_vertices)\\b", 451 | "beginCaptures": { 452 | "1": { 453 | "name": "entity.name.function" 454 | } 455 | }, 456 | "comment": "GLSL geometry shader defines", 457 | "end": "($|//)", 458 | "patterns": [ 459 | { 460 | "match": "\\b(point_list|line_list|line_strip|triangle_list|triangle_strip|triangle_fan)\\b", 461 | "name": "constant.language" 462 | }, 463 | { 464 | "include": "#numeric" 465 | } 466 | ] 467 | }, 468 | { 469 | "begin": "\\b(fog_override)\\b", 470 | "beginCaptures": { 471 | "1": { 472 | "name": "entity.name.function" 473 | } 474 | }, 475 | "comment": "Fog overrides for materials", 476 | "end": "($|//)", 477 | "patterns": [ 478 | { 479 | "match": "\\b(none|linear|exp|exp2)\\b", 480 | "name": "constant.language" 481 | }, 482 | { 483 | "include": "#boolean" 484 | }, 485 | { 486 | "include": "#numeric" 487 | } 488 | ] 489 | }, 490 | { 491 | "begin": "\\b(iteration)\\b", 492 | "beginCaptures": { 493 | "1": { 494 | "name": "entity.name.function" 495 | } 496 | }, 497 | "comment": "Iteration for material passes", 498 | "end": "($|//)", 499 | "patterns": [ 500 | { 501 | "match": "\\b(once_per_light|once|point|directional|spot|per_light|per_n_lights)\\b", 502 | "name": "constant.language" 503 | }, 504 | { 505 | "include": "#numeric" 506 | } 507 | ] 508 | }, 509 | { 510 | "begin": "\\b(illumination_stage)\\b", 511 | "beginCaptures": { 512 | "1": { 513 | "name": "entity.name.function" 514 | } 515 | }, 516 | "comment": "Iteration for material passes", 517 | "end": "($|//)", 518 | "patterns": [ 519 | { 520 | "match": "\\b(ambient|per_light|decal)\\b", 521 | "name": "constant.language" 522 | }, 523 | { 524 | "include": "#numeric" 525 | } 526 | ] 527 | }, 528 | { 529 | "begin": "\\b(manual_named_constants)\\b", 530 | "beginCaptures": { 531 | "1": { 532 | "name": "entity.name.function" 533 | } 534 | }, 535 | "comment": "Keyword with nothing special after them", 536 | "end": "($|//)" 537 | }, 538 | { 539 | "begin": "\\b(depth_check|compare_test|depth_write|alpha_to_coverage|light_scissor|light_clip_planes|only_initial|shadows|check|two_sided|point_sprites|point_size_attenuation|receive_shadows|colour_write|lighting|transparent_sorting|transparency_casts_shadows)\\b", 540 | "beginCaptures": { 541 | "1": { 542 | "name": "entity.name.function" 543 | } 544 | }, 545 | "comment": "Keyword On/Off", 546 | "end": "($|//)", 547 | "patterns": [ 548 | { 549 | "include": "#boolean" 550 | } 551 | ] 552 | }, 553 | { 554 | "begin": "\\b(polygon_mode_overrideable|includes_instancing|includes_skeletal_animation|includes_morph_animation|uses_vertex_texture_fetch|uses_adjacency_information|column_major_matrices|has_sampler_binding)\\b", 555 | "beginCaptures": { 556 | "1": { 557 | "name": "entity.name.function" 558 | } 559 | }, 560 | "comment": "Keyword true/false", 561 | "end": "($|//)", 562 | "patterns": [ 563 | { 564 | "include": "#boolean" 565 | } 566 | ] 567 | }, 568 | { 569 | "begin": "\\b(material_scheme|shadow_(caster|receiver)_material|scheme|material|compositor_logic|delegate|sampler_ref|attach|shared_params_ref)\\b", 570 | "beginCaptures": { 571 | "1": { 572 | "name": "entity.name.function" 573 | } 574 | }, 575 | "comment": "Keywords followed by names", 576 | "end": "($|//)" 577 | }, 578 | { 579 | "begin": "\\b(source|entry_point|texture|image)\\b", 580 | "beginCaptures": { 581 | "1": { 582 | "name": "entity.name.function" 583 | } 584 | }, 585 | "comment": "Keywords followed by strings", 586 | "end": "($|//)", 587 | "name": "string" 588 | }, 589 | { 590 | "match": "\\b(lod_index|point_size|depth_bias|iteration_depth_bias|first_render_queue|last_render_queue|visibility_mask|anim_texture|point_size_min|point_size_max|lod_bias|identifier|start_light|max_lights|depth_value|stencil_value|ref_value|mask|tex_coord_set|tex_border_colour|max_anisotropy|mipmap_bias|scroll|scroll_anim|rotate|rotate_anim|scale|transform|preprocessor_defines|includes_pose_animation)\\b", 591 | "name": "entity.name.function" 592 | }, 593 | { 594 | "include": "#comments" 595 | }, 596 | { 597 | "include": "#numeric" 598 | }, 599 | { 600 | "include": "#boolean" 601 | }, 602 | { 603 | "include": "#variable" 604 | }, 605 | { 606 | "include": "#string-double-quoted" 607 | } 608 | ], 609 | "repository": { 610 | "variable": { 611 | "comment": "Ogre Variable. Taken from PHP", 612 | "patterns": [ 613 | { 614 | "match": "(?x)\n \t\t\t (\\$+)[a-zA-Z_\\x{7f}-\\x{ff}]\n \t\t\t [a-zA-Z0-9_\\x{7f}-\\x{ff}]*?\\b", 615 | "name": "variable.other" 616 | } 617 | ] 618 | }, 619 | "numeric": { 620 | "patterns": [ 621 | { 622 | "match": "\\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\\.?[0-9]*)|(\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?)(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b", 623 | "name": "constant.numeric.c" 624 | } 625 | ] 626 | }, 627 | "pixelformat": { 628 | "patterns": [ 629 | { 630 | "match": "\\b(PF_BYTE_(LA|RGB|BGR|RGBA|BGRA)|PF_L(8|16)|PF_A8|PF_A4L4|PF_R5G6B5|PF_B5G6R5|PF_R3G3B2|PF_A4R4G4B4|PF_A1R5G5B5|PF_R8G8B8|PF_B8G8R8|PF_A8R8G8B8|PF_A8B8G8R8|PF_B8G8R8A8|PF_R8G8B8A8|PF_X8R8G8B8|PF_X8B8G8R8|PF_A2R10G10B10|PF_A2B10G10R10|PF_SHORT_(GR|RGB|RGBA)|PF_DEPTH(16|32F?)|PF_PVRTC_RGBA?(2|4)|PF_R8|PF_RG8|PF_A8R8G8B8|PF_R8G8B8A8|PF_R8G8B8|PF_FLOAT(16|32)_(R|GR|RGB|RGBA))\\b", 631 | "name": "storage.type" 632 | } 633 | ] 634 | }, 635 | "boolean": { 636 | "patterns": [ 637 | { 638 | "match": "\\b(true|false|TRUE|FALSE|yes|no|YES|NO|on|off|ON|OFF)\\b", 639 | "name": "constant.language.c" 640 | } 641 | ] 642 | }, 643 | "comments": { 644 | "patterns": [ 645 | { 646 | "captures": { 647 | "1": { 648 | "name": "meta.toc-list.banner.block.c" 649 | } 650 | }, 651 | "match": "^/\\* =(\\s*.*?)\\s*= \\*/$\\n?", 652 | "name": "comment.block.c" 653 | }, 654 | { 655 | "begin": "/\\*", 656 | "beginCaptures": { 657 | "0": { 658 | "name": "punctuation.definition.comment.begin.c" 659 | } 660 | }, 661 | "end": "\\*/", 662 | "endCaptures": { 663 | "0": { 664 | "name": "punctuation.definition.comment.end.c" 665 | } 666 | }, 667 | "name": "comment.block.c" 668 | }, 669 | { 670 | "match": "\\*/.*\\n", 671 | "name": "invalid.illegal.stray-comment-end.c" 672 | }, 673 | { 674 | "captures": { 675 | "1": { 676 | "name": "meta.toc-list.banner.line.c" 677 | } 678 | }, 679 | "match": "^// =(\\s*.*?)\\s*=\\s*$\\n?", 680 | "name": "comment.line.banner.c++" 681 | }, 682 | { 683 | "begin": "(^[ \\t]+)?(?=//)", 684 | "beginCaptures": { 685 | "1": { 686 | "name": "punctuation.whitespace.comment.leading.c++" 687 | } 688 | }, 689 | "end": "(?!\\G)", 690 | "patterns": [ 691 | { 692 | "begin": "//", 693 | "beginCaptures": { 694 | "0": { 695 | "name": "punctuation.definition.comment.c++" 696 | } 697 | }, 698 | "end": "\\n", 699 | "name": "comment.line.double-slash.c++", 700 | "patterns": [ 701 | { 702 | "match": "(?>\\\\\\s*\\n)", 703 | "name": "punctuation.separator.continuation.c++" 704 | } 705 | ] 706 | } 707 | ] 708 | } 709 | ] 710 | }, 711 | "string-double-quoted": { 712 | "begin": "\"", 713 | "beginCaptures": { 714 | "0": { 715 | "name": "punctuation.definition.string.begin.php" 716 | } 717 | }, 718 | "end": "\"", 719 | "endCaptures": { 720 | "0": { 721 | "name": "punctuation.definition.string.end.php" 722 | } 723 | }, 724 | "name": "string" 725 | } 726 | } 727 | } 728 | --------------------------------------------------------------------------------