[cpp] Undo changes to String literals in grammar, it's not needed anymore

Such slightly illegal char escape sequences can still be parsed now.
This commit is contained in:
Andreas Dangel
2017-07-08 11:48:06 +02:00
parent 5bcf30a2a4
commit ead8d964c5
2 changed files with 2 additions and 1 deletions

View File

@@ -321,7 +321,7 @@ TOKEN :
< CHARACTER : ("L")? "'" ( ( ~["'","\\","\r","\n"] ) | ( "\\" ( ~["\n","\r"] ) ) )* "'" >
| < STRING : ("L")? "\"" ( ( ~["\"","\\","\r","\n"] ) | ( ("\\")+ ( ~["\n","\r"] | "\n" | "\r\n" ) ) )* "\"" >
| < STRING : ("L")? "\"" ( ( ~["\"","\\","\r","\n"] ) | ( "\\" ( ~["\n","\r"] | "\n" | "\r\n" ) ) )* "\"" >
| < RSTRING : "R\"(" ( ~[")"] | ( ")" ~["\""] ) )* ")\"" >
}

View File

@@ -46,6 +46,7 @@ public class CPPTokenizerContinuationTest {
assertEquals(")", findByLine(12, tokens).get(3).toString());
assertEquals("{", findByLine(13, tokens).get(0).toString());
assertEquals("\"world!\\n\"", findByLine(16, tokens).get(0).toString());
assertEquals("\"3 Hello, \\world!\\n\"", findByLine(22, tokens).get(4).toString());
assertEquals("}", findByLine(29, tokens).get(0).toString());
}