%x HTMLNOTE HTMLCODE JAVANOTE JAVACODE
%{
/*
* $Header: /usr/build/vile/vile/filters/RCS/htmlfilt.l,v 1.30 2004/03/19 23:20:26 tom Exp $
*
* Filter to add vile "attribution" sequences to selected bits of HTML input
* text.
*
* Based on a version written by Pierre Dittgen (dittgen@univ-mlv.fr)
*/
#include
DefineFilter("html");
static char *Comment_attr;
static char *Ident_attr;
static char *Keyword_attr;
static char *Number_attr;
static char *String_attr;
static int next_state;
static void html_command(char *text);
static void may_resume_html(char *text);
%}
SPACE [ \t]
INTEGER [-+]?([0-9]+)
REAL [-+]?([0-9]*\.[0-9]+)([eE][+-]?[0-9]+)?
HEXNUM "#"[xX]?[0-9A-Fa-f]+
IDENT [a-zA-Z_][a-zA-Z_0-9-]*
HSTRING \"([^"])*\"
QSTRING \\["]([^"]|\\["])*\\["]
STRING {HSTRING}|{QSTRING}
SSTRING \'(\\.|[^'\\])*\'
DSTRING \"(\\.|[^"\\])*\"
STRINGS ({SSTRING}|{DSTRING})
ESCAPED &({IDENT}|{HEXNUM});
%%
"<" { WriteToken(Keyword_attr); BEGIN(HTMLCODE); }
">" { WriteToken(Keyword_attr); BEGIN(next_state); }
(\/)?{IDENT} { html_command(yytext); }
"