/********************************************************************** HTML tags **********************************************************************/ #include #include "scanner.h" #include "html.h" char *file_header = "\ \n\ \n\ Formatted Java output\n\ \n\ \n\
\n\
";

char *file_footer = "\
\n\ \n\ \n\ "; static struct { const char * pre; const char * post; } token_brackets[] = { {/* eof */ "", "" }, {/* space */ "", "" }, {/* nl_space */ "", "" }, {/* old_comment */ "", "" }, {/* new_comment */ "", "" }, {/* id_dec */ "", "" }, {/* ident */ "", "" }, {/* operator */ "", "" }, {/* kwoperator */ "", "" }, {/* literal */ "", "" }, {/* lbrace */ "", "" }, {/* rbrace */ "", "" }, {/* lbrac */ "", "" }, {/* rbrac */ "", "" }, {/* lparen */ "", "" }, {/* rparen */ "", "" }, {/* equals */ "", "" }, {/* colon */ "", "" }, {/* qmark */ "", "" }, {/* semic */ "", "" }, {/* comma */ "", "" }, {/* dot */ "", "" }, {/* star */ "", "" }, {/* modifier */ "", "" }, {/* type */ "", "" }, {/* atomword */ "", "" }, {/* classword */ "", "" }, {/* kw_break */ "", "" }, {/* kw_case */ "", "" }, {/* kw_catch */ "", "" }, {/* kw_continue */ "", "" }, {/* kw_default */ "", "" }, {/* kw_do */ "", "" }, {/* kw_else */ "", "" }, {/* kw_extends */ "", "" }, {/* kw_finally */ "", "" }, {/* kw_for */ "", "" }, {/* kw_goto */ "", "" }, {/* kw_if */ "", "" }, {/* kw_implements */ "", "" }, {/* kw_import */ "", "" }, {/* kw_package */ "", "" }, {/* kw_return */ "", "" }, {/* kw_switch */ "", "" }, {/* kw_synchronized */ "", "" }, {/* kw_throw */ "", "" }, {/* kw_throws */ "", "" }, {/* kw_try */ "", "" }, {/* kw_while */ "", "" } }; /******** Print specified token, bracketed as appropriate. Assume that declaration identifiers have had their token class modified. Note that some characters, specifically <, >, &, and ", have special meaning in HTML. We need to print escape sequences to get these to turn out correctly in the output. ********/ void print_token(const token_t * tok) { location_t loc = tok->location; int i; char c; fputs(token_brackets[tok->tc].pre, stdout); for (i = tok->length; i; i--) { switch (c = get_character(&loc)) { case '<': printf("<"); break; case '>': printf(">"); break; case '&': printf("&"); break; case '"': printf("""); break; default: putchar(c); /* not special to HTML */ break; } } fputs(token_brackets[tok->tc].post, stdout); }