作者在 2007-06-02 21:36:00 发布以下内容
case BACKTRACE:
/*将当前状态与子状态机的结束状态连接*/
setdestState(g_st->curState, (int)g_st->eleCount, g_mstk->topM->state_end);
/*将当前状态回退到子状态机的头部,开始一个新的分支*/
g_st->curState = g_mstk->topM->state_start;
break;
case INPUT_ELE:
/*是一个终结符,连上一条弧*/
g_lastchar = g_symbol_charvalue;
psnew = newState();
appendStateTable(g_st, psnew); /*添加到状态表*/
setdestState(g_st->curState, (int)g_symbol_charvalue, psnew);
/*重复运算符*/
getSymbol();
switch (g_symbol_type) {
case REPEAT_ZERO_MORE:
/*(a*)*/
setdestState(g_st->curState, g_st->eleCount, psnew);
setdestState(psnew, g_st->eleCount, g_st->curState);
/*移动到新的状态*/
g_st->curState = psnew;
printf("debug: ZEOR_MORE\n");
break;
case REPEAT_ZERO_ONCE:
/*(a?)*/
setdestState(g_st->curState, g_st->eleCount, psnew);
/*移动到新的状态*/
&nb
/*将当前状态与子状态机的结束状态连接*/
setdestState(g_st->curState, (int)g_st->eleCount, g_mstk->topM->state_end);
/*将当前状态回退到子状态机的头部,开始一个新的分支*/
g_st->curState = g_mstk->topM->state_start;
break;
case INPUT_ELE:
/*是一个终结符,连上一条弧*/
g_lastchar = g_symbol_charvalue;
psnew = newState();
appendStateTable(g_st, psnew); /*添加到状态表*/
setdestState(g_st->curState, (int)g_symbol_charvalue, psnew);
/*重复运算符*/
getSymbol();
switch (g_symbol_type) {
case REPEAT_ZERO_MORE:
/*(a*)*/
setdestState(g_st->curState, g_st->eleCount, psnew);
setdestState(psnew, g_st->eleCount, g_st->curState);
/*移动到新的状态*/
g_st->curState = psnew;
printf("debug: ZEOR_MORE\n");
break;
case REPEAT_ZERO_ONCE:
/*(a?)*/
setdestState(g_st->curState, g_st->eleCount, psnew);
/*移动到新的状态*/
&nb