boostorg / boostorg/wave

Unterminated string literals should be rejected by the lexer

Open
#228 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
29
Forks
55
PR merge metrics
No merged PRs in 30d

Description

At the moment Wave accepts text like this:
```
"A
B"
```
which a user might accidentally write, intending to create a multi-line string literal with an embedded newline. In fact these "classic" (pre C++11) string literals [disallow newlines](https://en.cppreference.com/w/cpp/language/string_literal).
Unfortunately, Wave has been turning these into a series of tokens:
```
(#34 ) at /tmp/blah.c ( 1/ 1): >"<
IDENTIFIER (#380) at /tmp/blah.c ( 1/ 2): >A<
NEWLINE (#394) at /tmp/blah.c ( 1/ 3): >\n<
IDENTIFIER (#380) at /tmp/blah.c ( 2/ 1): >B<
(#34 ) at /tmp/blah.c ( 2/ 2): >"<
```
It can then go on to do work on these tokens, like directive evaluation, as described in bug #225.

Wave should produce a lexer exception in this case instead.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.