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

Cannot use C++ multiline raw strings in grammar file #108

Open
zmajeed opened this issue May 8, 2024 · 0 comments
Open

Cannot use C++ multiline raw strings in grammar file #108

zmajeed opened this issue May 8, 2024 · 0 comments

Comments

@zmajeed
Copy link

zmajeed commented May 8, 2024

A C++ raw string literal that spans more than one line gives an error

The grammar file

1  // rawstring.y
2  %%
3  start: %empty
4  %%
5  #include <iostream>
6  using namespace std;

7  int main() {
8    cout << R"%(raw string on one line)%" << "\n";
9    cout << R"%(multiline raw string
10  )%";
11  }

Run bison

bison -Wall -Wdangling-alias -Werror rawstring.y

rawstring.y:10.12-11.0: error: missing ‘"’ at end of line
   10 |   cout << R"%(multiline raw string
      |            ^~~~~~~~~~~~~~~~~~~~~~~
rawstring.y:11.3-12.0: error: missing ‘"’ at end of line
   11 | )%";

No problems with the raw string on line 8 - but the second one on lines 9-10 doesn't work

Separate issue but the column number is wrong in the location "10.12" printed in the error message

bison --version

bison (GNU Bison) 3.8.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant