ZedScripts 1.1.0__tar.gz → 1.2.0__tar.gz

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.
Files changed (45) hide show
  1. {zedscripts-1.1.0/src/ZedScripts.egg-info → zedscripts-1.2.0}/PKG-INFO +22 -1
  2. {zedscripts-1.1.0 → zedscripts-1.2.0}/README.md +19 -0
  3. {zedscripts-1.1.0 → zedscripts-1.2.0}/pyproject.toml +7 -1
  4. {zedscripts-1.1.0 → zedscripts-1.2.0}/src/ZedScripts/__about__.py +1 -1
  5. {zedscripts-1.1.0 → zedscripts-1.2.0}/src/ZedScripts/enums/Diagnostic.py +7 -0
  6. {zedscripts-1.1.0 → zedscripts-1.2.0}/src/ZedScripts/locale/en.json +3 -1
  7. {zedscripts-1.1.0 → zedscripts-1.2.0}/src/ZedScripts/scripts/value.py +9 -3
  8. {zedscripts-1.1.0 → zedscripts-1.2.0}/src/ZedScripts/server.py +1 -1
  9. zedscripts-1.2.0/src/ZedScripts/structure/pygments_lexer.py +79 -0
  10. {zedscripts-1.1.0 → zedscripts-1.2.0}/src/ZedScripts/tests/parser/test_lexer.py +79 -22
  11. {zedscripts-1.1.0 → zedscripts-1.2.0/src/ZedScripts.egg-info}/PKG-INFO +22 -1
  12. {zedscripts-1.1.0 → zedscripts-1.2.0}/src/ZedScripts.egg-info/SOURCES.txt +2 -0
  13. zedscripts-1.2.0/src/ZedScripts.egg-info/entry_points.txt +2 -0
  14. {zedscripts-1.1.0 → zedscripts-1.2.0}/src/ZedScripts.egg-info/requires.txt +3 -0
  15. {zedscripts-1.1.0 → zedscripts-1.2.0}/LICENSE +0 -0
  16. {zedscripts-1.1.0 → zedscripts-1.2.0}/setup.cfg +0 -0
  17. {zedscripts-1.1.0 → zedscripts-1.2.0}/src/ZedScripts/__init__.py +0 -0
  18. {zedscripts-1.1.0 → zedscripts-1.2.0}/src/ZedScripts/enums/SyntaxErrorType.py +0 -0
  19. {zedscripts-1.1.0 → zedscripts-1.2.0}/src/ZedScripts/environment/__init__.py +0 -0
  20. {zedscripts-1.1.0 → zedscripts-1.2.0}/src/ZedScripts/environment/config.py +0 -0
  21. {zedscripts-1.1.0 → zedscripts-1.2.0}/src/ZedScripts/environment/document.py +0 -0
  22. {zedscripts-1.1.0 → zedscripts-1.2.0}/src/ZedScripts/environment/mod.py +0 -0
  23. {zedscripts-1.1.0 → zedscripts-1.2.0}/src/ZedScripts/environment/version.py +0 -0
  24. {zedscripts-1.1.0 → zedscripts-1.2.0}/src/ZedScripts/environment/workspace.py +0 -0
  25. {zedscripts-1.1.0 → zedscripts-1.2.0}/src/ZedScripts/main.py +0 -0
  26. {zedscripts-1.1.0 → zedscripts-1.2.0}/src/ZedScripts/providers/actions.py +0 -0
  27. {zedscripts-1.1.0 → zedscripts-1.2.0}/src/ZedScripts/providers/capabilities.py +0 -0
  28. {zedscripts-1.1.0 → zedscripts-1.2.0}/src/ZedScripts/providers/debug.py +0 -0
  29. {zedscripts-1.1.0 → zedscripts-1.2.0}/src/ZedScripts/providers/diagnostics.py +0 -0
  30. {zedscripts-1.1.0 → zedscripts-1.2.0}/src/ZedScripts/providers/hover.py +0 -0
  31. {zedscripts-1.1.0 → zedscripts-1.2.0}/src/ZedScripts/providers/http.py +0 -0
  32. {zedscripts-1.1.0 → zedscripts-1.2.0}/src/ZedScripts/providers/locale.py +0 -0
  33. {zedscripts-1.1.0 → zedscripts-1.2.0}/src/ZedScripts/providers/notifications.py +0 -0
  34. {zedscripts-1.1.0 → zedscripts-1.2.0}/src/ZedScripts/providers/semantic_tokens.py +0 -0
  35. {zedscripts-1.1.0 → zedscripts-1.2.0}/src/ZedScripts/scripts/__init__.py +0 -0
  36. {zedscripts-1.1.0 → zedscripts-1.2.0}/src/ZedScripts/scripts/block.py +0 -0
  37. {zedscripts-1.1.0 → zedscripts-1.2.0}/src/ZedScripts/scripts/dataset.py +0 -0
  38. {zedscripts-1.1.0 → zedscripts-1.2.0}/src/ZedScripts/scripts/version.py +0 -0
  39. {zedscripts-1.1.0 → zedscripts-1.2.0}/src/ZedScripts/structure/ast.py +0 -0
  40. {zedscripts-1.1.0 → zedscripts-1.2.0}/src/ZedScripts/structure/lexer.py +0 -0
  41. {zedscripts-1.1.0 → zedscripts-1.2.0}/src/ZedScripts/structure/parser.py +0 -0
  42. {zedscripts-1.1.0 → zedscripts-1.2.0}/src/ZedScripts/utils.py +0 -0
  43. {zedscripts-1.1.0 → zedscripts-1.2.0}/src/ZedScripts.egg-info/dependency_links.txt +0 -0
  44. {zedscripts-1.1.0 → zedscripts-1.2.0}/src/ZedScripts.egg-info/top_level.txt +0 -0
  45. {zedscripts-1.1.0 → zedscripts-1.2.0}/tests/test_config_cli.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ZedScripts
