@notjack Yes sort of like STM.
That looks like the bug fixed recently for this issue: https://github.com/racket/racket/issues/2458 Are you using v7.2, or at least a pre-release version that’s more than 17 days old?
Yep, I am using 7.2
Hello Racketeers! I wanna check for the presence of some keywords in a syntax-class (but the keyword themselves don’t have any value following them, they are just stand-alone keywords). I make a pattern to match them, but how do I retrieve the information about whether one of them is present or not if there’s no syntax binding? (~optional #:my-keyword <a-value>:expr)
can be checked with (~? <a-value>)
, but what about (~optional #:my-keyword)
?
@jerome.martin.dev try (~and p ...)
around that
oh, right!
thanks a lot, I forgot this trick!
I made a SO question to document that: https://stackoverflow.com/questions/55171895/how-do-i-check-for-the-presence-of-a-keyword-in-a-racket-syntax You are welcome to suggest a better answer than mine :slightly_smiling_face:
Maybe a better place would be in the syntax/parse
examples section on optional keyword arguments:
@joshgrant has joined the channel
@alexknauth Yeah, why not! I’ll do a PR too :slightly_smiling_face:
SO and this page of the doc were the two places where I looked for an answer
How do you match a single line comment using lexer
? Is there a way to match (eof) as the end of a single line comment? :disappointed_relieved:
Almost forgot racket source is a good place to learn! Thanks :pray:
The important part is that it doesn’t need to include a newline at the end, it just greedily consumes all characters that are not newlines.
Yes I see. @mbutterick I guess your jsonic lexer tutorial probably needs an update on matching single line comment.
That’s unfortunate. I did consider a macro, I was just a little unsure if that would mess things up in some way. I guess I’ll do that then.
Thanks!