File: mediaprm.lex

package info (click to toggle)
fdutils 5.3-3
  • links: PTS
  • area: main
  • in suites: potato
  • size: 1,004 kB
  • ctags: 621
  • sloc: ansic: 6,098; sh: 2,236; makefile: 279; sed: 4
file content (71 lines) | stat: -rw-r--r-- 1,058 bytes parent folder | download | duplicates (5)
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
71
%{
#include <stdio.h>
#include <string.h>
#include "parse.h"
#include "mediaprmP.h"
#include "mediaprm.h"
static int lineno;
static int col;
%}

%option noyywrap
%option pointer

fid	[^\"]+
vid     [A-Za-z_][A-Za-z0-9_]*
number	(0x[a-zA-Z0-9]+|-?[0-9]+)(KB|k|b)?

%%
\n { col = 0; lineno++; }
[ \t] { col++;}
#.*\n   { col = 0; lineno++;}
\042{fid}\042: {
	col += yyleng;
	if(*found) return 0;
	_zero_all(ids, size, mask);
	
	yytext[yyleng-2]='\0';
	if(!strcasecmp(yytext+1, name))
		*found = 1;
}

alias=\042{fid}\042 {
	col += yyleng;
	yytext[yyleng-1]='\0';
	if(!strcasecmp(yytext+7, name))
		*found = 1;
}

swapsides |
mss      |
2m	 |
2M	 |
ss       |
SS       |
ds       |
DS       |
sd       |
SD       |
dd       |
DD       |
qd       |
QD       |
hd       |
HD       |
ed       |
ED       |
{vid}={number} {
	col += yyleng;
	_set_int(yytext, ids, size, mask);
}

[^\t \n][^\t =\n]* {
	yytext[yyleng-1]='\0';
	fprintf(stderr,
		"Syntax error in " MEDIAPRMFILE
		" at line %d col %d: %s unexpected\n",
		lineno+1, col+1, yytext_ptr);
	return 1;
}
%%