3
- Version: 1.1.0
3
+ Version: 1.2.0
4
4
  Author: SimKDT
5
5
  License: MIT License
6
6
 
@@ -38,6 +38,8 @@ Provides-Extra: debug
38
38
  Requires-Dist: debugpy; extra == "debug"
39
39
  Provides-Extra: test
40
40
  Requires-Dist: pytest; extra == "test"
41
+ Provides-Extra: pygments
42
+ Requires-Dist: pygments; extra == "pygments"
41
43
  Dynamic: license-file
42
44
 
43
45
  # ZedScripts LSP
@@ -244,5 +246,24 @@ autocmd User LspSetup call LspAddServer(lspServers)
244
246
  > [!NOTE]
245
247
  > You can see [this video](https://www.youtube.com/watch?v=-5lb_jLQmKc) which explains how to set up VIM, and notably setup a LSP server.
246
248
 
249
+ ## Pygments
250
+
251
+ The ZedScripts LSP provides a Pygments lexer for syntax highlighting of ZedScripts code. It is available in the `ZedScripts.structure.pygments_lexer` module. You can notably use the command-line wrapper to highlight any file's content as ZedScripts:
252
+
253
+ ```bash
254
+ uv pip install ZedScripts[pygments]
255
+ highlight-zedscripts path/to/file.txt
256
+ ```
257
+
258
+ ![Screenshot of the output of highlight-zedscripts command on an example script file](assets/pygments_implementation.png)
259
+
260
+ To use the lexer in Sphinx docs, you can add the following to your `conf.py`:
261
+
262
+ ```python
263
+ from ZedScripts.structure.pygments_lexer import ZedScriptsLexer
264
+ from sphinx.highlighting import lexers
265
+ lexers['zedscripts'] = ZedScriptsLexer()
266
+ ```
267
+
247
268
  ## License and contribution
248
269
  This project is licensed under a [MIT license](LICENSE). Before contributing to the project, please see [CONTRIBUTING](CONTRIBUTING.md).
@@ -202,5 +202,24 @@ autocmd User LspSetup call LspAddServer(lspServers)
202
202
  > [!NOTE]
203
203
  > You can see [this video](https://www.youtube.com/watch?v=-5lb_jLQmKc) which explains how to set up VIM, and notably setup a LSP server.
204
204
 
205
+ ## Pygments
206
+
207
+ The ZedScripts LSP provides a Pygments lexer for syntax highlighting of ZedScripts code. It is available in the `ZedScripts.structure.pygments_lexer` module. You can notably use the command-line wrapper to highlight any file's content as ZedScripts:
208
+
209
+ ```bash
210
+ uv pip install ZedScripts[pygments]
211
+ highlight-zedscripts path/to/file.txt
212
+ ```
213
+
214
+ ![Screenshot of the output of highlight-zedscripts command on an example script file](assets/pygments_implementation.png)
215
+
216
+ To use the lexer in Sphinx docs, you can add the following to your `conf.py`:
217
+
218
+ ```python
219
+ from ZedScripts.structure.pygments_lexer import ZedScriptsLexer
220
+ from sphinx.highlighting import lexers
221
+ lexers['zedscripts'] = ZedScriptsLexer()
222
+ ```
223
+
205
224
  ## License and contribution
206
225
  This project is licensed under a [MIT license](LICENSE). Before contributing to the project, please see [CONTRIBUTING](CONTRIBUTING.md).
@@ -3,7 +3,7 @@ name = "ZedScripts"
3
3
  description = ""
4
4
  readme = { file = "README.md", content-type = "text/markdown" }
5
5
  requires-python = ">=3.12.3"
6
- version = "1.1.0"
6
+ version = "1.2.0"
7
7
  license = {file = "LICENSE"}
8
8
  authors = [
9
9
  { name = "SimKDT" },
@@ -26,12 +26,18 @@ debug = [
26
26
  test = [
27
27
  "pytest"
28
28
  ]
29
+ pygments = [
30
+ "pygments"
31
+ ]
29
32
 
30
33
  # used to load locale JSON files
31
34
  [build-system]
32
35
  requires = ["setuptools>=61"]
33
36
  build-backend = "setuptools.build_meta"
34
37
 
38
+ [project.scripts]
39
+ highlight-zedscripts = "ZedScripts.structure.pygments_lexer:main"
40
+
35
41
  [tool.setuptools.package-data]
36
42
  ZedScripts = [
37
43
  "locale/*.json"
@@ -1,4 +1,4 @@
1
- __version__ = "1.1.0"
1
+ __version__ = "1.2.0"
2
2
 
3
3
  def main():
4
4
  print(__version__)
@@ -52,6 +52,9 @@ class DiagnosticType(enum.StrEnum):
52
52
  VALUE_UNMATCHED_BLOCK_REF = enum.auto()
53
53
  VALUE_MULTIPLE_BLOCK_REFS = enum.auto()
54
54
 
55
+ # debug
56
+ DEBUG_MISSING_PARAMETER_DESCRIPTION = enum.auto()
57
+
55
58
 
56
59
  # syntax diagnostics
57
60
  DiagnosticDefinition(DiagnosticType.PARSER_TOO_MANY_CLOSING_BRACKETS,
@@ -155,6 +158,10 @@ DiagnosticDefinition(DiagnosticType.VALUE_MULTIPLE_BLOCK_REFS,
155
158
  DiagnosticSeverity.Error,
156
159
  args={"value": str, "parameter": str, "expected_block": str})
157
160
 
161
+ DiagnosticDefinition(DiagnosticType.DEBUG_MISSING_PARAMETER_DESCRIPTION,
162
+ DiagnosticSeverity.Information,
163
+ args={"type": str, "key": str})
164
+
158
165
 
159
166
  # ensure that all diagnostic types have a corresponding definition
160
167
  for diagnostic_type in DiagnosticType:
@@ -33,6 +33,8 @@
33
33
  "VALUE_CANNOT_PROVIDE_MODULE": "Value '{value}' cannot contain a module '{module}' reference, only direct block references are allowed.",
34
34
  "VALUE_BLOCK_REF_CANNOT_BE_EMPTY": "Value '{value}' has an empty block reference, which is not allowed.",
35
35
  "VALUE_UNMATCHED_BLOCK_REF": "Value '{value}' for parameter '{parameter}' does not match any existing block (expects '{expected_block}' block). Make sure the referenced block exists.",
36
- "VALUE_MULTIPLE_BLOCK_REFS": "Multiple block references found for '{value}' for parameter '{parameter}' (expects '{expected_block}' block). Make sure duplicate block references are not present."
36
+ "VALUE_MULTIPLE_BLOCK_REFS": "Multiple block references found for '{value}' for parameter '{parameter}' (expects '{expected_block}' block). Make sure duplicate block references are not present.",
37
+
38
+ "DEBUG_MISSING_PARAMETER_DESCRIPTION": "DEBUG: Parameter '{key}' in block '{type}' is missing a description."
37
39
  }
38
40
  }
@@ -240,7 +240,7 @@ class Value(Element["ValueNode"]):
240
240
  if not dataset.can_block_have_parameter(parent_type, key):
241
241
  return ''
242
242
  param_data = dataset.get_parameter_data(parent_type, key)
243
- return param_data.get('description', '') if param_data else ''
243
+ return param_data.get('description', '')
244
244
 
245
245
  def get_scriptsdocs_url(self, tree: list[str]) -> str | None:
246
246
  return self.parent.get_scriptsdocs_url(tree) + f"#scripts-{self.parent.type}-{self.key()}".replace(' ', '-').lower()
@@ -413,6 +413,14 @@ class Value(Element["ValueNode"]):
413
413
 
414
414
  param_data = dataset.get_parameter_data(parent_type, key)
415
415
 
416
+ # DEBUG: add information diagnostic if there is not description for the parameter
417
+ if not param_data.get('description', ''):
418
+ self.parent.add_diagnostic(
419
+ type=DiagnosticType.DEBUG_MISSING_PARAMETER_DESCRIPTION,
420
+ location=key_node.to_range(),
421
+ args={"type": parent_type, "key": key}
422
+ )
423
+
416
424
  # do the type highlight before anything else
417
425
  # so we highlight by type even if the value is otherwise invalid
418
426
  type_data = param_data.get('type')
@@ -652,8 +660,6 @@ class Value(Element["ValueNode"]):
652
660
  )
653
661
  return False
654
662
 
655
- # TODO: look for the source block
656
-
657
663
  root = self.parent.get_root()
658
664
 
659
665
  # retrieve imports
@@ -47,7 +47,7 @@ class ZedServer(LanguageServer):
47
47
  try:
48
48
  import debugpy
49
49
  except ImportError:
50
- logging.error("debugpy is not installed. Debugging will not be available.")
50
+ logging.error("debugpy is not installed. Debugging will not be available. Install the `debug` group dependencies (`pip install ZedScripts[debug]`).")
51
51
  return
52
52
 
53
53
  debug_port = 5678
@@ -0,0 +1,79 @@
1
+ try:
2
+ from pygments.lexer import RegexLexer, bygroups
3
+ from pygments import token
4
+ from pygments.formatter import Formatter
5
+ except ImportError:
6
+ raise ImportError("Pygments is required to use this module, install the `pygments` group dependencies (`pip install ZedScripts[pygments]`).")
7
+
8
+
9
+ class ZedScriptsLexer(RegexLexer):
10
+ name = "ZedScripts"
11
+ aliases = ["zedscripts"]
12
+
13
+ tokens = {
14
+ "root": [
15
+ (r'/\*', token.Comment.Multiline, 'comment'),
16
+
17
+ (r"[,;:|!={}\[\]]", token.Operator),
18
+ (r"(\S+[\S\/ ]*?)(\s*)(=)(\s*)",
19
+ bygroups(
20
+ token.Name.Attribute,
21
+ token.Whitespace,
22
+ token.Operator,
23
+ token.Whitespace,
24
+ )),
25
+ (r"^(\s*)(\w+)(\s+)(|[\w !*.:\/]+?)(\s*)({)(\s*)$",
26
+ bygroups(
27
+ token.Whitespace,
28
+ token.Keyword.Declaration,
29
+ token.Whitespace,
30
+ token.Name.Class,
31
+ token.Whitespace,
32
+ token.Operator,
33
+ token.Whitespace)),
34
+ (r"(?<!\w)-?\d+\.\d+", token.Number.Float),
35
+ (r"(?<!\w)-?\d+", token.Number.Integer),
36
+ (r"\w+\.\w+", token.String.Double),
37
+ # (r"\s+", token.Text),
38
+ (r"[^\S\n]+", token.Whitespace),
39
+ (r"\n", token.Whitespace),
40
+ (r"[^\s,;:|!={}/]+", token.Text),
41
+ (r"/(?!\*)", token.Text),
42
+ ],
43
+ 'comment': [
44
+ (r'[^*]+', token.Comment.Multiline),
45
+ (r'\*/', token.Comment.Multiline, '#pop'),
46
+ (r'\*', token.Comment.Multiline),
47
+ ],
48
+ }
49
+
50
+ def highlight_zedscripts(code: str, formatter: Formatter) -> str:
51
+ from pygments import highlight
52
+
53
+ return highlight(code, ZedScriptsLexer(), formatter)
54
+
55
+ def main():
56
+ import argparse
57
+ parser = argparse.ArgumentParser(description="Highlight ZedScripts code using Pygments.")
58
+ parser.add_argument("file",
59
+ help="Path to the ZedScripts file to highlight.")
60
+ parser.add_argument("-x", "--xterm", action="store_true",
61
+ help="Use Terminal256Formatter for pygments output.")
62
+ parser.add_argument("-t", "--tokens", action="store_true",
63
+ help="Show the tokens instead of the highlighted code.")
64
+ args = parser.parse_args()
65
+
66
+ from pygments.formatters import TerminalFormatter, Terminal256Formatter
67
+
68
+ with open(args.file, "r") as f:
69
+ code = f.read()
70
+
71
+ if args.tokens:
72
+ for ttype, value in ZedScriptsLexer().get_tokens(code):
73
+ print(ttype, value)
74
+ else:
75
+ formatter = Terminal256Formatter() if args.xterm else TerminalFormatter()
76
+ print(highlight_zedscripts(code, formatter))
77
+
78
+ if __name__ == "__main__":
79
+ main()
@@ -1,8 +1,9 @@
1
1
 
2
- from ZedScripts.structure.lexer import Lexer, TextPosition, TokenType, Token, TokenCollection
2
+ import argparse
3
3
 
4
+ from ZedScripts.structure.lexer import Lexer, TextPosition, TokenType, Token, TokenCollection
4
5
 
5
- def parse_example_content() -> TokenCollection:
6
+ def get_example() -> str:
6
7
  EXAMPLE_SCRIPT_CONTENT = r"""
7
8
  module Base {
8
9
  item ItemTest {
@@ -48,7 +49,10 @@ module Base {
48
49
  }
49
50
  }
50
51
  """.strip()
51
- return Lexer.tokenize(EXAMPLE_SCRIPT_CONTENT)
52
+ return EXAMPLE_SCRIPT_CONTENT
53
+
54
+ def parse_example_content() -> TokenCollection:
55
+ return Lexer.tokenize(get_example())
52
56
 
53
57
 
54
58
  def get_theorical_tokens():
@@ -224,7 +228,16 @@ def get_theorical_tokens():
224
228
 
225
229
 
226
230
 
227
- def test_lexer():
231
+ def generate_theorical_tokens(*args):
232
+ """
233
+ Assuming the tokens currently being parsed are already the right ones, generate the comparison list of theorical tokens
234
+ we are supposed to compare against.
235
+ """
236
+ lexical_tokens = parse_example_content()
237
+ for token in lexical_tokens:
238
+ print(f"Token({token.type}, TextPosition({token.pos.line}, {token.pos.offset}), TextPosition({token.end.line}, {token.end.offset}), {token.text!r}),")
239
+
240
+ def test_lexer(*args):
228
241
  """Test the lexer by comparing its output against the theorical tokens."""
229
242
  lexical_tokens = parse_example_content()
230
243
  theorical_tokens = get_theorical_tokens()
@@ -233,28 +246,72 @@ def test_lexer():
233
246
  print(repr(theorical_token).ljust(80), repr(token).ljust(80))
234
247
  assert token == theorical_token, f"Theorical token: {theorical_token!r}, Actual token: {token!r}"
235
248
 
236
- def generate_theorical_tokens():
237
- """
238
- Assuming the tokens currently being parsed are already the right ones, generate the comparison list of theorical tokens
239
- we are supposed to compare against.
240
- """
241
- lexical_tokens = parse_example_content()
242
- for token in lexical_tokens:
243
- print(f"Token({token.type}, TextPosition({token.pos.line}, {token.pos.offset}), TextPosition({token.end.line}, {token.end.offset}), {token.text!r}),")
249
+
250
+ def test_pygments(args: argparse.Namespace | None = None):
251
+ try:
252
+ from ZedScripts.structure.pygments_lexer import highlight_zedscripts
253
+ from pygments import highlight
254
+ from pygments.formatters import TerminalFormatter, Terminal256Formatter
255
+
256
+ # if pygments is not installed, then don't run this test
257
+ except ImportError:
258
+ print("Pygments is not installed, skipping the test.")
259
+ return
260
+
261
+ xterm = True if args is not None and args.xterm else False
262
+
263
+ print(
264
+ highlight_zedscripts(
265
+ get_example(),
266
+ Terminal256Formatter() if xterm else TerminalFormatter()))
267
+
268
+
269
+ def test_pygments_comments(*args):
270
+ try:
271
+ from ZedScripts.structure.pygments_lexer import ZedScriptsLexer
272
+ from pygments.token import Comment, Error, Name
273
+ except ImportError:
274
+ print("Pygments is not installed, skipping the test.")
275
+ return
276
+
277
+ tokens = list(ZedScriptsLexer().get_tokens(get_example()))
278
+ comment_text = "".join(value for token_type, value in tokens if token_type in Comment.Multiline)
279
+ assert "/* values */" in comment_text
280
+ assert "/* comment, different syntax block under\n hello world */" in comment_text
281
+ assert "/* comment continued */" in comment_text
282
+ assert not [value for token_type, value in tokens if token_type in Error]
283
+ assert (Name.Class, "ItemTest") in tokens
284
+
285
+
286
+
244
287
 
245
288
  def main():
246
289
  import argparse
247
290
 
248
- parser = argparse.ArgumentParser(description="Lexer test.")
249
- parser.add_argument("--run", action="store_true", help="Run the lexer test.")
250
- parser.add_argument("--generate", action="store_true", help="Generate the theorical tokens.")
251
- args = parser.parse_args()
252
- if args.run:
253
- test_lexer()
254
- elif args.generate:
255
- generate_theorical_tokens()
256
- else:
257
- parser.print_help()
291
+ main_parser = argparse.ArgumentParser(description="Lexer test.")
292
+ subparser = main_parser.add_subparsers(
293
+ dest="command",
294
+ required=True,
295
+ )
296
+
297
+ test_lexer_parser = subparser.add_parser("test_lexer",
298
+ help="Run the lexer test.")
299
+ test_lexer_parser.set_defaults(func=test_lexer)
300
+
301
+ test_pygments_parser = subparser.add_parser("test_pygments",
302
+ help="Run the pygments test.")
303
+ test_pygments_parser.set_defaults(func=test_pygments)
304
+ test_pygments_parser.add_argument('-x', '--xterm', action='store_true',
305
+ help='Use Terminal256Formatter for pygments output.')
306
+
307
+ generate_parser = subparser.add_parser("generate",
308
+ help="Generate the theorical tokens.")
309
+ generate_parser.set_defaults(func=generate_theorical_tokens)
310
+
311
+ args = main_parser.parse_args()
312
+
313
+
314
+ args.func(args)
258
315
 
259
316
 
260
317
  if __name__ == "__main__":
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ZedScripts
3
- Version: 1.1.0
3
+ Version: 1.2.0
4
4
  Author: SimKDT
5
5
  License: MIT License
6
6
 
@@ -38,6 +38,8 @@ Provides-Extra: debug
38
38
  Requires-Dist: debugpy; extra == "debug"
39
39
  Provides-Extra: test
40
40
  Requires-Dist: pytest; extra == "test"
41
+ Provides-Extra: pygments
42
+ Requires-Dist: pygments; extra == "pygments"
41
43
  Dynamic: license-file
42
44
 
43
45
  # ZedScripts LSP
@@ -244,5 +246,24 @@ autocmd User LspSetup call LspAddServer(lspServers)
244
246
  > [!NOTE]
245
247
  > You can see [this video](https://www.youtube.com/watch?v=-5lb_jLQmKc) which explains how to set up VIM, and notably setup a LSP server.
246
248
 
249
+ ## Pygments
250
+
251
+ The ZedScripts LSP provides a Pygments lexer for syntax highlighting of ZedScripts code. It is available in the `ZedScripts.structure.pygments_lexer` module. You can notably use the command-line wrapper to highlight any file's content as ZedScripts:
252
+
253
+ ```bash
254
+ uv pip install ZedScripts[pygments]
255
+ highlight-zedscripts path/to/file.txt
256
+ ```
257
+
258
+ ![Screenshot of the output of highlight-zedscripts command on an example script file](assets/pygments_implementation.png)
259
+
260
+ To use the lexer in Sphinx docs, you can add the following to your `conf.py`:
261
+
262
+ ```python
263
+ from ZedScripts.structure.pygments_lexer import ZedScriptsLexer
264
+ from sphinx.highlighting import lexers
265
+ lexers['zedscripts'] = ZedScriptsLexer()
266
+ ```
267
+
247
268
  ## License and contribution
248
269
  This project is licensed under a [MIT license](LICENSE). Before contributing to the project, please see [CONTRIBUTING](CONTRIBUTING.md).
@@ -9,6 +9,7 @@ src/ZedScripts/utils.py
9
9
  src/ZedScripts.egg-info/PKG-INFO
10
10
  src/ZedScripts.egg-info/SOURCES.txt
11
11
  src/ZedScripts.egg-info/dependency_links.txt
12
+ src/ZedScripts.egg-info/entry_points.txt
12
13
  src/ZedScripts.egg-info/requires.txt
13
14
  src/ZedScripts.egg-info/top_level.txt
14
15
  src/ZedScripts/enums/Diagnostic.py
@@ -37,5 +38,6 @@ src/ZedScripts/scripts/version.py
37
38
  src/ZedScripts/structure/ast.py
38
39
  src/ZedScripts/structure/lexer.py
39
40
  src/ZedScripts/structure/parser.py
41
+ src/ZedScripts/structure/pygments_lexer.py
40
42
  src/ZedScripts/tests/parser/test_lexer.py
41
43
  tests/test_config_cli.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ highlight-zedscripts = ZedScripts.structure.pygments_lexer:main
@@ -10,5 +10,8 @@ pyinstaller
10
10
  [debug]
11
11
  debugpy
12
12
 
13
+ [pygments]
14
+ pygments
15
+
13
16
  [test]
14
17
  pytest
File without changes
File without changes