microsoft / microsoft/vscode-textmate
Incorrect 'no more matches'?
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 678
- Forks
- 135
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 2
Description
Hello!
I'm writing my first TextMate grammar and I can't figure out why (<->) rule does not math.
This is my pikchr.tmLanguage.json and my code sample is arrow <-> down 70% from last box.s.
To see that the rule doesn't match I run npm run inspect pikchr.tmLanguage.json example.pikchr
@@scanNext 5: | <-> down 70% from last box.s\n|
scanning for (linePos: 5, anchorPosition: 5)
- -1: \s*([\n;])
- 13: ^\s*from)\s+
- 23: (\bthen\b)?\s*(\bgo\b)?\s*\b(right|down|left|up)\b
- 27: \b(\d*\.)?\d+(in|cm|px|pt|pc|mm|%)?(^|\s)
- 28: ^[a-z_$@][\w$@]*
- 29: \b(red|green|blue)\b
- 30: %
- 31: \b(close)\b
- 32: (?=\s*")
- 35: \b(diameter|ht|height|rad|radius|thickness|width|wid)(\s+)
- 37: (<->)
- 38: \b(same|cw|ccw|invis(ible)?|thick|thin|solid|chop|fit)\b
- 4: \#(\s.+)?(\n|$)
- 5: /\*
- 6: (//).*$\n?
- 8: ^\s*(box|circle|ellipse|oval|cylinder|file|line|arrow|spline|dot|arc|text|move)\b
- 32: (?=\s*")
no more matches.
token: | <-> down 70% from last box.s\n|
* source.pikchr
When I enable regexp debugging by adding | 8 to options (https://github.com/microsoft/vscode-textmate/blob/8b07a3c2be6fe4674f9ce6bba6d5c962a7f50df5/src/rule.ts#L884)
const result = this.scanner.findNextMatchSync(string, startPosition, options | 8);
the rule (<->) does match. Does anyone have any ideas what's going on? I'm using main branch and node v18.18.0.
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
Reproduce the report with npm run inspect pikchr.tmLanguage.json example.pikchr, then compare it with regexp debugging enabled. Start at src/rule.ts around findNextMatchSync and trace why rule 37 is reported as matching in debug output but ends with “no more matches.” Done means identifying and correcting or documenting that discrepancy, with a regression check if the repository’s existing tests cover the scanner.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- devtools, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100