Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mrolle45 opened this issue Jan 19, 2024 · 1 comment
Open

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

mrolle45 opened this issue Jan 19, 2024 · 1 comment

Comments

@mrolle45
Copy link

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.

@mrolle45
Copy link
Author

Anyone have a suggestion about what pcpp should do in these cases?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants