Mercurial > hg > freeDiameter
annotate extensions/dbg_loglevel/dbg_loglevel_conf.y @ 1345:51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
author | Thomas Klausner <tk@giga.or.at> |
---|---|
date | Sun, 12 May 2019 10:35:46 +0200 |
parents | |
children |
rev | line source |
---|---|
1345
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
1 /********************************************************************************************************* |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
2 * Software License Agreement (BSD License) * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
3 * Author: Thomas Klausner <tk@giga.or.at> * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
4 * * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
5 * Copyright (c) 2019, Thomas Klausner * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
6 * All rights reserved. * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
7 * * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
8 * Written under contract by Effortel Technologies SA, http://effortel.com/ * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
9 * * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
10 * Redistribution and use of this software in source and binary forms, with or without modification, are * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
11 * permitted provided that the following conditions are met: * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
12 * * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
13 * * Redistributions of source code must retain the above * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
14 * copyright notice, this list of conditions and the * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
15 * following disclaimer. * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
16 * * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
17 * * Redistributions in binary form must reproduce the above * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
18 * copyright notice, this list of conditions and the * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
19 * following disclaimer in the documentation and/or other * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
20 * materials provided with the distribution. * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
21 * * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
22 * * Neither the name of the WIDE Project or NICT nor the * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
23 * names of its contributors may be used to endorse or * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
24 * promote products derived from this software without * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
25 * specific prior written permission of WIDE Project and * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
26 * NICT. * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
27 * * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
29 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
30 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
31 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
32 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
34 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
35 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
36 *********************************************************************************************************/ |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
37 |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
38 /* Yacc extension's configuration parser. |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
39 */ |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
40 |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
41 /* For development only : */ |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
42 %debug |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
43 %error-verbose |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
44 |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
45 /* The parser receives the configuration file filename as parameter */ |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
46 %parse-param {char * conffile} |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
47 |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
48 /* Keep track of location */ |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
49 %locations |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
50 %pure-parser |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
51 |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
52 %{ |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
53 #include "dbg_loglevel.h" |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
54 #include "dbg_loglevel_conf.tab.h" |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
55 |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
56 /* Forward declaration */ |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
57 int dbg_loglevel_confparse(char *conffile); |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
58 void dbg_loglevel_confrestart(FILE *input_file); |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
59 |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
60 /* Parse the configuration file */ |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
61 int dbg_loglevel_conf_handle(char * conffile) |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
62 { |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
63 extern FILE *dbg_loglevel_confin; |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
64 int ret; |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
65 |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
66 TRACE_ENTRY("%p", conffile); |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
67 |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
68 TRACE_DEBUG(FULL, "Parsing configuration file: %s...", conffile); |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
69 |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
70 dbg_loglevel_confin = fopen(conffile, "r"); |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
71 if (dbg_loglevel_confin == NULL) { |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
72 ret = errno; |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
73 TRACE_ERROR("Unable to open extension configuration file %s for reading: %s", conffile, strerror(ret)); |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
74 return ret; |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
75 } |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
76 |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
77 dbg_loglevel_confrestart(dbg_loglevel_confin); |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
78 ret = dbg_loglevel_confparse(conffile); |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
79 |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
80 fclose(dbg_loglevel_confin); |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
81 |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
82 if (ret != 0) { |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
83 TRACE_ERROR( "Unable to parse the configuration file %s.", conffile); |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
84 return EINVAL; |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
85 } else { |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
86 TRACE_DEBUG(FULL, "[dbg_loglevel] LogLevel: %d.", fd_g_debug_lvl); |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
87 } |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
88 |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
89 return 0; |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
90 } |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
91 |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
92 /* The Lex parser prototype */ |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
93 int dbg_loglevel_conflex(YYSTYPE *lvalp, YYLTYPE *llocp); |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
94 |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
95 /* Function to report the errors */ |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
96 void yyerror (YYLTYPE *ploc, char * conffile, char const *s) |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
97 { |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
98 TRACE_DEBUG(INFO, "Error in configuration parsing"); |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
99 |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
100 if (ploc->first_line != ploc->last_line) |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
101 fd_log_error("%s:%d.%d-%d.%d : %s", conffile, ploc->first_line, ploc->first_column, ploc->last_line, ploc->last_column, s); |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
102 else if (ploc->first_column != ploc->last_column) |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
103 fd_log_error("%s:%d.%d-%d : %s", conffile, ploc->first_line, ploc->first_column, ploc->last_column, s); |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
104 else |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
105 fd_log_error("%s:%d.%d : %s", conffile, ploc->first_line, ploc->first_column, s); |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
106 } |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
107 |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
108 %} |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
109 |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
110 /* Values returned by lex for token */ |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
111 %union { |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
112 int integer; |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
113 } |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
114 |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
115 /* In case of error in the lexical analysis */ |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
116 %token LEX_ERROR |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
117 |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
118 /* A (de)quoted string (malloc'd in lex parser; it must be freed after use) */ |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
119 %token <integer> INTEGER |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
120 |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
121 /* Tokens */ |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
122 %token LOGLEVEL |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
123 |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
124 |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
125 /* -------------------------------------- */ |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
126 %% |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
127 |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
128 /* The grammar definition */ |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
129 conffile: /* empty is OK */ |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
130 | conffile size |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
131 | conffile errors |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
132 { |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
133 yyerror(&yylloc, conffile, "An error occurred while parsing the configuration file"); |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
134 YYABORT; |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
135 } |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
136 ; |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
137 |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
138 /* Lexical or syntax error */ |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
139 errors: LEX_ERROR |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
140 | error |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
141 ; |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
142 |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
143 size: LOGLEVEL '=' INTEGER ';' |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
144 { |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
145 fd_g_debug_lvl=$3; |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
146 } |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
147 ; |