private void AdjustCurrentTokenPropertiesBasedOnPreviousToken(Token newToken)
 {
     if (LastSignificantToken != null)
     {
         // Adjust current token properties based on previous context
         switch (newToken.TokenType)
         {
         case TokenType.DECLARATIVES:
             if (LastSignificantToken.TokenType == TokenType.END)
             {
                 LastSignificantToken.DegradePotentialCodeElementStartingKeywordToSyntaxKeyword();
             }
             break;
         }
     }
 }
        private void AdjustPreviousTokenPropertiesBasedOnCurrentToken(Token newToken)
        {
            if (LastSignificantToken != null)
            {
                // Adjust previous token properties based on current context
                switch (LastSignificantToken.TokenType)
                {
                case TokenType.DATA:
                    if (newToken.TokenType != TokenType.DIVISION)
                    {
                        LastSignificantToken.DegradePotentialCodeElementStartingKeywordToSyntaxKeyword();
                    }
                    break;

                case TokenType.DELETE:
                    if (newToken.TokenType == TokenType.IntegerLiteral)
                    {
                        LastSignificantToken.CorrectType(TokenType.DELETE_CD);
                    }
                    break;

                case TokenType.END:
                    if (!(newToken.TokenType == TokenType.PROGRAM || newToken.TokenType == TokenType.CLASS ||
                          newToken.TokenType == TokenType.FACTORY || newToken.TokenType == TokenType.OBJECT ||
                          newToken.TokenType == TokenType.METHOD || newToken.TokenType == TokenType.DECLARATIVES))
                    {
                        LastSignificantToken.DegradePotentialCodeElementStartingKeywordToSyntaxKeyword();
                    }
                    break;

                case TokenType.FILE:
                    if (newToken.TokenType != TokenType.SECTION)
                    {
                        LastSignificantToken.DegradePotentialCodeElementStartingKeywordToSyntaxKeyword();
                    }
                    break;

                case TokenType.ID:
                    if (newToken.TokenType != TokenType.DIVISION)
                    {
                        LastSignificantToken.DegradePotentialCodeElementStartingKeywordToSyntaxKeyword();
                    }
                    break;

                case TokenType.NEXT:
                    if (newToken.TokenType != TokenType.SENTENCE)
                    {
                        LastSignificantToken.DegradePotentialCodeElementStartingKeywordToSyntaxKeyword();
                    }
                    break;

                case TokenType.PROCEDURE:
                    if (newToken.TokenType != TokenType.DIVISION)
                    {
                        LastSignificantToken.DegradePotentialCodeElementStartingKeywordToSyntaxKeyword();
                    }
                    break;

                case TokenType.SERVICE:
                    if (newToken.TokenType == TokenType.LABEL || newToken.TokenType == TokenType.RELOAD)
                    {
                        LastSignificantToken.CorrectType(TokenType.SERVICE_CD);
                    }
                    break;

                case TokenType.WHEN:
                    if (newToken.TokenType == TokenType.HIGH_VALUE || newToken.TokenType == TokenType.HIGH_VALUES ||
                        newToken.TokenType == TokenType.LOW_VALUE || newToken.TokenType == TokenType.LOW_VALUES ||
                        newToken.TokenType == TokenType.SPACE || newToken.TokenType == TokenType.SPACES ||
                        newToken.TokenType == TokenType.ZERO || newToken.TokenType == TokenType.ZEROS || newToken.TokenType == TokenType.ZEROS)
                    {
                        LastSignificantToken.DegradePotentialCodeElementStartingKeywordToSyntaxKeyword();
                    }
                    break;
                }
            }
        }