Skip to content

Unterminated string literals should be rejected by the lexer #228

@jefftrull

Description

@jefftrull

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.
Unfortunately, Wave has been turning these into a series of tokens:

<UnknownToken>   (#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<
<UnknownToken>   (#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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions