bool FindStartingToken(TokenizedWord firstWord, Statement statment)
        {
            bool foundStartingToken = false;
            foreach (var token in firstWord.Tokens)
                if (token is Generic)
                {
                    var generictoken = (Generic)token;

                    foundStartingToken = statment.startingTokens.Any(t => t == generictoken.genericType);
                    if (foundStartingToken)
                    {
                        var type = generictoken.genericType;
                        if (statment.statementType != StatementType.Assignment)
                        {
                            if (type == GenericType.Intvariable ||
                                type == GenericType.StringVariable ||
                                type == GenericType.RealVariable)
                            {
                                if (!handler.IsDeclared(firstWord.Value))
                                    return false;
                                else
                                    return true;

                            }
                            return foundStartingToken;
                        }
                        return foundStartingToken;
                    }
                }
            return foundStartingToken;
        }
 public StatementIdentifier(Statement[] statements)
 {
     handler = new StatementHandler();
     handler.Ended += OnEnded;
     this.statements = statements;
     ViewAllStatemets();
 }
        public bool HandleStatement(Statement statement, TokenizedWord[] sentence)
        {
            currentStatement = statement;
            switch (statement.statementType)
            {
                case StatementType.Arithmatic:
                   return HandleArithmatic(sentence);
                case StatementType.Assignment:
                    return HandleAssignment(sentence);
                case StatementType.Comment:
                    return HandleComment(sentence);
                case StatementType.ConditionalExpression:
                    return HandleLogical(sentence) || HandleRelational(sentence);
                case StatementType.End:
                    if (Ended != null)
                        Ended();
                    return true;
                case StatementType.IFThen:
                    break;
                case StatementType.Print:
                    return HandlePrint(sentence);
                case StatementType.Read:
                    return HandleRead(sentence);
            }

            return false;
        }
 bool CheckTokens(TokenizedWord word, Statement statment)
 {
     var tokens = word.Tokens.Where(t => t is Generic).Select(t => (Generic)t).ToArray();
     return tokens.Any(t => statment.followUpTokens.Any(fT => t.genericType == fT));
 }
 public Result(Statement statement, string answer, GenericType type)
 {
     
 }