-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcue.l
70 lines (58 loc) · 1.37 KB
/
cue.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
%{
#include "cuefs.h"
#include "y.tab.h"
%}
%a 4096
%s MCNNO
%%
\".*\" {
yylval.str = strdup(yytext+1);
if(yylval.str[yyleng-2] != '"')
parserwarn("improperly terminated string");
else
yylval.str[yyleng-2] = '\0';
return STRING;
}
<MCNNO>[0-9]+ {
int len = strlen(yytext);
if(len > 13)
parserfatal("UPC/EAN code cannot be larger than 13 characters");
yylval.str = strdup(yytext);
BEGIN(INITIAL);
return MCN;
}
[A-Z][A-Z][A-Z][A-Z][A-Z][0-9][0-9][0-9][0-9][0-9][0-9][0-9] { /* FIXME this is ridiculous, but [A-Z]{5}[0-9]{7} just refuses to work */
yylval.str = strdup(yytext);
BEGIN(INITIAL);
return ISRCCODE;
}
[0-9]+ {
yylval.i = atoi(yytext);
return INTEGER;
}
"CATALOG" { BEGIN(MCNNO); return CATALOG; }
"CDTEXTFILE" return CDTEXTFILE;
"FILE" return FILE;
"FLAGS" return FLAGS;
"DCP" return DCP;
"4CH" return CHAN4;
"PRE" return PREEMPH;
"SCMS" return SCMS;
"INDEX" return INDEX;
"ISRC" return ISRC;
"PERFORMER" return PERFORMER;
"POSTGAP" return POSTGAP;
"PREGAP" return PREGAP;
"SONGWRITER" return SONGWRITER;
"TITLE" return TITLE;
"TRACK" return TRACK;
"WAVE" return FWAVE;
"MP3" return FMP3;
"AIFF" return FAIFF;
"BINARY" return FBINARY;
"MOTOROLA" return FMOTOROLA;
"AUDIO" return AUDIO;
[:\n] return *yytext;
"REM".*\n ;
[ \t\r]+ ;
%%