changeset 54:e55bd2270f94

- Relocated messages table to a separate module.
author aziz
date Wed, 27 Jun 2007 17:58:00 +0000
parents 1786c2825491
children 5887751f8e04
files trunk/src/Lexer.d trunk/src/Messages.d trunk/src/main.d
diffstat 3 files changed, 73 insertions(+), 66 deletions(-) [+]
line wrap: on
line diff
--- a/trunk/src/Lexer.d	Wed Jun 27 17:50:01 2007 +0000
+++ b/trunk/src/Lexer.d	Wed Jun 27 17:58:00 2007 +0000
@@ -6,6 +6,7 @@
 import Token;
 import Keywords;
 import Identifier;
+import Messages;
 import std.stdio;
 import std.utf;
 import std.uni;
@@ -107,72 +108,6 @@
 
 const uint _Z_ = 26; /// Control+Z
 
-/// Index into table of error messages.
-enum MID
-{
-  InvalidUnicodeCharacter,
-  InvalidUTF8Sequence,
-  // ''
-  UnterminatedCharacterLiteral,
-  EmptyCharacterLiteral,
-  // #line
-  ExpectedIdentifierSTLine,
-  ExpectedNormalStringLiteral,
-  ExpectedNumberAfterSTLine,
-  NewlineInSpecialToken,
-  UnterminatedSpecialToken,
-  // ""
-  UnterminatedString,
-  // x""
-  NonHexCharInHexString,
-  OddNumberOfDigitsInHexString,
-  UnterminatedHexString,
-  // /* */ /+ +/
-  UnterminatedBlockComment,
-  UnterminatedNestedComment,
-  // `` r""
-  UnterminatedRawString,
-  UnterminatedBackQuoteString,
-  // \x \u \U
-  UndefinedEscapeSequence,
-  InsufficientHexDigits,
-  // \&[a-zA-Z][a-zA-Z0-9]+;
-  UnterminatedHTMLEntity,
-  InvalidBeginHTMLEntity,
-}
-
-string[] messages = [
-  "invalid Unicode character.",
-  "invalid UTF-8 sequence.",
-  // ''
-  "unterminated character literal.",
-  "empty character literal.",
-  // #line
-  "expected 'line' after '#'.",
-  `the filespec must be defined in a double quote string literal (e.g. "filespec".)`,
-  "positive integer expected after #line",
-  "newline not allowed inside special token.",
-  "expected a terminating newline after special token.",
-  // ""
-  "unterminated string literal.",
-  // x""
-  "non-hex character '{1}' found in hex string.",
-  "odd number of hex digits in hex string.",
-  "unterminated hex string.",
-  // /* */ /+ +/
-  "unterminated block comment (/* */).",
-  "unterminated nested comment (/+ +/).",
-  // `` r""
-  "unterminated raw string.",
-  "unterminated back quote string.",
-  // \x \u \U
-  "found undefined escape sequence.",
-  "insufficient number of hex digits in escape sequence.",
-  // \&[a-zA-Z][a-zA-Z0-9]+;
-  "unterminated html entity.",
-  "html entities must begin with a letter.",
-];
-
 class Problem
 {
   enum Type
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trunk/src/Messages.d	Wed Jun 27 17:58:00 2007 +0000
@@ -0,0 +1,71 @@
+/++
+  Author: Aziz Köksal
+  License: GPL2
++/
+module Messages;
+
+/// Index into table of error messages.
+enum MID
+{
+  InvalidUnicodeCharacter,
+  InvalidUTF8Sequence,
+  // ''
+  UnterminatedCharacterLiteral,
+  EmptyCharacterLiteral,
+  // #line
+  ExpectedIdentifierSTLine,
+  ExpectedNormalStringLiteral,
+  ExpectedNumberAfterSTLine,
+  NewlineInSpecialToken,
+  UnterminatedSpecialToken,
+  // ""
+  UnterminatedString,
+  // x""
+  NonHexCharInHexString,
+  OddNumberOfDigitsInHexString,
+  UnterminatedHexString,
+  // /* */ /+ +/
+  UnterminatedBlockComment,
+  UnterminatedNestedComment,
+  // `` r""
+  UnterminatedRawString,
+  UnterminatedBackQuoteString,
+  // \x \u \U
+  UndefinedEscapeSequence,
+  InsufficientHexDigits,
+  // \&[a-zA-Z][a-zA-Z0-9]+;
+  UnterminatedHTMLEntity,
+  InvalidBeginHTMLEntity,
+}
+
+string[] messages = [
+  "invalid Unicode character.",
+  "invalid UTF-8 sequence.",
+  // ''
+  "unterminated character literal.",
+  "empty character literal.",
+  // #line
+  "expected 'line' after '#'.",
+  `the filespec must be defined in a double quote string literal (e.g. "filespec".)`,
+  "positive integer expected after #line",
+  "newline not allowed inside special token.",
+  "expected a terminating newline after special token.",
+  // ""
+  "unterminated string literal.",
+  // x""
+  "non-hex character '{1}' found in hex string.",
+  "odd number of hex digits in hex string.",
+  "unterminated hex string.",
+  // /* */ /+ +/
+  "unterminated block comment (/* */).",
+  "unterminated nested comment (/+ +/).",
+  // `` r""
+  "unterminated raw string.",
+  "unterminated back quote string.",
+  // \x \u \U
+  "found undefined escape sequence.",
+  "insufficient number of hex digits in escape sequence.",
+  // \&[a-zA-Z][a-zA-Z0-9]+;
+  "unterminated html entity.",
+  "html entities must begin with a letter.",
+];
--- a/trunk/src/main.d	Wed Jun 27 17:50:01 2007 +0000
+++ b/trunk/src/main.d	Wed Jun 27 17:58:00 2007 +0000
@@ -5,6 +5,7 @@
 module dparser;
 import Lexer;
 import Token;
+import Messages;
 import std.stdio;
 import std.file;