%class html_scanner include <ml/html/scanner.h> static int delim(char c) { return (c=='\0'||c==' '||c=='\n'||c=='\t'); }
escape ("\\\"") ident [A-Za-z0-9]+ stringelem ({escape}|[^\"\n]) string (\"{stringelem}+\") path [A-Za-z0-9\~\#\:\-\.\/\?]+ value ({path}|{string}) attrib {ident}"="{value} attribs ([ \t]|{attrib})* simple ("<"{ident}">") begintag ("<"{ident}{attribs}">") endtag "</"{ident}">") beginpr "<?"{ident}{attribs}">" endpr "<?/"{ident}">" doctype "<!doctype"[^\>]">" element "<!element"[^\>]">" attlist "<!attlist"(^\>]">" begincmt "<!--" endcmt "-->" any ({beginpr}|{endpr}|{doctype}|{element}|{attlist})
{begintag} { char tag[BUFSIZ]; char atts[2*BUFSIZ]; char* p = yytext+1; yytext[yyleng-1]='\0'; while (p && !delim(*p)) p++; if (*p != '\0') { *p = '\0'; strcpy(tag,yytext+1); strcpy(atts,p+1); } else { strcpy(tag,yytext+1); strcpy(atts,""); } cout << "TAG: " << tag << endl; cout << "ATTS: " << atts << endl; //VW->open_element(tag, atts ); //cout << "SC:begin simple " << yytext; } "</"{ident}">" { char* tag = yytext+2; yytext[yyleng-1]='\0'; cout << "/TAG: " << tag << endl; //VW->close_element(tag); } {begincmt} { in_cmt++; //cout << "begin cmt " <, endl; } {endcmt} { in_cmt--; cout << "begin cmt " << endl; } any { //cout << "Any " << yytext << endl; } {value}|\n|. { cout << "DATA: " << yytext << endl; //VW->new_data(yytext); }
Hush Online Technology
hush@cs.vu.nl
11/03/98 |
![]() |
![]() |