internal void rp_print_token(Print *print, nt_Token *token) { switch(token->type) { case rp_TOKEN_SKIP: { Print_cstr(print,"SKIP"); } break; case rp_TOKEN_TAGOPEN: { Print_cstr(print,"TAGOPEN"); } break; case rp_TOKEN_TAGCLOSE: { Print_cstr(print,"TAGCLOSE"); } break; case rp_TOKEN_TAGFINISH: { Print_cstr(print,"TAGFINISH"); } break; case rp_TOKEN_TAGFINISHOPEN: { Print_cstr(print,"TAGFINISHOPEN"); } break; case rp_TOKEN_EQUAL: { Print_cstr(print,"EQUAL"); } break; case rp_TOKEN_IDENTIFIER: { Print_cstr(print,"INDENTIFIER("); Print_str(print, token->begin, token->end); Print_cstr(print,")"); } break; case rp_TOKEN_STRING: { Print_cstr(print,"STRING("); Print_str(print, token->begin, token->end); Print_cstr(print,")"); } break; default: break; } }
internal void rp_Parser_log_context(rp_Parser *self) { b8 no_token = self->tkbegin == self->tkend; char *pos = 0; if (no_token) { pos = self->tokenizer.it; } else { pos = self->tkbegin->begin; } char *begin = self->tokenizer.text_begin; char *end = self->tokenizer.text_end; Assert(begin <= pos && pos <= end); char *context_begin; char *context_end; { char *it = pos; while (it != begin && *it != '\n') { --it; } if (*it == '\n') ++it; context_begin = it; } { char *it = pos; while (it != end && *it != '\n') { ++it; } context_end = it; } Print *print = &self->log; Print_cstr(print,"[Context]"); if (no_token) { Print_cstr(print, " No valid token available. line: "); Print_u64(print, self->tokenizer.line); Print_cstr(print, " column: "); Print_u64(print, self->tokenizer.column); Print_cstr(print, "\n"); } else { Print_cstr(print, "\n"); } Print_str(print, context_begin, context_end); Print_cstr(print,"\n"); Print_cstr(print,"^"); Print_align(print,pos - context_begin + 1, 1, ' '); Print_cstr(print,"\n"); }
string Assignment::Full_Print_str() { string result="\n\n\n////////////// statement ///////////////////////////\n"; result+=Print_str(); result+="\n////////////// definitions ///////////////////////////\n"; for(vector<Read_Reference*>::iterator it=this->GetReferences()->begin(); it != this->GetReferences()->end(); ++it) result +="\n"+(*it)->Print_str(0); return result; }
void Edge::Print(std::string s){ std::cout<<Print_str(s); }