├── .vscodeignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── images └── icon.png ├── language-configuration.json ├── package.json └── syntaxes └── asp.tmLanguage /.vscodeignore: -------------------------------------------------------------------------------- 1 | CONTRIBUTORS.md -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## Version 0.0.6: 02 January 2025 2 | - Fix issues with unescaped characters. 3 | - Add contributors in readme. 4 | 5 | ## Version 0.0.5: 11 March 2020 6 | - Add support for clingcon and clingoLP features. 7 | - Add support for asprilo. 8 | - Fix issue with asprin features. 9 | 10 | ## Version 0.0.4: 08 November 2019 11 | - Add #heuristic, preference and pareto (for asprin). 12 | - Fix #program and #include highlight. 13 | - Fix #end. for python and lua script. 14 | 15 | ## Version 0.0.3: 22 October 2019 16 | - Add support for lua script 17 | 18 | ## Version 0.0.2: 16 May 2019 19 | - Add support for [asprin](https://github.com/potassco/asprin) 20 | 21 | ## Version 0.0.1 22 | - Initial release -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Arnaud Belcour 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Answer Set Programming Syntax Highlighting 2 | 3 | A simple syntax highlight for Answer Set Programming in Virtual Studio Code. 4 | 5 | This extension was created with [yo code](https://code.visualstudio.com/docs/extensions/yocode). Also the syntax highlight is from [Atom's ASP-Core-2](https://github.com/0xbb/language-asp-core-2). 6 | 7 | ## Features 8 | 9 | Syntax highlighting for Answer Set Programming (variables, Clingo functions, asprin, asprilo, clingcon and clingoLP statements and types). 10 | 11 | ## Requirements 12 | 13 | No requirements. 14 | 15 | ## Issues/Suggestions 16 | 17 | You can post your issues/suggestions on the [GitHub page](https://github.com/ArnaudBelcour/asp-syntax-highlight). 18 | 19 | ## Contributors 20 | 21 | * [Arnaud Belcour](https://github.com/ArnaudBelcour) 22 | * [Nikolas Bertrand](https://github.com/ni-be) 23 | * [Nick Walker](https://github.com/nickswalker) -------------------------------------------------------------------------------- /images/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArnaudBelcour/asp-syntax-highlight/038795dc027baf575e6d2a8b5160ef4ff04cedeb/images/icon.png -------------------------------------------------------------------------------- /language-configuration.json: -------------------------------------------------------------------------------- 1 | { 2 | "comments": { 3 | // symbol used for single line comment. Remove this entry if your language does not support line comments 4 | "lineComment": "%", 5 | // symbols used for start and end a block comment. Remove this entry if your language does not support block comments 6 | "blockComment": [ "%*", "*%" ] 7 | }, 8 | // symbols used as brackets 9 | "brackets": [ 10 | ["{", "}"], 11 | ["[", "]"], 12 | ["(", ")"] 13 | ], 14 | // symbols that are auto closed when typing 15 | "autoClosingPairs": [ 16 | ["{", "}"], 17 | ["[", "]"], 18 | ["(", ")"], 19 | ["\"", "\""], 20 | ["'", "'"] 21 | ], 22 | // symbols that that can be used to surround a selection 23 | "surroundingPairs": [ 24 | ["{", "}"], 25 | ["[", "]"], 26 | ["(", ")"], 27 | ["\"", "\""], 28 | ["'", "'"] 29 | ] 30 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "asp-syntax-highlight", 3 | "displayName": "Answer Set Programming syntax highlighter", 4 | "description": "Syntax highlighting for Answer Set Programming", 5 | "version": "0.0.6", 6 | "publisher": "abelcour", 7 | "engines": { 8 | "vscode": "^1.18.0" 9 | }, 10 | "homepage": "https://github.com/ArnaudBelcour/asp-syntax-highlight", 11 | "repository": { 12 | "type": "git", 13 | "url": "https://github.com/ArnaudBelcour/asp-syntax-highlight" 14 | }, 15 | "icon": "images/icon.png", 16 | "categories": [ 17 | "Programming Languages" 18 | ], 19 | "contributes": { 20 | "languages": [ 21 | { 22 | "id": "asp", 23 | "aliases": [ 24 | "Answer Set Programming", 25 | "asp" 26 | ], 27 | "extensions": [ 28 | ".lp", 29 | ".ilp", 30 | ".cl", 31 | ".clp", 32 | ".iclp", 33 | ".Clp", 34 | ".iClp", 35 | ".blp", 36 | ".iblp" 37 | 38 | ], 39 | "configuration": "./language-configuration.json" 40 | } 41 | ], 42 | "grammars": [ 43 | { 44 | "language": "asp", 45 | "scopeName": "source.asp", 46 | "path": "./syntaxes/asp.tmLanguage" 47 | } 48 | ] 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /syntaxes/asp.tmLanguage: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | name 6 | asp 7 | scopeName 8 | source.asp 9 | patterns 10 | 11 | 12 | include 13 | #keywords 14 | 15 | 16 | repository 17 | 18 | keywords 19 | 20 | patterns 21 | 22 | 23 | name 24 | comment.asp 25 | begin 26 | %\* 27 | end 28 | \*% 29 | 30 | 31 | name 32 | comment.asp 33 | match 34 | %.* 35 | 36 | 37 | name 38 | constant.language.asp 39 | match 40 | \bnot\b 41 | 42 | 43 | name 44 | punctuation.section.embedded.asp 45 | match 46 | :- 47 | 48 | 49 | name 50 | punctuation.separator.and.asp 51 | match 52 | , 53 | 54 | 55 | name 56 | punctuation.separator.or.asp 57 | match 58 | ; 59 | 60 | 61 | name 62 | support.constant.cut.asp 63 | match 64 | != 65 | 66 | 67 | name 68 | support.constant.cut.asp 69 | match 70 | >> 71 | 72 | 73 | name 74 | keyword.asp 75 | match 76 | #(count|max|min|sum)\b 77 | 78 | 79 | name 80 | keyword.control.flow.asp 81 | comment 82 | asprilo types and statements 83 | match 84 | (object|value|node|highway|robot|shelf|pickingStation|product|order|carries|occurs|pickup|putdown|move|deliver|action|grid)\b 85 | 86 | 87 | name 88 | keyword.control.flow.asp 89 | comment 90 | asprin types and statements 91 | match 92 | (less\s*\(\s*cardinality\s*\)|more\s*\(\s*cardinality\s*\)|less\s*\(\s*weight\s*\)|more\s*\(\s*weight\s*\)|preference|pareto|subset|superset|minmax|maxmin|aso|poset|cp|#(preference|optimize))\b 93 | 94 | 95 | name 96 | support.function.asp 97 | comment 98 | Other language (Python, Lua) function call 99 | match 100 | @[a-z][A-Za-z0-9_]*\b 101 | 102 | 103 | name 104 | support.function.asp 105 | comment 106 | Clingcon and clingoLP features 107 | match 108 | &(sum|dom|distinct|minimize|maximize)\b 109 | 110 | 111 | name 112 | support.function.asp 113 | comment 114 | Gringo functions 115 | match 116 | #(maximize|minimize|show|hide|heuristic|showsig|sup|inf|true|false|forget|external|cumulative|disjoint|const|base)\b 117 | 118 | 119 | name 120 | support.function.asp 121 | comment 122 | Include 123 | match 124 | #include\s([<](incmode|csp)[>][.])? 125 | 126 | 127 | name 128 | support.function.asp 129 | comment 130 | init 131 | match 132 | init\b 133 | 134 | 135 | name 136 | support.function.asp 137 | comment 138 | Program 139 | match 140 | #program\s((base|step\(\w\)*|check\(\s*\w\s*\)*)[.])? 141 | 142 | 143 | comment 144 | Gringo script python 145 | begin 146 | #script\s*\(\s*python\s*\) 147 | beginCaptures 148 | 149 | 0 150 | 151 | name 152 | support.function.asp 153 | 154 | 155 | end 156 | #end[.] 157 | endCaptures 158 | 159 | 0 160 | 161 | name 162 | support.function.asp 163 | 164 | 165 | patterns 166 | 167 | 168 | include 169 | source.python 170 | 171 | 172 | 173 | 174 | comment 175 | Gringo script lua 176 | begin 177 | #script\s*\(\s*lua\s*\) 178 | beginCaptures 179 | 180 | 0 181 | 182 | name 183 | support.function.asp 184 | 185 | 186 | end 187 | #end[.] 188 | endCaptures 189 | 190 | 0 191 | 192 | name 193 | support.function.asp 194 | 195 | 196 | patterns 197 | 198 | 199 | include 200 | source.lua 201 | 202 | 203 | 204 | 205 | name 206 | entity.name.tag.asp 207 | match 208 | [a-z][A-Za-z0-9_]* 209 | 210 | 211 | name 212 | variable.asp 213 | match 214 | \b[A-Z][A-Za-z0-9_]* 215 | 216 | 217 | name 218 | string.asp 219 | begin 220 | " 221 | end 222 | " 223 | 224 | 225 | name 226 | constant.numeric.asp 227 | match 228 | 0|[1-9][0-9]* 229 | 230 | 231 | 232 | 233 | 234 | --------------------------------------------------------------------------------