package thompsonConstruction;/*** @author Cherry* @date 2022年1月23日* @time 18:47* @brief 正则表达式的错误处理*/public class ErrorHandler {public enum Error {E_MEM, //内存不足E_BADEXPR, //正则表达式错误E_PAREN, //括号不匹配E_LENGTH, //要解析的正则表达式过多E_BRACKET, //字符集类没有以 [ 开头E_BOL, //^必须在表达式的开头E_CLOSE, //* ? + 后面必须跟着表达式E_NEWLINE, //双引号中不能保护换行符E_BADMAC, //没有匹配的 }E_NOMAC, //给定的宏表达式不存在E_MACDEPTH //宏表达式的间套太深}private static String[] errMsgs = new String[] {"Not enough memory for NFA","Malformed regular expression","Missing close parenthesis","Too many regular expression or expression too long","Missing [ in character class","^ must be at the start of expression or after [","+ ? or * must follow an expression or subexpression","Newline in quoted string, use \\n to get newline into expression","Missing ) in macro expansion","Macro doesn't exist","Macro expansions nested too deeply"};public static void parseErr(Error type) throws Exception {throw new Exception(errMsgs[type.ordinal()]);}}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。