}
}
}
+ }
- if (SCF_DFA_OK == ret) {
- scf_dfa_hook_t** pp = &(dfa->hooks[SCF_DFA_HOOK_END]);
+ if (SCF_DFA_OK == ret) {
+ scf_dfa_hook_t** pp = &(dfa->hooks[SCF_DFA_HOOK_END]);
- while (*pp) {
- scf_dfa_hook_t* hook = *pp;
- scf_dfa_node_t* hook_node = hook->node;
+ while (*pp) {
+ scf_dfa_hook_t* hook = *pp;
+ scf_dfa_node_t* hook_node = hook->node;
- *pp = hook->next;
- free(hook);
- hook = NULL;
+ *pp = hook->next;
+ free(hook);
+ hook = NULL;
- scf_logi("\033[34m end hook: %s->action()\033[0m\n", hook_node->name);
+ scf_logi("\033[34m end hook: %s->action()\033[0m\n", hook_node->name);
- if (!hook_node->action)
- continue;
+ if (!hook_node->action)
+ continue;
- ret = hook_node->action(dfa, words, data);
+ ret = hook_node->action(dfa, words, data);
- if (SCF_DFA_OK == ret)
- continue;
+ if (SCF_DFA_OK == ret)
+ continue;
- if (SCF_DFA_SWITCH_TO == ret) {
- scf_logi("\033[34m end hook: switch to %s->%s\033[0m\n\n", node->name, hook_node->name);
+ if (SCF_DFA_SWITCH_TO == ret) {
+ scf_logi("\033[34m end hook: switch to %s->%s\033[0m\n\n", node->name, hook_node->name);
- node = hook_node;
- ret = SCF_DFA_NEXT_WORD;
- }
- break;
+ node = hook_node;
+ ret = SCF_DFA_NEXT_WORD;
}
+ break;
}
}
|| SCF_LEX_WORD_KEY_SIZEOF == w->type)
return 0;
+ if (SCF_LEX_WORD_DIV == w->type)
+ return 1;
+
scf_operator_t* op = scf_find_base_operator(w->text->data, 1);
if (op)
return 1;
static int _expr_action_unary_op(scf_dfa_t* dfa, scf_vector_t* words, void* data)
{
- scf_logd("\n");
+ scf_lex_word_t* w = words->data[words->size - 1];
+ scf_lex_word_t* w1;
+ scf_lex_word_t* w2;
+
+ if (SCF_LEX_WORD_DIV == w->type) {
+ while (1) {
+ w1 = dfa->ops->pop_word(dfa);
+ assert(w1);
+
+ if (SCF_LEX_WORD_EOF == w1->type) {
+ scf_loge("\n");
+
+ scf_lex_word_free(w1);
+ return SCF_DFA_ERROR;
+ }
+
+ int tmp = w1->type;
+ int ret = scf_string_cat(w->text, w1->text);
+
+ scf_lex_word_free(w1);
+ w1 = NULL;
+ if (ret < 0)
+ return ret;
+
+ if (SCF_LEX_WORD_DIV == tmp) {
+ w2 = dfa->ops->pop_word(dfa);
+ assert(w2);
+
+ if (SCF_LEX_WORD_ID != w2->type) {
+ scf_loge("\n");
+
+ scf_lex_word_free(w2);
+ return SCF_DFA_ERROR;
+ }
+
+ ret = scf_string_cat(w->text, w2->text);
+
+ scf_lex_word_free(w2);
+ w2 = NULL;
+ if (ret < 0)
+ return ret;
+
+ w->data.s = scf_string_clone(w->text);
+ if (!w->data.s)
+ return SCF_DFA_ERROR;
+
+ w->type = SCF_LEX_WORD_CONST_STRING;
+ return SCF_DFA_CONTINUE;
+ }
+ }
+ }
+
return _expr_action_op(dfa, words, data, 1);
}