Difficult-Rocket/Difficult_Rocket/api/Exp/command.py

55 lines
1.2 KiB
Python
Raw Normal View History

2022-05-11 11:11:39 +08:00
# -------------------------------
# Difficult Rocket
# Copyright © 2021-2022 by shenjackyuanjie
# All rights reserved
# -------------------------------
"""
writen by shenjackyuanjie
mail: 3695888@qq.com
github: @shenjackyuanjie
gitee: @shenjackyuanjie
"""
2022-05-25 09:16:38 +08:00
from . import Error
class CommandError(Error):
"""命令解析相关 error"""
2022-05-11 11:11:39 +08:00
class CommandParseError(CommandError):
"""命令解析时出现错误"""
2022-06-04 11:08:30 +08:00
# QMark -> Quotation marks
# Pos -> Position
class CommandQMarkPosError(CommandParseError):
2022-05-11 11:11:39 +08:00
"""命令中,引号位置不正确
2022-05-25 09:16:38 +08:00
例如 /command "aabcc "awdawd"""
2022-06-04 11:08:30 +08:00
class CommandQMarkMissing(CommandParseError):
2022-05-25 09:16:38 +08:00
"""命令中引号缺失
例如: /command "aawwdawda awdaw """
2022-06-04 11:08:30 +08:00
class CommandQMarkConflict(CommandParseError):
"""命令中引号位置冲突
例如: /command "aaaa "aaaa aaaa"""
first_qmark_pos = None
conflict_qmark_pos = None
2022-06-04 11:08:30 +08:00
class CommandQMarkPreMissing(CommandQMarkMissing):
"""命令中 前面的引号缺失
例如: /command aaaa" aaaaaa"""
suf_qmark_pos = None
class CommandQMarkSufMissing(CommandQMarkMissing):
"""命令中 后面的引号缺失(引号未闭合)
例如: /command "aaaawaa some command"""
pre_qmark_pos = None