Mercurial > projects > dil
annotate trunk/src/dil/Messages.d @ 394:6440da4adb07
Fixed forward references of enum MID complaints by compiler.
Fix in cmd.Generate: token whitespace mustn't be printed in printToken().
author | Aziz K?ksal <aziz.koeksal@gmail.com> |
---|---|
date | Wed, 19 Sep 2007 12:20:11 +0200 |
parents | 33b566df6af4 |
children | e2529923a0cb |
rev | line source |
---|---|
54 | 1 /++ |
2 Author: Aziz Köksal | |
249 | 3 License: GPL3 |
54 | 4 +/ |
326 | 5 module dil.Messages; |
391
33b566df6af4
Migrated project to Tango.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
390
diff
changeset
|
6 import common; |
54 | 7 |
309 | 8 /// Index into table of compiler messages. |
54 | 9 enum MID |
10 { | |
309 | 11 // Lexer messages: |
390
4d36eea1bbc9
Refactored Lexer.scan().
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
389
diff
changeset
|
12 IllegalCharacter, |
54 | 13 InvalidUnicodeCharacter, |
14 InvalidUTF8Sequence, | |
15 // '' | |
16 UnterminatedCharacterLiteral, | |
17 EmptyCharacterLiteral, | |
18 // #line | |
19 ExpectedIdentifierSTLine, | |
388
ae154eceba65
Applied some fixes to scanning and printing #line tokens.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
375
diff
changeset
|
20 ExpectedIntegerAfterSTLine, |
323 | 21 ExpectedFilespec, |
22 UnterminatedFilespec, | |
54 | 23 UnterminatedSpecialToken, |
24 // "" | |
25 UnterminatedString, | |
26 // x"" | |
27 NonHexCharInHexString, | |
28 OddNumberOfDigitsInHexString, | |
29 UnterminatedHexString, | |
30 // /* */ /+ +/ | |
31 UnterminatedBlockComment, | |
32 UnterminatedNestedComment, | |
33 // `` r"" | |
34 UnterminatedRawString, | |
35 UnterminatedBackQuoteString, | |
36 // \x \u \U | |
37 UndefinedEscapeSequence, | |
38 InsufficientHexDigits, | |
39 // \&[a-zA-Z][a-zA-Z0-9]+; | |
272
0bde32503976
- Added module HtmlEntities. It contains a table for converting HTML entities to Unicode characters.
aziz
parents:
249
diff
changeset
|
40 UndefinedHTMLEntity, |
54 | 41 UnterminatedHTMLEntity, |
42 InvalidBeginHTMLEntity, | |
56
63af7ddf52e1
- Started properly implementing number scanner. Added stub for real numbers.
aziz
parents:
54
diff
changeset
|
43 // integer overflows |
58 | 44 OverflowDecimalSign, |
56
63af7ddf52e1
- Started properly implementing number scanner. Added stub for real numbers.
aziz
parents:
54
diff
changeset
|
45 OverflowDecimalNumber, |
63af7ddf52e1
- Started properly implementing number scanner. Added stub for real numbers.
aziz
parents:
54
diff
changeset
|
46 OverflowHexNumber, |
63af7ddf52e1
- Started properly implementing number scanner. Added stub for real numbers.
aziz
parents:
54
diff
changeset
|
47 OverflowBinaryNumber, |
63af7ddf52e1
- Started properly implementing number scanner. Added stub for real numbers.
aziz
parents:
54
diff
changeset
|
48 OverflowOctalNumber, |
63 | 49 OverflowFloatNumber, |
50 OctalNumberHasDecimals, | |
59
3e594725899a
- Issuing error when no digits were found in hex and binary numbers.
aziz
parents:
58
diff
changeset
|
51 NoDigitsInHexNumber, |
3e594725899a
- Issuing error when no digits were found in hex and binary numbers.
aziz
parents:
58
diff
changeset
|
52 NoDigitsInBinNumber, |
62
96af5653acef
- Fixed loop of hex number scanner. Moved checks under the switch block.
aziz
parents:
59
diff
changeset
|
53 HexFloatExponentRequired, |
389
c4bfceab7246
Applied fixes and improvements to hex float scanner.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
388
diff
changeset
|
54 HexFloatExpMustStartWithDigit, |
c4bfceab7246
Applied fixes and improvements to hex float scanner.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
388
diff
changeset
|
55 FloatExpMustStartWithDigit, |
86
0459c902a370
- Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents:
81
diff
changeset
|
56 |
309 | 57 // Parser messages: |
86
0459c902a370
- Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents:
81
diff
changeset
|
58 ExpectedButFound, |
238
f3c6c15961bb
- Added method peekNext(). Replaced code that used lx.peek() with peekNext().
aziz
parents:
86
diff
changeset
|
59 RedundantStorageClass, |
341
3ac651ea83fb
- Fix: created TemplateAliasParameter instead of TemplateTypeParameter.
aziz
parents:
329
diff
changeset
|
60 TemplateTupleParameter, |
342
f13d551d7c4f
- Added error messages MID.InContract and MID.OutContract.
aziz
parents:
341
diff
changeset
|
61 InContract, |
f13d551d7c4f
- Added error messages MID.InContract and MID.OutContract.
aziz
parents:
341
diff
changeset
|
62 OutContract, |
359
511c14950cac
- Added messages MissingLinkageType and UnrecognizedLinkageType.
aziz
parents:
342
diff
changeset
|
63 MissingLinkageType, |
511c14950cac
- Added messages MissingLinkageType and UnrecognizedLinkageType.
aziz
parents:
342
diff
changeset
|
64 UnrecognizedLinkageType, |
309 | 65 |
66 // Help messages: | |
67 HelpMain, | |
329 | 68 HelpGenerate, |
375
0bd21b746a04
- Added code to main() for recognizing options to the importgraph command.
aziz
parents:
359
diff
changeset
|
69 HelpImportGraph, |
309 | 70 } |
71 | |
394
6440da4adb07
Fixed forward references of enum MID complaints by compiler.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
391
diff
changeset
|
72 private string[] messages; |
6440da4adb07
Fixed forward references of enum MID complaints by compiler.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
391
diff
changeset
|
73 |
6440da4adb07
Fixed forward references of enum MID complaints by compiler.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
391
diff
changeset
|
74 package void SetMessages(string[] msgs) |
6440da4adb07
Fixed forward references of enum MID complaints by compiler.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
391
diff
changeset
|
75 { |
6440da4adb07
Fixed forward references of enum MID complaints by compiler.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
391
diff
changeset
|
76 assert(MID.max+1 == msgs.length); |
6440da4adb07
Fixed forward references of enum MID complaints by compiler.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
391
diff
changeset
|
77 messages = msgs; |
6440da4adb07
Fixed forward references of enum MID complaints by compiler.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
391
diff
changeset
|
78 } |
6440da4adb07
Fixed forward references of enum MID complaints by compiler.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
391
diff
changeset
|
79 |
309 | 80 string GetMsg(MID mid) |
81 { | |
394
6440da4adb07
Fixed forward references of enum MID complaints by compiler.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
391
diff
changeset
|
82 assert(mid < messages.length); |
6440da4adb07
Fixed forward references of enum MID complaints by compiler.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
391
diff
changeset
|
83 return messages[mid]; |
309 | 84 } |
85 | |
391
33b566df6af4
Migrated project to Tango.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
390
diff
changeset
|
86 char[] FormatMsg(MID mid, ...) |
309 | 87 { |
391
33b566df6af4
Migrated project to Tango.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
390
diff
changeset
|
88 return Format(_arguments, _argptr, GetMsg(mid)); |
54 | 89 } |
90 | |
391
33b566df6af4
Migrated project to Tango.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
390
diff
changeset
|
91 /+ |
33b566df6af4
Migrated project to Tango.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
390
diff
changeset
|
92 char[] FormatArray(char[] format_str, char[][] args) |
309 | 93 { |
391
33b566df6af4
Migrated project to Tango.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
390
diff
changeset
|
94 auto tiinfos = new TypeInfo[args.length]; |
33b566df6af4
Migrated project to Tango.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
390
diff
changeset
|
95 foreach (ref tiinfo; tiinfos) |
33b566df6af4
Migrated project to Tango.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
390
diff
changeset
|
96 tiinfo = typeid(char[]); |
33b566df6af4
Migrated project to Tango.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
390
diff
changeset
|
97 return Format(tiinfos, args.ptr, format_str); |
309 | 98 } |
391
33b566df6af4
Migrated project to Tango.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
390
diff
changeset
|
99 +/ |