static Node *qs_pop_node(Doc* doc, NodeStack stack);
static void qs_dump_node_stack(Doc *doc, NodeStack stack);
static void qs_free_node_stack(Doc *doc, NodeStack stack);
+static void s_error_check(Doc *doc, Node *node, NodeStack node_stack, NodeStack err_stack);
Node*
doc->now_parent_node = doc->now_parent_node->parent;
doc->parse_mode = PARSE_MODE_CHTML;
}
- Node *prevNode;
- int err = 0;
- for (prevNode = qs_pop_node(doc,node_stack);
- prevNode;
- prevNode = qs_pop_node(doc, node_stack)) {
- if (prevNode && strcasecmp(prevNode->name, &node->name[1]) != 0) {
- qs_push_node(doc, prevNode, err_stack);
- err++;
- continue;
- }
- break;
- }
- if (err) {
- Node *tmpNode = qs_pop_node(doc,node_stack);
- if (tmpNode == NULL && err != 1) {
- if (doc->r)
- ERR(doc->r, "tag parse error (perhaps, miss spell). tag_name:[%s] line:[%d]", &node->name[1], node->line);
- else
- fprintf(stderr, "error :tag parse error (perhaps, miss spell). tag_name:[%s] line:[%d]\n", &node->name[1], node->line);
- for (prevNode = qs_pop_node(doc,err_stack);
- prevNode;
- prevNode = qs_pop_node(doc, err_stack)) {
- qs_push_node(doc, prevNode, node_stack);
- }
- }
- else {
- for (prevNode = qs_pop_node(doc,err_stack);
- prevNode;
- prevNode = qs_pop_node(doc, err_stack)) {
- if (doc->r)
- ERR(doc->r, "tag parse error (perhaps, not close). tag_name:[%s] line:[%d]", prevNode->name, prevNode->line);
- else
- fprintf(stderr, "error :tag parse error (perhaps, not close). tag_name:[%s] line:[%d]\n", prevNode->name, prevNode->line);
- }
- qs_push_node(doc, tmpNode, node_stack);
- }
- err = 0;
- }
+ s_error_check(doc, node, node_stack, err_stack);
}
else {
continue;
static void
+s_error_check(Doc *doc, Node *node, NodeStack node_stack, NodeStack err_stack)
+{
+ Node *prevNode;
+ int err = 0;
+ for (prevNode = qs_pop_node(doc,node_stack);
+ prevNode;
+ prevNode = qs_pop_node(doc, node_stack)) {
+ if (prevNode && strcasecmp(prevNode->name, &node->name[1]) != 0) {
+ qs_push_node(doc, prevNode, err_stack);
+ err++;
+ continue;
+ }
+ break;
+ }
+ if (err) {
+ Node *tmpNode = qs_pop_node(doc,node_stack);
+ if (tmpNode == NULL && err != 1) {
+ if (doc->r)
+ ERR(doc->r, "tag parse error (perhaps, miss spell). tag_name:[%s] line:[%d]", &node->name[1], node->line);
+ else
+ fprintf(stderr, "error :tag parse error (perhaps, miss spell). tag_name:[%s] line:[%d]\n", &node->name[1], node->line);
+ for (prevNode = qs_pop_node(doc,err_stack);
+ prevNode;
+ prevNode = qs_pop_node(doc, err_stack)) {
+ qs_push_node(doc, prevNode, node_stack);
+ }
+ }
+ else {
+ for (prevNode = qs_pop_node(doc,err_stack);
+ prevNode;
+ prevNode = qs_pop_node(doc, err_stack)) {
+ if (doc->r)
+ ERR(doc->r, "tag parse error (perhaps, not close). tag_name:[%s] line:[%d]", prevNode->name, prevNode->line);
+ else
+ fprintf(stderr, "error :tag parse error (perhaps, not close). tag_name:[%s] line:[%d]\n", prevNode->name, prevNode->line);
+ }
+ qs_push_node(doc, tmpNode, node_stack);
+ }
+ err = 0;
+ }
+}
+
+
+static void
qs_dump_node(Doc* doc, Node* node, int indent)
{
Node* p = (Node*)qs_get_child_node(doc,node);