@actualwave/codemirror-lang-glsl 0.1.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 +64 -0
- package/index.cjs +154 -0
- package/index.js +151 -0
- package/package.json +60 -0
- package/types/completion.d.ts +3 -0
- package/types/completion.d.ts.map +1 -0
- package/types/highlight.d.ts +2 -0
- package/types/highlight.d.ts.map +1 -0
- package/types/index.d.ts +4 -0
- package/types/index.d.ts.map +1 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (C) 2021 by Marijn Haverbeke <marijnh@gmail.com> and others
|
|
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
|
|
13
|
+
all 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
|
|
21
|
+
THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# codemirror-lang-glsl
|
|
2
|
+
|
|
3
|
+
[GLSL](https://www.khronos.org/opengl/wiki/OpenGL_Shading_Language) (OpenGL Shading Language) syntax support for [CodeMirror 6](https://codemirror.net/).
|
|
4
|
+
|
|
5
|
+
Targets GLSL ES 1.00/3.00 (WebGL 1/2) — the dialect used for real-time graphics shaders in browsers, mobile GPU pipelines, and Skia-adjacent tooling.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @actualwave/codemirror-lang-glsl
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
import { EditorState } from "@codemirror/state"
|
|
17
|
+
import { EditorView } from "@codemirror/view"
|
|
18
|
+
import { glsl } from "@actualwave/codemirror-lang-glsl"
|
|
19
|
+
|
|
20
|
+
const state = EditorState.create({
|
|
21
|
+
doc: `precision highp float;
|
|
22
|
+
uniform vec2 resolution;
|
|
23
|
+
|
|
24
|
+
void main() {
|
|
25
|
+
vec2 uv = gl_FragCoord.xy / resolution;
|
|
26
|
+
gl_FragColor = vec4(uv, 0.0, 1.0);
|
|
27
|
+
}`,
|
|
28
|
+
extensions: [glsl()],
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
const view = new EditorView({ state, parent: document.body })
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## API
|
|
35
|
+
|
|
36
|
+
### `glsl()`
|
|
37
|
+
|
|
38
|
+
Returns a `LanguageSupport` instance. This is the main extension to add to your editor.
|
|
39
|
+
|
|
40
|
+
### `glslLanguage`
|
|
41
|
+
|
|
42
|
+
The `LRLanguage` instance for GLSL. Use this when you need direct access to the language object, for example to add language-specific extensions via `glslLanguage.data.of(...)`.
|
|
43
|
+
|
|
44
|
+
### `glslHighlighting`
|
|
45
|
+
|
|
46
|
+
The highlight style prop source used by the parser. Exported for advanced use cases where you want to build a custom language configuration.
|
|
47
|
+
|
|
48
|
+
## Features
|
|
49
|
+
|
|
50
|
+
- Syntax highlighting for keywords, types, qualifiers, literals, operators, and comments
|
|
51
|
+
- Built-in type names: scalars (`float`, `int`, `uint`, `bool`), vectors (`vec2`–`vec4`, `ivec2`–`ivec4`, `uvec2`–`uvec4`, `bvec2`–`bvec4`), matrices (`mat2`–`mat4`, non-square `mat2x3`…`mat4x3`), and samplers (`sampler2D`, `samplerCube`, `sampler3D`, `sampler2DArray`, shadow and integer variants)
|
|
52
|
+
- Qualifiers: `const`, `in`, `out`, `inout`, `attribute`, `varying`, `uniform`, `centroid`, `flat`, `smooth`, `noperspective`, `invariant`, `precise`
|
|
53
|
+
- Precision qualifiers (`highp`, `mediump`, `lowp`) and `precision` statements
|
|
54
|
+
- `layout(...)` qualifiers (e.g. `layout(location = 0)`)
|
|
55
|
+
- Function prototypes (forward declarations) in addition to full definitions
|
|
56
|
+
- `switch`/`case`/`default` statements (GLSL ES 3.00)
|
|
57
|
+
- Boolean literals (`true`/`false`)
|
|
58
|
+
- Block indentation and code folding for `{}` blocks and struct definitions
|
|
59
|
+
- Line (`//`) and block (`/* */`) comment tokens
|
|
60
|
+
- Preprocessor directives (`#version`, `#define`, etc.)
|
|
61
|
+
|
|
62
|
+
## License
|
|
63
|
+
|
|
64
|
+
MIT
|
package/index.cjs
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var lr = require('@lezer/lr');
|
|
4
|
+
var highlight = require('@lezer/highlight');
|
|
5
|
+
var language = require('@codemirror/language');
|
|
6
|
+
var autocomplete = require('@codemirror/autocomplete');
|
|
7
|
+
|
|
8
|
+
const glslHighlighting = highlight.styleTags({
|
|
9
|
+
// Keywords
|
|
10
|
+
"if else for while do switch case default return discard break continue": highlight.tags.controlKeyword,
|
|
11
|
+
"struct": highlight.tags.definitionKeyword,
|
|
12
|
+
"precision": highlight.tags.definitionKeyword,
|
|
13
|
+
"layout": highlight.tags.definitionKeyword,
|
|
14
|
+
"const in out inout attribute varying uniform centroid flat smooth noperspective invariant precise": highlight.tags.modifier,
|
|
15
|
+
"highp mediump lowp": highlight.tags.modifier,
|
|
16
|
+
// Type names (built-in types only — identifier fallback handled separately)
|
|
17
|
+
"void bool int uint float": highlight.tags.typeName,
|
|
18
|
+
"vec2 vec3 vec4 bvec2 bvec3 bvec4 ivec2 ivec3 ivec4 uvec2 uvec3 uvec4": highlight.tags.typeName,
|
|
19
|
+
"mat2 mat3 mat4": highlight.tags.typeName,
|
|
20
|
+
"mat2x2 mat2x3 mat2x4 mat3x2 mat3x3 mat3x4 mat4x2 mat4x3 mat4x4": highlight.tags.typeName,
|
|
21
|
+
"sampler2D samplerCube sampler3D sampler2DArray": highlight.tags.typeName,
|
|
22
|
+
"sampler2DShadow samplerCubeShadow sampler2DArrayShadow": highlight.tags.typeName,
|
|
23
|
+
"isampler2D isampler3D isamplerCube isampler2DArray": highlight.tags.typeName,
|
|
24
|
+
"usampler2D usampler3D usamplerCube usampler2DArray": highlight.tags.typeName,
|
|
25
|
+
// Boolean literals
|
|
26
|
+
"BoolLiteral": highlight.tags.bool,
|
|
27
|
+
// Identifiers
|
|
28
|
+
"identifier": highlight.tags.variableName,
|
|
29
|
+
// Function definition / prototype name
|
|
30
|
+
"FunctionDef/identifier": highlight.tags.function(highlight.tags.definition(highlight.tags.variableName)),
|
|
31
|
+
"FunctionProto/identifier": highlight.tags.function(highlight.tags.definition(highlight.tags.variableName)),
|
|
32
|
+
// Struct name
|
|
33
|
+
"StructDef/identifier": highlight.tags.definition(highlight.tags.typeName),
|
|
34
|
+
// Variable declarator name
|
|
35
|
+
"declarator/identifier": highlight.tags.definition(highlight.tags.variableName),
|
|
36
|
+
// layout(...) item names
|
|
37
|
+
"layoutItem/identifier": highlight.tags.propertyName,
|
|
38
|
+
// Literals
|
|
39
|
+
"Literal": highlight.tags.number,
|
|
40
|
+
// Comments
|
|
41
|
+
"LineComment": highlight.tags.lineComment,
|
|
42
|
+
"BlockComment": highlight.tags.blockComment,
|
|
43
|
+
// Preprocessor
|
|
44
|
+
"PreprocessorDirective": highlight.tags.processingInstruction,
|
|
45
|
+
// Delimiters
|
|
46
|
+
"{ }": highlight.tags.brace,
|
|
47
|
+
"( )": highlight.tags.paren,
|
|
48
|
+
"[ ]": highlight.tags.squareBracket,
|
|
49
|
+
"; ,": highlight.tags.separator,
|
|
50
|
+
". ? :": highlight.tags.punctuation,
|
|
51
|
+
// Operators
|
|
52
|
+
"logicalOr logicalAnd": highlight.tags.logicOperator,
|
|
53
|
+
"eqOp relOp": highlight.tags.compareOperator,
|
|
54
|
+
"shiftOp": highlight.tags.bitwiseOperator,
|
|
55
|
+
"addOp": highlight.tags.arithmeticOperator,
|
|
56
|
+
"mulOp": highlight.tags.arithmeticOperator,
|
|
57
|
+
"unaryOp": highlight.tags.operator,
|
|
58
|
+
"assignOp": highlight.tags.definitionOperator,
|
|
59
|
+
"| ^ &": highlight.tags.bitwiseOperator,
|
|
60
|
+
// Field access dot
|
|
61
|
+
"FieldAccess/\".\"": highlight.tags.derefOperator,
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
|
65
|
+
const spec_identifier = {__proto__:null,void:12, bool:14, int:16, uint:18, float:20, vec2:22, vec3:24, vec4:26, bvec2:28, bvec3:30, bvec4:32, ivec2:34, ivec3:36, ivec4:38, uvec2:40, uvec3:42, uvec4:44, mat2:46, mat3:48, mat4:50, mat2x2:52, mat2x3:54, mat2x4:56, mat3x2:58, mat3x3:60, mat3x4:62, mat4x2:64, mat4x3:66, mat4x4:68, sampler2D:70, samplerCube:72, sampler3D:74, sampler2DArray:76, sampler2DShadow:78, samplerCubeShadow:80, sampler2DArrayShadow:82, isampler2D:84, isampler3D:86, isamplerCube:88, isampler2DArray:90, usampler2D:92, usampler3D:94, usamplerCube:96, usampler2DArray:98, const:102, in:104, out:106, inout:108, highp:110, mediump:112, lowp:114, true:136, false:138, return:164, if:168, else:170, for:174, layout:180, attribute:182, varying:184, uniform:186, centroid:188, flat:190, smooth:192, noperspective:194, invariant:196, precise:198, while:204, do:208, switch:212, case:214, default:216, discard:220, break:224, continue:228, struct:234, precision:238};
|
|
66
|
+
const parser = lr.LRParser.deserialize({
|
|
67
|
+
version: 14,
|
|
68
|
+
states: "BbQ]QPOOOOQO'#Fo'#FoOOQO'#FP'#FPO%jQPO'#EWO)kQPO'#EWOOQO'#FX'#FXO)sQPO'#FXOOQO'#Ey'#EyQ]QPOOOOQO'#Ca'#CaOOQO'#F^'#F^O)xQPO'#EXOOQO'#Fs'#FsO)}QPO'#EtO*SQPO'#EvOOQO-E8}-E8}O*_QPO,5:rO-uQPO'#DjO-|QPO,5;_O._QPO'#FtOOQO,5:r,5:rO*bQPO,5:rOOQO,5;s,5;sOOQO-E8w-E8wO.gQPO,5:sO.oQPO,5;`O.tQPO,5;bO.PQPO'#FuOOQO1G0^1G0^O*bQPO1G0^OOQO'#Do'#DoO*gQPO'#DoO1pQQO'#DnOOQO'#Dm'#DmO*gQPO'#DmO3{QQO,5:UOOQO'#F_'#F_OOQO,5:U,5:UOOQO'#Dq'#DqO*gQPO,5<aO4SQPO,5<aO4_QPO1G0yO*bQPO'#FRO4{QPO,5<`O5TQPO'#FqO5`QPO'#FpOOQO1G0_1G0_O5hQPO1G0_O5mQPO1G0zO6QQPO1G0|OOQO7+%x7+%xO6VQQO,5:ZO6^QPO'#DuO*gQPO'#DwO6cQPO'#DxOOQO'#E{'#E{O6jQQO,5:YOOQO,5:X,5:XO*gQPO,5;yO*gQPO,5;yO*gQPO,5;yO*gQPO,5;yO*gQPO,5;yO*gQPO,5;yO*gQPO,5;yO*gQPO,5;yO*gQPO,5;yO*gQPO,5;yO*gQPO,5;yO*gQPO,5;yOOQO1G/p1G/pO7}QQO1G1{O*gQPO1G1{OOQO'#F]'#F]OOQO'#Ez'#EzO8XQPO'#F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hv$T#j$W$^%^%b%i%m%o%x&O&Q&R&S&U&Y&Z&[&]&^T%V$v&hTUOWQWORgWS!my#hR#d!mQ!YpR#U!YQ#y#RR$k#yQ#i!oR$Q#iQ$W#jU$q$W&R&SQ&R&OR&S&Q!OROW#j$W$^$v%^%b%i%m%o%x&O&Q&R&S&U&Y&Z&[&]&^&hR_RQ!v}R#o!vQ{cR!s{Q%s%lR%{%sQ!{!QR#s!{TVOWR!qyQ!oyR$P#hV!ly!m#h!QPORW#j$W$^$v%^%b%i%m%o%x&O&Q&R&S&U&Y&Z&[&]&^&hQj^U!ky!m#hT!y!Q!{QsaQ!ToQ!iwQ#Q!VQ#R!WQ#V![Q#W!]Q#X!^Q#Y!_Q#Z!`Q#[!aQ#]!bQ#^!cQ#_!dQ#`!eQ#a!fQ#b!gQ#c!jz$S#j$W$^$v%^%b%i%m%o%x&O&Q&R&S&U&Y&Z&[&]&^&hQ$j#xQ$l#{Q$s$YQ%T$uQ%X$wQ%Z$yQ%`%WQ%h%aQ%k%cQ%n%gQ%}%tQ&V&WQ&_&dQ&b&`Q&c&aR&f&eR#T!W[$V#j$W&O&Q&R&SQ$x$^Q%f%^S%j%b&YS%p%i&ZS%w%m&[S%y%o&]S&P%x&^R&T&UQ%W$vR&e&h!RQORW#j$W$^$v%^%b%i%m%o%x&O&Q&R&S&U&Y&Z&[&]&^&hR!PhQ}hR#n!uSdS$RSl`eQ!SmQ#v!|R$i#t^cS`em!|#t$RR!rzT%r%l%sT!z!Q!{",
|
|
71
|
+
nodeNames: "⚠ LineComment BlockComment Program FunctionDef TypeName void bool int uint float vec2 vec3 vec4 bvec2 bvec3 bvec4 ivec2 ivec3 ivec4 uvec2 uvec3 uvec4 mat2 mat3 mat4 mat2x2 mat2x3 mat2x4 mat3x2 mat3x3 mat3x4 mat4x2 mat4x3 mat4x4 sampler2D samplerCube sampler3D sampler2DArray sampler2DShadow samplerCubeShadow sampler2DArrayShadow isampler2D isampler3D isamplerCube isampler2DArray usampler2D usampler3D usamplerCube usampler2DArray ( const in out inout highp mediump lowp ] [ ArraySuffix ? : UnaryExpr PostfixExpr PrimaryExpr Literal BoolLiteral true false ) FieldAccess . IndexAccess CallArgs , PostfixOp } { Block ; ReturnStmt return IfStmt if else ForStmt for VarDecl LayoutQualifier layout attribute varying uniform centroid flat smooth noperspective invariant precise ExprStmt WhileStmt while DoWhileStmt do SwitchStmt switch case default DiscardStmt discard BreakStmt break ContinueStmt continue FunctionProto StructDef struct PrecisionStmt precision PreprocessorDirective",
|
|
72
|
+
maxTerm: 165,
|
|
73
|
+
nodeProps: [
|
|
74
|
+
["closedBy", 50,")",59,"]",78,"}"],
|
|
75
|
+
["openedBy", 58,"[",70,"(",77,"{"]
|
|
76
|
+
],
|
|
77
|
+
propSources: [glslHighlighting],
|
|
78
|
+
skippedNodes: [0,1,2],
|
|
79
|
+
repeatNodeCount: 11,
|
|
80
|
+
tokenData: ".Z~RrXY#]YZ#]]^#]pq#]qr#nst#{uv$jvw$wxy%Xyz%^z{$j{|%c|}%w}!O%|!O!P&Z!P!Q'n!Q!R)r!R![*^![!]+g!]!^+l!^!_+q!_!`,Z!`!a,e!a!b,p!c!},u!}#O-W#P#Q-]#Q#R-b#R#S,u#T#o,u#o#p-j#p#q-o#q#r.P#r#s.U~#bS#z~XY#]YZ#]]^#]pq#]R#sP$`P!_!`#vQ#{O$WQ~$QU#l~OY#{Z#O#{#O#P#{#P;'S#{;'S;=`$d<%lO#{~$gP;=`<%l#{~$oP$S~!_!`$rQ$wO$^Q~$|Q$X~vw%S!_!`$r~%XO$[~~%^O!S~~%cO!h~~%jQ$`P$T~{|%p!_!`$r~%wO!n~$`P~%|O!m~~&TQ$`P$T~}!O%p!_!`$rR&`P!jQ!Q![&cP&hT!dP!Q![&c!g!h&w!h!i'i#X#Y&w#Y#Z'iP&zR{|'T}!O'T!Q!['ZP'WP!Q!['ZP'`R!dP!Q!['Z!h!i'i#Y#Z'iP'nO!dP~'sR$S~z{'|!P!Q)T!_!`$r~(PTOz'|z{(`{;'S'|;'S;=`(}<%lO'|~(cVOz'|z{(`{!P'|!P!Q(x!Q;'S'|;'S;=`(}<%lO'|~(}OQ~~)QP;=`<%l'|~)YUP~OY)TZ#O)T#O#P)T#P;'S)T;'S;=`)l<%lO)T~)oP;=`<%l)TP)wV!dP!O!P&c!Q![*^!g!h&w!w!x'i#X#Y&w#i#j'i#l#m*uP*cU!dP!O!P&c!Q![*^!g!h&w!w!x'i#X#Y&w#i#j'iP*xR!Q![+R!c!i+R#T#Z+RP+WT!dP!Q![+R!c!i+R!w!x'i#T#Z+R#i#j'i~+lO!`~~+qO!r~~+vQ$V~!^!_+|!_!`,U~,RP$U~!_!`$r~,ZO$V~R,bP$fP$^Q!_!`#v~,jQ$V~!_!`,U!`!a+|~,uO!_~~,zS#|~!Q![,u!c!},u#R#S,u#T#o,u~-]O!]~~-bO![~~-gP$Y~!_!`$r~-oO!p~~-tQ$Z~!_!`$r#p#q-z~.PO$]~~.UO!o~P.ZO$`P",
|
|
81
|
+
tokenizers: [0, 1],
|
|
82
|
+
topRules: {"Program":[0,3]},
|
|
83
|
+
specialized: [{term: 136, get: (value) => spec_identifier[value] || -1}],
|
|
84
|
+
tokenPrec: 2799
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
// Built-in GLSL ES / desktop GLSL vocabulary — types, qualifiers/keywords,
|
|
88
|
+
// standard-library functions, and the handful of predeclared gl_* variables.
|
|
89
|
+
// Not exhaustive of every dialect variant (e.g. GLSL ES 3.00's image/atomic
|
|
90
|
+
// builtins), just the common surface a shader author actually types.
|
|
91
|
+
const TYPES = [
|
|
92
|
+
"void", "bool", "int", "uint", "float", "double",
|
|
93
|
+
"vec2", "vec3", "vec4", "ivec2", "ivec3", "ivec4",
|
|
94
|
+
"uvec2", "uvec3", "uvec4", "bvec2", "bvec3", "bvec4",
|
|
95
|
+
"mat2", "mat3", "mat4",
|
|
96
|
+
"mat2x2", "mat2x3", "mat2x4", "mat3x2", "mat3x3", "mat3x4", "mat4x2", "mat4x3", "mat4x4",
|
|
97
|
+
"sampler2D", "sampler3D", "samplerCube", "sampler2DArray",
|
|
98
|
+
"sampler2DShadow", "samplerCubeShadow", "isampler2D", "usampler2D",
|
|
99
|
+
];
|
|
100
|
+
const QUALIFIERS = [
|
|
101
|
+
"attribute", "varying", "uniform", "in", "out", "inout", "const",
|
|
102
|
+
"precision", "highp", "mediump", "lowp",
|
|
103
|
+
"invariant", "flat", "noperspective", "smooth", "layout",
|
|
104
|
+
"struct", "return", "if", "else", "for", "while", "do",
|
|
105
|
+
"break", "continue", "discard", "true", "false",
|
|
106
|
+
];
|
|
107
|
+
const FUNCTIONS = [
|
|
108
|
+
"radians", "degrees", "sin", "cos", "tan", "asin", "acos", "atan",
|
|
109
|
+
"sinh", "cosh", "tanh", "asinh", "acosh", "atanh",
|
|
110
|
+
"pow", "exp", "log", "exp2", "log2", "sqrt", "inversesqrt",
|
|
111
|
+
"abs", "sign", "floor", "trunc", "round", "roundEven", "ceil", "fract",
|
|
112
|
+
"mod", "modf", "min", "max", "clamp", "mix", "step", "smoothstep",
|
|
113
|
+
"isnan", "isinf",
|
|
114
|
+
"length", "distance", "dot", "cross", "normalize", "faceforward", "reflect", "refract",
|
|
115
|
+
"matrixCompMult", "outerProduct", "transpose", "inverse", "determinant",
|
|
116
|
+
"lessThan", "lessThanEqual", "greaterThan", "greaterThanEqual", "equal", "notEqual", "any", "all", "not",
|
|
117
|
+
"texture", "texture2D", "textureCube", "textureProj", "textureLod", "texelFetch", "textureSize", "textureGrad",
|
|
118
|
+
"dFdx", "dFdy", "fwidth",
|
|
119
|
+
];
|
|
120
|
+
const VARIABLES = [
|
|
121
|
+
"gl_Position", "gl_PointSize", "gl_FragColor", "gl_FragCoord",
|
|
122
|
+
"gl_FrontFacing", "gl_PointCoord", "gl_FragDepth", "gl_VertexID", "gl_InstanceID",
|
|
123
|
+
];
|
|
124
|
+
const completions = [
|
|
125
|
+
...TYPES.map((label) => ({ label, type: "type" })),
|
|
126
|
+
...QUALIFIERS.map((label) => ({ label, type: "keyword" })),
|
|
127
|
+
...FUNCTIONS.map((label) => ({ label, type: "function", boost: -1 })),
|
|
128
|
+
...VARIABLES.map((label) => ({ label, type: "variable" })),
|
|
129
|
+
];
|
|
130
|
+
const glslCompletionSource = autocomplete.completeFromList(completions);
|
|
131
|
+
|
|
132
|
+
const glslLanguage = language.LRLanguage.define({
|
|
133
|
+
parser: parser.configure({
|
|
134
|
+
props: [
|
|
135
|
+
language.indentNodeProp.add({
|
|
136
|
+
Block: language.delimitedIndent({ closing: "}", align: false }),
|
|
137
|
+
}),
|
|
138
|
+
language.foldNodeProp.add({
|
|
139
|
+
Block: language.foldInside,
|
|
140
|
+
StructDef: language.foldInside,
|
|
141
|
+
}),
|
|
142
|
+
]
|
|
143
|
+
}),
|
|
144
|
+
languageData: {
|
|
145
|
+
commentTokens: { line: "//", block: { open: "/*", close: "*/" } },
|
|
146
|
+
indentOnInput: /^\s*\}$/,
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
function glsl() {
|
|
150
|
+
return new language.LanguageSupport(glslLanguage, glslLanguage.data.of({ autocomplete: glslCompletionSource }));
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
exports.glsl = glsl;
|
|
154
|
+
exports.glslLanguage = glslLanguage;
|
package/index.js
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { LRParser } from '@lezer/lr';
|
|
2
|
+
import { styleTags, tags } from '@lezer/highlight';
|
|
3
|
+
import { LRLanguage, indentNodeProp, delimitedIndent, foldNodeProp, foldInside, LanguageSupport } from '@codemirror/language';
|
|
4
|
+
import { completeFromList } from '@codemirror/autocomplete';
|
|
5
|
+
|
|
6
|
+
const glslHighlighting = styleTags({
|
|
7
|
+
// Keywords
|
|
8
|
+
"if else for while do switch case default return discard break continue": tags.controlKeyword,
|
|
9
|
+
"struct": tags.definitionKeyword,
|
|
10
|
+
"precision": tags.definitionKeyword,
|
|
11
|
+
"layout": tags.definitionKeyword,
|
|
12
|
+
"const in out inout attribute varying uniform centroid flat smooth noperspective invariant precise": tags.modifier,
|
|
13
|
+
"highp mediump lowp": tags.modifier,
|
|
14
|
+
// Type names (built-in types only — identifier fallback handled separately)
|
|
15
|
+
"void bool int uint float": tags.typeName,
|
|
16
|
+
"vec2 vec3 vec4 bvec2 bvec3 bvec4 ivec2 ivec3 ivec4 uvec2 uvec3 uvec4": tags.typeName,
|
|
17
|
+
"mat2 mat3 mat4": tags.typeName,
|
|
18
|
+
"mat2x2 mat2x3 mat2x4 mat3x2 mat3x3 mat3x4 mat4x2 mat4x3 mat4x4": tags.typeName,
|
|
19
|
+
"sampler2D samplerCube sampler3D sampler2DArray": tags.typeName,
|
|
20
|
+
"sampler2DShadow samplerCubeShadow sampler2DArrayShadow": tags.typeName,
|
|
21
|
+
"isampler2D isampler3D isamplerCube isampler2DArray": tags.typeName,
|
|
22
|
+
"usampler2D usampler3D usamplerCube usampler2DArray": tags.typeName,
|
|
23
|
+
// Boolean literals
|
|
24
|
+
"BoolLiteral": tags.bool,
|
|
25
|
+
// Identifiers
|
|
26
|
+
"identifier": tags.variableName,
|
|
27
|
+
// Function definition / prototype name
|
|
28
|
+
"FunctionDef/identifier": tags.function(tags.definition(tags.variableName)),
|
|
29
|
+
"FunctionProto/identifier": tags.function(tags.definition(tags.variableName)),
|
|
30
|
+
// Struct name
|
|
31
|
+
"StructDef/identifier": tags.definition(tags.typeName),
|
|
32
|
+
// Variable declarator name
|
|
33
|
+
"declarator/identifier": tags.definition(tags.variableName),
|
|
34
|
+
// layout(...) item names
|
|
35
|
+
"layoutItem/identifier": tags.propertyName,
|
|
36
|
+
// Literals
|
|
37
|
+
"Literal": tags.number,
|
|
38
|
+
// Comments
|
|
39
|
+
"LineComment": tags.lineComment,
|
|
40
|
+
"BlockComment": tags.blockComment,
|
|
41
|
+
// Preprocessor
|
|
42
|
+
"PreprocessorDirective": tags.processingInstruction,
|
|
43
|
+
// Delimiters
|
|
44
|
+
"{ }": tags.brace,
|
|
45
|
+
"( )": tags.paren,
|
|
46
|
+
"[ ]": tags.squareBracket,
|
|
47
|
+
"; ,": tags.separator,
|
|
48
|
+
". ? :": tags.punctuation,
|
|
49
|
+
// Operators
|
|
50
|
+
"logicalOr logicalAnd": tags.logicOperator,
|
|
51
|
+
"eqOp relOp": tags.compareOperator,
|
|
52
|
+
"shiftOp": tags.bitwiseOperator,
|
|
53
|
+
"addOp": tags.arithmeticOperator,
|
|
54
|
+
"mulOp": tags.arithmeticOperator,
|
|
55
|
+
"unaryOp": tags.operator,
|
|
56
|
+
"assignOp": tags.definitionOperator,
|
|
57
|
+
"| ^ &": tags.bitwiseOperator,
|
|
58
|
+
// Field access dot
|
|
59
|
+
"FieldAccess/\".\"": tags.derefOperator,
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
|
63
|
+
const spec_identifier = {__proto__:null,void:12, bool:14, int:16, uint:18, float:20, vec2:22, vec3:24, vec4:26, bvec2:28, bvec3:30, bvec4:32, ivec2:34, ivec3:36, ivec4:38, uvec2:40, uvec3:42, uvec4:44, mat2:46, mat3:48, mat4:50, mat2x2:52, mat2x3:54, mat2x4:56, mat3x2:58, mat3x3:60, mat3x4:62, mat4x2:64, mat4x3:66, mat4x4:68, sampler2D:70, samplerCube:72, sampler3D:74, sampler2DArray:76, sampler2DShadow:78, samplerCubeShadow:80, sampler2DArrayShadow:82, isampler2D:84, isampler3D:86, isamplerCube:88, isampler2DArray:90, usampler2D:92, usampler3D:94, usamplerCube:96, usampler2DArray:98, const:102, in:104, out:106, inout:108, highp:110, mediump:112, lowp:114, true:136, false:138, return:164, if:168, else:170, for:174, layout:180, attribute:182, varying:184, uniform:186, centroid:188, flat:190, smooth:192, noperspective:194, invariant:196, precise:198, while:204, do:208, switch:212, case:214, default:216, discard:220, break:224, continue:228, struct:234, precision:238};
|
|
64
|
+
const parser = LRParser.deserialize({
|
|
65
|
+
version: 14,
|
|
66
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R%{%sQ!{!QR#s!{TVOWR!qyQ!oyR$P#hV!ly!m#h!QPORW#j$W$^$v%^%b%i%m%o%x&O&Q&R&S&U&Y&Z&[&]&^&hQj^U!ky!m#hT!y!Q!{QsaQ!ToQ!iwQ#Q!VQ#R!WQ#V![Q#W!]Q#X!^Q#Y!_Q#Z!`Q#[!aQ#]!bQ#^!cQ#_!dQ#`!eQ#a!fQ#b!gQ#c!jz$S#j$W$^$v%^%b%i%m%o%x&O&Q&R&S&U&Y&Z&[&]&^&hQ$j#xQ$l#{Q$s$YQ%T$uQ%X$wQ%Z$yQ%`%WQ%h%aQ%k%cQ%n%gQ%}%tQ&V&WQ&_&dQ&b&`Q&c&aR&f&eR#T!W[$V#j$W&O&Q&R&SQ$x$^Q%f%^S%j%b&YS%p%i&ZS%w%m&[S%y%o&]S&P%x&^R&T&UQ%W$vR&e&h!RQORW#j$W$^$v%^%b%i%m%o%x&O&Q&R&S&U&Y&Z&[&]&^&hR!PhQ}hR#n!uSdS$RSl`eQ!SmQ#v!|R$i#t^cS`em!|#t$RR!rzT%r%l%sT!z!Q!{",
|
|
69
|
+
nodeNames: "⚠ LineComment BlockComment Program FunctionDef TypeName void bool int uint float vec2 vec3 vec4 bvec2 bvec3 bvec4 ivec2 ivec3 ivec4 uvec2 uvec3 uvec4 mat2 mat3 mat4 mat2x2 mat2x3 mat2x4 mat3x2 mat3x3 mat3x4 mat4x2 mat4x3 mat4x4 sampler2D samplerCube sampler3D sampler2DArray sampler2DShadow samplerCubeShadow sampler2DArrayShadow isampler2D isampler3D isamplerCube isampler2DArray usampler2D usampler3D usamplerCube usampler2DArray ( const in out inout highp mediump lowp ] [ ArraySuffix ? : UnaryExpr PostfixExpr PrimaryExpr Literal BoolLiteral true false ) FieldAccess . IndexAccess CallArgs , PostfixOp } { Block ; ReturnStmt return IfStmt if else ForStmt for VarDecl LayoutQualifier layout attribute varying uniform centroid flat smooth noperspective invariant precise ExprStmt WhileStmt while DoWhileStmt do SwitchStmt switch case default DiscardStmt discard BreakStmt break ContinueStmt continue FunctionProto StructDef struct PrecisionStmt precision PreprocessorDirective",
|
|
70
|
+
maxTerm: 165,
|
|
71
|
+
nodeProps: [
|
|
72
|
+
["closedBy", 50,")",59,"]",78,"}"],
|
|
73
|
+
["openedBy", 58,"[",70,"(",77,"{"]
|
|
74
|
+
],
|
|
75
|
+
propSources: [glslHighlighting],
|
|
76
|
+
skippedNodes: [0,1,2],
|
|
77
|
+
repeatNodeCount: 11,
|
|
78
|
+
tokenData: ".Z~RrXY#]YZ#]]^#]pq#]qr#nst#{uv$jvw$wxy%Xyz%^z{$j{|%c|}%w}!O%|!O!P&Z!P!Q'n!Q!R)r!R![*^![!]+g!]!^+l!^!_+q!_!`,Z!`!a,e!a!b,p!c!},u!}#O-W#P#Q-]#Q#R-b#R#S,u#T#o,u#o#p-j#p#q-o#q#r.P#r#s.U~#bS#z~XY#]YZ#]]^#]pq#]R#sP$`P!_!`#vQ#{O$WQ~$QU#l~OY#{Z#O#{#O#P#{#P;'S#{;'S;=`$d<%lO#{~$gP;=`<%l#{~$oP$S~!_!`$rQ$wO$^Q~$|Q$X~vw%S!_!`$r~%XO$[~~%^O!S~~%cO!h~~%jQ$`P$T~{|%p!_!`$r~%wO!n~$`P~%|O!m~~&TQ$`P$T~}!O%p!_!`$rR&`P!jQ!Q![&cP&hT!dP!Q![&c!g!h&w!h!i'i#X#Y&w#Y#Z'iP&zR{|'T}!O'T!Q!['ZP'WP!Q!['ZP'`R!dP!Q!['Z!h!i'i#Y#Z'iP'nO!dP~'sR$S~z{'|!P!Q)T!_!`$r~(PTOz'|z{(`{;'S'|;'S;=`(}<%lO'|~(cVOz'|z{(`{!P'|!P!Q(x!Q;'S'|;'S;=`(}<%lO'|~(}OQ~~)QP;=`<%l'|~)YUP~OY)TZ#O)T#O#P)T#P;'S)T;'S;=`)l<%lO)T~)oP;=`<%l)TP)wV!dP!O!P&c!Q![*^!g!h&w!w!x'i#X#Y&w#i#j'i#l#m*uP*cU!dP!O!P&c!Q![*^!g!h&w!w!x'i#X#Y&w#i#j'iP*xR!Q![+R!c!i+R#T#Z+RP+WT!dP!Q![+R!c!i+R!w!x'i#T#Z+R#i#j'i~+lO!`~~+qO!r~~+vQ$V~!^!_+|!_!`,U~,RP$U~!_!`$r~,ZO$V~R,bP$fP$^Q!_!`#v~,jQ$V~!_!`,U!`!a+|~,uO!_~~,zS#|~!Q![,u!c!},u#R#S,u#T#o,u~-]O!]~~-bO![~~-gP$Y~!_!`$r~-oO!p~~-tQ$Z~!_!`$r#p#q-z~.PO$]~~.UO!o~P.ZO$`P",
|
|
79
|
+
tokenizers: [0, 1],
|
|
80
|
+
topRules: {"Program":[0,3]},
|
|
81
|
+
specialized: [{term: 136, get: (value) => spec_identifier[value] || -1}],
|
|
82
|
+
tokenPrec: 2799
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
// Built-in GLSL ES / desktop GLSL vocabulary — types, qualifiers/keywords,
|
|
86
|
+
// standard-library functions, and the handful of predeclared gl_* variables.
|
|
87
|
+
// Not exhaustive of every dialect variant (e.g. GLSL ES 3.00's image/atomic
|
|
88
|
+
// builtins), just the common surface a shader author actually types.
|
|
89
|
+
const TYPES = [
|
|
90
|
+
"void", "bool", "int", "uint", "float", "double",
|
|
91
|
+
"vec2", "vec3", "vec4", "ivec2", "ivec3", "ivec4",
|
|
92
|
+
"uvec2", "uvec3", "uvec4", "bvec2", "bvec3", "bvec4",
|
|
93
|
+
"mat2", "mat3", "mat4",
|
|
94
|
+
"mat2x2", "mat2x3", "mat2x4", "mat3x2", "mat3x3", "mat3x4", "mat4x2", "mat4x3", "mat4x4",
|
|
95
|
+
"sampler2D", "sampler3D", "samplerCube", "sampler2DArray",
|
|
96
|
+
"sampler2DShadow", "samplerCubeShadow", "isampler2D", "usampler2D",
|
|
97
|
+
];
|
|
98
|
+
const QUALIFIERS = [
|
|
99
|
+
"attribute", "varying", "uniform", "in", "out", "inout", "const",
|
|
100
|
+
"precision", "highp", "mediump", "lowp",
|
|
101
|
+
"invariant", "flat", "noperspective", "smooth", "layout",
|
|
102
|
+
"struct", "return", "if", "else", "for", "while", "do",
|
|
103
|
+
"break", "continue", "discard", "true", "false",
|
|
104
|
+
];
|
|
105
|
+
const FUNCTIONS = [
|
|
106
|
+
"radians", "degrees", "sin", "cos", "tan", "asin", "acos", "atan",
|
|
107
|
+
"sinh", "cosh", "tanh", "asinh", "acosh", "atanh",
|
|
108
|
+
"pow", "exp", "log", "exp2", "log2", "sqrt", "inversesqrt",
|
|
109
|
+
"abs", "sign", "floor", "trunc", "round", "roundEven", "ceil", "fract",
|
|
110
|
+
"mod", "modf", "min", "max", "clamp", "mix", "step", "smoothstep",
|
|
111
|
+
"isnan", "isinf",
|
|
112
|
+
"length", "distance", "dot", "cross", "normalize", "faceforward", "reflect", "refract",
|
|
113
|
+
"matrixCompMult", "outerProduct", "transpose", "inverse", "determinant",
|
|
114
|
+
"lessThan", "lessThanEqual", "greaterThan", "greaterThanEqual", "equal", "notEqual", "any", "all", "not",
|
|
115
|
+
"texture", "texture2D", "textureCube", "textureProj", "textureLod", "texelFetch", "textureSize", "textureGrad",
|
|
116
|
+
"dFdx", "dFdy", "fwidth",
|
|
117
|
+
];
|
|
118
|
+
const VARIABLES = [
|
|
119
|
+
"gl_Position", "gl_PointSize", "gl_FragColor", "gl_FragCoord",
|
|
120
|
+
"gl_FrontFacing", "gl_PointCoord", "gl_FragDepth", "gl_VertexID", "gl_InstanceID",
|
|
121
|
+
];
|
|
122
|
+
const completions = [
|
|
123
|
+
...TYPES.map((label) => ({ label, type: "type" })),
|
|
124
|
+
...QUALIFIERS.map((label) => ({ label, type: "keyword" })),
|
|
125
|
+
...FUNCTIONS.map((label) => ({ label, type: "function", boost: -1 })),
|
|
126
|
+
...VARIABLES.map((label) => ({ label, type: "variable" })),
|
|
127
|
+
];
|
|
128
|
+
const glslCompletionSource = completeFromList(completions);
|
|
129
|
+
|
|
130
|
+
const glslLanguage = LRLanguage.define({
|
|
131
|
+
parser: parser.configure({
|
|
132
|
+
props: [
|
|
133
|
+
indentNodeProp.add({
|
|
134
|
+
Block: delimitedIndent({ closing: "}", align: false }),
|
|
135
|
+
}),
|
|
136
|
+
foldNodeProp.add({
|
|
137
|
+
Block: foldInside,
|
|
138
|
+
StructDef: foldInside,
|
|
139
|
+
}),
|
|
140
|
+
]
|
|
141
|
+
}),
|
|
142
|
+
languageData: {
|
|
143
|
+
commentTokens: { line: "//", block: { open: "/*", close: "*/" } },
|
|
144
|
+
indentOnInput: /^\s*\}$/,
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
function glsl() {
|
|
148
|
+
return new LanguageSupport(glslLanguage, glslLanguage.data.of({ autocomplete: glslCompletionSource }));
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export { glsl, glslLanguage };
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@actualwave/codemirror-lang-glsl",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "GLSL (OpenGL Shading Language) syntax support for CodeMirror 6",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"codemirror",
|
|
7
|
+
"codemirror-language",
|
|
8
|
+
"glsl",
|
|
9
|
+
"opengl",
|
|
10
|
+
"webgl",
|
|
11
|
+
"shader",
|
|
12
|
+
"syntax-highlighting",
|
|
13
|
+
"lezer"
|
|
14
|
+
],
|
|
15
|
+
"author": "Oleg Galaburda <burdiuz@gmail.com>",
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "https://github.com/burdiuz/codemorror-lang-modules.git",
|
|
19
|
+
"directory": "packages/glsl"
|
|
20
|
+
},
|
|
21
|
+
"bugs": {
|
|
22
|
+
"url": "https://github.com/burdiuz/codemorror-lang-modules/issues"
|
|
23
|
+
},
|
|
24
|
+
"homepage": "https://github.com/burdiuz/codemorror-lang-modules/tree/main/packages/glsl#readme",
|
|
25
|
+
"scripts": {
|
|
26
|
+
"test": "mocha test/test.js",
|
|
27
|
+
"build": "rollup -c"
|
|
28
|
+
},
|
|
29
|
+
"publishConfig": {
|
|
30
|
+
"directory": "dist"
|
|
31
|
+
},
|
|
32
|
+
"type": "module",
|
|
33
|
+
"main": "index.cjs",
|
|
34
|
+
"module": "index.js",
|
|
35
|
+
"exports": {
|
|
36
|
+
"types": "./types/index.d.ts",
|
|
37
|
+
"import": "./index.js",
|
|
38
|
+
"require": "./index.cjs"
|
|
39
|
+
},
|
|
40
|
+
"types": "types/index.d.ts",
|
|
41
|
+
"sideEffects": false,
|
|
42
|
+
"peerDependencies": {
|
|
43
|
+
"@codemirror/autocomplete": "^6.0.0",
|
|
44
|
+
"@codemirror/language": "^6.0.0",
|
|
45
|
+
"@lezer/highlight": "^1.0.0",
|
|
46
|
+
"@lezer/lr": "^1.0.0"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@codemirror/autocomplete": "^6.20.3",
|
|
50
|
+
"@lezer/generator": "^1.0.0",
|
|
51
|
+
"@rollup/plugin-typescript": "^12.1.4",
|
|
52
|
+
"@types/node": "^24.1.0",
|
|
53
|
+
"mocha": "^11.7.1",
|
|
54
|
+
"rollup": "^4.45.1",
|
|
55
|
+
"rollup-plugin-copy": "^3.5.0",
|
|
56
|
+
"tslib": "^2.8.1",
|
|
57
|
+
"typescript": "^5.8.3"
|
|
58
|
+
},
|
|
59
|
+
"license": "MIT"
|
|
60
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"completion.d.ts","sourceRoot":"","sources":["../../src/completion.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,0BAA0B,CAAA;AAmD9D,eAAO,MAAM,oBAAoB,EAAE,gBAAgD,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"highlight.d.ts","sourceRoot":"","sources":["../../src/highlight.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB,wCAmE3B,CAAA"}
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,UAAU,EAAE,eAAe,EAA4D,MAAM,sBAAsB,CAAA;AAG3H,eAAO,MAAM,YAAY,YAgBvB,CAAA;AAEF,wBAAgB,IAAI,oBAEnB"}
|