get_error_message Function

public pure function get_error_message(code) result(msg)

This function accepts integer error status code and then return error messagge corresponding to it. !

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: code

Return Value character(len=:), allocatable


Source Code

   pure function get_error_message(code) result(msg)
      implicit none
      integer, intent(in)       :: code
      character(:), allocatable :: msg

      select case (code)
      case (SYNTAX_VALID)
         msg = err_is_nothing

      case (SYNTAX_ERR)
         msg = err_generic

      case (SYNTAX_ERR_PARENTHESIS_MISSING)
         msg = err_r_parenthesis_missing

      case (SYNTAX_ERR_PARENTHESIS_UNEXPECTED)
         msg = err_r_parenthesis_unexpected

      case (SYNTAX_ERR_BRACKET_MISSING)
         msg = err_r_bracket_missing

      case (SYNTAX_ERR_BRACKET_UNEXPECTED)
         msg = err_r_bracket_unexpected

      case (SYNTAX_ERR_CURLYBRACE_MISSING)
         msg = err_r_curlybrace_missing
   
      case (SYNTAX_ERR_CURLYBRACE_UNEXPECTED)
         msg = err_r_curlybrace_unexpected

      case (SYNTAX_ERR_INVALID_TIMES)
         msg = err_invalid_quantifier

      case (SYNTAX_ERR_ESCAPED_SYMBOL_MISSING)
         msg = err_escaped_symbol_missing

      case (SYNTAX_ERR_ESCAPED_SYMBOL_INVALID)
         msg = err_escaped_symbol_invalid
      
      case (SYNTAX_ERR_EMPTY_CHARACTER_CLASS)
         msg = err_empty_character_class
      
      case (SYNTAX_ERR_RANGE_WITH_ESCAPE_SEQUENCES)
         msg = err_range_with_escape_sequences

      case (SYNTAX_ERR_MISPLACED_SUBTRACTION_OPERATOR)
         msg = err_misplaced_subtraction_operator

      case (SYNTAX_ERR_INVALID_CHARACTER_RANGE)
         msg = err_invalid_character_range
      
      case (SYNTAX_ERR_CHAR_CLASS_SUBTRANCTION_NOT_IMPLEMENTED)
         msg = err_character_class_subtraction
      
      case (SYNTAX_ERR_STAR_INCOMPLETE)
         msg = err_star_incomplete
      
      case (SYNTAX_ERR_PLUS_INCOMPLETE)
         msg = err_plus_incomplete
      
      case (SYNTAX_ERR_QUESTION_INCOMPLETE)
         msg = err_question_incomplete

      case (SYNTAX_ERR_INVALID_HEXADECIMAL)
         msg = err_invalid_hexadecimal_value
      
      case (SYNTAX_ERR_HEX_DIGITS_NOT_ENOUGH)
         msg = err_hex_is_not_enought_digit

      case (SYNTAX_ERR_UNICODE_EXCEED)
         msg = err_exceed_unicode_limit
      
      case (ALLOCATION_ERR)
         msg = err_allocation

      !!!
      case (SYNTAX_ERR_THIS_SHOULD_NOT_HAPPEN)
         msg = err_this_should_not_happen

      case default
         msg = err_this_should_not_happen

      end select

   end function get_error_message