Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect 'no more matches'? #220

Open
senyai opened this issue Nov 26, 2023 · 3 comments
Open

Incorrect 'no more matches'? #220

senyai opened this issue Nov 26, 2023 · 3 comments

Comments

@senyai
Copy link

senyai commented Nov 26, 2023

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 (

const result = this.scanner.findNextMatchSync(string, startPosition, options);
)

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.

@RedCMD
Copy link

RedCMD commented Nov 26, 2023

I haven't test it
but you do have 2 errors in "path-attribute"
image

and I think you mean $ for end of line, instead of ^; start of line
image

@senyai
Copy link
Author

senyai commented Nov 26, 2023

I haven't test it but you do have 2 errors in "path-attribute"

Thank you, @RedCMD. I do. How did you get that nice highlighting? Fixing this, fixed the matching. I will keep the issue open, as I hope to see inspect command to not hide this kind of errors.

@RedCMD
Copy link

RedCMD commented Nov 26, 2023

How did you get that nice highlighting?

My textmate extension

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants