@robot-inventor/regex-syntax 1.0.3 → 1.0.5

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 CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2024 ろぼいん
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.
1
+ MIT License
2
+
3
+ Copyright (c) 2024 ろぼいん
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 CHANGED
@@ -5,17 +5,24 @@ Grammar files for syntax highlight of regex. The grammar files are automatically
5
5
  > [!NOTE]
6
6
  > You may also be interested in [shell-session-syntax](https://github.com/Robot-Inventor/shell-session-syntax/) for syntax highlight of shell sessions.
7
7
 
8
- |Before|After|
9
- |:---:|:---:|
10
- |![before](docs/without-regex-syntax.png)|![after](docs/regex-syntax.png)|
8
+ | Before | After |
9
+ | :--------------------------------------: | :-----------------------------: |
10
+ | ![before](docs/without-regex-syntax.png) | ![after](docs/regex-syntax.png) |
11
11
 
12
12
  ## Usage
13
13
 
14
- To use regex-syntax in [Shiki.js](https://shiki.style/), please download ``./syntaxes/regex.tmLanguage.json`` and load it as a custom language grammar. Language name is ``regex`` and ``regexp``.
14
+ To use regex-syntax in [Shiki.js](https://shiki.style/), please download ``./syntaxes/regex.tmLanguage.json`` or install the package and load it as a custom language grammar. Language name is ``regex`` and ``regexp``.
15
15
 
16
- ```javascript
16
+ ```bash
17
+ npm install @robot-inventor/regex-syntax
18
+ ```
19
+
20
+ ```typescript
17
21
  import { getHighlighter } from "shiki";
18
- import regex from "./regex.tmLanguage.json" assert { type: "json" };
22
+ // Directly import the downloaded file.
23
+ import regex from "./regex.tmLanguage.json";
24
+ // Or import the package.
25
+ import regex from "@robot-inventor/regex-syntax";
19
26
 
20
27
  const code = `
21
28
  ^[a-zA-Z0-9.!#$%&'*+/=?^_\`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$
package/package.json CHANGED
@@ -1,38 +1,43 @@
1
- {
2
- "name": "@robot-inventor/regex-syntax",
3
- "version": "1.0.3",
4
- "description": "Grammar files for syntax highlight of regex.",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
7
- "type": "module",
8
- "files": [
9
- "dist",
10
- "syntaxes"
11
- ],
12
- "scripts": {
13
- "test": "echo \"Error: no test specified\" && exit 1",
14
- "build": "ts-node ./scripts/generate.ts && tsc"
15
- },
16
- "publishConfig": {
17
- "access": "public"
18
- },
19
- "repository": {
20
- "type": "git",
21
- "url": "git+https://github.com/Robot-Inventor/regex-syntax.git"
22
- },
23
- "author": "Robot-Inventor",
24
- "license": "MIT",
25
- "bugs": {
26
- "url": "https://github.com/Robot-Inventor/regex-syntax/issues"
27
- },
28
- "homepage": "https://github.com/Robot-Inventor/regex-syntax#readme",
29
- "devDependencies": {
30
- "rss-parser": "^3.13.0",
31
- "tar": "^7.0.0",
32
- "ts-node": "^10.9.2",
33
- "typescript": "^5.4.2"
34
- },
35
- "dependencies": {
36
- "shiki": "^1.3.0"
37
- }
38
- }
1
+ {
2
+ "name": "@robot-inventor/regex-syntax",
3
+ "version": "1.0.5",
4
+ "description": "Grammar files for syntax highlight of regex.",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "type": "module",
8
+ "files": [
9
+ "dist",
10
+ "syntaxes"
11
+ ],
12
+ "scripts": {
13
+ "test": "echo \"Error: no test specified\" && exit 1",
14
+ "build": "ts-node ./scripts/generate.ts && tsc",
15
+ "ci:version": "changeset version",
16
+ "ci:publish": "tsc && changeset publish"
17
+ },
18
+ "publishConfig": {
19
+ "access": "public",
20
+ "provenance": true
21
+ },
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git+https://github.com/Robot-Inventor/regex-syntax.git"
25
+ },
26
+ "author": "Robot-Inventor",
27
+ "license": "MIT",
28
+ "bugs": {
29
+ "url": "https://github.com/Robot-Inventor/regex-syntax/issues"
30
+ },
31
+ "homepage": "https://github.com/Robot-Inventor/regex-syntax#readme",
32
+ "devDependencies": {
33
+ "@changesets/changelog-github": "^0.5.0",
34
+ "@changesets/cli": "^2.27.1",
35
+ "rss-parser": "^3.13.0",
36
+ "tar": "^7.0.0",
37
+ "ts-node": "^10.9.2",
38
+ "typescript": "^5.4.2"
39
+ },
40
+ "dependencies": {
41
+ "shiki": "^1.3.0"
42
+ }
43
+ }
@@ -1,167 +1,167 @@
1
- {
2
- "information_for_contributors": [
3
- "This file is autogenerated. Do not edit it manually. Instead, edit the `generate.ts` script and run it.",
4
- "Sources for this file are:",
5
- "https://github.com/github-linguist/linguist/"
6
- ],
7
- "lastUpdated": "2024-04-29T00:57:43.416Z",
8
- "regexGrammarVersion": "v7.29.0",
9
- "name": "regex",
10
- "aliases": [
11
- "regexp"
12
- ],
13
- "scopeName": "text.regex",
14
- "patterns": [
15
- {
16
- "include": "#regexp"
17
- }
18
- ],
19
- "repository": {
20
- "regex-character-class": {
21
- "patterns": [
22
- {
23
- "name": "constant.character.character-class.regexp",
24
- "match": "\\\\[wWsSdDtrnvf]|\\."
25
- },
26
- {
27
- "name": "constant.character.numeric.regexp",
28
- "match": "\\\\([0-7]{3}|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4})"
29
- },
30
- {
31
- "name": "constant.character.control.regexp",
32
- "match": "\\\\c[A-Z]"
33
- },
34
- {
35
- "name": "constant.character.escape.backslash.regexp",
36
- "match": "\\\\."
37
- }
38
- ]
39
- },
40
- "regexp": {
41
- "patterns": [
42
- {
43
- "name": "keyword.control.anchor.regexp",
44
- "match": "\\\\[bB]|\\^|\\$"
45
- },
46
- {
47
- "name": "keyword.other.back-reference.regexp",
48
- "match": "\\\\[1-9]\\d*|\\\\k<[a-zA-Z_$][\\w$]*>"
49
- },
50
- {
51
- "name": "keyword.operator.quantifier.regexp",
52
- "match": "[?+*]|\\{(\\d+,\\d+|\\d+,|,\\d+|\\d+)\\}\\??"
53
- },
54
- {
55
- "name": "keyword.operator.or.regexp",
56
- "match": "\\|"
57
- },
58
- {
59
- "name": "meta.group.assertion.regexp",
60
- "begin": "(\\()(?:(\\?=)|(\\?!)|(\\?<=)|(\\?<!))",
61
- "end": "(\\))",
62
- "patterns": [
63
- {
64
- "include": "#regexp"
65
- }
66
- ],
67
- "beginCaptures": {
68
- "1": {
69
- "name": "punctuation.definition.group.regexp"
70
- },
71
- "2": {
72
- "name": "meta.assertion.look-ahead.regexp"
73
- },
74
- "3": {
75
- "name": "meta.assertion.negative-look-ahead.regexp"
76
- },
77
- "4": {
78
- "name": "meta.assertion.look-behind.regexp"
79
- },
80
- "5": {
81
- "name": "meta.assertion.negative-look-behind.regexp"
82
- }
83
- },
84
- "endCaptures": {
85
- "1": {
86
- "name": "punctuation.definition.group.regexp"
87
- }
88
- }
89
- },
90
- {
91
- "name": "meta.group.regexp",
92
- "begin": "\\(((\\?:)|(\\?<[a-zA-Z_$][\\w$]*>))?",
93
- "end": "\\)",
94
- "patterns": [
95
- {
96
- "include": "#regexp"
97
- }
98
- ],
99
- "beginCaptures": {
100
- "0": {
101
- "name": "punctuation.definition.group.regexp"
102
- }
103
- },
104
- "endCaptures": {
105
- "0": {
106
- "name": "punctuation.definition.group.regexp"
107
- }
108
- }
109
- },
110
- {
111
- "name": "constant.other.character-class.set.regexp",
112
- "begin": "(\\[)(\\^)?",
113
- "end": "(\\])",
114
- "patterns": [
115
- {
116
- "name": "constant.other.character-class.range.regexp",
117
- "match": "(?:.|(\\\\(?:[0-7]{3}|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}))|(\\\\c[A-Z])|(\\\\.))\\-(?:[^\\]\\\\]|(\\\\(?:[0-7]{3}|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}))|(\\\\c[A-Z])|(\\\\.))",
118
- "captures": {
119
- "1": {
120
- "name": "constant.character.numeric.regexp"
121
- },
122
- "2": {
123
- "name": "constant.character.control.regexp"
124
- },
125
- "3": {
126
- "name": "constant.character.escape.backslash.regexp"
127
- },
128
- "4": {
129
- "name": "constant.character.numeric.regexp"
130
- },
131
- "5": {
132
- "name": "constant.character.control.regexp"
133
- },
134
- "6": {
135
- "name": "constant.character.escape.backslash.regexp"
136
- }
137
- }
138
- },
139
- {
140
- "include": "#regex-character-class"
141
- }
142
- ],
143
- "beginCaptures": {
144
- "1": {
145
- "name": "punctuation.definition.character-class.regexp"
146
- },
147
- "2": {
148
- "name": "keyword.operator.negation.regexp"
149
- }
150
- },
151
- "endCaptures": {
152
- "1": {
153
- "name": "punctuation.definition.character-class.regexp"
154
- }
155
- }
156
- },
157
- {
158
- "include": "#regex-character-class"
159
- },
160
- {
161
- "match": ".",
162
- "name": "string.regexp"
163
- }
164
- ]
165
- }
166
- }
1
+ {
2
+ "information_for_contributors": [
3
+ "This file is autogenerated. Do not edit it manually. Instead, edit the `generate.ts` script and run it.",
4
+ "Sources for this file are:",
5
+ "https://github.com/github-linguist/linguist/"
6
+ ],
7
+ "lastUpdated": "2024-04-29T00:57:43.416Z",
8
+ "regexGrammarVersion": "v7.29.0",
9
+ "name": "regex",
10
+ "aliases": [
11
+ "regexp"
12
+ ],
13
+ "scopeName": "text.regex",
14
+ "patterns": [
15
+ {
16
+ "include": "#regexp"
17
+ }
18
+ ],
19
+ "repository": {
20
+ "regex-character-class": {
21
+ "patterns": [
22
+ {
23
+ "name": "constant.character.character-class.regexp",
24
+ "match": "\\\\[wWsSdDtrnvf]|\\."
25
+ },
26
+ {
27
+ "name": "constant.character.numeric.regexp",
28
+ "match": "\\\\([0-7]{3}|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4})"
29
+ },
30
+ {
31
+ "name": "constant.character.control.regexp",
32
+ "match": "\\\\c[A-Z]"
33
+ },
34
+ {
35
+ "name": "constant.character.escape.backslash.regexp",
36
+ "match": "\\\\."
37
+ }
38
+ ]
39
+ },
40
+ "regexp": {
41
+ "patterns": [
42
+ {
43
+ "name": "keyword.control.anchor.regexp",
44
+ "match": "\\\\[bB]|\\^|\\$"
45
+ },
46
+ {
47
+ "name": "keyword.other.back-reference.regexp",
48
+ "match": "\\\\[1-9]\\d*|\\\\k<[a-zA-Z_$][\\w$]*>"
49
+ },
50
+ {
51
+ "name": "keyword.operator.quantifier.regexp",
52
+ "match": "[?+*]|\\{(\\d+,\\d+|\\d+,|,\\d+|\\d+)\\}\\??"
53
+ },
54
+ {
55
+ "name": "keyword.operator.or.regexp",
56
+ "match": "\\|"
57
+ },
58
+ {
59
+ "name": "meta.group.assertion.regexp",
60
+ "begin": "(\\()(?:(\\?=)|(\\?!)|(\\?<=)|(\\?<!))",
61
+ "end": "(\\))",
62
+ "patterns": [
63
+ {
64
+ "include": "#regexp"
65
+ }
66
+ ],
67
+ "beginCaptures": {
68
+ "1": {
69
+ "name": "punctuation.definition.group.regexp"
70
+ },
71
+ "2": {
72
+ "name": "meta.assertion.look-ahead.regexp"
73
+ },
74
+ "3": {
75
+ "name": "meta.assertion.negative-look-ahead.regexp"
76
+ },
77
+ "4": {
78
+ "name": "meta.assertion.look-behind.regexp"
79
+ },
80
+ "5": {
81
+ "name": "meta.assertion.negative-look-behind.regexp"
82
+ }
83
+ },
84
+ "endCaptures": {
85
+ "1": {
86
+ "name": "punctuation.definition.group.regexp"
87
+ }
88
+ }
89
+ },
90
+ {
91
+ "name": "meta.group.regexp",
92
+ "begin": "\\(((\\?:)|(\\?<[a-zA-Z_$][\\w$]*>))?",
93
+ "end": "\\)",
94
+ "patterns": [
95
+ {
96
+ "include": "#regexp"
97
+ }
98
+ ],
99
+ "beginCaptures": {
100
+ "0": {
101
+ "name": "punctuation.definition.group.regexp"
102
+ }
103
+ },
104
+ "endCaptures": {
105
+ "0": {
106
+ "name": "punctuation.definition.group.regexp"
107
+ }
108
+ }
109
+ },
110
+ {
111
+ "name": "constant.other.character-class.set.regexp",
112
+ "begin": "(\\[)(\\^)?",
113
+ "end": "(\\])",
114
+ "patterns": [
115
+ {
116
+ "name": "constant.other.character-class.range.regexp",
117
+ "match": "(?:.|(\\\\(?:[0-7]{3}|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}))|(\\\\c[A-Z])|(\\\\.))\\-(?:[^\\]\\\\]|(\\\\(?:[0-7]{3}|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}))|(\\\\c[A-Z])|(\\\\.))",
118
+ "captures": {
119
+ "1": {
120
+ "name": "constant.character.numeric.regexp"
121
+ },
122
+ "2": {
123
+ "name": "constant.character.control.regexp"
124
+ },
125
+ "3": {
126
+ "name": "constant.character.escape.backslash.regexp"
127
+ },
128
+ "4": {
129
+ "name": "constant.character.numeric.regexp"
130
+ },
131
+ "5": {
132
+ "name": "constant.character.control.regexp"
133
+ },
134
+ "6": {
135
+ "name": "constant.character.escape.backslash.regexp"
136
+ }
137
+ }
138
+ },
139
+ {
140
+ "include": "#regex-character-class"
141
+ }
142
+ ],
143
+ "beginCaptures": {
144
+ "1": {
145
+ "name": "punctuation.definition.character-class.regexp"
146
+ },
147
+ "2": {
148
+ "name": "keyword.operator.negation.regexp"
149
+ }
150
+ },
151
+ "endCaptures": {
152
+ "1": {
153
+ "name": "punctuation.definition.character-class.regexp"
154
+ }
155
+ }
156
+ },
157
+ {
158
+ "include": "#regex-character-class"
159
+ },
160
+ {
161
+ "match": ".",
162
+ "name": "string.regexp"
163
+ }
164
+ ]
165
+ }
166
+ }
167
167
  }