I'm currently poking the single quote parsing. already implemented a very dirty working variant. now want to make it right. I noticed we have StringStart
, StringEnd
and pairs for braces. But SingleQuote
doesn't have start/end pair. I assume tokens seq for a valid single quote (e.g. 'a'
) are expected to be [SingleQuoteStart, StringPart, SingleQuoteEnd]
(StringPart
in the middle)? wdyt?
i don't think we should be parsing this
we only parse strings due to interpolation
it should come out of the tokenizer as a single token with the value inside of it interned like the strings for num literals
My original thinking with parsing single quotes interpolations was for devs coming from python who though single and double quotes were equivalent, so that we can have better error messages and auto fixes
I don’t feel super strongly tho; open to changing that
yes, and that's how it's implemented in rust compiler (rocR?)
I like this touch. it's also valid for js devs
on the other hand we can still generate a similar message when there are >1 unicode chars
Yeah there are multiple ways to accomplish that better error messaging, and only some of them involve parsing single quotes similarly to strings
10 messages were moved here from #compiler development > casual conversation by Luke Boswell.
let's keep it simple then
@Anthony Bullard could you please take a look my draft pr? https://github.com/roc-lang/roc/pull/7914
I feel that if I start cleaning it up on my own, it would take muuuch longer than if I get some guidance
Last updated: Jul 06 2025 at 12:14 UTC