]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sbin/veriexecctl/veriexecctl_conf.l
Instead of using hand-rolled loops where not needed switch them
[FreeBSD/FreeBSD.git] / sbin / veriexecctl / veriexecctl_conf.l
1 %{
2 /*
3  * $FreeBSD$
4  *
5  * Configuration file lexer for Verified exec
6  *
7  *
8  */
9
10 #include <stdio.h>
11 #include <string.h>
12 #include "veriexecctl_parse.h"
13
14 int lineno = 1;
15
16 void yyerror(const char *message);
17 void warning(const char *message);
18 int yylex __P((void));
19
20 %}
21
22 %%
23
24 path     { return PATH; }
25 string   { return STRING; }
26 eol      { return EOL; }
27
28 \/[^    ]+  {
29         yylval.string = strdup(yytext);
30         return PATH;
31 }
32
33 [0-9a-zA-Z]+  {
34         yylval.string = strdup(yytext);
35         return STRING;
36 }
37
38 \n      {
39         lineno++;  /* for error reporting */
40         return EOL;
41 }
42
43 [ \t\r] ;  /* eat white ones */
44
45 #.* ;      /* comment */
46
47 .    yyerror("invalid character");
48
49 %%
50
51 void yyerror(const char *string)
52 {
53   fprintf(stderr, "%d: %s at %s\n", lineno, string, yytext);
54 }