17846, "mppf", "Language spec does not describe some string literal syntax details", "2021-05-28T15:32:18Z"
The parser supports several things that aren't described in the spec. The spec covers
""" variations and includes
\x escapes as well as the escapes
\' \" \? \\ \a \b \f \n \r \t \v. However in working on the parser recently I came across some questions it does not make clear:
- What happens if the number of hexadecimal digits is > 2. Should it be an error? Or is that the way to specify a Unicode code point? Or should we have
\u1234etc to specify a Unicode code point and
\xcan only specify an ascii character or byte?
- The compiler currently makes other escapes, such as
\qinto errors. If we keep it that way, it should be documented I think.
- The parser allows newlines in string literals if they are preceded by backslash (and in that case, the backslash is removed). If the newline does not have a backslash before it, we get an error. But this behavior is not documented.
writeln( "bla\ bla");