private static bool ifCheck(Logic[] logicOrder, int lineNumber) { if (logicOrder [logicOrder.Length - 1].currentType != WordTypes.indentOperator) { ErrorMessage.sendErrorMessage(lineNumber, ErrorType.IfStatements, IfErrorType.missingIndentOperator.ToString(), null); } if (logicOrder.Length < 3) { ErrorMessage.sendErrorMessage(lineNumber, ErrorType.IfStatements, IfErrorType.unknownFormat.ToString(), null); } Logic[] statementLogic = new Logic[logicOrder.Length - 2]; for (int i = 1; i < logicOrder.Length - 1; i++) { statementLogic [i - 1] = logicOrder [i]; } if (!PossibleStatement.validStatement(statementLogic, lineNumber)) { ErrorMessage.sendErrorMessage(lineNumber, ErrorType.System, SystemFailureErrorType.possibleComparissonStatements.ToString(), null); } return(true); }
private static bool whileCheck(Logic[] logicOrder, int lineNumber) { if (logicOrder.Length < 3) { ErrorMessage.sendErrorMessage(lineNumber, "Okänt format i din While loop"); } if (logicOrder [logicOrder.Length - 1].currentType != WordTypes.indentOperator) { ErrorMessage.sendErrorMessage(lineNumber, "Saknas ett \":\" i slutet av din While loop"); } Logic[] statementLogic = new Logic[logicOrder.Length - 2]; for (int i = 1; i < logicOrder.Length - 1; i++) { statementLogic [i - 1] = logicOrder [i]; } if (!PossibleStatement.validStatement(statementLogic, lineNumber)) { ErrorMessage.sendErrorMessage(lineNumber, "Okänt format i din While loops expression"); } return(true); }