引入有限状态机来解析处理代码逻辑

Signed-off-by: hurley25 <liuhuan1992@gmail.com>