micro-editor / micro-editor/micro
[Feature request] Capture groups in syntax definition files
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 29.6k
- Forks
- 1.4k
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 10
Description
Some languages require knowing a previous token to be able to correctly highlight them. For example:
- Lua allows putting an arbitrary amount of equals signs
=between the two square brackets for long strings ([[ ... ]]) and block comments (--[[ ... ]]). The equals signs must be balanced (same amount for the opening and closing token). - C# allows using more than tree double-quote characters
"""for long strings literals. - Unix shells (Bash, Zsh, etc.) allow creating "heredoc" strings with the
<<operator:cat << EOF This will be treated as text, piped into cat's standard input. Variables like $x may be expanded here. EOF
In the case of shell heredocs, the problem is worse because the text after << can be anything.
Thus, my suggestion: Allow YAML grammar files to use captures with $1, $2 and so on, similarly to how it currently works with the replaceall command.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing YAML grammar handling and the existing replaceall command, since the issue identifies those as the relevant behavior. Define how numbered captures should work, then verify the Lua, C# and shell heredoc examples with tests covering balanced delimiters and arbitrary heredoc markers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100