py/parse2: Make pt_show function work.

This commit is contained in:
Damien George 2017-08-14 18:21:25 +10:00
parent 3417b28eaf
commit 022d6a9798
1 changed files with 5 additions and 14 deletions

View File

@ -378,19 +378,10 @@ const byte *pt_rule_first(const byte *p) {
}
#if 0
void pt_show(pt_t *pt) {
const byte *top = (byte*)pt->vv.buf + pt->vv.len;
/*
for (const byte *p = (byte*)pt->buf; p < top; ++p) {
if ((p - (byte*)pt->buf) % 20 == 0) {
printf("\n");
}
printf("%02x ", *p);
}
printf("\n");
*/
for (const byte *p = (byte*)pt->vv.buf; p < top;) {
printf("%04u ", (uint)(p - (byte*)pt->vv.buf));
void pt_show(const byte *p, const byte *ptop) {
const byte *start = p;
while (p < ptop) {
printf("%04u ", (uint)(p - (byte*)start));
const byte *p2 = pt_advance(p, false);
for (const byte *p3 = p; p3 < p2; ++p3) {
printf("%02x ", *p3);
@ -1365,7 +1356,7 @@ mp_parse_tree_t mp_parse(mp_lexer_t *lex, mp_parse_input_kind_t input_kind) {
#endif
#if 0
pt_show(pt);
pt_show((const byte*)pt->vv.buf, (const byte*)pt->vv.buf + pt->vv.len);
{
size_t n_pool, n_qstr, n_str_data_bytes, n_total_bytes;