annotate extensions/rt_ereg/rtereg_conf.l @ 1554:566bb46cc73f

Updated copyright information
author Sebastien Decugis <sdecugis@freediameter.net>
date Tue, 06 Oct 2020 21:34:53 +0800
parents d70f5f6cb306
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
525
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1 /*********************************************************************************************************
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
2 * Software License Agreement (BSD License) *
740
4a9f08d6b6ba Updated my mail address
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 525
diff changeset
3 * Author: Sebastien Decugis <sdecugis@freediameter.net> *
525
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
4 * *
1554
566bb46cc73f Updated copyright information
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1387
diff changeset
5 * Copyright (c) 2019, WIDE Project and NICT *
525
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
6 * All rights reserved. *
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
7 * *
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
8 * Redistribution and use of this software in source and binary forms, with or without modification, are *
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
9 * permitted provided that the following conditions are met: *
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
10 * *
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
11 * * Redistributions of source code must retain the above *
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
12 * copyright notice, this list of conditions and the *
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
13 * following disclaimer. *
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
14 * *
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
15 * * Redistributions in binary form must reproduce the above *
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
16 * copyright notice, this list of conditions and the *
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
17 * following disclaimer in the documentation and/or other *
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
18 * materials provided with the distribution. *
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
19 * *
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
20 * * Neither the name of the WIDE Project or NICT nor the *
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
21 * names of its contributors may be used to endorse or *
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
22 * promote products derived from this software without *
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
23 * specific prior written permission of WIDE Project and *
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
24 * NICT. *
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
25 * *
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED *
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
27 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
28 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
29 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
30 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS *
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR *
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
32 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF *
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
33 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
34 *********************************************************************************************************/
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
35
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
36 /* Tokenizer
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
37 *
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
38 */
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
39
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
40 %{
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
41 #include "rtereg.h"
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
42 /* Include yacc tokens definitions */
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
43 #include "rtereg_conf.tab.h"
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
44
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
45 /* Update the column information */
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
46 #define YY_USER_ACTION { \
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
47 yylloc->first_column = yylloc->last_column + 1; \
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
48 yylloc->last_column = yylloc->first_column + yyleng - 1; \
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
49 }
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
50
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
51 /* Avoid warning with newer flex */
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
52 #define YY_NO_INPUT
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
53
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
54 %}
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
55
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
56 qstring \"[^\"\n]*\"
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
57
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
58
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
59 %option bison-bridge bison-locations
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
60 %option noyywrap
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
61 %option nounput
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
62
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
63 %%
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
64
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
65 /* Update the line count */
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
66 \n {
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
67 yylloc->first_line++;
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
68 yylloc->last_line++;
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
69 yylloc->last_column=0;
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
70 }
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
71
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
72 /* Eat all spaces but not new lines */
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
73 ([[:space:]]{-}[\n])+ ;
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
74 /* Eat all comments */
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
75 #.*$ ;
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
76
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
77
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
78 /* Recognize quoted strings */
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
79 {qstring} {
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
80 /* Match a quoted string. */
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
81 CHECK_MALLOC_DO( yylval->string = strdup(yytext+1),
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
82 {
1387
d70f5f6cb306 rt_ereg: improve logging and locking
Thomas Klausner <tk@giga.or.at>
parents: 1127
diff changeset
83 LOG_E("[rt_ereg] unable to copy the string '%s': %s", yytext, strerror(errno));
525
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
84 return LEX_ERROR; /* trig an error in yacc parser */
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
85 } );
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
86 yylval->string[strlen(yytext) - 2] = '\0';
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
87 return QSTRING;
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
88 }
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
89
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
90
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
91 /* Recognize any integer */
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
92 [-]?[[:digit:]]+ {
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
93 /* Convert this to an integer value */
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
94 int ret=0;
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
95 ret = sscanf(yytext, "%i", &yylval->integer);
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
96 if (ret != 1) {
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
97 /* No matching: an error occurred */
974
2091bf698fb1 Remove newlines from fd_log_debug, TRACE_DEBUG, TRACE_ERROR, and TRACE_DEBUG_ERROR
Thomas Klausner <tk@giga.or.at>
parents: 741
diff changeset
98 fd_log_debug("Unable to convert the value '%s' to a valid number: %s", yytext, strerror(errno));
525
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
99 return LEX_ERROR; /* trig an error in yacc parser */
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
100 /* Maybe we could REJECT instead of failing here? */
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
101 }
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
102 return INTEGER;
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
103 }
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
104
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
105
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
106
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
107 /* The key words */
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
108 (?i:"AVP") { return AVP; }
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
109
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
110 /* Valid single characters for yyparse */
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
111 [=:;+-] { return yytext[0]; }
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
112
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
113 /* Unrecognized sequence, if it did not match any previous pattern */
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
114 [^[:space:]\":=+;\n]+ {
974
2091bf698fb1 Remove newlines from fd_log_debug, TRACE_DEBUG, TRACE_ERROR, and TRACE_DEBUG_ERROR
Thomas Klausner <tk@giga.or.at>
parents: 741
diff changeset
115 fd_log_debug("Unrecognized text on line %d col %d: '%s'.", yylloc->first_line, yylloc->first_column, yytext);
525
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
116 return LEX_ERROR;
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
117 }
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
118
ecfa089bd29a Forgot new files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
119 %%
"Welcome to our mercurial repository"