parserl_warning_error.h 1.6 KB

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * 文件名: parser_warning_error.h
  3. * 目标: 记录parser的警告和错误信息
  4. */
  5. #ifndef AFUN_PARSERL_WARNING_ERROR_H
  6. #define AFUN_PARSERL_WARNING_ERROR_H
  7. /* 词法分析器错误和警告信息 */
  8. #define LEXICAL_ERROR(status, info) ("status: " #status " " info)
  9. #define SYS_ILLEGAL_CHAR(status) LEXICAL_ERROR(status, "System error to obtain illegal characters") /* switch分支获得了不可能的字符 */
  10. #define ILLEGAL_CHAR(status) LEXICAL_ERROR(status, "Illegal characters") /* 输入了非法字符 */
  11. #define SYS_ERROR_STATUS(status) LEXICAL_ERROR(status, "System error to jump status") /* 状态跳转错误 */
  12. #define INCOMPLETE_FILE(status) LEXICAL_ERROR(status, "Incomplete file") /* 文件不完整 */
  13. #define INCULDE_CONTROL(status) LEXICAL_ERROR(status, "Include control characters in the text (not recommended)") /* 文本中包含控制符 */
  14. /* 语法分析器错误和经过信息 */
  15. #define SYNTACTIC_ERROR(status, info) (#status ": " info)
  16. #define CodeListStartError() SYNTACTIC_ERROR(CodeList, "CodeList did not get a suitable start symbol")
  17. #define CodeListEndError() SYNTACTIC_ERROR(CodeList, "CodeList did not get EOF/NUL with end")
  18. #define CodeStartError() SYNTACTIC_ERROR(Code, "Code did not get a suitable start symbol")
  19. #define CodeEndError(p) SYNTACTIC_ERROR(Code, "Code-Block did not get " p " with end")
  20. #define MakeCodeFail() SYNTACTIC_ERROR(Code, "Make code fail (Maybe by prefix)")
  21. #define SYNTACTIC_TOO_DEEP() SYNTACTIC_ERROR(Syntactic, "Recursion too deep")
  22. #define PREFIX_ERROR(satus) SYNTACTIC_ERROR(status, "The system gets the prefix error")
  23. #endif //AFUN_PARSERL_WARNING_ERROR_H