diff options
| -rw-r--r-- | src/ctemplates.c | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/src/ctemplates.c b/src/ctemplates.c index 2129ec2..2092209 100644 --- a/src/ctemplates.c +++ b/src/ctemplates.c @@ -446,7 +446,6 @@ print_ast_helper(struct TMPL_tagnode* cursor, int level){ } void print_ast(struct TMPL_templates* t){ - printf("Printing template %p\nRoottag: %p\n",(void*)t,(void*)t->roottag); print_ast_helper(t->roottag,0); } @@ -789,15 +788,12 @@ parse_loop(struct TMPL_token* head, struct TMPL_buf* errbuf){ } cursor = cursor->next; } - printf("When parsing loop, cursor for continue is %p\n",(void*)cursor); if(cursor == NULL){ bputs(errbuf,"Parse error: Tried parsing loop and hit end of stream near\n"); bputsn(errbuf,head->start,ERRBUF_HINTLEN); return NULL; } - printf("When parsing loop, cursor was %p and cursor->next was %p\n",(void*)cursor,(void*)cursor->next); t->next = parse(cursor->next,errbuf); - printf("Setting loop %p's next to %p\n",(void*)t,(void*)t->next); t->TMPL_tag.loop.body = parse(head->next,errbuf); return t; } @@ -883,7 +879,6 @@ parse_variable(struct TMPL_token* head, struct TMPL_buf* errbuf){ struct TMPL_tagnode* parse_continue(struct TMPL_token* head, struct TMPL_buf* errbuf){ - printf("Praseing continue\n"); struct TMPL_tagnode* t = alloc_tagnode(); head->into = t; const char* start_of_attribs = head->start + TAG_CONTINUE_LENGTH; @@ -895,7 +890,6 @@ parse_continue(struct TMPL_token* head, struct TMPL_buf* errbuf){ while(is_whitespace(*start_of_level)) start_of_level++; if(*start_of_level != '='){ - printf("Start of level was %c\n",*start_of_level); if(*start_of_level == '>'){ level = 1; }else{ @@ -911,7 +905,6 @@ parse_continue(struct TMPL_token* head, struct TMPL_buf* errbuf){ sscanf(start_of_level,"%u",&level); } } - printf("Found continue %u levels\n",level); int y = level; struct TMPL_token* cursor = head; while(y > 0){ @@ -927,7 +920,6 @@ parse_continue(struct TMPL_token* head, struct TMPL_buf* errbuf){ bputs(errbuf,errmsg); } } - printf("Turning continue's next into %5s's into(%p)\n",cursor->start,(void*)cursor->into->next); t->TMPL_tag.breakcont.level = level; t->next = parse(head->next,errbuf); t->type = tag_continue; @@ -968,7 +960,6 @@ parse_break(struct TMPL_token* head, struct TMPL_buf* errbuf){ } y--; if(y > 0 && cursor == NULL){ - printf("Failed 927\n"); exit(-1); size_t msglen = snprintf(NULL,0,"Parsing error: Break was %d levels, but was only nested %d levels deep\n",level,level - y); char errmsg[msglen]; @@ -976,10 +967,7 @@ parse_break(struct TMPL_token* head, struct TMPL_buf* errbuf){ bputs(errbuf,errmsg); } } - printf("Turning break's next into %5s's into (%p)\n",cursor->start,(void*)cursor->into); - /*t->next = cursor->into;*/ t->next = NULL; - printf("At time of prasing, cursor is %p and cursor->into is %p\n",(void*)cursor,(void*)cursor->into); t->TMPL_tag.breakcont.into = cursor->into; t->type = tag_break; return t; @@ -1063,7 +1051,6 @@ parse(struct TMPL_token* head, struct TMPL_buf* errbuf){ if(head == NULL){ return NULL; } - printf("Parse called... on type (%d:%s)\n",head->type,tokentype_to_str(head)); switch(head->type){ case tag_text: root = parse_text(head,errbuf); @@ -1092,7 +1079,6 @@ parse(struct TMPL_token* head, struct TMPL_buf* errbuf){ root = parse_continue(head,errbuf); break; case tag_break: - printf("Parsing break\n"); root = parse_break(head,errbuf); break; default: @@ -1105,7 +1091,6 @@ parse(struct TMPL_token* head, struct TMPL_buf* errbuf){ printf("Error: %s\n",bstringify(errbuf,&dummy)); return NULL; } - printf("parse returning %p\n",(void*)root); return root; } @@ -1122,15 +1107,9 @@ compile(const char* tmplstr){ ret->out = alloc_tmpl_buf(); ret->errout = alloc_tmpl_buf(); struct TMPL_token* tokens = TMPL_tokenize(tmplstr,slen); - printf("After tokenizing, tokens are:\n"); - print_tokens(tokens); struct TMPL_tagnode* ast = parse(tokens,ret->errout); size_t dummy; - printf("errbuf:%s\n",bstringify(ret->errout,&dummy)); - printf("After parsing, syntax tree is:\n"); if(ast == NULL){ - //size_t dummy; - //printf("error: %s\n",bstringify(ret->errout,&dummy)); }else{ ret->roottag = ast; } @@ -1271,23 +1250,11 @@ resolve_name(struct TMPL_varlist* varlist, char* name,struct TMPL_varitem** item int render_break(struct TMPL_templates* t, struct TMPL_tagnode* node, struct TMPL_varlist* varlist){ - printf("Rendering break\n"); - printf("node is:%p\n",(void*)node); - printf("node->next:%p\n",(void*)node->TMPL_tag.breakcont.into->next); - printf("varlist->parent:%p\n",(void*)varlist->parent); - printf("varlist->parent->parent:%p\n",(void*)varlist->parent->parent); - printf("node into:%p\n",(void*)node->TMPL_tag.breakcont.into); - printf("node into->next:%p\n",(void*)node->TMPL_tag.breakcont.into->next); - /*struct TMPL_templates* nt = (struct TMPL_templates)malloc(sizeof(struct TMPL_templates));*/ - /*nt->out = t->out;*/ - /*nt->errout = t->errout;*/ - /*nt->roottag = node->TMPL_tag.breakcont.*/ return render_any(t,node->TMPL_tag.breakcont.into->next,varlist->parent->parent); } int render_continue(struct TMPL_templates* t, struct TMPL_tagnode* node, struct TMPL_varlist* varlist){ - printf("Rendering continue\n"); return render_any(t,node->next,varlist->parent->next->varlist); } @@ -1348,7 +1315,6 @@ render_any(struct TMPL_templates* t, struct TMPL_tagnode* node, struct TMPL_varl err = render_break(t,node,varlist); break; default: - printf("Failed to find node type: %d\n",node->type); exit(-1); break; } @@ -1357,7 +1323,6 @@ render_any(struct TMPL_templates* t, struct TMPL_tagnode* node, struct TMPL_varl void TMPL_render_helper(struct TMPL_templates* t, struct TMPL_varlist* varlist){ - printf("Render helper\n"); struct TMPL_tagnode* cursor = t->roottag; while(cursor != NULL){ render_any(t,cursor,varlist); |
