Comments (2)
Can confirm
seems like there are two different points being made
\\k<2>
does not behave the same as\\2
when backreferencing capture groups betweenbegin
/end
rules.
I would think is a non-issue as it would be annoying to have to count all the capture groups inbegin
when trying to reference one inend
(through the usage of\\k<2>
)- an invalid group number in
\\k<2>
causes the textmate engine to crash.
this is more or less consistent with all other textmate errors. eg. invalid\\g<4>
groups
seems like\\2
insideend
has a special property, to not crash the engine when capture group2
does not exist, but instead match against nothing
\\h<2>
matches against a hexadecimal number and the literal chars <2>
(Note: \2 is not a viable workaround when group numbers are ≥10)
from vscode-textmate.
\14 works fine for me?
Oh interesting, I suppose (?:\14)4
would be equivlent to \k<14>4
in that case.
So there's still a bug, but there's a reliable workaround (which is great news for me)
causes the textmate engine to crash. this is more or less consistent with all other textmate errors
I'd argue that for both \k
and \g
, either the crash should show up in the debug console, or (if crashing is not an option) then the engine should fallback on matching as an empty string. Having it partially highlight document, while sliently crashing is what I would consider an issue.
I would think is a non-issue as it would be annoying to have to count all the capture groups in begin when trying to reference one in end (through the usage of \k<2>)
Many existing syntaxes, like Ruby and Shell, would break if that reference-groups-from-the-start feature never worked. Just cause a feature is hard to manually use doesn't make it being broken a non-issue.
it would be annoying to have to count all the capture groups
I agree which is why I never count capture groups, I made the ruby grammer builder do the heavy lifting. Some C++ patterns have over 100 capture groups so it would've been unrealistic for me to maintain any other way.
from vscode-textmate.
Related Issues (20)
- Consider using end pattern as bail out for embedded languages HOT 12
- Scopes on Recursive Regex Cause Problems
- Nested `begin`/`while` rules do not continue past begin match HOT 3
- Misclassification of PHP syntax tokens HOT 3
- Matching multiline text HOT 2
- How to find all local variables? HOT 2
- JSON grammar without `filePath` parsed incorrectly as PList
- How to make the embedded language have corresponding language id
- Clarification about concurrent tokenization using multiple themes
- PHPdoc highlighting issue HOT 1
- Incorrect 'no more matches'? HOT 3
- Support for YAML-TMLanguage
- How to create language dialects HOT 3
- TextMate grammar does not parse correctly under 1.86 HOT 8
- Expose scope comment in `IToken`
- `ruleStack.clone()` doesn't actually clone
- JSON key `"id"` breaks the tokenizer
- Vscode HOT 1
- [Idea] markdown in js extension HOT 1
- `\\G` matches unicode character 0xFFFF `` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vscode-textmate.