The Notation section says:
The hard cut operator is necessary because some tokens in Rust begin with a prefix that is itself a valid token. [...] Without the cut, if c"\0" failed to lex as a C string literal (because null bytes are not allowed in C strings), the parser could backtrack and lex it as two tokens [...]
My question is: why do we exclude null bytes in string literals as part of lexing instead of as a separate "c strings may not contain null bytes" rule? Could this make an observable different to e.g. macros? I'd quite like to remove that operator to make the grammar simpler.
The Notation section says:
My question is: why do we exclude null bytes in string literals as part of lexing instead of as a separate "c strings may not contain null bytes" rule? Could this make an observable different to e.g. macros? I'd quite like to remove that operator to make the grammar simpler.