-
Notifications
You must be signed in to change notification settings - Fork 0
/
gfal.l
47 lines (39 loc) · 775 Bytes
/
gfal.l
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
/**
* Tokenize a GFA file.
* @author Shaun Jackman <sjackman@gmail.com>
*/
%option nodefault
%option yylineno
%{
#include "gfay.h"
void yyerror(const char *s);
%}
%%
^#.*\n /* Comment */
^E return 'E';
^F return 'F';
^G return 'G';
^H return 'H';
^L return 'L';
^O return 'O';
^P return 'P';
^S return 'S';
^U return 'U';
" " return ' ';
"\t" return '\t';
"\n" return '\n';
"*" return '*';
([0-9]+[MDIP])+ return CIGAR;
([0-9]+[MDIP])+(,([0-9]+[MDIP])+)+ return CIGARS1;
0|-?[1-9][0-9]* return INTEGER;
[-+] return ORIENTATION;
0|[1-9][0-9]*"$"? return POSITION;
[A-Za-z0-9][A-Za-z0-9]:[ABHJZif]:[ -~]* return TAGGED_FIELD;
[0-9]+(,[0-9]+)+ return TRACE;
[!-~]+[-+] return REF;
[!-~]+ return STRING;
. {
yyerror("Unexpected character");
exit(EXIT_FAILURE);
}
%%