Commit a5dc086
authored
Add argparse to pygemnts2chroma_xml.py script (#1140)
I also adapted the README to use `uv` since this removes an install step
(uv resolves and installs dependencies on `uv run`).
We could also debate if we should switch from `KotlinLexer` as an
example to some other lexer as there seems to be a bug upstream in
pygments where `KotlinLexer.get_tokendefs()` returns a string that is
not valid unicode. You can read more about the bug in [this
issue](pygments/pygments#2964).
With argparse the error messages are a lot nicer and the script can
better explain itself.
```bash
uv run pygments2chroma_xml.py --help
usage: pygments2chroma_xml.py [-h] lexer_class
Converts pygments RegexLexer classes to chroma xml grammar definitions.
positional arguments:
lexer_class The class name of the pygments lexer, like: 'pygments.lexers.jvm.KotlinLexer'.
options:
-h, --help show this help message and exit
```1 parent 3f991b1 commit a5dc086
3 files changed
+22
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
212 | | - | |
| 212 | + | |
213 | 213 | | |
214 | | - | |
| 214 | + | |
215 | 215 | | |
216 | 216 | | |
217 | 217 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
2 | 10 | | |
3 | 11 | | |
4 | 12 | | |
| |||
168 | 176 | | |
169 | 177 | | |
170 | 178 | | |
171 | | - | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
172 | 184 | | |
173 | 185 | | |
174 | 186 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
2 | 9 | | |
3 | 10 | | |
4 | 11 | | |
| |||
0 commit comments