diff --git a/tutorial/Sgml.pmod b/tutorial/Sgml.pmod index e866695d08c01206e020695dcc6108547e4c69ec..d4fc1fab2b359f5820af3edf73e0ebac8da0282a 100644 --- a/tutorial/Sgml.pmod +++ b/tutorial/Sgml.pmod @@ -13,6 +13,11 @@ class Tag array(object) data; string file; + string location() + { + return "pos "+pos+" in file "+file; + } + varargs void create(string t, mapping p, int po, array(object) d, string f) { tag=t; diff --git a/tutorial/Wmml.pmod b/tutorial/Wmml.pmod index ab1206b752c8ba556a685ee0770e071257504c5c..9c5e85fd51bbf18d48d6ad8763980c052ae2b295 100644 --- a/tutorial/Wmml.pmod +++ b/tutorial/Wmml.pmod @@ -3,6 +3,7 @@ import Sgml; SGML low_make_concrete_wmml(SGML data); + static private int verify_any(SGML data, string in) { int i=1; @@ -12,7 +13,7 @@ static private int verify_any(SGML data, string in) { if(strlen(x->tag) && x->tag[0]=='/') { - werror("Unmatched "+x->tag+" near pos "+x->pos+"\n"); + werror("Unmatched "+x->tag+" near "+x->location()+"\n"); werror(in); i=0; continue; @@ -20,7 +21,7 @@ static private int verify_any(SGML data, string in) switch(x->tag) { default: - werror("Unknown tag "+x->tag+" near pos "+x->pos+".\n"); + werror("Unknown tag "+x->tag+" near "+x->location()+".\n"); werror(in); i=0; break; @@ -75,7 +76,7 @@ static private int verify_any(SGML data, string in) case "example": if(!x->data) { - werror("Tag "+x->tag+" not closed near pos "+x->pos+".\n"); + werror("Tag "+x->tag+" not closed near "+x->location()+".\n"); werror(in); i=0; } @@ -96,7 +97,7 @@ static private int verify_any(SGML data, string in) case "index": if(x->data) { - werror("Tag "+x->tag+" should not be closed near pos "+x->pos+"\n"); + werror("Tag "+x->tag+" should not be closed near "+x->location()+"\n"); werror(in); i=0; } @@ -105,7 +106,7 @@ static private int verify_any(SGML data, string in) } if(x->data) - if(!verify_any(x->data," In tag "+(x->tag=="anchor"?x->tag+" (name="+x->params->name+")":x->tag)+" near pos "+x->pos+"\n"+in)) + if(!verify_any(x->data," In tag "+(x->tag=="anchor"?x->tag+" (name="+x->params->name+")":x->tag)+" near "+x->location()+"\n"+in)) i=0; } } @@ -135,7 +136,7 @@ INDEX_DATA collect_index(SGML data, void|INDEX_DATA index,void|mapping taken) if(taken[new_name]) { int n=2; -// werror("Warning, duplicate "+real_name+" near pos "+data->pos+".\n"); +// werror("Warning, duplicate "+real_name+" near "+data->location()+".\n"); while(taken[new_name+"_"+n]) n++; new_name+="_"+n; } @@ -549,6 +550,7 @@ SGML low_make_concrete_wmml(SGML data) { string filename=tag->params->file; SGML tmp=group(lex(Stdio.read_file(filename),filename)); + verify(tmp); ret+=low_make_concrete_wmml(tmp); continue; } @@ -838,7 +840,7 @@ string image_to_gif(TAG data, float dpi) { if(!params->src) { - werror("Image without source near pos "+data->pos+".\n"); + werror("Image without source near "+data->location()+".\n"); return ""; } string ext=reverse(params->src); diff --git a/tutorial/html.pike b/tutorial/html.pike index 44ec5a870e2707ac3cb0b8a9978f0446381f8dd0..7a17f736c48421cb3a1819c4b8650f09a6ffcae0 100644 --- a/tutorial/html.pike +++ b/tutorial/html.pike @@ -303,7 +303,7 @@ SGML convert(SGML data) m_delete(data->params,"to"); if(!link_to_page[to]) { - werror("Warning: Cannot find link "+to+" (near pos "+data->pos+")\n"); + werror("Warning: Cannot find link "+to+" (near "+data->location()+")\n"); } data->params->href=mkfilename(link_to_page[to])+"#"+to; break; @@ -315,7 +315,7 @@ SGML convert(SGML data) TAG t2=link_to_data[to]; if(!t2) { - werror("Warning: Cannot find ref "+to+" (near pos "+data->pos+")\n"); + werror("Warning: Cannot find ref "+to+" (near "+data->location()+")\n"); } if(t2) data->data=({t2->tag+" "+t2->params->number+" \""+t2->params->title+"\""});