Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
mariux64
/
mxq
Public
Notifications
You must be signed in to change notification settings
Fork
3
Star
3
Code
Issues
20
Pull requests
3
Actions
Projects
0
Wiki
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security
Insights
Files
3732792
helper
manpages
mysql
web
.gitignore
.vimrc
Doxyfile
LICENSE
Makefile
README.md
keywordset.c
keywordset.h
mx_flock.c
mx_flock.h
mx_getopt.c
mx_getopt.h
mx_log.c
mx_log.h
mx_mysql.c
mx_mysql.h
mx_proc.c
mx_proc.h
mx_util.c
mx_util.h
mxq.h
mxq_daemon.c
mxq_daemon.h
mxq_group.c
mxq_group.h
mxq_job.c
mxq_job.h
mxq_log.c
mxq_reaper.c
mxqadmin.c
mxqd.c
mxqd.h
mxqd_control.c
mxqd_control.h
mxqdctl-hostconfig.sh
mxqdump.c
mxqkill.c
mxqps.c
mxqset.c
mxqsub.c
os-release
parser.y
ppidcache.c
ppidcache.h
test_keywordset.c
test_mx_log.c
test_mx_mysql.c
test_mx_util.c
test_mxqd_control.c
test_parser.c
xmalloc.h
Breadcrumbs
mxq
/
parser.y
Blame
Blame
Latest commit
History
History
97 lines (72 loc) · 1.84 KB
Breadcrumbs
mxq
/
parser.y
Top
File metadata and controls
Code
Blame
97 lines (72 loc) · 1.84 KB
Raw
%code requires { #include "keywordset.h" struct parser_context { char *input; struct keywordset *tags; int pos; int result; }; struct empty {}; // #define YYLTYPE struct empty } %code { #define YYMAXDEPTH 200 // #define YYLLOC_DEFAULT(Cur, Rhs, N) { ; } int yylex (YYSTYPE *lvalp, YYLTYPE *llocp, struct parser_context *ctx); void yyerror (YYLTYPE *llocp, struct parser_context *ctx, char const *s); } /* Bison declarations */ %define api.pure full %define api.value.type {int} %param {struct parser_context *ctx} %locations %token TAG %nterm bool %left '|' %left '&' %right '!' %% /* Bison Grammar rules and actions */ expr: bool { ctx->result = $1; } bool: TAG; bool: bool '&' bool { $$ = $1 && $3; }; bool: bool '|' bool { $$ = $1 || $3; }; bool: '!' bool { $$ = ! $2; }; bool: '(' bool ')' { $$ = $2; }; %% /* Bison Epilogue */ #include <ctype.h> #include <string.h> #include "xmalloc.h" int yylex (YYSTYPE *lvalp, YYLTYPE *llocp, struct parser_context *ctx) { (void)llocp; int c = ctx->input[ctx->pos]; while (c == ' ' || c == '\t') c = ctx->input[++ctx->pos]; if (!c) return 0; /* identifier => read the name. */ if (isalpha (c)) { size_t name_len = 1; while(isalnum(ctx->input[ctx->pos+name_len]) || ctx->input[ctx->pos+name_len] == '_') name_len++; char *name=xstrndup(&ctx->input[ctx->pos], name_len); ctx->pos += name_len; if (keywordset_ismember(ctx->tags, name)) *lvalp = 1; else *lvalp = 0; free(name); return TAG; } /* Any other character is a token by itself. */ ctx->pos++; return c; } #include <stdio.h> void yyerror (YYLTYPE *locp, struct parser_context *ctx, char const *s) { (void)locp; (void)ctx; (void)s; }
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
You can’t perform that action at this time.