Based on seeing an apparent error in code that was compiling, I reduced it to this
#include <iostream>
#include <string>
using namespace std;
int main()
{
const char* p = "The ";
string s = string("Bob ") + + "world.";
cout << s << endl;
}
I would have thought maximal munch would see "+ +" as "++" and produce an error.
Maximal munch refers to processing a sequence of punctuation without any spaces.
Your code has spaces. The parser/lexer won't create a single token when there's whitespace in the middle, because the grammar doesn't allow operators to contain whitespace.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With