X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;ds=sidebyside;f=scan.l;fp=scan.l;h=19f6777f48227aaed311d2d0c848371f048da239;hb=8001a0abc5f72c5055a76c566b8b6f04ba784b1c;hp=0000000000000000000000000000000000000000;hpb=506ae3a9437ff9f4b409cd133a6c96b442b1926d;p=~andy%2Fct diff --git a/scan.l b/scan.l new file mode 100644 index 0000000..19f6777 --- /dev/null +++ b/scan.l @@ -0,0 +1,23 @@ +%{ +#define YYSTYPE char * +#include +#include "parse.h" +#define debug(arg) // g_message("scan: " arg, yytext); +%} +%option noyywrap +%option nounput +%option noinput +/* %option nodebug */ +START [ \t]*<% +END [ \t]*%>[ \t]* +DATA ([^<\n]|<[^%])* +CODE [ \t\n]([^%\n]|%[^>])* +%s IN FMT +%% +{START} { debug("START [%s]"); yylval = g_strdup(yytext); BEGIN(IN); return START; } +{DATA} { debug("DATA [%s]"); yylval = g_strdup(yytext); return DATA; } +{END} { debug("END [%s]"); yylval = g_strdup(yytext); BEGIN(INITIAL); return END; } += { debug("OUT [%s]"); yylval = g_strdup(yytext); return OUT; } +{CODE} { debug("CODE [%s]"); yylval = g_strdup(yytext); return DATA; } +[\n] { debug("NL [%s]"); } +%%