@@ -968,7 +968,7 @@ void generateStateMachine(ref CodeWriter code, const EBNFGrammar lexerGrammar,
968
968
goto lexerend;
969
969
$$}
970
970
else
971
- throw lexerException (text(" Error unexpected \' " , $(ascii?" currentChar" :" currentDchar" ), " \' " ), " $(codepointSetToStr(allAllowedSet).escapeD)" , inputCopy.ptr - input.ptr);
971
+ throw lexerException (text(" Error unexpected \' " , $(ascii?" currentChar" :" currentDchar" ).escapeChar( false ) , " \' " ), " $(codepointSetToStr(allAllowedSet).escapeD)" , inputCopy.ptr - input.ptr);
972
972
$$}
973
973
$$} else {
974
974
$$needsElse = true ;
@@ -1010,15 +1010,15 @@ void generateStateMachine(ref CodeWriter code, const EBNFGrammar lexerGrammar,
1010
1010
storedStart = size_t .max;
1011
1011
$$}
1012
1012
$$if (e.next3.id == size_t .max) {
1013
- throw lexerException (text(" Error unexpected \' " , $(ascii?" currentChar" :" currentDchar" ), " \' " ), " $(codepointSetToStr(allAllowedSet).escapeD)" , inputCopy.ptr - input.ptr);
1013
+ throw lexerException (text(" Error unexpected \' " , $(ascii?" currentChar" :" currentDchar" ).escapeChar( false ) , " \' " ), " $(codepointSetToStr(allAllowedSet).escapeD)" , inputCopy.ptr - input.ptr);
1014
1014
$$} else {
1015
1015
goto state$(e.next3.id);
1016
1016
$$}
1017
1017
}
1018
1018
else if (compareString.length < storedString.length && currentCharCorrect)
1019
1019
{
1020
1020
$$if (e.next2.id == size_t .max) {
1021
- throw lexerException (text(" Error unexpected \' " , $(ascii?" currentChar" :" currentDchar" ), " \' " ), " $(codepointSetToStr(allAllowedSet).escapeD)" , inputCopy.ptr - input.ptr);
1021
+ throw lexerException (text(" Error unexpected \' " , $(ascii?" currentChar" :" currentDchar" ).escapeChar( false ) , " \' " ), " $(codepointSetToStr(allAllowedSet).escapeD)" , inputCopy.ptr - input.ptr);
1022
1022
$$} else {
1023
1023
goto state$(e.next2.id);
1024
1024
$$}
@@ -1027,7 +1027,7 @@ void generateStateMachine(ref CodeWriter code, const EBNFGrammar lexerGrammar,
1027
1027
{
1028
1028
storedStart = size_t .max;
1029
1029
$$if (e.next.id == size_t .max) {
1030
- throw lexerException (text(" Error unexpected \' " , $(ascii?" currentChar" :" currentDchar" ), " \' " ), " $(codepointSetToStr(allAllowedSet).escapeD)" , inputCopy.ptr - input.ptr);
1030
+ throw lexerException (text(" Error unexpected \' " , $(ascii?" currentChar" :" currentDchar" ).escapeChar( false ) , " \' " ), " $(codepointSetToStr(allAllowedSet).escapeD)" , inputCopy.ptr - input.ptr);
1031
1031
$$} else {
1032
1032
goto state$(e.next.id);
1033
1033
$$}
@@ -1541,6 +1541,7 @@ const(char)[] createLexerCode(EBNFGrammar lexerGrammar, string modulename, strin
1541
1541
module $(modulename) ;
1542
1542
import dparsergen.core.grammarinfo ;
1543
1543
import dparsergen.core.parseexception ;
1544
+ import dparsergen.core.utils ;
1544
1545
import std.conv ;
1545
1546
import std.string ;
1546
1547
import std.typecons ;
0 commit comments