Skip to content

Unterminated char or string literal should raise an error. #95

@mrolle45

Description

@mrolle45

If a ' or " doesn't have a matching terminator on the same line, this is not a valid token. The newline character at the end of the line is not allowed.
gcc -E issues a warning, and then emits the quote followed by the remainder of the line. I don't know what actual tokens are passed to the compiler without the -E switch.
pcpp fails to match the regex and produces a token for just the quote character, then tokenizes the rest of the line.
In order to keep a program which is using the tokens produced by pcpp from getting confused, I think that an error should be generated. Perhaps a character or string literal token should be produced as though the missing terminator appeared at the end of the line.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions