Mercurial > projects > dil
comparison src/dil/lexer/Lexer.d @ 814:49e32b5bc161
Added isValidUnreservedIdentifier() to Lexer.
Added the msg InvalidModuleName.
author | Aziz K?ksal <aziz.koeksal@gmail.com> |
---|---|
date | Wed, 12 Mar 2008 17:01:27 +0100 |
parents | bcb74c9b895c |
children | 372fa4fbbb1d |
comparison
equal
deleted
inserted
replaced
813:1abffc396594 | 814:49e32b5bc161 |
---|---|
2545 } | 2545 } |
2546 | 2546 |
2547 /// Returns true if str is a keyword or a special token (__FILE__, __LINE__ etc.) | 2547 /// Returns true if str is a keyword or a special token (__FILE__, __LINE__ etc.) |
2548 static bool isReservedIdentifier(char[] str) | 2548 static bool isReservedIdentifier(char[] str) |
2549 { | 2549 { |
2550 if (!isIdentifierString(str)) | |
2551 return false; // str is not a valid identifier. | |
2552 | |
2553 auto id = IdTable.inStatic(str); | 2550 auto id = IdTable.inStatic(str); |
2554 if (id is null || id.kind == TOK.Identifier) | 2551 if (id is null || id.kind == TOK.Identifier) |
2555 return false; // str is not in the table or a normal identifier. | 2552 return false; // str is not in the table or a normal identifier. |
2556 | |
2557 return true; | 2553 return true; |
2554 } | |
2555 | |
2556 /// Returns true if this is a valid identifier and if it's not reserved. | |
2557 static bool isValidUnreservedIdentifier(char[] str) | |
2558 { | |
2559 return isIdentifierString(str) && !isReservedIdentifier(str); | |
2558 } | 2560 } |
2559 | 2561 |
2560 /// Returns true if the current character to be decoded is | 2562 /// Returns true if the current character to be decoded is |
2561 /// a Unicode alpha character. | 2563 /// a Unicode alpha character. |
2562 /// | 2564 /// |