-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrules.l
77 lines (66 loc) · 2.34 KB
/
rules.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
71
72
73
74
75
76
77
%{
#include <stdio.h>
#define YYSTYPE char*
#include "y.tab.h"
extern int yyget_lineno();
extern void set_parsererror(int, int, char*);
static void lexer_error()
{
set_parsererror(0, yyget_lineno(), yytext);
}
int found_verbatim = 0;
static void abort_parsing_now()
{
found_verbatim = 1;
}
#define ECHO lexer_error()
%}
%option warn
%option yylineno
%option nounput
%option noinput
%%
program return PROGRAM;
library return LIBRARY;
worker return WORKER;
external return CONF_MAKE_INSTALL;
patches return PATCHES;
src return SRC;
src-dir return SRC_DIR;
extension return SRC_EXTENSION;
cmd return COMMAND;
depends return DEPENDS;
flags return FLAGS;
libs return LIBS;
ld-flags return LDFLAGS;
extra-obj return ADD_OBJECTS;
export-inc return EXPORT_INC;
dest-dir return DESTDIR;
skip-install return SKIP_INSTALL;
skip-shared return SKIP_SHARED;
skip-static return SKIP_STATIC;
convenience return CONVENIENCE_LIB;
clean-files return CLEAN_FILES;
version-info return VERSION_INFO;
version-number return VERSION_NUMBER;
true return TRUE_VALUE;
false return FALSE_VALUE;
VERBATIM abort_parsing_now(); return EOF;
skip-if return SKIP_IF;
require-ng-version return REQUIRE_NAMGEN_VERSION;
! return EXPR_MARK;
= return EQUALS;
\" return QUOTE;
\{ return OBRACE;
\} return EBRACE;
\/\* return OCOMMENT;
\*\/ return ECOMMENT;
[0-9]+\.[0-9]+\.[0-9]+ yylval = strdup(yytext); return THREE_NUMBERS;
[a-zA-Z0-9_\-]+ yylval = strdup(yytext); return WORD;
[a-zA-Z0-9\/\._\-]+ yylval = strdup(yytext); return FILENAME;
[a-zA-Z0-9_\-\*\.]+ yylval = strdup(yytext); return WILDCARD;
[a-zA-Z0-9\/\.,:_\-\+=]+ yylval = strdup(yytext); return STUFF;
$\([a-zA-Z0-9_ ]+\) yylval = strdup(yytext); return VARIABLE;
\n /* igore newlines */;
[ \t]+ /* ignore whitespace */;
%%