Sublime Forum

"rule #anon_expect_regex_2 has a scope name, but is unreachable, so the name will never be used"

#1

I’m currently working on a syntax definition for syntax definitions and I’m almost done, but for some reason I can’t get including the actual regex matching to work. Maybe someone else can see something that I don’t.

The syntax definition: https://2.lithi.io/Pilfg.sublime-syntax (the regex include is commented since it doesn’t matter here)
You can highlight the file itself with it.

Output on console when saving the file:

rule #anon_expect_regex_2 has a scope name, but is unreachable, so the name will never be used

Commenting 373-378 makes this console output go away.

When commenting 370-371, highlighting changes but the message persists.
However, with 370-371 commented, uncommenting lines 376-377 makes highlighting change as well while the message is still being displayed.

1 Like

#2

weird one…

further observation: commenting out the - meta_scope: source.regexp line (369) makes the message disappear (can uncomment 371-378)

0 Likes

#3

That error has to do with anonymous context using a with_prototype. Basically, the non-with_prototype version gets orphaned since it is anonymous and the with_prototype version “overwrites” it. This is on my list of little niggles to fix, but it functionality isn’t “broken”, just confusing, so it is pretty low priority.

2 Likes

#4

Ah thanks, I think I understand now. Since the anonymous context is only used with a with_prototype, it gets rewritten instantly and the actual anonymous context is never used by itself. However, this is not a bug and just a result of how it works and the message is merely for debugging purposes.

I’m slowly making progress with the syntax but keep running into weird issues that seem to make no sense at first.

PS: God bless email notifications that I can still read while the forum is unreachable.

1 Like

#5

today I discovered that variables don’t work in the with_prototype matches - it was driving me crazy until I realized:

1 Like

#6

Wow, thanks! That was unexpected and indeed one of the issues I was running into. That’s pretty significant and inconvenient.

0 Likes

#7

I found the other (final) issue I was having problems with: Nested positive look-ahead patterns.

I’ll prepare a bug report for this and also prepare an initial release of the sublime-syntax.sublime-syntax to PackageDev for people to test. I’ll most likely flag it as a pre-release, but that will be part of a different thread.

0 Likes

#8

Here’s the issue report with reproduction steps:

0 Likes