token * walker = chain->child; // Walk the existing tree
token * remainder; // Hold unparsed tail of chain
-#ifndef NDEBUG
- ParseTrace(stderr, "parser >>");
-#endif
+ // Enable to monitor parsing steps
+ // ParseTrace(stderr, "parser >>");
// Remove existing token tree
e->root = NULL;
remainder->prev = NULL;
}
-#ifndef NDEBUG
- fprintf(stderr, "\nNew line\n");
-#endif
-
Parse(pParser, walker->type, walker, e);
walker = remainder;
}
// Signal finish to parser
-#ifndef NDEBUG
- fprintf(stderr, "\nFinish parse\n");
-#endif
Parse(pParser, 0, NULL, e);
// Disconnect of (now empty) root
return;
}
-#ifndef NDEBUG
- fprintf(stderr, "Strip line tokens from %d (%lu:%lu) (child %d)\n", block->type, block->start, block->len, block->child->type);
- token_tree_describe(block, e->dstr->str);
-#endif
-
token * l = block->child;
// Custom actions
stack_free(pair_stack);
pair_emphasis_tokens(doc);
-
-#ifndef NDEBUG
- token_tree_describe(doc, e->dstr->str);
-#endif
}
// Return original extensions
if (yymsp[-1].minor.yy0 == NULL) { yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; yymsp[0].minor.yy0 = NULL;}
yylhsminor.yy0 = yymsp[-1].minor.yy0;
token_chain_append(yylhsminor.yy0, yymsp[0].minor.yy0);
- #ifndef NDEBUG
- fprintf(stderr, "Next block %d\n", yylhsminor.yy0->tail->type);
- #endif
}
yymsp[-1].minor.yy0 = yylhsminor.yy0;
break;
{
engine->root = yymsp[0].minor.yy0; // In case the first block is metadata and we just want to know if it exists
strip_line_tokens_from_block(engine, yymsp[0].minor.yy0);
- #ifndef NDEBUG
- fprintf(stderr, "First block %d\n", yymsp[0].minor.yy0->type);
- #endif
yylhsminor.yy0 = yymsp[0].minor.yy0;
}
yymsp[0].minor.yy0 = yylhsminor.yy0;
if (B == NULL) { B = C; C = NULL;}
A = B;
token_chain_append(A, C);
- #ifndef NDEBUG
- fprintf(stderr, "Next block %d\n", A->tail->type);
- #endif
}
blocks(A) ::= block(B).
{
engine->root = B; // In case the first block is metadata and we just want to know if it exists
strip_line_tokens_from_block(engine, B);
- #ifndef NDEBUG
- fprintf(stderr, "First block %d\n", B->type);
- #endif
A = B;
}
opener_count[peek->type]--;
}
-#ifndef NDEBUG
- fprintf(stderr, "stack now sized %lu\n", s->size);
-#endif
// Prune matched section
if (e->should_prune[pair_type]) {
if (walker->can_open && e->can_open_pair[walker->type] && walker->unmatched) {
stack_push(s, walker);
opener_count[walker->type]++;
-#ifndef NDEBUG
- fprintf(stderr, "push token type %d to stack (%lu elements)\n", walker->type, s->size);
-#endif
}
walker = walker->next;
}
-#ifndef NDEBUG
- fprintf(stderr, "token stack has %lu elements (of %lu)\n", s->size, s->capacity);
-#endif
-
// Remove unused tokens from stack and return to parent
s->size = start_counter;
}