diff 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
line wrap: on
line diff
--- a/src/dil/lexer/Lexer.d	Wed Mar 12 00:49:17 2008 +0100
+++ b/src/dil/lexer/Lexer.d	Wed Mar 12 17:01:27 2008 +0100
@@ -2547,14 +2547,16 @@
   /// Returns true if str is a keyword or a special token (__FILE__, __LINE__ etc.)
   static bool isReservedIdentifier(char[] str)
   {
-    if (!isIdentifierString(str))
-      return false; // str is not a valid identifier.
-
     auto id = IdTable.inStatic(str);
     if (id is null || id.kind == TOK.Identifier)
       return false; // str is not in the table or a normal identifier.
+    return true;
+  }
 
-    return true;
+  /// Returns true if this is a valid identifier and if it's not reserved.
+  static bool isValidUnreservedIdentifier(char[] str)
+  {
+    return isIdentifierString(str) && !isReservedIdentifier(str);
   }
 
   /// Returns true if the current character to be decoded is