comparison trunk/src/dil/Lexer.d @ 496:5a607597dc22

Improved error recovery in the Parser. The Parser skips to the next valid token if an illegal Declaration, Statement or AsmInstruction was found. Refactored a few things in Lexer.d and LexerFuncs.d.
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Sun, 09 Dec 2007 13:04:15 +0100
parents 9a7ca8c56e59
children 0ffcc4ff82f3
comparison
equal deleted inserted replaced
495:b60450804b6e 496:5a607597dc22
1430 ++n; 1430 ++n;
1431 continue; 1431 continue;
1432 } 1432 }
1433 else if (isspace(c)) 1433 else if (isspace(c))
1434 continue; // Skip spaces. 1434 continue; // Skip spaces.
1435 else if (c == 0 || c == _Z_) 1435 else if (isEOF(c))
1436 { 1436 {
1437 error(tokenLineNum, tokenLineBegin, t.start, MID.UnterminatedHexString); 1437 error(tokenLineNum, tokenLineBegin, t.start, MID.UnterminatedHexString);
1438 t.pf = 0; 1438 t.pf = 0;
1439 goto Lreturn; 1439 goto Lreturn;
1440 } 1440 }
1837 else 1837 else
1838 error(sequenceStart, MID.InvalidBeginHTMLEntity); 1838 error(sequenceStart, MID.InvalidBeginHTMLEntity);
1839 } 1839 }
1840 else if (isEndOfLine(p)) 1840 else if (isEndOfLine(p))
1841 error(sequenceStart, MID.UndefinedEscapeSequence, 1841 error(sequenceStart, MID.UndefinedEscapeSequence,
1842 (*p == 0 || *p == _Z_) ? `\EOF` : `\NewLine`); 1842 isEOF(*p) ? `\EOF` : `\NewLine`);
1843 else 1843 else
1844 { 1844 {
1845 char[] str = `\`; 1845 char[] str = `\`;
1846 if (isascii(c)) 1846 if (isascii(c))
1847 str ~= *p; 1847 str ~= *p;