Skip to content

Commit

Permalink
Temporary fix for Raku#43
Browse files Browse the repository at this point in the history
Angle brackets are no longer treated as string delimiters, which makes
the $<foobar> syntax slightly uglier but allows us to use less than
signs in code without the rest of the file blowing up.
  • Loading branch information
Mercerenies committed Feb 15, 2022
1 parent 977b14a commit 63cd520
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion raku-font-lock.el
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ Takes arguments START and END which delimit the region to propertize."
((raku-rx (or set-operator rsxz-operator reduce-operator hyper-operator))
(0 (ignore (raku-add-font-lock-hint 'raku-metaoperator 0))))
;; angle-bracketed quoting construct
((rx (or (1+ "<") (1+ "«")))
((rx (1+ "«"))
(0 (ignore (raku-syntax-propertize-angles (match-string 0)))))
;; backslashes outside strings/comments are punctuation, not escapes
((rx "\\")
Expand Down

3 comments on commit 63cd520

@raiph
Copy link

@raiph raiph commented on 63cd520 Mar 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Angle brackets are no longer treated as string delimiters

I'm curious how that works for code like:

say <foo bar>; # (foo bar)
say <baz>;     # baz

?

@Mercerenies
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed that it's a terribly temporary fix. <foo bar> will be color-coded as a couple of barewords, not a string. But, in my mind, that's preferable to having < and > turn half of the file into a string. Definitely open to this MR being replaced by a proper solution though. I just don't know what that solution is; parsing Raku is a complicated mess, and doing so in something that isn't Raku is even more so.

@raiph
Copy link

@raiph raiph commented on 63cd520 Mar 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Mercerenies. Thanks for commenting.

preferable to [current situation]

I hear that. And "<foo bar> will be color-coded as a couple of barewords" reassures me it won't be too bad.

I just don't know what that solution is; parsing Raku is a complicated mess, and doing so in something that isn't Raku is even more so.

Perhaps the more generic parts of my answer to Multiline comments in VS Code for Raku will be of interest, despite it being about a different editor and regex engine.

Please sign in to comment.