annotate basic/Messages.d @ 99:857f0d530789 new_gen

Imports and improved module statement Allow "module a.b.c" Supports most forms of D's import. import A, B; import A, B = C; import A, B : a = b, c;
author Anders Halager <halager@gmail.com>
date Tue, 06 May 2008 21:59:22 +0200
parents 771ac63898e2
children 5f258eaf9517
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
89
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents:
diff changeset
1 module basic.Messages;
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents:
diff changeset
2
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents:
diff changeset
3 enum : uint
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents:
diff changeset
4 {
99
857f0d530789 Imports and improved module statement
Anders Halager <halager@gmail.com>
parents: 92
diff changeset
5 // Lex
89
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents:
diff changeset
6 InvalidSymbol,
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents:
diff changeset
7 InvalidIlligaleType,
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents:
diff changeset
8 UnexpectedEOFBlock,
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents:
diff changeset
9 OnlyOneDotFloating,
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents:
diff changeset
10 OnlyOneEFloating,
99
857f0d530789 Imports and improved module statement
Anders Halager <halager@gmail.com>
parents: 92
diff changeset
11
857f0d530789 Imports and improved module statement
Anders Halager <halager@gmail.com>
parents: 92
diff changeset
12 // Parse
89
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents:
diff changeset
13 UnexpectedTokMulti,
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents:
diff changeset
14 UnexpectedTokSingle,
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents:
diff changeset
15 UnexpectedTok,
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents:
diff changeset
16 CaseValueMustBeInt,
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents:
diff changeset
17 UnexpectedBeginStmt,
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents:
diff changeset
18 UnexpectedTokType,
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents:
diff changeset
19 ExpectedIdAfterDot,
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents:
diff changeset
20 ExpectedExp,
92
771ac63898e2 A few better parser errors plus renaming most of the sema classes to match that they do now. Some have changes a lot.
Anders Johnsen <skabet@gmail.com>
parents: 89
diff changeset
21 ExpectedCastType,
771ac63898e2 A few better parser errors plus renaming most of the sema classes to match that they do now. Some have changes a lot.
Anders Johnsen <skabet@gmail.com>
parents: 89
diff changeset
22 InvalidDeclType,
771ac63898e2 A few better parser errors plus renaming most of the sema classes to match that they do now. Some have changes a lot.
Anders Johnsen <skabet@gmail.com>
parents: 89
diff changeset
23 InvalidType,
99
857f0d530789 Imports and improved module statement
Anders Halager <halager@gmail.com>
parents: 92
diff changeset
24 // - imports/module
857f0d530789 Imports and improved module statement
Anders Halager <halager@gmail.com>
parents: 92
diff changeset
25 ExpectedIdAfterPackage,
857f0d530789 Imports and improved module statement
Anders Halager <halager@gmail.com>
parents: 92
diff changeset
26 RenameMustBeSingleIdent,
89
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents:
diff changeset
27 }
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents:
diff changeset
28
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents:
diff changeset
29 enum MessageType
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents:
diff changeset
30 {
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents:
diff changeset
31 Warning,
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents:
diff changeset
32 Error,
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents:
diff changeset
33 }
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents:
diff changeset
34
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents:
diff changeset
35 MessageEntry[uint] Messages;
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents:
diff changeset
36
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents:
diff changeset
37 struct MessageEntry
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents:
diff changeset
38 {
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents:
diff changeset
39 MessageType type;
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents:
diff changeset
40 char[] message;
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents:
diff changeset
41 }
99
857f0d530789 Imports and improved module statement
Anders Halager <halager@gmail.com>
parents: 92
diff changeset
42
857f0d530789 Imports and improved module statement
Anders Halager <halager@gmail.com>
parents: 92
diff changeset
43 private alias MessageType.Error Err;
857f0d530789 Imports and improved module statement
Anders Halager <halager@gmail.com>
parents: 92
diff changeset
44 private alias MessageType.Warning War;
857f0d530789 Imports and improved module statement
Anders Halager <halager@gmail.com>
parents: 92
diff changeset
45 private alias MessageEntry E;
89
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents:
diff changeset
46 static this()
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents:
diff changeset
47 {
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents:
diff changeset
48 Messages = [
99
857f0d530789 Imports and improved module statement
Anders Halager <halager@gmail.com>
parents: 92
diff changeset
49 UnexpectedEOFBlock : E(Err, "Unexpected end of file. Unclosed comment block"),
857f0d530789 Imports and improved module statement
Anders Halager <halager@gmail.com>
parents: 92
diff changeset
50 InvalidSymbol : E(Err, "Read invalid symbol: '%0'"),
857f0d530789 Imports and improved module statement
Anders Halager <halager@gmail.com>
parents: 92
diff changeset
51 OnlyOneDotFloating : E(Err, "Only one '.' is allowed in an floating number"),
857f0d530789 Imports and improved module statement
Anders Halager <halager@gmail.com>
parents: 92
diff changeset
52 OnlyOneEFloating : E(Err, "Only one E is allowed in an floating number"),
857f0d530789 Imports and improved module statement
Anders Halager <halager@gmail.com>
parents: 92
diff changeset
53
857f0d530789 Imports and improved module statement
Anders Halager <halager@gmail.com>
parents: 92
diff changeset
54 UnexpectedTokMulti : E(Err, "Unexpected token, got %0 expected one of %1"),
857f0d530789 Imports and improved module statement
Anders Halager <halager@gmail.com>
parents: 92
diff changeset
55 UnexpectedTokSingle : E(Err, "Unexpected token, got %0 expected %1"),
857f0d530789 Imports and improved module statement
Anders Halager <halager@gmail.com>
parents: 92
diff changeset
56 UnexpectedTok : E(Err, "Unexpected token %0"),
857f0d530789 Imports and improved module statement
Anders Halager <halager@gmail.com>
parents: 92
diff changeset
57 CaseValueMustBeInt : E(Err, "Cases can only be integer literals"),
857f0d530789 Imports and improved module statement
Anders Halager <halager@gmail.com>
parents: 92
diff changeset
58 UnexpectedBeginStmt : E(Err, "Unexpected begining of statement."),
857f0d530789 Imports and improved module statement
Anders Halager <halager@gmail.com>
parents: 92
diff changeset
59 UnexpectedTokType : E(Err, "Unexpected token in Type parsing. Got %0"),
857f0d530789 Imports and improved module statement
Anders Halager <halager@gmail.com>
parents: 92
diff changeset
60 ExpectedIdAfterDot : E(Err, "Expected identifier after '.'"),
857f0d530789 Imports and improved module statement
Anders Halager <halager@gmail.com>
parents: 92
diff changeset
61 ExpectedExp : E(Err, "Expected expression"),
857f0d530789 Imports and improved module statement
Anders Halager <halager@gmail.com>
parents: 92
diff changeset
62 ExpectedCastType : E(Err, "Expected cast type"),
857f0d530789 Imports and improved module statement
Anders Halager <halager@gmail.com>
parents: 92
diff changeset
63 InvalidDeclType : E(Err, "Invalid declaration type"),
857f0d530789 Imports and improved module statement
Anders Halager <halager@gmail.com>
parents: 92
diff changeset
64 InvalidType : E(Err, "Invalid type"),
857f0d530789 Imports and improved module statement
Anders Halager <halager@gmail.com>
parents: 92
diff changeset
65 ExpectedIdAfterPackage : E(Err, "Identifier expected following package")
89
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents:
diff changeset
66 ];
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents:
diff changeset
67 }
99
857f0d530789 Imports and improved module statement
Anders Halager <halager@gmail.com>
parents: 92
diff changeset
68