in reply to Re: Lexing C++
in thread Lexing C++
At least it doesn't fail any of your provided test cases :)
But a single escaped double quote in the example is sufficient to make it return garbage.
// comment should not appear main(void) { int foo = 1 << 5; puts("testing \"quoted\" string"); exit(0); // done }
... [ 'Identifier', 'puts' ], [ 'LeftParen', '(' ], [ 'string', 'testing \\' ], [ 'Identifier', 'quoted' ], [ 'character', '\\' ], [ 'string', ' string' ], [ 'RightParen', ')' ], [ 'Semicolon', ';' ], ...
There is no identifier named quoted in the example C/C++ code. quoted is part of a string passed to puts().
Alexander
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Lexing C++
by tybalt89 (Monsignor) on Sep 02, 2019 at 11:18 UTC |