annotate basic/Messages.d @ 136:2be29b296081

Lots of changes: - Parsing classes and interfaces - Fixed some seg faults in sema - Supporting "private" to some extend - And a lot of other small fixes
author johnsen@johnsen-laptop
date Fri, 11 Jul 2008 21:47:57 +0200
parents 3a0cd42de9cc
children 927ae00bd9d2
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,
100
5f258eaf9517 Loading modules in. Just need to add them to the scope of the "main" Module now.
Anders Johnsen <skabet@gmail.com>
parents: 99
diff changeset
27
5f258eaf9517 Loading modules in. Just need to add them to the scope of the "main" Module now.
Anders Johnsen <skabet@gmail.com>
parents: 99
diff changeset
28
114
3a0cd42de9cc Removed misc/Error.d and is now using the error system all way through.
Anders Johnsen <skabet@gmail.com>
parents: 111
diff changeset
29 // sema
100
5f258eaf9517 Loading modules in. Just need to add them to the scope of the "main" Module now.
Anders Johnsen <skabet@gmail.com>
parents: 99
diff changeset
30 CannotFindModule,
114
3a0cd42de9cc Removed misc/Error.d and is now using the error system all way through.
Anders Johnsen <skabet@gmail.com>
parents: 111
diff changeset
31 InvalidImplicitCast,
3a0cd42de9cc Removed misc/Error.d and is now using the error system all way through.
Anders Johnsen <skabet@gmail.com>
parents: 111
diff changeset
32 UndefinedIdentifier,
3a0cd42de9cc Removed misc/Error.d and is now using the error system all way through.
Anders Johnsen <skabet@gmail.com>
parents: 111
diff changeset
33 UndefinedType,
3a0cd42de9cc Removed misc/Error.d and is now using the error system all way through.
Anders Johnsen <skabet@gmail.com>
parents: 111
diff changeset
34 MissingMember,
136
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 114
diff changeset
35 CannotRedeclare,
106
89db676fbacb Now able of understanding strings.
Anders Johnsen <skabet@gmail.com>
parents: 100
diff changeset
36
89db676fbacb Now able of understanding strings.
Anders Johnsen <skabet@gmail.com>
parents: 100
diff changeset
37 // Strings
89db676fbacb Now able of understanding strings.
Anders Johnsen <skabet@gmail.com>
parents: 100
diff changeset
38 InvalidStrPrefix,
89db676fbacb Now able of understanding strings.
Anders Johnsen <skabet@gmail.com>
parents: 100
diff changeset
39 InvalidStrEscape,
89db676fbacb Now able of understanding strings.
Anders Johnsen <skabet@gmail.com>
parents: 100
diff changeset
40 InvalidUtf8Hex,
89db676fbacb Now able of understanding strings.
Anders Johnsen <skabet@gmail.com>
parents: 100
diff changeset
41 InvalidHexStrChar,
111
c658172ca8a0 Parsing basic integers and floats.
Anders Johnsen <skabet@gmail.com>
parents: 109
diff changeset
42 InvalidCharEntity,
c658172ca8a0 Parsing basic integers and floats.
Anders Johnsen <skabet@gmail.com>
parents: 109
diff changeset
43 NoCharEntityEnd,
106
89db676fbacb Now able of understanding strings.
Anders Johnsen <skabet@gmail.com>
parents: 100
diff changeset
44 StringShortEscape,
89db676fbacb Now able of understanding strings.
Anders Johnsen <skabet@gmail.com>
parents: 100
diff changeset
45 StringHexInvalid,
111
c658172ca8a0 Parsing basic integers and floats.
Anders Johnsen <skabet@gmail.com>
parents: 109
diff changeset
46 InvalidStartInteger,
c658172ca8a0 Parsing basic integers and floats.
Anders Johnsen <skabet@gmail.com>
parents: 109
diff changeset
47 IntegerToLarge,
c658172ca8a0 Parsing basic integers and floats.
Anders Johnsen <skabet@gmail.com>
parents: 109
diff changeset
48 FloatingToLarge,
c658172ca8a0 Parsing basic integers and floats.
Anders Johnsen <skabet@gmail.com>
parents: 109
diff changeset
49 FloatingInvalidEnd,
c658172ca8a0 Parsing basic integers and floats.
Anders Johnsen <skabet@gmail.com>
parents: 109
diff changeset
50 FloatingBadLocation,
c658172ca8a0 Parsing basic integers and floats.
Anders Johnsen <skabet@gmail.com>
parents: 109
diff changeset
51 FloatingDotInE,
136
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 114
diff changeset
52
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 114
diff changeset
53 // Protection
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 114
diff changeset
54 CannotAccessPrivate,
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
55 }
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
56
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
57 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
58 {
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
59 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
60 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
61 }
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
62
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
63 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
64
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
65 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
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 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
68 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
69 }
99
857f0d530789 Imports and improved module statement
Anders Halager <halager@gmail.com>
parents: 92
diff changeset
70
857f0d530789 Imports and improved module statement
Anders Halager <halager@gmail.com>
parents: 92
diff changeset
71 private alias MessageType.Error Err;
857f0d530789 Imports and improved module statement
Anders Halager <halager@gmail.com>
parents: 92
diff changeset
72 private alias MessageType.Warning War;
857f0d530789 Imports and improved module statement
Anders Halager <halager@gmail.com>
parents: 92
diff changeset
73 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
74 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
75 {
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
76 Messages = [
109
Anders Halager <halager@gmail.com>
parents: 107 106
diff changeset
77 // lexing
99
857f0d530789 Imports and improved module statement
Anders Halager <halager@gmail.com>
parents: 92
diff changeset
78 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
79 InvalidSymbol : E(Err, "Read invalid symbol: '%0'"),
857f0d530789 Imports and improved module statement
Anders Halager <halager@gmail.com>
parents: 92
diff changeset
80 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
81 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
82
109
Anders Halager <halager@gmail.com>
parents: 107 106
diff changeset
83 // parsing
99
857f0d530789 Imports and improved module statement
Anders Halager <halager@gmail.com>
parents: 92
diff changeset
84 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
85 UnexpectedTokSingle : E(Err, "Unexpected token, got %0 expected %1"),
857f0d530789 Imports and improved module statement
Anders Halager <halager@gmail.com>
parents: 92
diff changeset
86 UnexpectedTok : E(Err, "Unexpected token %0"),
857f0d530789 Imports and improved module statement
Anders Halager <halager@gmail.com>
parents: 92
diff changeset
87 CaseValueMustBeInt : E(Err, "Cases can only be integer literals"),
857f0d530789 Imports and improved module statement
Anders Halager <halager@gmail.com>
parents: 92
diff changeset
88 UnexpectedBeginStmt : E(Err, "Unexpected begining of statement."),
857f0d530789 Imports and improved module statement
Anders Halager <halager@gmail.com>
parents: 92
diff changeset
89 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
90 ExpectedIdAfterDot : E(Err, "Expected identifier after '.'"),
857f0d530789 Imports and improved module statement
Anders Halager <halager@gmail.com>
parents: 92
diff changeset
91 ExpectedExp : E(Err, "Expected expression"),
857f0d530789 Imports and improved module statement
Anders Halager <halager@gmail.com>
parents: 92
diff changeset
92 ExpectedCastType : E(Err, "Expected cast type"),
857f0d530789 Imports and improved module statement
Anders Halager <halager@gmail.com>
parents: 92
diff changeset
93 InvalidDeclType : E(Err, "Invalid declaration type"),
857f0d530789 Imports and improved module statement
Anders Halager <halager@gmail.com>
parents: 92
diff changeset
94 InvalidType : E(Err, "Invalid type"),
100
5f258eaf9517 Loading modules in. Just need to add them to the scope of the "main" Module now.
Anders Johnsen <skabet@gmail.com>
parents: 99
diff changeset
95 ExpectedIdAfterPackage : E(Err, "Identifier expected following package"),
107
189c049cbfcc Cleanup of codegen, better support for operators a few bugfixes
Anders Halager <halager@gmail.com>
parents: 100
diff changeset
96
109
Anders Halager <halager@gmail.com>
parents: 107 106
diff changeset
97 // sema
106
89db676fbacb Now able of understanding strings.
Anders Johnsen <skabet@gmail.com>
parents: 100
diff changeset
98 CannotFindModule : E(Err, "Cannot find module '%0'"),
114
3a0cd42de9cc Removed misc/Error.d and is now using the error system all way through.
Anders Johnsen <skabet@gmail.com>
parents: 111
diff changeset
99 InvalidImplicitCast : E(Err, "Cannot make implicit cast between %0 and %1"),
3a0cd42de9cc Removed misc/Error.d and is now using the error system all way through.
Anders Johnsen <skabet@gmail.com>
parents: 111
diff changeset
100 UndefinedIdentifier : E(Err, "Undefined identifier '%0'"),
3a0cd42de9cc Removed misc/Error.d and is now using the error system all way through.
Anders Johnsen <skabet@gmail.com>
parents: 111
diff changeset
101 UndefinedType : E(Err, "Undefined type '%0'"),
3a0cd42de9cc Removed misc/Error.d and is now using the error system all way through.
Anders Johnsen <skabet@gmail.com>
parents: 111
diff changeset
102 MissingMember : E(Err, "%0 %1 has no member %2"),
136
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 114
diff changeset
103 CannotRedeclare : E(Err, "Cannot redeclare '%0'"),
109
Anders Halager <halager@gmail.com>
parents: 107 106
diff changeset
104
114
3a0cd42de9cc Removed misc/Error.d and is now using the error system all way through.
Anders Johnsen <skabet@gmail.com>
parents: 111
diff changeset
105 // literals
106
89db676fbacb Now able of understanding strings.
Anders Johnsen <skabet@gmail.com>
parents: 100
diff changeset
106 InvalidStrPrefix : E(Err, "Invalid string literal prefix"),
89db676fbacb Now able of understanding strings.
Anders Johnsen <skabet@gmail.com>
parents: 100
diff changeset
107 InvalidStrEscape : E(Err, "Invalid escape sequence"),
89db676fbacb Now able of understanding strings.
Anders Johnsen <skabet@gmail.com>
parents: 100
diff changeset
108 InvalidUtf8Hex : E(Err, "Invalid Utf8 hex char"),
111
c658172ca8a0 Parsing basic integers and floats.
Anders Johnsen <skabet@gmail.com>
parents: 109
diff changeset
109 NoCharEntityEnd : E(Err, "Character entity have no end, insert ';'"),
c658172ca8a0 Parsing basic integers and floats.
Anders Johnsen <skabet@gmail.com>
parents: 109
diff changeset
110 InvalidCharEntity : E(Err, "Invalid character entity"),
106
89db676fbacb Now able of understanding strings.
Anders Johnsen <skabet@gmail.com>
parents: 100
diff changeset
111 InvalidHexStrChar : E(Err, "Invalid character in hex string"),
89db676fbacb Now able of understanding strings.
Anders Johnsen <skabet@gmail.com>
parents: 100
diff changeset
112 StringShortEscape : E(Err, "String literal is to short for escape sequence"),
111
c658172ca8a0 Parsing basic integers and floats.
Anders Johnsen <skabet@gmail.com>
parents: 109
diff changeset
113 StringHexInvalid : E(Err, "Hex escape sequence have invalid digit at position %0 of %1"),
c658172ca8a0 Parsing basic integers and floats.
Anders Johnsen <skabet@gmail.com>
parents: 109
diff changeset
114 InvalidStartInteger : E(Err, "Invalid begining of number"),
c658172ca8a0 Parsing basic integers and floats.
Anders Johnsen <skabet@gmail.com>
parents: 109
diff changeset
115 IntegerToLarge : E(Err, "Integer is to large. Max size is 18446744073709551615"),
c658172ca8a0 Parsing basic integers and floats.
Anders Johnsen <skabet@gmail.com>
parents: 109
diff changeset
116 FloatingToLarge : E(Err, "Floating literal is to large"),
c658172ca8a0 Parsing basic integers and floats.
Anders Johnsen <skabet@gmail.com>
parents: 109
diff changeset
117 FloatingInvalidEnd : E(Err, "Floating literal have wrong ending"),
c658172ca8a0 Parsing basic integers and floats.
Anders Johnsen <skabet@gmail.com>
parents: 109
diff changeset
118 FloatingBadLocation : E(Err, "Bad location for '%0' in floting literal"),
136
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 114
diff changeset
119 FloatingDotInE : E(Err, "There cannot be a dot in the exponent of a floating literal"),
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 114
diff changeset
120 CannotAccessPrivate : E(Err, "Cannot access private member.")
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
121 ];
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
122 }
99
857f0d530789 Imports and improved module statement
Anders Halager <halager@gmail.com>
parents: 92
diff changeset
123