view basic/Messages.d @ 100:5f258eaf9517 new_gen

Loading modules in. Just need to add them to the scope of the "main" Module now.
author Anders Johnsen <skabet@gmail.com>
date Tue, 06 May 2008 22:49:43 +0200
parents 857f0d530789
children 89db676fbacb 189c049cbfcc
line wrap: on
line source

module basic.Messages;

enum : uint
{
    // Lex
    InvalidSymbol,
    InvalidIlligaleType,
    UnexpectedEOFBlock,
    OnlyOneDotFloating,
    OnlyOneEFloating,

    // Parse
    UnexpectedTokMulti,
    UnexpectedTokSingle,
    UnexpectedTok,
    CaseValueMustBeInt,
    UnexpectedBeginStmt,
    UnexpectedTokType,
    ExpectedIdAfterDot,
    ExpectedExp,
    ExpectedCastType,
    InvalidDeclType,
    InvalidType,
    //   - imports/module
    ExpectedIdAfterPackage,
    RenameMustBeSingleIdent,


    // Imports
    CannotFindModule,
}

enum MessageType
{
    Warning,
    Error,
}

MessageEntry[uint] Messages;

struct MessageEntry
{
    MessageType type;
    char[] message;
}
    
private alias MessageType.Error Err;
private alias MessageType.Warning War;
private alias MessageEntry E;
static this()
{
    Messages = [
        UnexpectedEOFBlock  : E(Err, "Unexpected end of file. Unclosed comment block"),
        InvalidSymbol       : E(Err, "Read invalid symbol: '%0'"),
        OnlyOneDotFloating  : E(Err, "Only one '.' is allowed in an floating number"),
        OnlyOneEFloating    : E(Err, "Only one E is allowed in an floating number"),

        UnexpectedTokMulti  : E(Err, "Unexpected token, got %0 expected one of %1"),
        UnexpectedTokSingle : E(Err, "Unexpected token, got %0 expected %1"),
        UnexpectedTok       : E(Err, "Unexpected token %0"),
        CaseValueMustBeInt  : E(Err, "Cases can only be integer literals"),
        UnexpectedBeginStmt : E(Err, "Unexpected begining of statement."),
        UnexpectedTokType   : E(Err, "Unexpected token in Type parsing. Got %0"),
        ExpectedIdAfterDot  : E(Err, "Expected identifier after '.'"),
        ExpectedExp         : E(Err, "Expected expression"),
        ExpectedCastType    : E(Err, "Expected cast type"),
        InvalidDeclType     : E(Err, "Invalid declaration type"),
        InvalidType         : E(Err, "Invalid type"),
        ExpectedIdAfterPackage : E(Err, "Identifier expected following package"),
        CannotFindModule    : E(Err, "Cannot find module '%0'")
    ];
}