comparison trunk/src/dil/LexerFuncs.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 2a8d0ed0d71e
comparison
equal deleted inserted replaced
495:b60450804b6e 496:5a607597dc22
32 { 32 {
33 return *p == '\n' || *p == '\r' || isUnicodeNewline(p); 33 return *p == '\n' || *p == '\r' || isUnicodeNewline(p);
34 } 34 }
35 35
36 /++ 36 /++
37 Returns true if p points to an EOF character.
38 EOF: 0 | _Z_
39 +/
40 bool isEOF(dchar c)
41 {
42 return c == 0 || c == _Z_;
43 }
44
45 /++
37 Returns true if p points to the first character of an EndOfLine. 46 Returns true if p points to the first character of an EndOfLine.
38 EndOfLine: Newline | 0 | _Z_ 47 EndOfLine: Newline | EOF
39 +/ 48 +/
40 bool isEndOfLine(char* p) 49 bool isEndOfLine(char* p)
41 { 50 {
42 return isNewline(p) || *p == 0 || *p == _Z_; 51 return isNewline(p) || isEOF(*p);
43 } 52 }
44 53
45 /++ 54 /++
46 Scans a Newline and sets p one character past it. 55 Scans a Newline and sets p one character past it.
47 Returns '\n' if scanned or 0 otherwise. 56 Returns '\n' if scanned or 0 otherwise.