1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
/* gdel.l - GDE sequence lexer */
%{
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdlib.h>
#include <string.h>
#include "extern/text.h"
#include "sequence.h"
#include "sequence/gdey.h"
%}
%option bison-bridge
%option never-interactive
%option noinput nounput noyywrap
%x HEAD SEQS
alp [[:alpha:]]
blk [[:blank:]]
die "#"
eol "\n"
min "-"
per "%"
txt .{1,80}
tag ({die}|{per})
nam [^ \n]{1,80}
gap {min}
bas ({alp}|{min}){1,80}
%%
^{eol} ; /* Empty lines ignored */
^{tag} { BEGIN HEAD; return TAG; }
<HEAD>{nam} { yylval->str = xstrdup(yytext, yyleng); return NAM; }
<HEAD>{blk}/{eol} ; /* Ignore trailing spaces */
<HEAD>{eol} { BEGIN SEQS; return EOL; }
<HEAD>. { return ERR; }
<SEQS>{bas} { yylval->str = xstrdup(yytext, yyleng); return BAS; }
<SEQS>{eol}/{tag} { BEGIN INITIAL; return END; }
<SEQS>{eol} ; /* Newlines ignored */
<SEQS>{blk} ; /* Spaces ignored */
<SEQS><<EOF>> { BEGIN INITIAL; return END; }
<SEQS>. { return ERR; }
<<EOF>> { return NUL; }
{eol} { return ERR; }
. { return ERR; }
%%
|