highlightjs-verse 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +128 -0
- package/dist/verse.es.min.js +1 -0
- package/dist/verse.min.js +2 -0
- package/package.json +53 -0
- package/src/languages/verse.js +212 -0
- package/styles/verse-dark.css +111 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Abdelrahman Abdelaal
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# highlightjs-verse
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/highlightjs-verse)
|
|
4
|
+
[](https://github.com/abdelrahman-mohammad/highlightjs-verse/actions/workflows/ci.yml)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
|
|
7
|
+
[Verse](https://dev.epicgames.com/documentation/en-us/uefn/verse-language-reference) language grammar and theme for [highlight.js](https://highlightjs.org/).
|
|
8
|
+
|
|
9
|
+
Verse is the programming language for [Unreal Editor for Fortnite (UEFN)](https://dev.epicgames.com/documentation/en-us/uefn/unreal-editor-for-fortnite-documentation) by Epic Games. This package adds Verse syntax highlighting support to highlight.js with colors matching Epic's official VS Code extension.
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install highlightjs-verse highlight.js
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
### ES Modules (React, Vue, Vite, webpack)
|
|
20
|
+
|
|
21
|
+
```js
|
|
22
|
+
import hljs from 'highlight.js/lib/core';
|
|
23
|
+
import verse from 'highlightjs-verse';
|
|
24
|
+
import 'highlightjs-verse/styles/verse-dark.css';
|
|
25
|
+
|
|
26
|
+
hljs.registerLanguage('verse', verse);
|
|
27
|
+
|
|
28
|
+
// Highlight a code string
|
|
29
|
+
const result = hljs.highlight(code, { language: 'verse' });
|
|
30
|
+
|
|
31
|
+
// Or highlight a DOM element
|
|
32
|
+
hljs.highlightElement(document.querySelector('code'));
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### CommonJS (Node.js, SSR)
|
|
36
|
+
|
|
37
|
+
```js
|
|
38
|
+
const hljs = require('highlight.js/lib/core');
|
|
39
|
+
const verse = require('highlightjs-verse');
|
|
40
|
+
|
|
41
|
+
hljs.registerLanguage('verse', verse);
|
|
42
|
+
|
|
43
|
+
// Server-side render highlighted HTML
|
|
44
|
+
const html = hljs.highlight(verseCode, { language: 'verse' }).value;
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Browser / CDN
|
|
48
|
+
|
|
49
|
+
```html
|
|
50
|
+
<!-- highlight.js core -->
|
|
51
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/highlight.js@11/styles/default.min.css">
|
|
52
|
+
<script src="https://cdn.jsdelivr.net/npm/highlight.js@11/highlight.min.js"></script>
|
|
53
|
+
|
|
54
|
+
<!-- Verse support (auto-registers, no extra JS needed) -->
|
|
55
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/highlightjs-verse@1/styles/verse-dark.css">
|
|
56
|
+
<script src="https://cdn.jsdelivr.net/npm/highlightjs-verse@1/dist/verse.min.js"></script>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
The browser build auto-registers the language — just include the script and go:
|
|
60
|
+
|
|
61
|
+
```html
|
|
62
|
+
<pre><code class="language-verse">
|
|
63
|
+
MyDevice := class(creative_device):
|
|
64
|
+
@editable
|
|
65
|
+
Greeting : string = "Hello, Verse!"
|
|
66
|
+
|
|
67
|
+
OnBegin<override>()<suspends> : void =
|
|
68
|
+
Print(Greeting)
|
|
69
|
+
</code></pre>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Markdown renderers
|
|
73
|
+
|
|
74
|
+
Works with any markdown renderer that supports highlight.js (markdown-it, marked, rehype, etc.):
|
|
75
|
+
|
|
76
|
+
```js
|
|
77
|
+
import markdownit from 'markdown-it';
|
|
78
|
+
import hljs from 'highlight.js/lib/core';
|
|
79
|
+
import verse from 'highlightjs-verse';
|
|
80
|
+
|
|
81
|
+
hljs.registerLanguage('verse', verse);
|
|
82
|
+
|
|
83
|
+
const md = markdownit({
|
|
84
|
+
highlight: (str, lang) => {
|
|
85
|
+
if (lang === 'verse') {
|
|
86
|
+
return hljs.highlight(str, { language: 'verse' }).value;
|
|
87
|
+
}
|
|
88
|
+
return '';
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Now ` ```verse ` code fences in markdown are syntax highlighted.
|
|
94
|
+
|
|
95
|
+
## What Gets Highlighted
|
|
96
|
+
|
|
97
|
+
| Token | Examples | Color |
|
|
98
|
+
|---|---|---|
|
|
99
|
+
| Block comments | `<# nested #>` | Green `#77B06B` |
|
|
100
|
+
| Line comments | `# comment` | Green `#77B06B` |
|
|
101
|
+
| Strings | `"Hello {Name}"` | Tan `#C09077` |
|
|
102
|
+
| String interpolation | `{expr}` inside strings | Gold `#B89047` |
|
|
103
|
+
| Escape sequences | `\n`, `\t`, `\"` | Gold `#B89047` |
|
|
104
|
+
| Numbers | `42`, `0xFF`, `3.14e2` | Light green `#c2ddb4` |
|
|
105
|
+
| Control keywords | `return`, `yield`, `break` | Blue `#569cd6` |
|
|
106
|
+
| Block keywords | `with`, `do`, `then`, `else` | Slate blue `#8499b7` |
|
|
107
|
+
| Declaration keywords | `var`, `set`, `ref`, `in` | Slate blue `#8499b7` |
|
|
108
|
+
| Type specifiers | `class`, `struct`, `interface` | Blue `#569cd6` |
|
|
109
|
+
| Operators | `+`, `->`, `=>`, `:=` | Teal `#77AFAF` |
|
|
110
|
+
| Logical operators | `and`, `or`, `not` | Teal `#77AFAF` |
|
|
111
|
+
| Functions/definitions | `MyFunc(...)`, `Name : type` | Purple `#e5c2ff` |
|
|
112
|
+
| Paths | `/Fortnite.com/Devices` | Blue `#569cd6` |
|
|
113
|
+
| Literals | `true`, `false` | Blue `#569cd6` |
|
|
114
|
+
| Punctuation | `:`, `;`, `,`, `@` | Slate blue `#8499b7` |
|
|
115
|
+
|
|
116
|
+
## Theme
|
|
117
|
+
|
|
118
|
+
The `verse-dark` theme ships as a standalone CSS file at `styles/verse-dark.css`. Colors are sourced from Epic Games' official [VS Code Verse extension](https://marketplace.visualstudio.com/items?itemName=epicgames.verse) (`verse-dark.tmTheme.json`).
|
|
119
|
+
|
|
120
|
+
The theme uses a transparent background, so it layers on top of whatever code block styling your site already has. Pair it with highlight.js's built-in dark themes, or use your own.
|
|
121
|
+
|
|
122
|
+
## Requirements
|
|
123
|
+
|
|
124
|
+
- highlight.js >= 11.0.0 (peer dependency)
|
|
125
|
+
|
|
126
|
+
## License
|
|
127
|
+
|
|
128
|
+
[MIT](LICENSE)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var E=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var I=E((O,b)=>{function _(n){var e={keyword:"return yield break continue",built_in:"with do until catch then else of at over when where while next",type:"var set ref alias live in is",literal:"true false"},a={scope:"comment",begin:"<#",end:"#>",contains:["self"],relevance:10},r={scope:"comment",begin:"(?<!<)#(?!>)",end:"$",contains:[a],relevance:0},c={scope:"char.escape",match:`\\\\[rnt'"\\\\{}#<>&~]`,relevance:0},t={scope:"subst",begin:"\\{",end:"\\}",keywords:e,contains:[]},s={scope:"string",begin:'"',end:'"|$',contains:[c,t],relevance:0},i={scope:"string",variants:[{match:`'\\\\[rnt'"\\\\{}#<>&~]'`},{match:"'[^'\\\\]'"},{match:"\\b0[ou][0-9A-Fa-f]+\\b"}],relevance:0},o={scope:"number",variants:[{match:"\\b0x[0-9A-Fa-f]+\\b"},{match:"\\b[0-9]+(?:\\.[0-9]+)?(?:e[+-]?[0-9]+)?\\b"}],relevance:0},v={scope:"link",match:"/[A-Za-z_][A-Za-z0-9_.@/-]*",relevance:5},h={scope:"title.function",match:/[A-Za-z_]\w*(?:'[^']*')?(?=\s*(?:\(|<(?!#)\w))/,relevance:0},m={scope:"title.function",match:/[A-Za-z_]\w*(?:'[^']*')?(?=\s*(?::\s*[A-Za-z_({/\[]|:=))/,relevance:0},u={match:/\b(class|struct|interface|enum|module|trait|unique|abstract|concrete|final|internal|public|private|protected|override|transacts|varies|computes|converges|decides|no_rollback|suspends|native|epic_internal)\b/,scope:"keyword",relevance:5},d={match:/\b(using)\b/,scope:"keyword",relevance:10},l={scope:"operator",match:"<>|<=|>=|=>|->|\\.\\.|[+\\-*/]=|[+\\-*/=<>|]",relevance:0},A={match:/\b(and|or|not)\b/,scope:"operator",relevance:0},p={scope:"punctuation",match:":=|[@&:;,]",relevance:0};return t.contains=[a,r,s,i,o,v,c,p,l],{name:"Verse",aliases:["verse"],case_insensitive:!1,keywords:e,contains:[a,r,s,i,o,v,d,u,h,m,A,p,l]}}b.exports=_});export default I();
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var hljsDefineVerse=(()=>{var E=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var I=E((O,b)=>{function _(n){var e={keyword:"return yield break continue",built_in:"with do until catch then else of at over when where while next",type:"var set ref alias live in is",literal:"true false"},a={scope:"comment",begin:"<#",end:"#>",contains:["self"],relevance:10},r={scope:"comment",begin:"(?<!<)#(?!>)",end:"$",contains:[a],relevance:0},c={scope:"char.escape",match:`\\\\[rnt'"\\\\{}#<>&~]`,relevance:0},t={scope:"subst",begin:"\\{",end:"\\}",keywords:e,contains:[]},s={scope:"string",begin:'"',end:'"|$',contains:[c,t],relevance:0},i={scope:"string",variants:[{match:`'\\\\[rnt'"\\\\{}#<>&~]'`},{match:"'[^'\\\\]'"},{match:"\\b0[ou][0-9A-Fa-f]+\\b"}],relevance:0},o={scope:"number",variants:[{match:"\\b0x[0-9A-Fa-f]+\\b"},{match:"\\b[0-9]+(?:\\.[0-9]+)?(?:e[+-]?[0-9]+)?\\b"}],relevance:0},v={scope:"link",match:"/[A-Za-z_][A-Za-z0-9_.@/-]*",relevance:5},h={scope:"title.function",match:/[A-Za-z_]\w*(?:'[^']*')?(?=\s*(?:\(|<(?!#)\w))/,relevance:0},m={scope:"title.function",match:/[A-Za-z_]\w*(?:'[^']*')?(?=\s*(?::\s*[A-Za-z_({/\[]|:=))/,relevance:0},u={match:/\b(class|struct|interface|enum|module|trait|unique|abstract|concrete|final|internal|public|private|protected|override|transacts|varies|computes|converges|decides|no_rollback|suspends|native|epic_internal)\b/,scope:"keyword",relevance:5},d={match:/\b(using)\b/,scope:"keyword",relevance:10},l={scope:"operator",match:"<>|<=|>=|=>|->|\\.\\.|[+\\-*/]=|[+\\-*/=<>|]",relevance:0},A={match:/\b(and|or|not)\b/,scope:"operator",relevance:0},p={scope:"punctuation",match:":=|[@&:;,]",relevance:0};return t.contains=[a,r,s,i,o,v,c,p,l],{name:"Verse",aliases:["verse"],case_insensitive:!1,keywords:e,contains:[a,r,s,i,o,v,d,u,h,m,A,p,l]}}b.exports=_});return I();})();
|
|
2
|
+
if(typeof hljs!=="undefined"){hljs.registerLanguage("verse",hljsDefineVerse);}
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "highlightjs-verse",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Verse (Epic Games UEFN) language grammar and theme for highlight.js",
|
|
5
|
+
"main": "src/languages/verse.js",
|
|
6
|
+
"module": "dist/verse.es.min.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./dist/verse.es.min.js",
|
|
10
|
+
"require": "./src/languages/verse.js",
|
|
11
|
+
"default": "./src/languages/verse.js"
|
|
12
|
+
},
|
|
13
|
+
"./styles/*": "./styles/*"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"src/",
|
|
17
|
+
"dist/",
|
|
18
|
+
"styles/"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "node build.mjs",
|
|
22
|
+
"test": "jest",
|
|
23
|
+
"prepublishOnly": "npm run build"
|
|
24
|
+
},
|
|
25
|
+
"peerDependencies": {
|
|
26
|
+
"highlight.js": ">=11.0.0"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"esbuild": "^0.25.0",
|
|
30
|
+
"highlight.js": "^11.11.1",
|
|
31
|
+
"jest": "^30.3.0"
|
|
32
|
+
},
|
|
33
|
+
"keywords": [
|
|
34
|
+
"verse",
|
|
35
|
+
"uefn",
|
|
36
|
+
"epic-games",
|
|
37
|
+
"fortnite",
|
|
38
|
+
"highlight.js",
|
|
39
|
+
"highlightjs",
|
|
40
|
+
"syntax",
|
|
41
|
+
"syntax-highlighting"
|
|
42
|
+
],
|
|
43
|
+
"author": "Abdelrahman Abdelaal",
|
|
44
|
+
"license": "MIT",
|
|
45
|
+
"repository": {
|
|
46
|
+
"type": "git",
|
|
47
|
+
"url": "git+https://github.com/abdelrahman-mohammad/highlightjs-verse.git"
|
|
48
|
+
},
|
|
49
|
+
"bugs": {
|
|
50
|
+
"url": "https://github.com/abdelrahman-mohammad/highlightjs-verse/issues"
|
|
51
|
+
},
|
|
52
|
+
"homepage": "https://github.com/abdelrahman-mohammad/highlightjs-verse#readme"
|
|
53
|
+
}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Verse language definition for highlight.js
|
|
3
|
+
*
|
|
4
|
+
* Based on Epic Games' TextMate grammar (verse.json) and verse-dark.tmTheme.json
|
|
5
|
+
* from the VS Code Verse extension (epicgames.verse).
|
|
6
|
+
*
|
|
7
|
+
* Scope -> color mapping (verse-dark):
|
|
8
|
+
* keyword.control (#569cd6 blue) -> hljs keyword
|
|
9
|
+
* keyword.declaration (#8499b7 slate blue) -> hljs built_in / type
|
|
10
|
+
* keyword.operator (#77AFAF teal) -> hljs operator
|
|
11
|
+
* entity.name.function (#e5c2ff purple) -> hljs title.function
|
|
12
|
+
* variable (#b9d6ff light blue) -> hljs variable
|
|
13
|
+
* punctuation.definition.tag (#8499b7 slate) -> hljs punctuation
|
|
14
|
+
* constant.language (#569cd6 blue) -> hljs link (paths)
|
|
15
|
+
* constant.numeric (#c2ddb4 light green) -> hljs number
|
|
16
|
+
* comment (#77B06B green) -> hljs comment
|
|
17
|
+
* string (#C09077 tan) -> hljs string
|
|
18
|
+
* constant.character.escape (#B89047 gold) -> hljs char.escape
|
|
19
|
+
*
|
|
20
|
+
* @see https://dev.epicgames.com/documentation/en-us/uefn/verse-language-reference
|
|
21
|
+
*/
|
|
22
|
+
function hljsDefineVerse(hljs) {
|
|
23
|
+
// --- Keywords --------------------------------------------------------
|
|
24
|
+
// Grouped by TextMate scope for correct color mapping:
|
|
25
|
+
// keyword -> keyword.control.verse (#569cd6 blue)
|
|
26
|
+
// built_in -> keyword.declaration.verse (#8499b7 slate blue)
|
|
27
|
+
// type -> keyword.declaration.verse (#8499b7 slate blue)
|
|
28
|
+
// literal -> constant.language (#569cd6 blue)
|
|
29
|
+
var KEYWORDS = {
|
|
30
|
+
keyword: 'return yield break continue',
|
|
31
|
+
built_in: 'with do until catch then else of at over when where while next',
|
|
32
|
+
type: 'var set ref alias live in is',
|
|
33
|
+
literal: 'true false'
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
// --- Block comment: <# ... #> (nestable) -----------------------------
|
|
37
|
+
var BLOCK_COMMENT = {
|
|
38
|
+
scope: 'comment',
|
|
39
|
+
begin: '<#',
|
|
40
|
+
end: '#>',
|
|
41
|
+
contains: ['self'],
|
|
42
|
+
relevance: 10
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
// --- Line comment: # to EOL (not part of <# or #>) ------------------
|
|
46
|
+
// Official grammar: (?<!<)#(?!>) with nested BlockCmt support
|
|
47
|
+
var LINE_COMMENT = {
|
|
48
|
+
scope: 'comment',
|
|
49
|
+
begin: '(?<!<)#(?!>)',
|
|
50
|
+
end: '$',
|
|
51
|
+
contains: [BLOCK_COMMENT],
|
|
52
|
+
relevance: 0
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
// --- Escape sequences inside strings/chars ---------------------------
|
|
56
|
+
// Official: \\(\<(?!#)|[rnt'\\"\\{}#<>&~]|$)
|
|
57
|
+
var ESCAPE = {
|
|
58
|
+
scope: 'char.escape',
|
|
59
|
+
match: '\\\\[rnt\'"\\\\{}#<>&~]',
|
|
60
|
+
relevance: 0
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
// --- String interpolation: {expr} inside strings ---------------------
|
|
64
|
+
// Official scope: constant.character.escape for { and }
|
|
65
|
+
var INTERPOLATION = {
|
|
66
|
+
scope: 'subst',
|
|
67
|
+
begin: '\\{',
|
|
68
|
+
end: '\\}',
|
|
69
|
+
keywords: KEYWORDS,
|
|
70
|
+
contains: [] // filled below to allow recursion
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
// --- Double-quoted string: "..." -------------------------------------
|
|
74
|
+
var STRING = {
|
|
75
|
+
scope: 'string',
|
|
76
|
+
begin: '"',
|
|
77
|
+
end: '"|$',
|
|
78
|
+
contains: [ESCAPE, INTERPOLATION],
|
|
79
|
+
relevance: 0
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
// --- Character literals: 'x', '\n', 0o/0u hex -----------------------
|
|
83
|
+
// Official: CharLit0 ('x'), CharLit1 ('\n'), Char8 (0o_), Char32 (0u_)
|
|
84
|
+
var CHAR_LITERAL = {
|
|
85
|
+
scope: 'string',
|
|
86
|
+
variants: [
|
|
87
|
+
{ match: "'\\\\[rnt'\"\\\\{}#<>&~]'" },
|
|
88
|
+
{ match: "'[^'\\\\]'" },
|
|
89
|
+
{ match: '\\b0[ou][0-9A-Fa-f]+\\b' }
|
|
90
|
+
],
|
|
91
|
+
relevance: 0
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
// --- Numbers: 0x hex, decimal, float, optional unit ------------------
|
|
95
|
+
// Official: 0x hex, then (?!0o|0u)[0-9]+ with optional .frac, exp, unit
|
|
96
|
+
var NUMBER = {
|
|
97
|
+
scope: 'number',
|
|
98
|
+
variants: [
|
|
99
|
+
{ match: '\\b0x[0-9A-Fa-f]+\\b' },
|
|
100
|
+
{ match: '\\b[0-9]+(?:\\.[0-9]+)?(?:e[+-]?[0-9]+)?\\b' }
|
|
101
|
+
],
|
|
102
|
+
relevance: 0
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
// --- Paths: /Package/Module/Type -------------------------------------
|
|
106
|
+
// Official scope: constant.language.path.verse -> blue via constant.language
|
|
107
|
+
var PATH = {
|
|
108
|
+
scope: 'link',
|
|
109
|
+
match: '/[A-Za-z_][A-Za-z0-9_.@/-]*',
|
|
110
|
+
relevance: 5
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
// --- Function / method call: name( or name<spec> ---------------------
|
|
114
|
+
// Official scope: entity.name.function.verse (#e5c2ff purple)
|
|
115
|
+
// Matches identifiers before ( or <word (not <# which starts a comment)
|
|
116
|
+
var FUNCTION_CALL = {
|
|
117
|
+
scope: 'title.function',
|
|
118
|
+
match: /[A-Za-z_]\w*(?:'[^']*')?(?=\s*(?:\(|<(?!#)\w))/,
|
|
119
|
+
relevance: 0
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
// --- Definition: name : type or name := -----------------------------
|
|
123
|
+
// Approximates DefineIdent1/DefineIdent2 from official grammar.
|
|
124
|
+
// Official scope: entity.name.function.verse (#e5c2ff purple)
|
|
125
|
+
var DEFINITION = {
|
|
126
|
+
scope: 'title.function',
|
|
127
|
+
match: /[A-Za-z_]\w*(?:'[^']*')?(?=\s*(?::\s*[A-Za-z_({/\[]|:=))/,
|
|
128
|
+
relevance: 0
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
// --- Class/struct/interface/enum specifiers ---------------------------
|
|
132
|
+
// Not separate keywords in the official grammar (just identifiers),
|
|
133
|
+
// but highlighting these as keywords improves readability.
|
|
134
|
+
var TYPE_SPECIFIER = {
|
|
135
|
+
match: /\b(class|struct|interface|enum|module|trait|unique|abstract|concrete|final|internal|public|private|protected|override|transacts|varies|computes|converges|decides|no_rollback|suspends|native|epic_internal)\b/,
|
|
136
|
+
scope: 'keyword',
|
|
137
|
+
relevance: 5
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
// --- Using statement -------------------------------------------------
|
|
141
|
+
var USING = {
|
|
142
|
+
match: /\b(using)\b/,
|
|
143
|
+
scope: 'keyword',
|
|
144
|
+
relevance: 10
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
// --- Operators -------------------------------------------------------
|
|
148
|
+
// Official scopes: keyword.operator.verse, keyword.operator.arithmetic,
|
|
149
|
+
// keyword.operator.comparison -> all #77AFAF teal
|
|
150
|
+
var OPERATOR = {
|
|
151
|
+
scope: 'operator',
|
|
152
|
+
match: '<>|<=|>=|=>|->|\\.\\.|[+\\-*/]=|[+\\-*/=<>|]',
|
|
153
|
+
relevance: 0
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
// --- Logical operator keywords ---------------------------------------
|
|
157
|
+
// Official scope: keyword.operator.logical.verse (#77AFAF teal)
|
|
158
|
+
var LOGICAL_OPERATOR = {
|
|
159
|
+
match: /\b(and|or|not)\b/,
|
|
160
|
+
scope: 'operator',
|
|
161
|
+
relevance: 0
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
// --- Definition punctuation ------------------------------------------
|
|
165
|
+
// Official scope: punctuation.definition.tag (#8499b7 slate blue)
|
|
166
|
+
// := is definition assignment, @ is decorator/attribute, & is reference
|
|
167
|
+
var PUNCTUATION = {
|
|
168
|
+
scope: 'punctuation',
|
|
169
|
+
match: ':=|[@&:;,]',
|
|
170
|
+
relevance: 0
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
// Fill interpolation contents (recursive references)
|
|
174
|
+
INTERPOLATION.contains = [
|
|
175
|
+
BLOCK_COMMENT,
|
|
176
|
+
LINE_COMMENT,
|
|
177
|
+
STRING,
|
|
178
|
+
CHAR_LITERAL,
|
|
179
|
+
NUMBER,
|
|
180
|
+
PATH,
|
|
181
|
+
ESCAPE,
|
|
182
|
+
PUNCTUATION,
|
|
183
|
+
OPERATOR
|
|
184
|
+
];
|
|
185
|
+
|
|
186
|
+
// Base text color set to #b9d6ff (variable/identifier) in CSS,
|
|
187
|
+
// so unmatched identifiers naturally appear light blue.
|
|
188
|
+
// Keywords override via the keywords property on root.
|
|
189
|
+
return {
|
|
190
|
+
name: 'Verse',
|
|
191
|
+
aliases: ['verse'],
|
|
192
|
+
case_insensitive: false,
|
|
193
|
+
keywords: KEYWORDS,
|
|
194
|
+
contains: [
|
|
195
|
+
BLOCK_COMMENT,
|
|
196
|
+
LINE_COMMENT,
|
|
197
|
+
STRING,
|
|
198
|
+
CHAR_LITERAL,
|
|
199
|
+
NUMBER,
|
|
200
|
+
PATH,
|
|
201
|
+
USING,
|
|
202
|
+
TYPE_SPECIFIER,
|
|
203
|
+
FUNCTION_CALL,
|
|
204
|
+
DEFINITION,
|
|
205
|
+
LOGICAL_OPERATOR,
|
|
206
|
+
PUNCTUATION,
|
|
207
|
+
OPERATOR
|
|
208
|
+
]
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
module.exports = hljsDefineVerse;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Verse Dark theme for highlight.js
|
|
3
|
+
*
|
|
4
|
+
* Colors sourced from Epic Games' verse-dark.tmTheme.json
|
|
5
|
+
* (VS Code Verse extension). Background is transparent so
|
|
6
|
+
* the dashboard's existing code-block styles remain in control.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/* Base — light blue (variable/identifier) as default text color.
|
|
10
|
+
Official theme: editor.foreground is #D4D4D4, but identifiers
|
|
11
|
+
(variable.verse) are #b9d6ff. Since most code text IS identifiers,
|
|
12
|
+
using the identifier color as default gives the closest match. */
|
|
13
|
+
.hljs {
|
|
14
|
+
color: #b9d6ff;
|
|
15
|
+
background: transparent;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/* Comments — green (official theme: no italic) */
|
|
19
|
+
.hljs-comment {
|
|
20
|
+
color: #77B06B;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/* Strings — tan */
|
|
24
|
+
.hljs-string {
|
|
25
|
+
color: #C09077;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/* Escape characters — gold */
|
|
29
|
+
.hljs-char\.escape {
|
|
30
|
+
color: #B89047;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* String interpolation — gold */
|
|
34
|
+
.hljs-subst {
|
|
35
|
+
color: #B89047;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/* Numbers — light green */
|
|
39
|
+
.hljs-number {
|
|
40
|
+
color: #c2ddb4;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* Keywords (control flow) — blue */
|
|
44
|
+
.hljs-keyword {
|
|
45
|
+
color: #569cd6;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/* Built-in / block keywords — slate blue */
|
|
49
|
+
.hljs-built_in {
|
|
50
|
+
color: #8499b7;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/* Declaration keywords (var, set, ref, etc.) — slate blue */
|
|
54
|
+
.hljs-type {
|
|
55
|
+
color: #8499b7;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/* Operators — teal */
|
|
59
|
+
.hljs-operator {
|
|
60
|
+
color: #77AFAF;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/* Defined names / functions — light purple */
|
|
64
|
+
.hljs-title,
|
|
65
|
+
.hljs-title\.function {
|
|
66
|
+
color: #e5c2ff;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/* Paths (/Package/Module) — blue */
|
|
70
|
+
.hljs-link {
|
|
71
|
+
color: #569cd6;
|
|
72
|
+
text-decoration: none;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/* Literals (true/false) — blue */
|
|
76
|
+
.hljs-literal {
|
|
77
|
+
color: #569cd6;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/* Punctuation (: ; ,) — slate blue */
|
|
81
|
+
.hljs-punctuation {
|
|
82
|
+
color: #8499b7;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/* Variables / referenced identifiers — light blue */
|
|
86
|
+
.hljs-variable {
|
|
87
|
+
color: #b9d6ff;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/* Tags (markup) — muted purple */
|
|
91
|
+
.hljs-tag {
|
|
92
|
+
color: #6F77A6;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.hljs-name {
|
|
96
|
+
color: #8499b7;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/* Section headers in output (relevance metadata) */
|
|
100
|
+
.hljs-section {
|
|
101
|
+
color: #e5c2ff;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/* Emphasis within comments */
|
|
105
|
+
.hljs-emphasis {
|
|
106
|
+
font-style: italic;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.hljs-strong {
|
|
110
|
+
font-weight: bold;
|
|
111
|
+
}
|