Fix bug in HEREDOC string literal lexing

This commit is contained in:
Hackerpilot 2014-01-29 15:39:57 -08:00
parent 8bf1f5b36f
commit bf7f098799
2 changed files with 8 additions and 6 deletions

View File

@ -1120,17 +1120,21 @@ public struct DLexer
if (isNewline()) if (isNewline())
{ {
popFrontWhitespaceAware(); popFrontWhitespaceAware();
if (range.peek(ident.text.length) == ident.text) if (!range.canPeek(ident.text.length))
{ {
foreach (i ; 0 .. ident.text.length) error(ident.text ~ " expected");
range.popFront(); break;
}
if (range.peek(ident.text.length - 1) == ident.text)
{
range.popFrontN(ident.text.length);
break; break;
} }
} }
else else
range.popFront(); range.popFront();
} }
if (range.front == '"') if (!range.empty() && range.front == '"')
range.popFront(); range.popFront();
else else
error(`" expected`); error(`" expected`);

View File

@ -1780,8 +1780,6 @@ class ClassFour(A, B) if (someTest()) : Super {}}c;
auto dos = parseDeclarationOrStatement(); auto dos = parseDeclarationOrStatement();
if (dos !is null) if (dos !is null)
node.declarationsAndStatements ~= dos; node.declarationsAndStatements ~= dos;
/*else
return null;*/
} }
return node; return node;
} }