public static Dictionary <string, Func <string[], string> > getMessages(ForLoopErrors theLogicOrder) { Dictionary <string, Func <string[], string> > messages = new Dictionary <string, Func <string[], string> > (); messages.Add(ForLoopErrorType.missingIndentOperator.ToString(), theLogicOrder.missingIndentOperator); messages.Add(ForLoopErrorType.unknownFormat.ToString(), theLogicOrder.unknownFormat); messages.Add(ForLoopErrorType.expectVariableAt2.ToString(), theLogicOrder.expectVariableAt2); messages.Add(ForLoopErrorType.expectInAt3.ToString(), theLogicOrder.expectInAt3); messages.Add(ForLoopErrorType.expectRangeAt4.ToString(), theLogicOrder.expectRangeAt4); messages.Add(ForLoopErrorType.rangeArgumentEmpty.ToString(), theLogicOrder.rangeArgumentEmpty); messages.Add(ForLoopErrorType.rangeArgumentNotNumber.ToString(), theLogicOrder.rangeArgumentNotNumber); messages.Add(ForLoopErrorType.rangeMissingParenthesis.ToString(), theLogicOrder.rangeMissingParenthesis); messages.Add(ForLoopErrorType.counterVariableIsNotNumber.ToString(), theLogicOrder.counterVariableIsNotNumber); return(messages); }
public static Func <string[], string>[] getStatements(ForLoopErrors theLogicOrder) { List <Func <string[], string> > statements = new List <Func <string[], string> > (); statements.Add(theLogicOrder.missingIndentOperator); statements.Add(theLogicOrder.unknownFormat); statements.Add(theLogicOrder.expectVariableAt2); statements.Add(theLogicOrder.expectInAt3); statements.Add(theLogicOrder.expectRangeAt4); statements.Add(theLogicOrder.rangeArgumentEmpty); statements.Add(theLogicOrder.rangeArgumentNotNumber); statements.Add(theLogicOrder.rangeMissingParenthesis); statements.Add(theLogicOrder.counterVariableIsNotNumber); return(statements.ToArray()); }
public static void setLanguage() { currentLanguage = new SwedishLanguage(); IErrorSender theSender = (currentLanguage as IErrorSender); IfStatementErrors ifError = theSender.ifStatementErrors; ElseStatementErrors elseError = theSender.elseStatementErrors; ForLoopErrors forError = theSender.forLoopErrors; IndentationErrors indentError = theSender.indentErrors; TextErrors txtError = theSender.textErrors; VariableErrors varError = theSender.variableErrors; WhileLoopErrors whileError = theSender.whileLoopErrors; NumberErrors numError = theSender.numberErrors; KeywordErrors keywordError = theSender.keywordErrors; FunctionErrors funcError = theSender.functionErrors; OtherErrors otherError = theSender.otherErrors; SystemFailureErrors systemErrors = theSender.systemErrors; currentLanguage.initLanguageErrors1(ifError, elseError, forError, indentError, txtError, varError); currentLanguage.initLanguageErrors2(whileError, numError, keywordError, funcError, otherError, systemErrors); }
/// Inits first part of the language errors. Stores error messages in dictionary. public void initLanguageErrors1(IfStatementErrors If, ElseStatementErrors Else, ForLoopErrors For, IndentationErrors Indent, TextErrors Text, VariableErrors Variable) { errorMessages.Add(ErrorType.IfStatements, IfErrorsOrder.getMessages(If)); errorMessages.Add(ErrorType.ElseStatements, ElseErrorsOrder.getMessages(Else)); errorMessages.Add(ErrorType.ForLoop, ForErrorsOrder.getMessages(For)); errorMessages.Add(ErrorType.Indentation, IndentationErrorsOrder.getMessages(Indent)); errorMessages.Add(ErrorType.Text, TextErrorsOrder.getMessages(Text)); errorMessages.Add(ErrorType.Variable, VariableErrorsOrder.getMessages(Variable)); }