# HG changeset patch # User Aziz K?ksal # Date 1199108925 -3600 # Node ID ae8f58a1391734f1ea3ba77e8bb4528acfa911b6 # Parent 87c4474a1295fc48d3f58d949469c790c1f47ba0 Added messages to struct MSG. diff -r 87c4474a1295 -r ae8f58a13917 trunk/src/dil/Declarations.d --- a/trunk/src/dil/Declarations.d Sat Dec 29 23:37:18 2007 +0100 +++ b/trunk/src/dil/Declarations.d Mon Dec 31 14:48:45 2007 +0100 @@ -15,6 +15,7 @@ import dil.Semantics; import dil.Symbols; import dil.TypeSystem; +import dil.Messages; import common; abstract class Declaration : Node @@ -511,7 +512,7 @@ // Check for interface. if (scop.isInterface) - return scop.error(begin, "an interface can't have member variables"); + return scop.error(begin, MSG.InterfaceCantHaveVariables); // Iterate over variable identifiers in this declaration. foreach (i, ident; idents) diff -r 87c4474a1295 -r ae8f58a13917 trunk/src/dil/Messages.d --- a/trunk/src/dil/Messages.d Sat Dec 29 23:37:18 2007 +0100 +++ b/trunk/src/dil/Messages.d Mon Dec 31 14:48:45 2007 +0100 @@ -133,13 +133,16 @@ auto IllegalStatement = "illegal Statement found: "; auto ExpectedNonEmptyStatement = "didn't expect ';', use {{ } instead"; auto ExpectedScopeIdentifier = "expected 'exit', 'success' or 'failure', not '{}'"; - auto InvalidScopeIdentifier = "'exit', 'success', 'failure' are valid scope identifiers, but not '{}';"; + auto InvalidScopeIdentifier = "'exit', 'success', 'failure' are valid scope identifiers, but not '{}'"; auto ExpectedIntegerAfterAlign = "expected an integer after align, not '{}'"; auto IllegalAsmInstructino = "illegal AsmInstruction found: "; auto ExpectedDeclaratorIdentifier = "expected declarator identifier, not '{}'"; - auto ExpectedTemplateParameters = "expected one or more template parameters not ')'"; - auto ExpectedTypeOrExpression = "expected a type or and expression not ')'"; + auto ExpectedTemplateParameters = "expected one or more template parameters, not ')'"; + auto ExpectedTypeOrExpression = "expected a type or and expression, not ')'"; auto ExpectedAliasTemplateParam = "expected name for alias template parameter, not '{}'"; auto ExpectedNameForThisTempParam = "expected name for 'this' template parameter, not '{}'"; auto ExpectedIdentOrInt = "expected an identifier or an integer, not '{}'"; + // Semantic analysis: + auto VariableConflictsWithDecl = "variable '{}' conflicts with declaration @{}"; + auto InterfaceCantHaveVariables = "an interface can't have member variables"; } diff -r 87c4474a1295 -r ae8f58a13917 trunk/src/dil/Scope.d --- a/trunk/src/dil/Scope.d Sat Dec 29 23:37:18 2007 +0100 +++ b/trunk/src/dil/Scope.d Mon Dec 31 14:48:45 2007 +0100 @@ -46,7 +46,7 @@ { auto loc = sym.node.begin.getLocation(); auto locString = Format("{}({},{})", loc.filePath, loc.lineNum, loc.colNum); - error(var.node.begin, "variable '"~var.ident.str~"' conflicts with symbol @"~locString); + error(var.node.begin, MSG.VariableConflictsWithDecl, var.ident.str, locString); } else symbol.insert(var, var.ident); @@ -113,9 +113,10 @@ infoMan ~= new SemanticError(location, GetMsg(mid)); } - void error(Token* token, char[] msg) + void error(Token* token, char[] formatMsg, ...) { auto location = token.getLocation(); + auto msg = Format(_arguments, _argptr, formatMsg); infoMan ~= new SemanticError(location, msg); } }