https://github.com/dcwatson/tm2nova
Utility for converting TextMate grammars to Nova syntaxes.
https://github.com/dcwatson/tm2nova
Last synced: 8 months ago
JSON representation
Utility for converting TextMate grammars to Nova syntaxes.
- Host: GitHub
- URL: https://github.com/dcwatson/tm2nova
- Owner: dcwatson
- Created: 2020-12-05T00:46:48.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2020-12-05T00:47:05.000Z (over 5 years ago)
- Last Synced: 2025-04-09T21:43:15.606Z (about 1 year ago)
- Language: Python
- Size: 1.95 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# tm2nova
A small utility for converting TextMate language grammars to Nova syntaxes.
**Note**: this is only meant to be a first step. There will almost certainly be issues with the
conversion that you will need to address, a non-exhaustive list of which are outlined below.
### Regular Expression Problems
It seems (unsurprisingly) that there are differences both in the regex parsers themselves, and how
the text is fed into them.
1. Regexes with a `#` may not be escaped. I have an automatic fix for this, but other similar
escaping issues are likely.
2. TM grammars with begin/end expressions sometimes use `$` as the end match. I suspect this is for
single-line expressions which a simple Nova `` scope can handle, but I don't convert these
automatically.
### Highlighting Scope Names
Nova's syntax highlighting scope names do not match, and sometimes there are not direct analogues. I
do a few automatic conversions, but these really need to be (or at least should be) hand-edited.
### Symbols and Folding
Probably the biggest issue with the conversion is that the scopes do not generate symbols. To do this
well (in my limited experience) means really mirroring the grammar of the language in scopes that
capture whole blocks (for example) with proper subscoping. Some of the TM grammars I've seen are more
(or only) focused on syntax highlighting, which is a good first step, but won't get you cool things
like Nova's Symbols panel.