undns 0.4.0a
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/undns_decode +29 -0
- data/ext/undns/buffer.c +247 -0
- data/ext/undns/buffer.h +59 -0
- data/ext/undns/config.h +2 -0
- data/ext/undns/conventions.c +1813 -0
- data/ext/undns/conventions.h +89 -0
- data/ext/undns/conventlex.c +2808 -0
- data/ext/undns/earth.c +180 -0
- data/ext/undns/earth.h +4 -0
- data/ext/undns/exception.h +12 -0
- data/ext/undns/extconf.rb +44 -0
- data/ext/undns/filetest.c +90 -0
- data/ext/undns/filetest.h +7 -0
- data/ext/undns/hashes.c +104 -0
- data/ext/undns/hashes.h +48 -0
- data/ext/undns/hashtable.c +518 -0
- data/ext/undns/hashtable.h +103 -0
- data/ext/undns/my_ruby.h +3 -0
- data/ext/undns/nscommon.h +207 -0
- data/ext/undns/originAS.c +134 -0
- data/ext/undns/originAS.h +17 -0
- data/ext/undns/progress.c +285 -0
- data/ext/undns/progress.h +45 -0
- data/ext/undns/queue.c +346 -0
- data/ext/undns/queue.h +70 -0
- data/ext/undns/radix.c +517 -0
- data/ext/undns/radix.h +72 -0
- data/ext/undns/ruleset.c +603 -0
- data/ext/undns/ruleset.h +108 -0
- data/ext/undns/swig-undns_wrap-rb.c +2995 -0
- data/ext/undns/typed_hashtable.h +158 -0
- data/ext/undns/typed_queue.h +112 -0
- data/ext/undns/xmalloc.c +153 -0
- data/ext/undns/xmalloc.h +14 -0
- data/lib/undns.rb +5 -0
- metadata +84 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 172a71497f8cb1d0558209759e1cef205647bd69
|
4
|
+
data.tar.gz: 0153427521413f744190b0ca5ed22df7b779ec28
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 44bcd261073d51c10511309d632e33a295eac06c5c058caa2052305d05bfa2cbc096296080a04a9052b56e297a899d1193b4d3eeabbb81cd9cb232b9d84b6873
|
7
|
+
data.tar.gz: 69aef9f6be887818868c264df2c07c79e652f952cd87f23507e8efc2f75e493647459176a527ed8505a61ffa243da39284f7061d29617fafb03aa74bab22d815
|
data/bin/undns_decode
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'undns'
|
4
|
+
|
5
|
+
# this is a demo driver code only. If you're writing an
|
6
|
+
# analysis, you'll want to take this template and use it
|
7
|
+
# within your own code that might read hostnames from a
|
8
|
+
# file or database then only extract the information you're
|
9
|
+
# really interested in, like location or asn. The startup cost
|
10
|
+
# of loading the undns ruleset is intentionally high to
|
11
|
+
# amortize repeated lookups.
|
12
|
+
|
13
|
+
if(ARGV.length < 1) then raise "need a router hostname" end
|
14
|
+
|
15
|
+
#Undns.want_conventions_debug = 1
|
16
|
+
Undns.load_ruleset # ("Conventions.dat")
|
17
|
+
Undns.want_debug = 1
|
18
|
+
as = 0
|
19
|
+
puts "AS%d\t" % (Undns.get_asn_bydns(ARGV[0])) +
|
20
|
+
"-- which AS this hostname matches (or 0)"
|
21
|
+
puts "@%s\t" % Undns.get_loc(as, ARGV[0]) +
|
22
|
+
"-- where in the world"
|
23
|
+
puts "is a %s\t" % Undns.get_role(as, ARGV[0]) +
|
24
|
+
"-- backbone or gateway or customer"
|
25
|
+
|
26
|
+
puts "Unique %s\t" % Undns.get_identifier(as, ARGV[0]) +
|
27
|
+
"-- a fragment that represents its identity within the AS"
|
28
|
+
puts "POPtag %s\t" % Undns.get_poptag(as, ARGV[0]) +
|
29
|
+
"-- a fragment that represents the POP within a city"
|
data/ext/undns/buffer.c
ADDED
@@ -0,0 +1,247 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (c) 2002
|
3
|
+
* Neil Spring and the University of Washington.
|
4
|
+
* All rights reserved.
|
5
|
+
* Copyright (c) 1999
|
6
|
+
* Eric Hoffman
|
7
|
+
*
|
8
|
+
*
|
9
|
+
* Redistribution and use in source and binary forms, with or without
|
10
|
+
* modification, are permitted provided that the following conditions
|
11
|
+
* are met:
|
12
|
+
* 1. Redistributions of source code must retain the above copyright
|
13
|
+
* notice, this list of conditions and the following disclaimer.
|
14
|
+
* 2. Redistributions in binary form must reproduce the above copyright
|
15
|
+
* notice, this list of conditions and the following disclaimer in the
|
16
|
+
* documentation and/or other materials provided with the distribution.
|
17
|
+
* 3. The name of the author(s) may not be used to endorse or promote
|
18
|
+
* products derived from this software without specific prior
|
19
|
+
* written permission.
|
20
|
+
*
|
21
|
+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
|
22
|
+
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
23
|
+
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
24
|
+
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
|
25
|
+
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
26
|
+
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
27
|
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
28
|
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
29
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
30
|
+
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
31
|
+
*/
|
32
|
+
|
33
|
+
#ifdef HAVE_CONFIG_H
|
34
|
+
#include <config.h>
|
35
|
+
#endif
|
36
|
+
#include <string.h>
|
37
|
+
#include <stdio.h>
|
38
|
+
#include <stdarg.h>
|
39
|
+
#include <stdlib.h>
|
40
|
+
#include <assert.h>
|
41
|
+
// #include "timer.h"
|
42
|
+
typedef unsigned int when;
|
43
|
+
#ifndef FISHTIME_HZ
|
44
|
+
#define FISHTIME_HZ ((when)1000)
|
45
|
+
#endif
|
46
|
+
|
47
|
+
/* open */
|
48
|
+
#include <sys/types.h>
|
49
|
+
#include <sys/stat.h>
|
50
|
+
#include <fcntl.h>
|
51
|
+
/* end open */
|
52
|
+
|
53
|
+
#ifdef WIN32
|
54
|
+
#include "win32.h"
|
55
|
+
#else
|
56
|
+
#include <netinet/in.h>
|
57
|
+
#endif
|
58
|
+
#include "buffer.h"
|
59
|
+
|
60
|
+
//
|
61
|
+
// unsigned int ipv4_addr_from_string(const char *x)
|
62
|
+
// {
|
63
|
+
// int a,b,c,d;
|
64
|
+
// unsigned int t;
|
65
|
+
//
|
66
|
+
// a=b=c=d=0;
|
67
|
+
// if (sscanf(x,"%d.%d.%d.%d",&a,&b,&c,&d)>0){
|
68
|
+
// return(htonl(a<<24|b<<16|c<<8|d));
|
69
|
+
// } else {
|
70
|
+
// sscanf(x,"x%x",&t);
|
71
|
+
// return(htonl(t));
|
72
|
+
// }
|
73
|
+
// }
|
74
|
+
|
75
|
+
char *buffer_contents(buffer b)
|
76
|
+
{
|
77
|
+
return(b->contents);
|
78
|
+
}
|
79
|
+
|
80
|
+
#define is_digit(c) ((char_to_digit(c) >= 0) && (char_to_digit(c) <= 9))
|
81
|
+
#define char_to_digit(c) (int)((c) - '0')
|
82
|
+
|
83
|
+
static char hex_digits[]="0123456789abcdef";
|
84
|
+
|
85
|
+
void buffer_concat(buffer b,buffer k)
|
86
|
+
{
|
87
|
+
while ((b->length-b->fill)< k->fill)
|
88
|
+
b->contents=(char *)realloc(b->contents,b->length+=k->fill+2);
|
89
|
+
|
90
|
+
memcpy(b->contents+b->fill,k->contents,k->fill);
|
91
|
+
b->contents[b->fill+=k->fill]=0;
|
92
|
+
}
|
93
|
+
|
94
|
+
void buffer_append(buffer b,const char *item,int len)
|
95
|
+
{
|
96
|
+
while ((b->length-b->fill)< (len+1))
|
97
|
+
b->contents=(char *)realloc(b->contents,b->length*=2);
|
98
|
+
|
99
|
+
memcpy(b->contents+b->fill,item,len);
|
100
|
+
b->contents[b->fill+=len]=0;
|
101
|
+
}
|
102
|
+
|
103
|
+
void vbprintf(buffer b,const char *fmt, va_list ap)
|
104
|
+
{
|
105
|
+
const char *fc; /* pointer to current format character */
|
106
|
+
int qf; /* flag to quit reading % format */
|
107
|
+
int min_len, len;
|
108
|
+
char *c;
|
109
|
+
char type;
|
110
|
+
unsigned int x,a1;
|
111
|
+
int i, j,base, negative;
|
112
|
+
int rfill;
|
113
|
+
char reverse[20];
|
114
|
+
|
115
|
+
for (fc=fmt;*fc;fc++){
|
116
|
+
if (*fc != '%') {
|
117
|
+
buffer_append(b,fc,1);
|
118
|
+
} else{
|
119
|
+
min_len=0;
|
120
|
+
qf=0;
|
121
|
+
fc++;
|
122
|
+
|
123
|
+
if (*fc=='0') {
|
124
|
+
fc++;
|
125
|
+
while (is_digit(*fc) && *fc)
|
126
|
+
min_len=10*min_len + char_to_digit(*fc++);
|
127
|
+
}
|
128
|
+
|
129
|
+
type=*fc;
|
130
|
+
base =0;
|
131
|
+
negative=0;
|
132
|
+
switch (type) {
|
133
|
+
|
134
|
+
case '%':
|
135
|
+
buffer_append(b,"%",1);
|
136
|
+
break;
|
137
|
+
|
138
|
+
case 't':
|
139
|
+
buffer_append(b,reverse,
|
140
|
+
sprintf (reverse,"%f",
|
141
|
+
(float)(va_arg(ap,when))/(float)FISHTIME_HZ));
|
142
|
+
break;
|
143
|
+
|
144
|
+
case 'b':
|
145
|
+
buffer_concat(b,va_arg(ap, buffer));
|
146
|
+
break;
|
147
|
+
|
148
|
+
case 'a':
|
149
|
+
a1 = va_arg(ap, unsigned int);
|
150
|
+
a1=htonl(a1);
|
151
|
+
bprintf(b,"%d.",(a1>>24)&255);
|
152
|
+
bprintf(b,"%d.",(a1>>16)&255);
|
153
|
+
bprintf(b,"%d.",(a1>>8)&255);
|
154
|
+
bprintf(b,"%d",a1&255);
|
155
|
+
break;
|
156
|
+
|
157
|
+
case 's':
|
158
|
+
c = va_arg(ap, char *);
|
159
|
+
if (!c) c= (char *)"(null)";
|
160
|
+
len=strlen(c);
|
161
|
+
for (i=0;i<min_len-len;i++)
|
162
|
+
buffer_append(b," ",1);
|
163
|
+
buffer_append(b,c,len);
|
164
|
+
break;
|
165
|
+
|
166
|
+
case 'x':
|
167
|
+
base=16;
|
168
|
+
case 'o':
|
169
|
+
if (!base) base=8;
|
170
|
+
case 'u':
|
171
|
+
if (!base) base=10;
|
172
|
+
case 'd': case 'i':
|
173
|
+
x = va_arg(ap, unsigned int );
|
174
|
+
if (!base){
|
175
|
+
base=10;
|
176
|
+
if ((negative=((int)x <0))){
|
177
|
+
buffer_append(b,"-",1);
|
178
|
+
x=(unsigned)(-1*(int)x);
|
179
|
+
}
|
180
|
+
}
|
181
|
+
if (x){
|
182
|
+
for ( i=0,rfill=19; i<12 && x; i++, x/=base)
|
183
|
+
reverse[rfill--]=hex_digits[x%base];
|
184
|
+
for (j=i;j<min_len;j++) buffer_append(b,"0",1);
|
185
|
+
buffer_append(b,reverse+rfill+1,i);
|
186
|
+
} else {
|
187
|
+
buffer_append(b,"0",1);
|
188
|
+
i=1;
|
189
|
+
}
|
190
|
+
break;
|
191
|
+
default:
|
192
|
+
break;
|
193
|
+
}
|
194
|
+
}
|
195
|
+
}
|
196
|
+
}
|
197
|
+
|
198
|
+
void bprintf(buffer b,const char *fmt, ...)
|
199
|
+
{
|
200
|
+
va_list ap;
|
201
|
+
va_start(ap,fmt);
|
202
|
+
vbprintf(b,fmt,ap);
|
203
|
+
va_end(ap);
|
204
|
+
}
|
205
|
+
|
206
|
+
buffer create_buffer(int len)
|
207
|
+
{
|
208
|
+
buffer b=(buffer)malloc(sizeof(struct buffer_st));
|
209
|
+
assert(b!=NULL);
|
210
|
+
b->contents=(char *)malloc(b->length=len);
|
211
|
+
b->fill=0;
|
212
|
+
b->contents[0]=0;
|
213
|
+
return(b);
|
214
|
+
}
|
215
|
+
|
216
|
+
void free_buffer(buffer b)
|
217
|
+
{
|
218
|
+
free(b->contents);
|
219
|
+
free(b);
|
220
|
+
}
|
221
|
+
|
222
|
+
|
223
|
+
int writef(int (*f)(void *, char *, int),void *a,const char *format,...)
|
224
|
+
{
|
225
|
+
buffer b=create_buffer(10);
|
226
|
+
va_list ap;
|
227
|
+
va_start(ap,format);
|
228
|
+
vbprintf(b,format,ap);
|
229
|
+
(void)((*f)(a,b->contents,b->fill));
|
230
|
+
va_end(ap);
|
231
|
+
free_buffer(b);
|
232
|
+
|
233
|
+
return(0);
|
234
|
+
}
|
235
|
+
|
236
|
+
int openf(int flags,char *format,...)
|
237
|
+
{
|
238
|
+
buffer b=create_buffer(10);
|
239
|
+
va_list ap;
|
240
|
+
va_start(ap,format);
|
241
|
+
vbprintf(b,format,ap);
|
242
|
+
(void)open(b->contents,flags,0666);
|
243
|
+
va_end(ap);
|
244
|
+
free_buffer(b);
|
245
|
+
|
246
|
+
return(0);
|
247
|
+
}
|
data/ext/undns/buffer.h
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (c) 2002
|
3
|
+
* Neil Spring and the University of Washington.
|
4
|
+
* Copyright (c) 1999
|
5
|
+
* Eric Hoffman
|
6
|
+
*
|
7
|
+
* All rights reserved.
|
8
|
+
*
|
9
|
+
* Redistribution and use in source and binary forms, with or without
|
10
|
+
* modification, are permitted provided that the following conditions
|
11
|
+
* are met:
|
12
|
+
* 1. Redistributions of source code must retain the above copyright
|
13
|
+
* notice, this list of conditions and the following disclaimer.
|
14
|
+
* 2. Redistributions in binary form must reproduce the above copyright
|
15
|
+
* notice, this list of conditions and the following disclaimer in the
|
16
|
+
* documentation and/or other materials provided with the distribution.
|
17
|
+
* 3. The name of the author(s) may not be used to endorse or promote
|
18
|
+
* products derived from this software without specific prior
|
19
|
+
* written permission.
|
20
|
+
*
|
21
|
+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
|
22
|
+
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
23
|
+
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
24
|
+
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
|
25
|
+
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
26
|
+
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
27
|
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
28
|
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
29
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
30
|
+
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
31
|
+
*/
|
32
|
+
|
33
|
+
#ifndef _buffer_h
|
34
|
+
#define _buffer_h
|
35
|
+
#include "nscommon.h"
|
36
|
+
|
37
|
+
|
38
|
+
NS_BEGIN_DECLS
|
39
|
+
|
40
|
+
#include <stdarg.h>
|
41
|
+
|
42
|
+
typedef struct buffer_st {
|
43
|
+
int length;
|
44
|
+
int fill;
|
45
|
+
char *contents;
|
46
|
+
} *buffer;
|
47
|
+
|
48
|
+
/*@notnull@*/ /*@only@*/
|
49
|
+
buffer create_buffer(int len);
|
50
|
+
void free_buffer(/*@null@*/ /*@out@*/ /*@only@*/buffer b) /*@modifies b@*/;
|
51
|
+
|
52
|
+
void vbprintf(buffer b,const char *fmt, va_list ap);
|
53
|
+
void bprintf(buffer b,const char *fmt, ...);
|
54
|
+
void buffer_append(buffer b,const char *item,int len);
|
55
|
+
int writef(int (*f)(void *, char *, int),void *a,const char *format,...);
|
56
|
+
unsigned int ipv4_addr_from_string(const char *x);
|
57
|
+
|
58
|
+
NS_END_DECLS
|
59
|
+
#endif
|
data/ext/undns/config.h
ADDED
@@ -0,0 +1,1813 @@
|
|
1
|
+
/* A Bison parser, made by GNU Bison 3.0.2. */
|
2
|
+
|
3
|
+
/* Bison implementation for Yacc-like parsers in C
|
4
|
+
|
5
|
+
Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
|
6
|
+
|
7
|
+
This program is free software: you can redistribute it and/or modify
|
8
|
+
it under the terms of the GNU General Public License as published by
|
9
|
+
the Free Software Foundation, either version 3 of the License, or
|
10
|
+
(at your option) any later version.
|
11
|
+
|
12
|
+
This program is distributed in the hope that it will be useful,
|
13
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
GNU General Public License for more details.
|
16
|
+
|
17
|
+
You should have received a copy of the GNU General Public License
|
18
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
19
|
+
|
20
|
+
/* As a special exception, you may create a larger work that contains
|
21
|
+
part or all of the Bison parser skeleton and distribute that work
|
22
|
+
under terms of your choice, so long as that work isn't itself a
|
23
|
+
parser generator using the skeleton or a modified version thereof
|
24
|
+
as a parser skeleton. Alternatively, if you modify or redistribute
|
25
|
+
the parser skeleton itself, you may (at your option) remove this
|
26
|
+
special exception, which will cause the skeleton and the resulting
|
27
|
+
Bison output files to be licensed under the GNU General Public
|
28
|
+
License without this special exception.
|
29
|
+
|
30
|
+
This special exception was added by the Free Software Foundation in
|
31
|
+
version 2.2 of Bison. */
|
32
|
+
|
33
|
+
/* C LALR(1) parser skeleton written by Richard Stallman, by
|
34
|
+
simplifying the original so-called "semantic" parser. */
|
35
|
+
|
36
|
+
/* All symbols defined below should begin with yy or YY, to avoid
|
37
|
+
infringing on user name space. This should be done even for local
|
38
|
+
variables, as they might otherwise be expanded by user macros.
|
39
|
+
There are some unavoidable exceptions within include files to
|
40
|
+
define necessary library symbols; they are noted "INFRINGES ON
|
41
|
+
USER NAME SPACE" below. */
|
42
|
+
|
43
|
+
/* Identify Bison output. */
|
44
|
+
#define YYBISON 1
|
45
|
+
|
46
|
+
/* Bison version. */
|
47
|
+
#define YYBISON_VERSION "3.0.2"
|
48
|
+
|
49
|
+
/* Skeleton name. */
|
50
|
+
#define YYSKELETON_NAME "yacc.c"
|
51
|
+
|
52
|
+
/* Pure parsers. */
|
53
|
+
#define YYPURE 0
|
54
|
+
|
55
|
+
/* Push parsers. */
|
56
|
+
#define YYPUSH 0
|
57
|
+
|
58
|
+
/* Pull parsers. */
|
59
|
+
#define YYPULL 1
|
60
|
+
|
61
|
+
|
62
|
+
/* Substitute the variable and function names. */
|
63
|
+
#define yyparse conv_yyparse
|
64
|
+
#define yylex conv_yylex
|
65
|
+
#define yyerror conv_yyerror
|
66
|
+
#define yydebug conv_yydebug
|
67
|
+
#define yynerrs conv_yynerrs
|
68
|
+
|
69
|
+
#define yylval conv_yylval
|
70
|
+
#define yychar conv_yychar
|
71
|
+
|
72
|
+
/* Copy the first part of user declarations. */
|
73
|
+
#line 1 "conventions.y" /* yacc.c:339 */
|
74
|
+
|
75
|
+
// #define _GNU_SOURCE
|
76
|
+
#include <config.h>
|
77
|
+
#include <stdlib.h>
|
78
|
+
#include <stdio.h>
|
79
|
+
#include <sys/types.h>
|
80
|
+
#include <regex.h>
|
81
|
+
#include "ruleset.h"
|
82
|
+
#include "typed_hashtable.h"
|
83
|
+
#include "hashes.h"
|
84
|
+
int yyerror(const char *string);
|
85
|
+
int yylex(void);
|
86
|
+
extern boolean want_debug;
|
87
|
+
extern boolean want_conventions_debug;
|
88
|
+
extern asnc_hashtable Ruleset;
|
89
|
+
extern const char *currentfilename(void);
|
90
|
+
extern void print_stack_trace();
|
91
|
+
extern int linenum;
|
92
|
+
|
93
|
+
boolean set_asn(struct convention *c, void *asn_i) {
|
94
|
+
long asn = (long)asn_i;
|
95
|
+
c->asn=asn;
|
96
|
+
return TRUE;
|
97
|
+
}
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
#line 102 "conventions.c" /* yacc.c:339 */
|
102
|
+
|
103
|
+
# ifndef YY_NULLPTR
|
104
|
+
# if defined __cplusplus && 201103L <= __cplusplus
|
105
|
+
# define YY_NULLPTR nullptr
|
106
|
+
# else
|
107
|
+
# define YY_NULLPTR 0
|
108
|
+
# endif
|
109
|
+
# endif
|
110
|
+
|
111
|
+
/* Enabling verbose error messages. */
|
112
|
+
#ifdef YYERROR_VERBOSE
|
113
|
+
# undef YYERROR_VERBOSE
|
114
|
+
# define YYERROR_VERBOSE 1
|
115
|
+
#else
|
116
|
+
# define YYERROR_VERBOSE 0
|
117
|
+
#endif
|
118
|
+
|
119
|
+
/* In a future release of Bison, this section will be replaced
|
120
|
+
by #include "y.tab.h". */
|
121
|
+
#ifndef YY_CONV_YY_Y_TAB_H_INCLUDED
|
122
|
+
# define YY_CONV_YY_Y_TAB_H_INCLUDED
|
123
|
+
/* Debug traces. */
|
124
|
+
#ifndef YYDEBUG
|
125
|
+
# define YYDEBUG 0
|
126
|
+
#endif
|
127
|
+
#if YYDEBUG
|
128
|
+
extern int conv_yydebug;
|
129
|
+
#endif
|
130
|
+
|
131
|
+
/* Token type. */
|
132
|
+
#ifndef YYTOKENTYPE
|
133
|
+
# define YYTOKENTYPE
|
134
|
+
enum yytokentype
|
135
|
+
{
|
136
|
+
TOK_QID = 258,
|
137
|
+
TOK_ID = 259,
|
138
|
+
TOK_NUMBER = 260,
|
139
|
+
TOK_REGEX = 261
|
140
|
+
};
|
141
|
+
#endif
|
142
|
+
/* Tokens. */
|
143
|
+
#define TOK_QID 258
|
144
|
+
#define TOK_ID 259
|
145
|
+
#define TOK_NUMBER 260
|
146
|
+
#define TOK_REGEX 261
|
147
|
+
|
148
|
+
/* Value type. */
|
149
|
+
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
150
|
+
typedef union YYSTYPE YYSTYPE;
|
151
|
+
union YYSTYPE
|
152
|
+
{
|
153
|
+
#line 27 "conventions.y" /* yacc.c:355 */
|
154
|
+
|
155
|
+
struct asnc *asnc;
|
156
|
+
int in;
|
157
|
+
char *cp;
|
158
|
+
struct stringpair *binding;
|
159
|
+
struct expression *expr;
|
160
|
+
struct convention *conv;
|
161
|
+
struct key_decl *kvb;
|
162
|
+
conv_queue cq;
|
163
|
+
key_hashtable dict;
|
164
|
+
boolean bool;
|
165
|
+
|
166
|
+
#line 167 "conventions.c" /* yacc.c:355 */
|
167
|
+
};
|
168
|
+
# define YYSTYPE_IS_TRIVIAL 1
|
169
|
+
# define YYSTYPE_IS_DECLARED 1
|
170
|
+
#endif
|
171
|
+
|
172
|
+
|
173
|
+
extern YYSTYPE conv_yylval;
|
174
|
+
|
175
|
+
int conv_yyparse (void);
|
176
|
+
|
177
|
+
#endif /* !YY_CONV_YY_Y_TAB_H_INCLUDED */
|
178
|
+
|
179
|
+
/* Copy the second part of user declarations. */
|
180
|
+
|
181
|
+
#line 182 "conventions.c" /* yacc.c:358 */
|
182
|
+
|
183
|
+
#ifdef short
|
184
|
+
# undef short
|
185
|
+
#endif
|
186
|
+
|
187
|
+
#ifdef YYTYPE_UINT8
|
188
|
+
typedef YYTYPE_UINT8 yytype_uint8;
|
189
|
+
#else
|
190
|
+
typedef unsigned char yytype_uint8;
|
191
|
+
#endif
|
192
|
+
|
193
|
+
#ifdef YYTYPE_INT8
|
194
|
+
typedef YYTYPE_INT8 yytype_int8;
|
195
|
+
#else
|
196
|
+
typedef signed char yytype_int8;
|
197
|
+
#endif
|
198
|
+
|
199
|
+
#ifdef YYTYPE_UINT16
|
200
|
+
typedef YYTYPE_UINT16 yytype_uint16;
|
201
|
+
#else
|
202
|
+
typedef unsigned short int yytype_uint16;
|
203
|
+
#endif
|
204
|
+
|
205
|
+
#ifdef YYTYPE_INT16
|
206
|
+
typedef YYTYPE_INT16 yytype_int16;
|
207
|
+
#else
|
208
|
+
typedef short int yytype_int16;
|
209
|
+
#endif
|
210
|
+
|
211
|
+
#ifndef YYSIZE_T
|
212
|
+
# ifdef __SIZE_TYPE__
|
213
|
+
# define YYSIZE_T __SIZE_TYPE__
|
214
|
+
# elif defined size_t
|
215
|
+
# define YYSIZE_T size_t
|
216
|
+
# elif ! defined YYSIZE_T
|
217
|
+
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
|
218
|
+
# define YYSIZE_T size_t
|
219
|
+
# else
|
220
|
+
# define YYSIZE_T unsigned int
|
221
|
+
# endif
|
222
|
+
#endif
|
223
|
+
|
224
|
+
#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
|
225
|
+
|
226
|
+
#ifndef YY_
|
227
|
+
# if defined YYENABLE_NLS && YYENABLE_NLS
|
228
|
+
# if ENABLE_NLS
|
229
|
+
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
|
230
|
+
# define YY_(Msgid) dgettext ("bison-runtime", Msgid)
|
231
|
+
# endif
|
232
|
+
# endif
|
233
|
+
# ifndef YY_
|
234
|
+
# define YY_(Msgid) Msgid
|
235
|
+
# endif
|
236
|
+
#endif
|
237
|
+
|
238
|
+
#ifndef YY_ATTRIBUTE
|
239
|
+
# if (defined __GNUC__ \
|
240
|
+
&& (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
|
241
|
+
|| defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
|
242
|
+
# define YY_ATTRIBUTE(Spec) __attribute__(Spec)
|
243
|
+
# else
|
244
|
+
# define YY_ATTRIBUTE(Spec) /* empty */
|
245
|
+
# endif
|
246
|
+
#endif
|
247
|
+
|
248
|
+
#ifndef YY_ATTRIBUTE_PURE
|
249
|
+
# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
|
250
|
+
#endif
|
251
|
+
|
252
|
+
#ifndef YY_ATTRIBUTE_UNUSED
|
253
|
+
# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
|
254
|
+
#endif
|
255
|
+
|
256
|
+
#if !defined _Noreturn \
|
257
|
+
&& (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
|
258
|
+
# if defined _MSC_VER && 1200 <= _MSC_VER
|
259
|
+
# define _Noreturn __declspec (noreturn)
|
260
|
+
# else
|
261
|
+
# define _Noreturn YY_ATTRIBUTE ((__noreturn__))
|
262
|
+
# endif
|
263
|
+
#endif
|
264
|
+
|
265
|
+
/* Suppress unused-variable warnings by "using" E. */
|
266
|
+
#if ! defined lint || defined __GNUC__
|
267
|
+
# define YYUSE(E) ((void) (E))
|
268
|
+
#else
|
269
|
+
# define YYUSE(E) /* empty */
|
270
|
+
#endif
|
271
|
+
|
272
|
+
#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
|
273
|
+
/* Suppress an incorrect diagnostic about yylval being uninitialized. */
|
274
|
+
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
|
275
|
+
_Pragma ("GCC diagnostic push") \
|
276
|
+
_Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
|
277
|
+
_Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
|
278
|
+
# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
|
279
|
+
_Pragma ("GCC diagnostic pop")
|
280
|
+
#else
|
281
|
+
# define YY_INITIAL_VALUE(Value) Value
|
282
|
+
#endif
|
283
|
+
#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
|
284
|
+
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
|
285
|
+
# define YY_IGNORE_MAYBE_UNINITIALIZED_END
|
286
|
+
#endif
|
287
|
+
#ifndef YY_INITIAL_VALUE
|
288
|
+
# define YY_INITIAL_VALUE(Value) /* Nothing. */
|
289
|
+
#endif
|
290
|
+
|
291
|
+
|
292
|
+
#if ! defined yyoverflow || YYERROR_VERBOSE
|
293
|
+
|
294
|
+
/* The parser invokes alloca or malloc; define the necessary symbols. */
|
295
|
+
|
296
|
+
# ifdef YYSTACK_USE_ALLOCA
|
297
|
+
# if YYSTACK_USE_ALLOCA
|
298
|
+
# ifdef __GNUC__
|
299
|
+
# define YYSTACK_ALLOC __builtin_alloca
|
300
|
+
# elif defined __BUILTIN_VA_ARG_INCR
|
301
|
+
# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
|
302
|
+
# elif defined _AIX
|
303
|
+
# define YYSTACK_ALLOC __alloca
|
304
|
+
# elif defined _MSC_VER
|
305
|
+
# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
|
306
|
+
# define alloca _alloca
|
307
|
+
# else
|
308
|
+
# define YYSTACK_ALLOC alloca
|
309
|
+
# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
|
310
|
+
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
|
311
|
+
/* Use EXIT_SUCCESS as a witness for stdlib.h. */
|
312
|
+
# ifndef EXIT_SUCCESS
|
313
|
+
# define EXIT_SUCCESS 0
|
314
|
+
# endif
|
315
|
+
# endif
|
316
|
+
# endif
|
317
|
+
# endif
|
318
|
+
# endif
|
319
|
+
|
320
|
+
# ifdef YYSTACK_ALLOC
|
321
|
+
/* Pacify GCC's 'empty if-body' warning. */
|
322
|
+
# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
|
323
|
+
# ifndef YYSTACK_ALLOC_MAXIMUM
|
324
|
+
/* The OS might guarantee only one guard page at the bottom of the stack,
|
325
|
+
and a page size can be as small as 4096 bytes. So we cannot safely
|
326
|
+
invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
|
327
|
+
to allow for a few compiler-allocated temporary stack slots. */
|
328
|
+
# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
|
329
|
+
# endif
|
330
|
+
# else
|
331
|
+
# define YYSTACK_ALLOC YYMALLOC
|
332
|
+
# define YYSTACK_FREE YYFREE
|
333
|
+
# ifndef YYSTACK_ALLOC_MAXIMUM
|
334
|
+
# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
|
335
|
+
# endif
|
336
|
+
# if (defined __cplusplus && ! defined EXIT_SUCCESS \
|
337
|
+
&& ! ((defined YYMALLOC || defined malloc) \
|
338
|
+
&& (defined YYFREE || defined free)))
|
339
|
+
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
|
340
|
+
# ifndef EXIT_SUCCESS
|
341
|
+
# define EXIT_SUCCESS 0
|
342
|
+
# endif
|
343
|
+
# endif
|
344
|
+
# ifndef YYMALLOC
|
345
|
+
# define YYMALLOC malloc
|
346
|
+
# if ! defined malloc && ! defined EXIT_SUCCESS
|
347
|
+
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
|
348
|
+
# endif
|
349
|
+
# endif
|
350
|
+
# ifndef YYFREE
|
351
|
+
# define YYFREE free
|
352
|
+
# if ! defined free && ! defined EXIT_SUCCESS
|
353
|
+
void free (void *); /* INFRINGES ON USER NAME SPACE */
|
354
|
+
# endif
|
355
|
+
# endif
|
356
|
+
# endif
|
357
|
+
#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
|
358
|
+
|
359
|
+
|
360
|
+
#if (! defined yyoverflow \
|
361
|
+
&& (! defined __cplusplus \
|
362
|
+
|| (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
|
363
|
+
|
364
|
+
/* A type that is properly aligned for any stack member. */
|
365
|
+
union yyalloc
|
366
|
+
{
|
367
|
+
yytype_int16 yyss_alloc;
|
368
|
+
YYSTYPE yyvs_alloc;
|
369
|
+
};
|
370
|
+
|
371
|
+
/* The size of the maximum gap between one aligned stack and the next. */
|
372
|
+
# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
|
373
|
+
|
374
|
+
/* The size of an array large to enough to hold all stacks, each with
|
375
|
+
N elements. */
|
376
|
+
# define YYSTACK_BYTES(N) \
|
377
|
+
((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
|
378
|
+
+ YYSTACK_GAP_MAXIMUM)
|
379
|
+
|
380
|
+
# define YYCOPY_NEEDED 1
|
381
|
+
|
382
|
+
/* Relocate STACK from its old location to the new one. The
|
383
|
+
local variables YYSIZE and YYSTACKSIZE give the old and new number of
|
384
|
+
elements in the stack, and YYPTR gives the new location of the
|
385
|
+
stack. Advance YYPTR to a properly aligned location for the next
|
386
|
+
stack. */
|
387
|
+
# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
|
388
|
+
do \
|
389
|
+
{ \
|
390
|
+
YYSIZE_T yynewbytes; \
|
391
|
+
YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
|
392
|
+
Stack = &yyptr->Stack_alloc; \
|
393
|
+
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
|
394
|
+
yyptr += yynewbytes / sizeof (*yyptr); \
|
395
|
+
} \
|
396
|
+
while (0)
|
397
|
+
|
398
|
+
#endif
|
399
|
+
|
400
|
+
#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
|
401
|
+
/* Copy COUNT objects from SRC to DST. The source and destination do
|
402
|
+
not overlap. */
|
403
|
+
# ifndef YYCOPY
|
404
|
+
# if defined __GNUC__ && 1 < __GNUC__
|
405
|
+
# define YYCOPY(Dst, Src, Count) \
|
406
|
+
__builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
|
407
|
+
# else
|
408
|
+
# define YYCOPY(Dst, Src, Count) \
|
409
|
+
do \
|
410
|
+
{ \
|
411
|
+
YYSIZE_T yyi; \
|
412
|
+
for (yyi = 0; yyi < (Count); yyi++) \
|
413
|
+
(Dst)[yyi] = (Src)[yyi]; \
|
414
|
+
} \
|
415
|
+
while (0)
|
416
|
+
# endif
|
417
|
+
# endif
|
418
|
+
#endif /* !YYCOPY_NEEDED */
|
419
|
+
|
420
|
+
/* YYFINAL -- State number of the termination state. */
|
421
|
+
#define YYFINAL 2
|
422
|
+
/* YYLAST -- Last index in YYTABLE. */
|
423
|
+
#define YYLAST 50
|
424
|
+
|
425
|
+
/* YYNTOKENS -- Number of terminals. */
|
426
|
+
#define YYNTOKENS 11
|
427
|
+
/* YYNNTS -- Number of nonterminals. */
|
428
|
+
#define YYNNTS 9
|
429
|
+
/* YYNRULES -- Number of rules. */
|
430
|
+
#define YYNRULES 28
|
431
|
+
/* YYNSTATES -- Number of states. */
|
432
|
+
#define YYNSTATES 49
|
433
|
+
|
434
|
+
/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
|
435
|
+
by yylex, with out-of-bounds checking. */
|
436
|
+
#define YYUNDEFTOK 2
|
437
|
+
#define YYMAXUTOK 261
|
438
|
+
|
439
|
+
#define YYTRANSLATE(YYX) \
|
440
|
+
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
|
441
|
+
|
442
|
+
/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
|
443
|
+
as returned by yylex, without out-of-bounds checking. */
|
444
|
+
static const yytype_uint8 yytranslate[] =
|
445
|
+
{
|
446
|
+
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
447
|
+
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
448
|
+
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
449
|
+
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
450
|
+
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
451
|
+
2, 2, 2, 2, 2, 2, 2, 2, 2, 9,
|
452
|
+
2, 10, 2, 2, 2, 2, 2, 2, 2, 2,
|
453
|
+
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
454
|
+
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
455
|
+
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
456
|
+
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
457
|
+
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
458
|
+
2, 2, 2, 7, 2, 8, 2, 2, 2, 2,
|
459
|
+
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
460
|
+
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
461
|
+
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
462
|
+
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
463
|
+
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
464
|
+
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
465
|
+
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
466
|
+
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
467
|
+
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
468
|
+
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
469
|
+
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
470
|
+
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
471
|
+
2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
|
472
|
+
5, 6
|
473
|
+
};
|
474
|
+
|
475
|
+
#if YYDEBUG
|
476
|
+
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
|
477
|
+
static const yytype_uint8 yyrline[] =
|
478
|
+
{
|
479
|
+
0, 54, 54, 62, 68, 79, 119, 122, 126, 128,
|
480
|
+
130, 132, 134, 136, 141, 146, 153, 156, 164, 172,
|
481
|
+
176, 180, 184, 190, 190, 192, 212, 216, 222
|
482
|
+
};
|
483
|
+
#endif
|
484
|
+
|
485
|
+
#if YYDEBUG || YYERROR_VERBOSE || 0
|
486
|
+
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
|
487
|
+
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
|
488
|
+
static const char *const yytname[] =
|
489
|
+
{
|
490
|
+
"$end", "error", "$undefined", "TOK_QID", "TOK_ID", "TOK_NUMBER",
|
491
|
+
"TOK_REGEX", "'{'", "'}'", "';'", "'='", "$accept", "conventions", "asn",
|
492
|
+
"expressionlist", "expression", "keyvalbinding", "quotableident",
|
493
|
+
"bindingtable", "binding", YY_NULLPTR
|
494
|
+
};
|
495
|
+
#endif
|
496
|
+
|
497
|
+
# ifdef YYPRINT
|
498
|
+
/* YYTOKNUM[NUM] -- (External) token number corresponding to the
|
499
|
+
(internal) symbol number NUM (which must be that of a token). */
|
500
|
+
static const yytype_uint16 yytoknum[] =
|
501
|
+
{
|
502
|
+
0, 256, 257, 258, 259, 260, 261, 123, 125, 59,
|
503
|
+
61
|
504
|
+
};
|
505
|
+
# endif
|
506
|
+
|
507
|
+
#define YYPACT_NINF -22
|
508
|
+
|
509
|
+
#define yypact_value_is_default(Yystate) \
|
510
|
+
(!!((Yystate) == (-22)))
|
511
|
+
|
512
|
+
#define YYTABLE_NINF -27
|
513
|
+
|
514
|
+
#define yytable_value_is_error(Yytable_value) \
|
515
|
+
0
|
516
|
+
|
517
|
+
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
|
518
|
+
STATE-NUM. */
|
519
|
+
static const yytype_int8 yypact[] =
|
520
|
+
{
|
521
|
+
-22, 3, -22, 39, -22, 2, -22, -22, 33, 36,
|
522
|
+
12, -22, -22, -22, -22, 0, -22, 13, -22, 1,
|
523
|
+
-22, -22, 14, -22, 23, 21, 26, -22, -22, 16,
|
524
|
+
-22, 25, 42, -22, -2, -22, 30, -22, -22, 44,
|
525
|
+
44, -22, -22, 32, -22, -22, -22, -22, -22
|
526
|
+
};
|
527
|
+
|
528
|
+
/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
|
529
|
+
Performed when YYTABLE does not specify something else to do. Zero
|
530
|
+
means the default is an error. */
|
531
|
+
static const yytype_uint8 yydefact[] =
|
532
|
+
{
|
533
|
+
3, 0, 1, 0, 2, 0, 7, 7, 0, 0,
|
534
|
+
0, 4, 6, 5, 15, 0, 12, 0, 22, 0,
|
535
|
+
14, 8, 0, 21, 0, 0, 0, 13, 9, 0,
|
536
|
+
20, 0, 0, 10, 0, 19, 0, 26, 11, 0,
|
537
|
+
0, 16, 25, 0, 24, 23, 27, 28, 17
|
538
|
+
};
|
539
|
+
|
540
|
+
/* YYPGOTO[NTERM-NUM]. */
|
541
|
+
static const yytype_int8 yypgoto[] =
|
542
|
+
{
|
543
|
+
-22, -22, -22, 43, -22, -17, -21, 6, -22
|
544
|
+
};
|
545
|
+
|
546
|
+
/* YYDEFGOTO[NTERM-NUM]. */
|
547
|
+
static const yytype_int8 yydefgoto[] =
|
548
|
+
{
|
549
|
+
-1, 1, 4, 8, 12, 17, 46, 36, 42
|
550
|
+
};
|
551
|
+
|
552
|
+
/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
|
553
|
+
positive, shift that token. If negative, reduce the rule whose
|
554
|
+
number is the opposite. If YYTABLE_NINF, syntax error. */
|
555
|
+
static const yytype_int8 yytable[] =
|
556
|
+
{
|
557
|
+
22, 18, 23, 2, 24, 29, 25, 38, 3, 7,
|
558
|
+
19, 26, 34, 14, 20, 27, 15, 15, 15, 47,
|
559
|
+
15, 16, 21, 28, 30, 33, 35, -18, 31, -26,
|
560
|
+
-26, 32, -18, -26, 39, 40, 39, 40, 41, 10,
|
561
|
+
48, 11, 10, 43, 13, 5, 6, 44, 45, 37,
|
562
|
+
9
|
563
|
+
};
|
564
|
+
|
565
|
+
static const yytype_uint8 yycheck[] =
|
566
|
+
{
|
567
|
+
17, 1, 1, 0, 3, 22, 5, 9, 5, 7,
|
568
|
+
10, 10, 29, 1, 1, 1, 4, 4, 4, 40,
|
569
|
+
4, 9, 9, 9, 1, 9, 1, 4, 7, 4,
|
570
|
+
5, 5, 9, 8, 4, 5, 4, 5, 8, 6,
|
571
|
+
8, 8, 6, 37, 8, 6, 7, 3, 4, 7,
|
572
|
+
7
|
573
|
+
};
|
574
|
+
|
575
|
+
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
|
576
|
+
symbol of state STATE-NUM. */
|
577
|
+
static const yytype_uint8 yystos[] =
|
578
|
+
{
|
579
|
+
0, 12, 0, 5, 13, 6, 7, 7, 14, 14,
|
580
|
+
6, 8, 15, 8, 1, 4, 9, 16, 1, 10,
|
581
|
+
1, 9, 16, 1, 3, 5, 10, 1, 9, 16,
|
582
|
+
1, 7, 5, 9, 16, 1, 18, 7, 9, 4,
|
583
|
+
5, 8, 19, 18, 3, 4, 17, 17, 8
|
584
|
+
};
|
585
|
+
|
586
|
+
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
|
587
|
+
static const yytype_uint8 yyr1[] =
|
588
|
+
{
|
589
|
+
0, 11, 12, 12, 13, 13, 14, 14, 15, 15,
|
590
|
+
15, 15, 15, 15, 15, 15, 16, 16, 16, 16,
|
591
|
+
16, 16, 16, 17, 17, 18, 18, 19, 19
|
592
|
+
};
|
593
|
+
|
594
|
+
/* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
|
595
|
+
static const yytype_uint8 yyr2[] =
|
596
|
+
{
|
597
|
+
0, 2, 2, 0, 4, 5, 2, 0, 3, 4,
|
598
|
+
5, 6, 2, 4, 3, 2, 6, 7, 3, 5,
|
599
|
+
4, 3, 2, 1, 1, 2, 0, 2, 2
|
600
|
+
};
|
601
|
+
|
602
|
+
|
603
|
+
#define yyerrok (yyerrstatus = 0)
|
604
|
+
#define yyclearin (yychar = YYEMPTY)
|
605
|
+
#define YYEMPTY (-2)
|
606
|
+
#define YYEOF 0
|
607
|
+
|
608
|
+
#define YYACCEPT goto yyacceptlab
|
609
|
+
#define YYABORT goto yyabortlab
|
610
|
+
#define YYERROR goto yyerrorlab
|
611
|
+
|
612
|
+
|
613
|
+
#define YYRECOVERING() (!!yyerrstatus)
|
614
|
+
|
615
|
+
#define YYBACKUP(Token, Value) \
|
616
|
+
do \
|
617
|
+
if (yychar == YYEMPTY) \
|
618
|
+
{ \
|
619
|
+
yychar = (Token); \
|
620
|
+
yylval = (Value); \
|
621
|
+
YYPOPSTACK (yylen); \
|
622
|
+
yystate = *yyssp; \
|
623
|
+
goto yybackup; \
|
624
|
+
} \
|
625
|
+
else \
|
626
|
+
{ \
|
627
|
+
yyerror (YY_("syntax error: cannot back up")); \
|
628
|
+
YYERROR; \
|
629
|
+
} \
|
630
|
+
while (0)
|
631
|
+
|
632
|
+
/* Error token number */
|
633
|
+
#define YYTERROR 1
|
634
|
+
#define YYERRCODE 256
|
635
|
+
|
636
|
+
|
637
|
+
|
638
|
+
/* Enable debugging if requested. */
|
639
|
+
#if YYDEBUG
|
640
|
+
|
641
|
+
# ifndef YYFPRINTF
|
642
|
+
# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
|
643
|
+
# define YYFPRINTF fprintf
|
644
|
+
# endif
|
645
|
+
|
646
|
+
# define YYDPRINTF(Args) \
|
647
|
+
do { \
|
648
|
+
if (yydebug) \
|
649
|
+
YYFPRINTF Args; \
|
650
|
+
} while (0)
|
651
|
+
|
652
|
+
/* This macro is provided for backward compatibility. */
|
653
|
+
#ifndef YY_LOCATION_PRINT
|
654
|
+
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
|
655
|
+
#endif
|
656
|
+
|
657
|
+
|
658
|
+
# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
|
659
|
+
do { \
|
660
|
+
if (yydebug) \
|
661
|
+
{ \
|
662
|
+
YYFPRINTF (stderr, "%s ", Title); \
|
663
|
+
yy_symbol_print (stderr, \
|
664
|
+
Type, Value); \
|
665
|
+
YYFPRINTF (stderr, "\n"); \
|
666
|
+
} \
|
667
|
+
} while (0)
|
668
|
+
|
669
|
+
|
670
|
+
/*----------------------------------------.
|
671
|
+
| Print this symbol's value on YYOUTPUT. |
|
672
|
+
`----------------------------------------*/
|
673
|
+
|
674
|
+
static void
|
675
|
+
yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
|
676
|
+
{
|
677
|
+
FILE *yyo = yyoutput;
|
678
|
+
YYUSE (yyo);
|
679
|
+
if (!yyvaluep)
|
680
|
+
return;
|
681
|
+
# ifdef YYPRINT
|
682
|
+
if (yytype < YYNTOKENS)
|
683
|
+
YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
|
684
|
+
# endif
|
685
|
+
YYUSE (yytype);
|
686
|
+
}
|
687
|
+
|
688
|
+
|
689
|
+
/*--------------------------------.
|
690
|
+
| Print this symbol on YYOUTPUT. |
|
691
|
+
`--------------------------------*/
|
692
|
+
|
693
|
+
static void
|
694
|
+
yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
|
695
|
+
{
|
696
|
+
YYFPRINTF (yyoutput, "%s %s (",
|
697
|
+
yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
|
698
|
+
|
699
|
+
yy_symbol_value_print (yyoutput, yytype, yyvaluep);
|
700
|
+
YYFPRINTF (yyoutput, ")");
|
701
|
+
}
|
702
|
+
|
703
|
+
/*------------------------------------------------------------------.
|
704
|
+
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
|
705
|
+
| TOP (included). |
|
706
|
+
`------------------------------------------------------------------*/
|
707
|
+
|
708
|
+
static void
|
709
|
+
yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
|
710
|
+
{
|
711
|
+
YYFPRINTF (stderr, "Stack now");
|
712
|
+
for (; yybottom <= yytop; yybottom++)
|
713
|
+
{
|
714
|
+
int yybot = *yybottom;
|
715
|
+
YYFPRINTF (stderr, " %d", yybot);
|
716
|
+
}
|
717
|
+
YYFPRINTF (stderr, "\n");
|
718
|
+
}
|
719
|
+
|
720
|
+
# define YY_STACK_PRINT(Bottom, Top) \
|
721
|
+
do { \
|
722
|
+
if (yydebug) \
|
723
|
+
yy_stack_print ((Bottom), (Top)); \
|
724
|
+
} while (0)
|
725
|
+
|
726
|
+
|
727
|
+
/*------------------------------------------------.
|
728
|
+
| Report that the YYRULE is going to be reduced. |
|
729
|
+
`------------------------------------------------*/
|
730
|
+
|
731
|
+
static void
|
732
|
+
yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
|
733
|
+
{
|
734
|
+
unsigned long int yylno = yyrline[yyrule];
|
735
|
+
int yynrhs = yyr2[yyrule];
|
736
|
+
int yyi;
|
737
|
+
YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
|
738
|
+
yyrule - 1, yylno);
|
739
|
+
/* The symbols being reduced. */
|
740
|
+
for (yyi = 0; yyi < yynrhs; yyi++)
|
741
|
+
{
|
742
|
+
YYFPRINTF (stderr, " $%d = ", yyi + 1);
|
743
|
+
yy_symbol_print (stderr,
|
744
|
+
yystos[yyssp[yyi + 1 - yynrhs]],
|
745
|
+
&(yyvsp[(yyi + 1) - (yynrhs)])
|
746
|
+
);
|
747
|
+
YYFPRINTF (stderr, "\n");
|
748
|
+
}
|
749
|
+
}
|
750
|
+
|
751
|
+
# define YY_REDUCE_PRINT(Rule) \
|
752
|
+
do { \
|
753
|
+
if (yydebug) \
|
754
|
+
yy_reduce_print (yyssp, yyvsp, Rule); \
|
755
|
+
} while (0)
|
756
|
+
|
757
|
+
/* Nonzero means print parse trace. It is left uninitialized so that
|
758
|
+
multiple parsers can coexist. */
|
759
|
+
int yydebug;
|
760
|
+
#else /* !YYDEBUG */
|
761
|
+
# define YYDPRINTF(Args)
|
762
|
+
# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
|
763
|
+
# define YY_STACK_PRINT(Bottom, Top)
|
764
|
+
# define YY_REDUCE_PRINT(Rule)
|
765
|
+
#endif /* !YYDEBUG */
|
766
|
+
|
767
|
+
|
768
|
+
/* YYINITDEPTH -- initial size of the parser's stacks. */
|
769
|
+
#ifndef YYINITDEPTH
|
770
|
+
# define YYINITDEPTH 200
|
771
|
+
#endif
|
772
|
+
|
773
|
+
/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
|
774
|
+
if the built-in stack extension method is used).
|
775
|
+
|
776
|
+
Do not make this value too large; the results are undefined if
|
777
|
+
YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
|
778
|
+
evaluated with infinite-precision integer arithmetic. */
|
779
|
+
|
780
|
+
#ifndef YYMAXDEPTH
|
781
|
+
# define YYMAXDEPTH 10000
|
782
|
+
#endif
|
783
|
+
|
784
|
+
|
785
|
+
#if YYERROR_VERBOSE
|
786
|
+
|
787
|
+
# ifndef yystrlen
|
788
|
+
# if defined __GLIBC__ && defined _STRING_H
|
789
|
+
# define yystrlen strlen
|
790
|
+
# else
|
791
|
+
/* Return the length of YYSTR. */
|
792
|
+
static YYSIZE_T
|
793
|
+
yystrlen (const char *yystr)
|
794
|
+
{
|
795
|
+
YYSIZE_T yylen;
|
796
|
+
for (yylen = 0; yystr[yylen]; yylen++)
|
797
|
+
continue;
|
798
|
+
return yylen;
|
799
|
+
}
|
800
|
+
# endif
|
801
|
+
# endif
|
802
|
+
|
803
|
+
# ifndef yystpcpy
|
804
|
+
# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
|
805
|
+
# define yystpcpy stpcpy
|
806
|
+
# else
|
807
|
+
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
|
808
|
+
YYDEST. */
|
809
|
+
static char *
|
810
|
+
yystpcpy (char *yydest, const char *yysrc)
|
811
|
+
{
|
812
|
+
char *yyd = yydest;
|
813
|
+
const char *yys = yysrc;
|
814
|
+
|
815
|
+
while ((*yyd++ = *yys++) != '\0')
|
816
|
+
continue;
|
817
|
+
|
818
|
+
return yyd - 1;
|
819
|
+
}
|
820
|
+
# endif
|
821
|
+
# endif
|
822
|
+
|
823
|
+
# ifndef yytnamerr
|
824
|
+
/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
|
825
|
+
quotes and backslashes, so that it's suitable for yyerror. The
|
826
|
+
heuristic is that double-quoting is unnecessary unless the string
|
827
|
+
contains an apostrophe, a comma, or backslash (other than
|
828
|
+
backslash-backslash). YYSTR is taken from yytname. If YYRES is
|
829
|
+
null, do not copy; instead, return the length of what the result
|
830
|
+
would have been. */
|
831
|
+
static YYSIZE_T
|
832
|
+
yytnamerr (char *yyres, const char *yystr)
|
833
|
+
{
|
834
|
+
if (*yystr == '"')
|
835
|
+
{
|
836
|
+
YYSIZE_T yyn = 0;
|
837
|
+
char const *yyp = yystr;
|
838
|
+
|
839
|
+
for (;;)
|
840
|
+
switch (*++yyp)
|
841
|
+
{
|
842
|
+
case '\'':
|
843
|
+
case ',':
|
844
|
+
goto do_not_strip_quotes;
|
845
|
+
|
846
|
+
case '\\':
|
847
|
+
if (*++yyp != '\\')
|
848
|
+
goto do_not_strip_quotes;
|
849
|
+
/* Fall through. */
|
850
|
+
default:
|
851
|
+
if (yyres)
|
852
|
+
yyres[yyn] = *yyp;
|
853
|
+
yyn++;
|
854
|
+
break;
|
855
|
+
|
856
|
+
case '"':
|
857
|
+
if (yyres)
|
858
|
+
yyres[yyn] = '\0';
|
859
|
+
return yyn;
|
860
|
+
}
|
861
|
+
do_not_strip_quotes: ;
|
862
|
+
}
|
863
|
+
|
864
|
+
if (! yyres)
|
865
|
+
return yystrlen (yystr);
|
866
|
+
|
867
|
+
return yystpcpy (yyres, yystr) - yyres;
|
868
|
+
}
|
869
|
+
# endif
|
870
|
+
|
871
|
+
/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
|
872
|
+
about the unexpected token YYTOKEN for the state stack whose top is
|
873
|
+
YYSSP.
|
874
|
+
|
875
|
+
Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
|
876
|
+
not large enough to hold the message. In that case, also set
|
877
|
+
*YYMSG_ALLOC to the required number of bytes. Return 2 if the
|
878
|
+
required number of bytes is too large to store. */
|
879
|
+
static int
|
880
|
+
yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
|
881
|
+
yytype_int16 *yyssp, int yytoken)
|
882
|
+
{
|
883
|
+
YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
|
884
|
+
YYSIZE_T yysize = yysize0;
|
885
|
+
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
|
886
|
+
/* Internationalized format string. */
|
887
|
+
const char *yyformat = YY_NULLPTR;
|
888
|
+
/* Arguments of yyformat. */
|
889
|
+
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
|
890
|
+
/* Number of reported tokens (one for the "unexpected", one per
|
891
|
+
"expected"). */
|
892
|
+
int yycount = 0;
|
893
|
+
|
894
|
+
/* There are many possibilities here to consider:
|
895
|
+
- If this state is a consistent state with a default action, then
|
896
|
+
the only way this function was invoked is if the default action
|
897
|
+
is an error action. In that case, don't check for expected
|
898
|
+
tokens because there are none.
|
899
|
+
- The only way there can be no lookahead present (in yychar) is if
|
900
|
+
this state is a consistent state with a default action. Thus,
|
901
|
+
detecting the absence of a lookahead is sufficient to determine
|
902
|
+
that there is no unexpected or expected token to report. In that
|
903
|
+
case, just report a simple "syntax error".
|
904
|
+
- Don't assume there isn't a lookahead just because this state is a
|
905
|
+
consistent state with a default action. There might have been a
|
906
|
+
previous inconsistent state, consistent state with a non-default
|
907
|
+
action, or user semantic action that manipulated yychar.
|
908
|
+
- Of course, the expected token list depends on states to have
|
909
|
+
correct lookahead information, and it depends on the parser not
|
910
|
+
to perform extra reductions after fetching a lookahead from the
|
911
|
+
scanner and before detecting a syntax error. Thus, state merging
|
912
|
+
(from LALR or IELR) and default reductions corrupt the expected
|
913
|
+
token list. However, the list is correct for canonical LR with
|
914
|
+
one exception: it will still contain any token that will not be
|
915
|
+
accepted due to an error action in a later state.
|
916
|
+
*/
|
917
|
+
if (yytoken != YYEMPTY)
|
918
|
+
{
|
919
|
+
int yyn = yypact[*yyssp];
|
920
|
+
yyarg[yycount++] = yytname[yytoken];
|
921
|
+
if (!yypact_value_is_default (yyn))
|
922
|
+
{
|
923
|
+
/* Start YYX at -YYN if negative to avoid negative indexes in
|
924
|
+
YYCHECK. In other words, skip the first -YYN actions for
|
925
|
+
this state because they are default actions. */
|
926
|
+
int yyxbegin = yyn < 0 ? -yyn : 0;
|
927
|
+
/* Stay within bounds of both yycheck and yytname. */
|
928
|
+
int yychecklim = YYLAST - yyn + 1;
|
929
|
+
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
|
930
|
+
int yyx;
|
931
|
+
|
932
|
+
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
|
933
|
+
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
|
934
|
+
&& !yytable_value_is_error (yytable[yyx + yyn]))
|
935
|
+
{
|
936
|
+
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
|
937
|
+
{
|
938
|
+
yycount = 1;
|
939
|
+
yysize = yysize0;
|
940
|
+
break;
|
941
|
+
}
|
942
|
+
yyarg[yycount++] = yytname[yyx];
|
943
|
+
{
|
944
|
+
YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
|
945
|
+
if (! (yysize <= yysize1
|
946
|
+
&& yysize1 <= YYSTACK_ALLOC_MAXIMUM))
|
947
|
+
return 2;
|
948
|
+
yysize = yysize1;
|
949
|
+
}
|
950
|
+
}
|
951
|
+
}
|
952
|
+
}
|
953
|
+
|
954
|
+
switch (yycount)
|
955
|
+
{
|
956
|
+
# define YYCASE_(N, S) \
|
957
|
+
case N: \
|
958
|
+
yyformat = S; \
|
959
|
+
break
|
960
|
+
YYCASE_(0, YY_("syntax error"));
|
961
|
+
YYCASE_(1, YY_("syntax error, unexpected %s"));
|
962
|
+
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
|
963
|
+
YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
|
964
|
+
YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
|
965
|
+
YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
|
966
|
+
# undef YYCASE_
|
967
|
+
}
|
968
|
+
|
969
|
+
{
|
970
|
+
YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
|
971
|
+
if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
|
972
|
+
return 2;
|
973
|
+
yysize = yysize1;
|
974
|
+
}
|
975
|
+
|
976
|
+
if (*yymsg_alloc < yysize)
|
977
|
+
{
|
978
|
+
*yymsg_alloc = 2 * yysize;
|
979
|
+
if (! (yysize <= *yymsg_alloc
|
980
|
+
&& *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
|
981
|
+
*yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
|
982
|
+
return 1;
|
983
|
+
}
|
984
|
+
|
985
|
+
/* Avoid sprintf, as that infringes on the user's name space.
|
986
|
+
Don't have undefined behavior even if the translation
|
987
|
+
produced a string with the wrong number of "%s"s. */
|
988
|
+
{
|
989
|
+
char *yyp = *yymsg;
|
990
|
+
int yyi = 0;
|
991
|
+
while ((*yyp = *yyformat) != '\0')
|
992
|
+
if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
|
993
|
+
{
|
994
|
+
yyp += yytnamerr (yyp, yyarg[yyi++]);
|
995
|
+
yyformat += 2;
|
996
|
+
}
|
997
|
+
else
|
998
|
+
{
|
999
|
+
yyp++;
|
1000
|
+
yyformat++;
|
1001
|
+
}
|
1002
|
+
}
|
1003
|
+
return 0;
|
1004
|
+
}
|
1005
|
+
#endif /* YYERROR_VERBOSE */
|
1006
|
+
|
1007
|
+
/*-----------------------------------------------.
|
1008
|
+
| Release the memory associated to this symbol. |
|
1009
|
+
`-----------------------------------------------*/
|
1010
|
+
|
1011
|
+
static void
|
1012
|
+
yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
|
1013
|
+
{
|
1014
|
+
YYUSE (yyvaluep);
|
1015
|
+
if (!yymsg)
|
1016
|
+
yymsg = "Deleting";
|
1017
|
+
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
|
1018
|
+
|
1019
|
+
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
|
1020
|
+
YYUSE (yytype);
|
1021
|
+
YY_IGNORE_MAYBE_UNINITIALIZED_END
|
1022
|
+
}
|
1023
|
+
|
1024
|
+
|
1025
|
+
|
1026
|
+
|
1027
|
+
/* The lookahead symbol. */
|
1028
|
+
int yychar;
|
1029
|
+
|
1030
|
+
/* The semantic value of the lookahead symbol. */
|
1031
|
+
YYSTYPE yylval;
|
1032
|
+
/* Number of syntax errors so far. */
|
1033
|
+
int yynerrs;
|
1034
|
+
|
1035
|
+
|
1036
|
+
/*----------.
|
1037
|
+
| yyparse. |
|
1038
|
+
`----------*/
|
1039
|
+
|
1040
|
+
int
|
1041
|
+
yyparse (void)
|
1042
|
+
{
|
1043
|
+
int yystate;
|
1044
|
+
/* Number of tokens to shift before error messages enabled. */
|
1045
|
+
int yyerrstatus;
|
1046
|
+
|
1047
|
+
/* The stacks and their tools:
|
1048
|
+
'yyss': related to states.
|
1049
|
+
'yyvs': related to semantic values.
|
1050
|
+
|
1051
|
+
Refer to the stacks through separate pointers, to allow yyoverflow
|
1052
|
+
to reallocate them elsewhere. */
|
1053
|
+
|
1054
|
+
/* The state stack. */
|
1055
|
+
yytype_int16 yyssa[YYINITDEPTH];
|
1056
|
+
yytype_int16 *yyss;
|
1057
|
+
yytype_int16 *yyssp;
|
1058
|
+
|
1059
|
+
/* The semantic value stack. */
|
1060
|
+
YYSTYPE yyvsa[YYINITDEPTH];
|
1061
|
+
YYSTYPE *yyvs;
|
1062
|
+
YYSTYPE *yyvsp;
|
1063
|
+
|
1064
|
+
YYSIZE_T yystacksize;
|
1065
|
+
|
1066
|
+
int yyn;
|
1067
|
+
int yyresult;
|
1068
|
+
/* Lookahead token as an internal (translated) token number. */
|
1069
|
+
int yytoken = 0;
|
1070
|
+
/* The variables used to return semantic value and location from the
|
1071
|
+
action routines. */
|
1072
|
+
YYSTYPE yyval;
|
1073
|
+
|
1074
|
+
#if YYERROR_VERBOSE
|
1075
|
+
/* Buffer for error messages, and its allocated size. */
|
1076
|
+
char yymsgbuf[128];
|
1077
|
+
char *yymsg = yymsgbuf;
|
1078
|
+
YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
|
1079
|
+
#endif
|
1080
|
+
|
1081
|
+
#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
|
1082
|
+
|
1083
|
+
/* The number of symbols on the RHS of the reduced rule.
|
1084
|
+
Keep to zero when no symbol should be popped. */
|
1085
|
+
int yylen = 0;
|
1086
|
+
|
1087
|
+
yyssp = yyss = yyssa;
|
1088
|
+
yyvsp = yyvs = yyvsa;
|
1089
|
+
yystacksize = YYINITDEPTH;
|
1090
|
+
|
1091
|
+
YYDPRINTF ((stderr, "Starting parse\n"));
|
1092
|
+
|
1093
|
+
yystate = 0;
|
1094
|
+
yyerrstatus = 0;
|
1095
|
+
yynerrs = 0;
|
1096
|
+
yychar = YYEMPTY; /* Cause a token to be read. */
|
1097
|
+
goto yysetstate;
|
1098
|
+
|
1099
|
+
/*------------------------------------------------------------.
|
1100
|
+
| yynewstate -- Push a new state, which is found in yystate. |
|
1101
|
+
`------------------------------------------------------------*/
|
1102
|
+
yynewstate:
|
1103
|
+
/* In all cases, when you get here, the value and location stacks
|
1104
|
+
have just been pushed. So pushing a state here evens the stacks. */
|
1105
|
+
yyssp++;
|
1106
|
+
|
1107
|
+
yysetstate:
|
1108
|
+
*yyssp = yystate;
|
1109
|
+
|
1110
|
+
if (yyss + yystacksize - 1 <= yyssp)
|
1111
|
+
{
|
1112
|
+
/* Get the current used size of the three stacks, in elements. */
|
1113
|
+
YYSIZE_T yysize = yyssp - yyss + 1;
|
1114
|
+
|
1115
|
+
#ifdef yyoverflow
|
1116
|
+
{
|
1117
|
+
/* Give user a chance to reallocate the stack. Use copies of
|
1118
|
+
these so that the &'s don't force the real ones into
|
1119
|
+
memory. */
|
1120
|
+
YYSTYPE *yyvs1 = yyvs;
|
1121
|
+
yytype_int16 *yyss1 = yyss;
|
1122
|
+
|
1123
|
+
/* Each stack pointer address is followed by the size of the
|
1124
|
+
data in use in that stack, in bytes. This used to be a
|
1125
|
+
conditional around just the two extra args, but that might
|
1126
|
+
be undefined if yyoverflow is a macro. */
|
1127
|
+
yyoverflow (YY_("memory exhausted"),
|
1128
|
+
&yyss1, yysize * sizeof (*yyssp),
|
1129
|
+
&yyvs1, yysize * sizeof (*yyvsp),
|
1130
|
+
&yystacksize);
|
1131
|
+
|
1132
|
+
yyss = yyss1;
|
1133
|
+
yyvs = yyvs1;
|
1134
|
+
}
|
1135
|
+
#else /* no yyoverflow */
|
1136
|
+
# ifndef YYSTACK_RELOCATE
|
1137
|
+
goto yyexhaustedlab;
|
1138
|
+
# else
|
1139
|
+
/* Extend the stack our own way. */
|
1140
|
+
if (YYMAXDEPTH <= yystacksize)
|
1141
|
+
goto yyexhaustedlab;
|
1142
|
+
yystacksize *= 2;
|
1143
|
+
if (YYMAXDEPTH < yystacksize)
|
1144
|
+
yystacksize = YYMAXDEPTH;
|
1145
|
+
|
1146
|
+
{
|
1147
|
+
yytype_int16 *yyss1 = yyss;
|
1148
|
+
union yyalloc *yyptr =
|
1149
|
+
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
|
1150
|
+
if (! yyptr)
|
1151
|
+
goto yyexhaustedlab;
|
1152
|
+
YYSTACK_RELOCATE (yyss_alloc, yyss);
|
1153
|
+
YYSTACK_RELOCATE (yyvs_alloc, yyvs);
|
1154
|
+
# undef YYSTACK_RELOCATE
|
1155
|
+
if (yyss1 != yyssa)
|
1156
|
+
YYSTACK_FREE (yyss1);
|
1157
|
+
}
|
1158
|
+
# endif
|
1159
|
+
#endif /* no yyoverflow */
|
1160
|
+
|
1161
|
+
yyssp = yyss + yysize - 1;
|
1162
|
+
yyvsp = yyvs + yysize - 1;
|
1163
|
+
|
1164
|
+
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
|
1165
|
+
(unsigned long int) yystacksize));
|
1166
|
+
|
1167
|
+
if (yyss + yystacksize - 1 <= yyssp)
|
1168
|
+
YYABORT;
|
1169
|
+
}
|
1170
|
+
|
1171
|
+
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
|
1172
|
+
|
1173
|
+
if (yystate == YYFINAL)
|
1174
|
+
YYACCEPT;
|
1175
|
+
|
1176
|
+
goto yybackup;
|
1177
|
+
|
1178
|
+
/*-----------.
|
1179
|
+
| yybackup. |
|
1180
|
+
`-----------*/
|
1181
|
+
yybackup:
|
1182
|
+
|
1183
|
+
/* Do appropriate processing given the current state. Read a
|
1184
|
+
lookahead token if we need one and don't already have one. */
|
1185
|
+
|
1186
|
+
/* First try to decide what to do without reference to lookahead token. */
|
1187
|
+
yyn = yypact[yystate];
|
1188
|
+
if (yypact_value_is_default (yyn))
|
1189
|
+
goto yydefault;
|
1190
|
+
|
1191
|
+
/* Not known => get a lookahead token if don't already have one. */
|
1192
|
+
|
1193
|
+
/* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
|
1194
|
+
if (yychar == YYEMPTY)
|
1195
|
+
{
|
1196
|
+
YYDPRINTF ((stderr, "Reading a token: "));
|
1197
|
+
yychar = yylex ();
|
1198
|
+
}
|
1199
|
+
|
1200
|
+
if (yychar <= YYEOF)
|
1201
|
+
{
|
1202
|
+
yychar = yytoken = YYEOF;
|
1203
|
+
YYDPRINTF ((stderr, "Now at end of input.\n"));
|
1204
|
+
}
|
1205
|
+
else
|
1206
|
+
{
|
1207
|
+
yytoken = YYTRANSLATE (yychar);
|
1208
|
+
YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
|
1209
|
+
}
|
1210
|
+
|
1211
|
+
/* If the proper action on seeing token YYTOKEN is to reduce or to
|
1212
|
+
detect an error, take that action. */
|
1213
|
+
yyn += yytoken;
|
1214
|
+
if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
|
1215
|
+
goto yydefault;
|
1216
|
+
yyn = yytable[yyn];
|
1217
|
+
if (yyn <= 0)
|
1218
|
+
{
|
1219
|
+
if (yytable_value_is_error (yyn))
|
1220
|
+
goto yyerrlab;
|
1221
|
+
yyn = -yyn;
|
1222
|
+
goto yyreduce;
|
1223
|
+
}
|
1224
|
+
|
1225
|
+
/* Count tokens shifted since error; after three, turn off error
|
1226
|
+
status. */
|
1227
|
+
if (yyerrstatus)
|
1228
|
+
yyerrstatus--;
|
1229
|
+
|
1230
|
+
/* Shift the lookahead token. */
|
1231
|
+
YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
|
1232
|
+
|
1233
|
+
/* Discard the shifted token. */
|
1234
|
+
yychar = YYEMPTY;
|
1235
|
+
|
1236
|
+
yystate = yyn;
|
1237
|
+
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
|
1238
|
+
*++yyvsp = yylval;
|
1239
|
+
YY_IGNORE_MAYBE_UNINITIALIZED_END
|
1240
|
+
|
1241
|
+
goto yynewstate;
|
1242
|
+
|
1243
|
+
|
1244
|
+
/*-----------------------------------------------------------.
|
1245
|
+
| yydefault -- do the default action for the current state. |
|
1246
|
+
`-----------------------------------------------------------*/
|
1247
|
+
yydefault:
|
1248
|
+
yyn = yydefact[yystate];
|
1249
|
+
if (yyn == 0)
|
1250
|
+
goto yyerrlab;
|
1251
|
+
goto yyreduce;
|
1252
|
+
|
1253
|
+
|
1254
|
+
/*-----------------------------.
|
1255
|
+
| yyreduce -- Do a reduction. |
|
1256
|
+
`-----------------------------*/
|
1257
|
+
yyreduce:
|
1258
|
+
/* yyn is the number of a rule to reduce with. */
|
1259
|
+
yylen = yyr2[yyn];
|
1260
|
+
|
1261
|
+
/* If YYLEN is nonzero, implement the default value of the action:
|
1262
|
+
'$$ = $1'.
|
1263
|
+
|
1264
|
+
Otherwise, the following line sets YYVAL to garbage.
|
1265
|
+
This behavior is undocumented and Bison
|
1266
|
+
users should not rely upon it. Assigning to YYVAL
|
1267
|
+
unconditionally makes the parser a bit smaller, and it avoids a
|
1268
|
+
GCC warning that YYVAL may be used uninitialized. */
|
1269
|
+
yyval = yyvsp[1-yylen];
|
1270
|
+
|
1271
|
+
|
1272
|
+
YY_REDUCE_PRINT (yyn);
|
1273
|
+
switch (yyn)
|
1274
|
+
{
|
1275
|
+
case 2:
|
1276
|
+
#line 54 "conventions.y" /* yacc.c:1646 */
|
1277
|
+
{
|
1278
|
+
if( asnc_ht_lookup(Ruleset, (yyvsp[0].asnc)) ) {
|
1279
|
+
printf("%s:%d warning: we've already got one asn '%d'\n",
|
1280
|
+
currentfilename(), linenum, (yyvsp[0].asnc)->asn);
|
1281
|
+
print_stack_trace();
|
1282
|
+
}
|
1283
|
+
asnc_ht_insert(Ruleset, (yyvsp[0].asnc));
|
1284
|
+
}
|
1285
|
+
#line 1286 "conventions.c" /* yacc.c:1646 */
|
1286
|
+
break;
|
1287
|
+
|
1288
|
+
case 3:
|
1289
|
+
#line 62 "conventions.y" /* yacc.c:1646 */
|
1290
|
+
{
|
1291
|
+
Ruleset = asnc_ht_new(20,
|
1292
|
+
(asnc_hash_fn)hash_int,
|
1293
|
+
(asnc_iseq_fn)isequal_int, NULL);
|
1294
|
+
}
|
1295
|
+
#line 1296 "conventions.c" /* yacc.c:1646 */
|
1296
|
+
break;
|
1297
|
+
|
1298
|
+
case 4:
|
1299
|
+
#line 68 "conventions.y" /* yacc.c:1646 */
|
1300
|
+
{
|
1301
|
+
(yyval.asnc) = malloc(sizeof(struct asnc));
|
1302
|
+
(yyval.asnc)->asn = (yyvsp[-3].in);
|
1303
|
+
(yyval.asnc)->prefilter_regex = NULL;
|
1304
|
+
(yyval.asnc)->conventions = (yyvsp[-1].cq);
|
1305
|
+
set_file_and_line(&(yyval.asnc)->inst, currentfilename(), linenum);
|
1306
|
+
conv_q_iterate_nonconst( (yyval.asnc)->conventions, set_asn, (void *)(yyval.asnc)->asn );
|
1307
|
+
if(want_debug && conv_q_length( (yyval.asnc)->conventions) > 2) {
|
1308
|
+
fprintf(stderr, "ASN %u has %lu unguarded expressions, an optimization opportunity.\n",
|
1309
|
+
(yyval.asnc)->asn, conv_q_length( (yyval.asnc)->conventions));
|
1310
|
+
}
|
1311
|
+
}
|
1312
|
+
#line 1313 "conventions.c" /* yacc.c:1646 */
|
1313
|
+
break;
|
1314
|
+
|
1315
|
+
case 5:
|
1316
|
+
#line 79 "conventions.y" /* yacc.c:1646 */
|
1317
|
+
{
|
1318
|
+
(yyval.asnc) = malloc(sizeof(struct asnc));
|
1319
|
+
memset((yyval.asnc), 0, sizeof(struct asnc));
|
1320
|
+
(yyval.asnc)->asn = (yyvsp[-4].in);
|
1321
|
+
(yyval.asnc)->prefilter_regex = (yyvsp[-3].cp);
|
1322
|
+
set_file_and_line(&(yyval.asnc)->inst, currentfilename(), linenum);
|
1323
|
+
|
1324
|
+
/* posix egrep interprets intervals (eg. {1,32}) nicely */
|
1325
|
+
#ifdef DEPRECATED_GNU_REGEX
|
1326
|
+
re_syntax_options = RE_SYNTAX_POSIX_EGREP;
|
1327
|
+
{
|
1328
|
+
const char *errstr =
|
1329
|
+
re_compile_pattern((yyvsp[-3].cp), strlen((yyvsp[-3].cp)), &((yyval.asnc)->prefilter_rpbuf));
|
1330
|
+
if (errstr != NULL) {
|
1331
|
+
fprintf(stderr, "error in compiling regular expression '%s': %s\n",
|
1332
|
+
(yyvsp[-3].cp), errstr);
|
1333
|
+
fprintf(stderr, "proceeding without it; error in compiling regular expression '%s': %s\n",
|
1334
|
+
(yyvsp[-3].cp), errstr);
|
1335
|
+
}
|
1336
|
+
}
|
1337
|
+
#else
|
1338
|
+
{
|
1339
|
+
int error = regcomp(&((yyval.asnc)->prefilter_rpbuf), (yyvsp[-3].cp), REG_EXTENDED);
|
1340
|
+
if(error) {
|
1341
|
+
char *err = malloc(256);
|
1342
|
+
err[255]='\0';
|
1343
|
+
regerror(error, &((yyval.asnc)->prefilter_rpbuf), err, 255);
|
1344
|
+
fprintf(stderr, "error in compiling regular expression '%s': %s\n",
|
1345
|
+
(yyvsp[-3].cp), err);
|
1346
|
+
fprintf(stderr, "proceeding without it; error in compiling regular expression '%s': %s\n",
|
1347
|
+
(yyvsp[-3].cp), err);
|
1348
|
+
free(err); /* why not. */
|
1349
|
+
}
|
1350
|
+
}
|
1351
|
+
#endif
|
1352
|
+
|
1353
|
+
(yyval.asnc)->conventions = (yyvsp[-1].cq);
|
1354
|
+
conv_q_iterate_nonconst( (yyval.asnc)->conventions, set_asn, (void *)(yyval.asnc)->asn );
|
1355
|
+
}
|
1356
|
+
#line 1357 "conventions.c" /* yacc.c:1646 */
|
1357
|
+
break;
|
1358
|
+
|
1359
|
+
case 6:
|
1360
|
+
#line 119 "conventions.y" /* yacc.c:1646 */
|
1361
|
+
{ /* this is an ordered list */
|
1362
|
+
(yyval.cq) = (yyvsp[-1].cq);
|
1363
|
+
conv_q_append((yyvsp[-1].cq), (yyvsp[0].conv));
|
1364
|
+
}
|
1365
|
+
#line 1366 "conventions.c" /* yacc.c:1646 */
|
1366
|
+
break;
|
1367
|
+
|
1368
|
+
case 7:
|
1369
|
+
#line 122 "conventions.y" /* yacc.c:1646 */
|
1370
|
+
{
|
1371
|
+
(yyval.cq) = conv_q_new(NULL, NULL);
|
1372
|
+
}
|
1373
|
+
#line 1374 "conventions.c" /* yacc.c:1646 */
|
1374
|
+
break;
|
1375
|
+
|
1376
|
+
case 8:
|
1377
|
+
#line 126 "conventions.y" /* yacc.c:1646 */
|
1378
|
+
{
|
1379
|
+
(yyval.conv) = new_convention((yyvsp[-2].cp), (yyvsp[-1].kvb), NULL, NULL, NULL, currentfilename(), linenum);
|
1380
|
+
}
|
1381
|
+
#line 1382 "conventions.c" /* yacc.c:1646 */
|
1382
|
+
break;
|
1383
|
+
|
1384
|
+
case 9:
|
1385
|
+
#line 128 "conventions.y" /* yacc.c:1646 */
|
1386
|
+
{
|
1387
|
+
(yyval.conv) = new_convention((yyvsp[-3].cp), (yyvsp[-2].kvb), (yyvsp[-1].kvb), NULL, NULL, currentfilename(), linenum);
|
1388
|
+
}
|
1389
|
+
#line 1390 "conventions.c" /* yacc.c:1646 */
|
1390
|
+
break;
|
1391
|
+
|
1392
|
+
case 10:
|
1393
|
+
#line 130 "conventions.y" /* yacc.c:1646 */
|
1394
|
+
{
|
1395
|
+
(yyval.conv) = new_convention((yyvsp[-4].cp), (yyvsp[-3].kvb), (yyvsp[-2].kvb), (yyvsp[-1].kvb), NULL, currentfilename(), linenum);
|
1396
|
+
}
|
1397
|
+
#line 1398 "conventions.c" /* yacc.c:1646 */
|
1398
|
+
break;
|
1399
|
+
|
1400
|
+
case 11:
|
1401
|
+
#line 132 "conventions.y" /* yacc.c:1646 */
|
1402
|
+
{
|
1403
|
+
(yyval.conv) = new_convention((yyvsp[-5].cp), (yyvsp[-4].kvb), (yyvsp[-3].kvb), (yyvsp[-2].kvb), (yyvsp[-1].kvb), currentfilename(), linenum);
|
1404
|
+
}
|
1405
|
+
#line 1406 "conventions.c" /* yacc.c:1646 */
|
1406
|
+
break;
|
1407
|
+
|
1408
|
+
case 12:
|
1409
|
+
#line 134 "conventions.y" /* yacc.c:1646 */
|
1410
|
+
{
|
1411
|
+
(yyval.conv) = new_convention((yyvsp[-1].cp), NULL, NULL, NULL, NULL, currentfilename(), linenum);
|
1412
|
+
}
|
1413
|
+
#line 1414 "conventions.c" /* yacc.c:1646 */
|
1414
|
+
break;
|
1415
|
+
|
1416
|
+
case 13:
|
1417
|
+
#line 136 "conventions.y" /* yacc.c:1646 */
|
1418
|
+
{
|
1419
|
+
printf("%s:%d parse error in rule, expected ';'\n",
|
1420
|
+
currentfilename(), linenum);
|
1421
|
+
print_stack_trace();
|
1422
|
+
(yyval.conv) = new_convention((yyvsp[-3].cp), (yyvsp[-2].kvb), (yyvsp[-1].kvb), NULL, NULL, currentfilename(), linenum);
|
1423
|
+
}
|
1424
|
+
#line 1425 "conventions.c" /* yacc.c:1646 */
|
1425
|
+
break;
|
1426
|
+
|
1427
|
+
case 14:
|
1428
|
+
#line 141 "conventions.y" /* yacc.c:1646 */
|
1429
|
+
{
|
1430
|
+
printf("%s:%d parse error in rule, expected ';'\n",
|
1431
|
+
currentfilename(), linenum);
|
1432
|
+
print_stack_trace();
|
1433
|
+
(yyval.conv) = new_convention((yyvsp[-2].cp), (yyvsp[-1].kvb), NULL, NULL, NULL, currentfilename(), linenum);
|
1434
|
+
}
|
1435
|
+
#line 1436 "conventions.c" /* yacc.c:1646 */
|
1436
|
+
break;
|
1437
|
+
|
1438
|
+
case 15:
|
1439
|
+
#line 146 "conventions.y" /* yacc.c:1646 */
|
1440
|
+
{
|
1441
|
+
printf("%s:%d parse error after regex '%s'\n",
|
1442
|
+
currentfilename(), linenum, (yyvsp[-1].cp));
|
1443
|
+
print_stack_trace();
|
1444
|
+
(yyval.conv) = new_convention((yyvsp[-1].cp), NULL, NULL, NULL, NULL, currentfilename(), linenum);
|
1445
|
+
}
|
1446
|
+
#line 1447 "conventions.c" /* yacc.c:1646 */
|
1447
|
+
break;
|
1448
|
+
|
1449
|
+
case 16:
|
1450
|
+
#line 153 "conventions.y" /* yacc.c:1646 */
|
1451
|
+
{
|
1452
|
+
(yyval.kvb) = new_key_decl((yyvsp[-5].cp), (yyvsp[-3].in), FALSE, (yyvsp[-1].dict));
|
1453
|
+
set_file_and_line(&(yyval.kvb)->inst, currentfilename(), linenum);
|
1454
|
+
}
|
1455
|
+
#line 1456 "conventions.c" /* yacc.c:1646 */
|
1456
|
+
break;
|
1457
|
+
|
1458
|
+
case 17:
|
1459
|
+
#line 156 "conventions.y" /* yacc.c:1646 */
|
1460
|
+
{
|
1461
|
+
(yyval.kvb) = new_key_decl((yyvsp[-6].cp), (yyvsp[-3].in), TRUE, (yyvsp[-1].dict));
|
1462
|
+
if((yyval.kvb) == NULL) {
|
1463
|
+
printf("%s:%d bad type declaration '%s = %d'\n",
|
1464
|
+
currentfilename(), linenum, (yyvsp[-6].cp), (yyvsp[-3].in));
|
1465
|
+
} else {
|
1466
|
+
set_file_and_line(&(yyval.kvb)->inst, currentfilename(), linenum);
|
1467
|
+
}
|
1468
|
+
}
|
1469
|
+
#line 1470 "conventions.c" /* yacc.c:1646 */
|
1470
|
+
break;
|
1471
|
+
|
1472
|
+
case 18:
|
1473
|
+
#line 164 "conventions.y" /* yacc.c:1646 */
|
1474
|
+
{
|
1475
|
+
(yyval.kvb) = new_key_decl_const((yyvsp[-2].cp), (yyvsp[0].cp));
|
1476
|
+
if((yyval.kvb) == NULL) {
|
1477
|
+
printf("%s:%d bad type declaration '%s = %s'\n",
|
1478
|
+
currentfilename(), linenum, (yyvsp[-2].cp), (yyvsp[0].cp));
|
1479
|
+
} else {
|
1480
|
+
set_file_and_line(&(yyval.kvb)->inst, currentfilename(), linenum);
|
1481
|
+
}
|
1482
|
+
}
|
1483
|
+
#line 1484 "conventions.c" /* yacc.c:1646 */
|
1484
|
+
break;
|
1485
|
+
|
1486
|
+
case 19:
|
1487
|
+
#line 172 "conventions.y" /* yacc.c:1646 */
|
1488
|
+
{
|
1489
|
+
printf("%s:%d parse error after '%s = %d {' (expecting binding table)\n",
|
1490
|
+
currentfilename(), linenum, (yyvsp[-4].cp), (yyvsp[-2].in));
|
1491
|
+
print_stack_trace();
|
1492
|
+
}
|
1493
|
+
#line 1494 "conventions.c" /* yacc.c:1646 */
|
1494
|
+
break;
|
1495
|
+
|
1496
|
+
case 20:
|
1497
|
+
#line 176 "conventions.y" /* yacc.c:1646 */
|
1498
|
+
{
|
1499
|
+
printf("%s:%d parse error after '%s = quid' (expecting ';')\n",
|
1500
|
+
currentfilename(), linenum, (yyvsp[-3].cp));
|
1501
|
+
print_stack_trace();
|
1502
|
+
}
|
1503
|
+
#line 1504 "conventions.c" /* yacc.c:1646 */
|
1504
|
+
break;
|
1505
|
+
|
1506
|
+
case 21:
|
1507
|
+
#line 180 "conventions.y" /* yacc.c:1646 */
|
1508
|
+
{
|
1509
|
+
printf("%s:%d parse error after '%s =' (expecting '{' or quid.)\n",
|
1510
|
+
currentfilename(), linenum, (yyvsp[-2].cp));
|
1511
|
+
print_stack_trace();
|
1512
|
+
}
|
1513
|
+
#line 1514 "conventions.c" /* yacc.c:1646 */
|
1514
|
+
break;
|
1515
|
+
|
1516
|
+
case 22:
|
1517
|
+
#line 184 "conventions.y" /* yacc.c:1646 */
|
1518
|
+
{
|
1519
|
+
printf("%s:%d parse error after id '%s'\n",
|
1520
|
+
currentfilename(), linenum, (yyvsp[-1].cp));
|
1521
|
+
print_stack_trace();
|
1522
|
+
}
|
1523
|
+
#line 1524 "conventions.c" /* yacc.c:1646 */
|
1524
|
+
break;
|
1525
|
+
|
1526
|
+
case 25:
|
1527
|
+
#line 192 "conventions.y" /* yacc.c:1646 */
|
1528
|
+
{
|
1529
|
+
struct stringpair *existing;
|
1530
|
+
(yyval.dict) = (yyvsp[-1].dict);
|
1531
|
+
/* make sure it's not already there */
|
1532
|
+
if((existing = key_ht_lookup((yyval.dict), (yyvsp[0].binding))) != NULL) {
|
1533
|
+
if(want_debug) {
|
1534
|
+
if(strcmp(existing->value, (yyvsp[0].binding)->value)) {
|
1535
|
+
printf("%s:%d key %s inconsistently redefined from %s to %s.\n",
|
1536
|
+
currentfilename(), linenum, (yyvsp[0].binding)->key, existing->value, (yyvsp[0].binding)->value);
|
1537
|
+
print_stack_trace();
|
1538
|
+
printf(" this is okay if that's what you want it to do.\n");
|
1539
|
+
} else if(want_conventions_debug) {
|
1540
|
+
/* seems unnecessary to spew this often. */
|
1541
|
+
printf("%s:%d key %s doubly defined to %s.\n",
|
1542
|
+
currentfilename(), linenum, (yyvsp[0].binding)->key, existing->value);
|
1543
|
+
print_stack_trace();
|
1544
|
+
}
|
1545
|
+
}
|
1546
|
+
}
|
1547
|
+
key_ht_insert((yyval.dict), (yyvsp[0].binding));
|
1548
|
+
}
|
1549
|
+
#line 1550 "conventions.c" /* yacc.c:1646 */
|
1550
|
+
break;
|
1551
|
+
|
1552
|
+
case 26:
|
1553
|
+
#line 212 "conventions.y" /* yacc.c:1646 */
|
1554
|
+
{
|
1555
|
+
(yyval.dict) = key_ht_new_k(50, pstring_hash, pstring_isequal, NULL);
|
1556
|
+
}
|
1557
|
+
#line 1558 "conventions.c" /* yacc.c:1646 */
|
1558
|
+
break;
|
1559
|
+
|
1560
|
+
case 27:
|
1561
|
+
#line 216 "conventions.y" /* yacc.c:1646 */
|
1562
|
+
{
|
1563
|
+
(yyval.binding) = (struct stringpair *)malloc(sizeof(struct stringpair));
|
1564
|
+
(yyval.binding)->key = (yyvsp[-1].cp);
|
1565
|
+
(yyval.binding)->value = (yyvsp[0].cp);
|
1566
|
+
set_file_and_line(&(yyval.binding)->inst, currentfilename(), linenum);
|
1567
|
+
/* if(want_debug) printf("making binding %s->%s\n", $1, $2); */
|
1568
|
+
}
|
1569
|
+
#line 1570 "conventions.c" /* yacc.c:1646 */
|
1570
|
+
break;
|
1571
|
+
|
1572
|
+
case 28:
|
1573
|
+
#line 222 "conventions.y" /* yacc.c:1646 */
|
1574
|
+
{
|
1575
|
+
(yyval.binding) = (struct stringpair *)malloc(sizeof(struct stringpair));
|
1576
|
+
(yyval.binding)->key=malloc(15);
|
1577
|
+
snprintf((yyval.binding)->key, 15, "%d", (yyvsp[-1].in));
|
1578
|
+
(yyval.binding)->value = (yyvsp[0].cp);
|
1579
|
+
set_file_and_line(&(yyval.binding)->inst, currentfilename(), linenum);
|
1580
|
+
/* if(want_debug) printf("making binding %s->%s\n", $1, $2); */
|
1581
|
+
}
|
1582
|
+
#line 1583 "conventions.c" /* yacc.c:1646 */
|
1583
|
+
break;
|
1584
|
+
|
1585
|
+
|
1586
|
+
#line 1587 "conventions.c" /* yacc.c:1646 */
|
1587
|
+
default: break;
|
1588
|
+
}
|
1589
|
+
/* User semantic actions sometimes alter yychar, and that requires
|
1590
|
+
that yytoken be updated with the new translation. We take the
|
1591
|
+
approach of translating immediately before every use of yytoken.
|
1592
|
+
One alternative is translating here after every semantic action,
|
1593
|
+
but that translation would be missed if the semantic action invokes
|
1594
|
+
YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
|
1595
|
+
if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
|
1596
|
+
incorrect destructor might then be invoked immediately. In the
|
1597
|
+
case of YYERROR or YYBACKUP, subsequent parser actions might lead
|
1598
|
+
to an incorrect destructor call or verbose syntax error message
|
1599
|
+
before the lookahead is translated. */
|
1600
|
+
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
|
1601
|
+
|
1602
|
+
YYPOPSTACK (yylen);
|
1603
|
+
yylen = 0;
|
1604
|
+
YY_STACK_PRINT (yyss, yyssp);
|
1605
|
+
|
1606
|
+
*++yyvsp = yyval;
|
1607
|
+
|
1608
|
+
/* Now 'shift' the result of the reduction. Determine what state
|
1609
|
+
that goes to, based on the state we popped back to and the rule
|
1610
|
+
number reduced by. */
|
1611
|
+
|
1612
|
+
yyn = yyr1[yyn];
|
1613
|
+
|
1614
|
+
yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
|
1615
|
+
if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
|
1616
|
+
yystate = yytable[yystate];
|
1617
|
+
else
|
1618
|
+
yystate = yydefgoto[yyn - YYNTOKENS];
|
1619
|
+
|
1620
|
+
goto yynewstate;
|
1621
|
+
|
1622
|
+
|
1623
|
+
/*--------------------------------------.
|
1624
|
+
| yyerrlab -- here on detecting error. |
|
1625
|
+
`--------------------------------------*/
|
1626
|
+
yyerrlab:
|
1627
|
+
/* Make sure we have latest lookahead translation. See comments at
|
1628
|
+
user semantic actions for why this is necessary. */
|
1629
|
+
yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
|
1630
|
+
|
1631
|
+
/* If not already recovering from an error, report this error. */
|
1632
|
+
if (!yyerrstatus)
|
1633
|
+
{
|
1634
|
+
++yynerrs;
|
1635
|
+
#if ! YYERROR_VERBOSE
|
1636
|
+
yyerror (YY_("syntax error"));
|
1637
|
+
#else
|
1638
|
+
# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
|
1639
|
+
yyssp, yytoken)
|
1640
|
+
{
|
1641
|
+
char const *yymsgp = YY_("syntax error");
|
1642
|
+
int yysyntax_error_status;
|
1643
|
+
yysyntax_error_status = YYSYNTAX_ERROR;
|
1644
|
+
if (yysyntax_error_status == 0)
|
1645
|
+
yymsgp = yymsg;
|
1646
|
+
else if (yysyntax_error_status == 1)
|
1647
|
+
{
|
1648
|
+
if (yymsg != yymsgbuf)
|
1649
|
+
YYSTACK_FREE (yymsg);
|
1650
|
+
yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
|
1651
|
+
if (!yymsg)
|
1652
|
+
{
|
1653
|
+
yymsg = yymsgbuf;
|
1654
|
+
yymsg_alloc = sizeof yymsgbuf;
|
1655
|
+
yysyntax_error_status = 2;
|
1656
|
+
}
|
1657
|
+
else
|
1658
|
+
{
|
1659
|
+
yysyntax_error_status = YYSYNTAX_ERROR;
|
1660
|
+
yymsgp = yymsg;
|
1661
|
+
}
|
1662
|
+
}
|
1663
|
+
yyerror (yymsgp);
|
1664
|
+
if (yysyntax_error_status == 2)
|
1665
|
+
goto yyexhaustedlab;
|
1666
|
+
}
|
1667
|
+
# undef YYSYNTAX_ERROR
|
1668
|
+
#endif
|
1669
|
+
}
|
1670
|
+
|
1671
|
+
|
1672
|
+
|
1673
|
+
if (yyerrstatus == 3)
|
1674
|
+
{
|
1675
|
+
/* If just tried and failed to reuse lookahead token after an
|
1676
|
+
error, discard it. */
|
1677
|
+
|
1678
|
+
if (yychar <= YYEOF)
|
1679
|
+
{
|
1680
|
+
/* Return failure if at end of input. */
|
1681
|
+
if (yychar == YYEOF)
|
1682
|
+
YYABORT;
|
1683
|
+
}
|
1684
|
+
else
|
1685
|
+
{
|
1686
|
+
yydestruct ("Error: discarding",
|
1687
|
+
yytoken, &yylval);
|
1688
|
+
yychar = YYEMPTY;
|
1689
|
+
}
|
1690
|
+
}
|
1691
|
+
|
1692
|
+
/* Else will try to reuse lookahead token after shifting the error
|
1693
|
+
token. */
|
1694
|
+
goto yyerrlab1;
|
1695
|
+
|
1696
|
+
|
1697
|
+
/*---------------------------------------------------.
|
1698
|
+
| yyerrorlab -- error raised explicitly by YYERROR. |
|
1699
|
+
`---------------------------------------------------*/
|
1700
|
+
yyerrorlab:
|
1701
|
+
|
1702
|
+
/* Pacify compilers like GCC when the user code never invokes
|
1703
|
+
YYERROR and the label yyerrorlab therefore never appears in user
|
1704
|
+
code. */
|
1705
|
+
if (/*CONSTCOND*/ 0)
|
1706
|
+
goto yyerrorlab;
|
1707
|
+
|
1708
|
+
/* Do not reclaim the symbols of the rule whose action triggered
|
1709
|
+
this YYERROR. */
|
1710
|
+
YYPOPSTACK (yylen);
|
1711
|
+
yylen = 0;
|
1712
|
+
YY_STACK_PRINT (yyss, yyssp);
|
1713
|
+
yystate = *yyssp;
|
1714
|
+
goto yyerrlab1;
|
1715
|
+
|
1716
|
+
|
1717
|
+
/*-------------------------------------------------------------.
|
1718
|
+
| yyerrlab1 -- common code for both syntax error and YYERROR. |
|
1719
|
+
`-------------------------------------------------------------*/
|
1720
|
+
yyerrlab1:
|
1721
|
+
yyerrstatus = 3; /* Each real token shifted decrements this. */
|
1722
|
+
|
1723
|
+
for (;;)
|
1724
|
+
{
|
1725
|
+
yyn = yypact[yystate];
|
1726
|
+
if (!yypact_value_is_default (yyn))
|
1727
|
+
{
|
1728
|
+
yyn += YYTERROR;
|
1729
|
+
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
|
1730
|
+
{
|
1731
|
+
yyn = yytable[yyn];
|
1732
|
+
if (0 < yyn)
|
1733
|
+
break;
|
1734
|
+
}
|
1735
|
+
}
|
1736
|
+
|
1737
|
+
/* Pop the current state because it cannot handle the error token. */
|
1738
|
+
if (yyssp == yyss)
|
1739
|
+
YYABORT;
|
1740
|
+
|
1741
|
+
|
1742
|
+
yydestruct ("Error: popping",
|
1743
|
+
yystos[yystate], yyvsp);
|
1744
|
+
YYPOPSTACK (1);
|
1745
|
+
yystate = *yyssp;
|
1746
|
+
YY_STACK_PRINT (yyss, yyssp);
|
1747
|
+
}
|
1748
|
+
|
1749
|
+
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
|
1750
|
+
*++yyvsp = yylval;
|
1751
|
+
YY_IGNORE_MAYBE_UNINITIALIZED_END
|
1752
|
+
|
1753
|
+
|
1754
|
+
/* Shift the error token. */
|
1755
|
+
YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
|
1756
|
+
|
1757
|
+
yystate = yyn;
|
1758
|
+
goto yynewstate;
|
1759
|
+
|
1760
|
+
|
1761
|
+
/*-------------------------------------.
|
1762
|
+
| yyacceptlab -- YYACCEPT comes here. |
|
1763
|
+
`-------------------------------------*/
|
1764
|
+
yyacceptlab:
|
1765
|
+
yyresult = 0;
|
1766
|
+
goto yyreturn;
|
1767
|
+
|
1768
|
+
/*-----------------------------------.
|
1769
|
+
| yyabortlab -- YYABORT comes here. |
|
1770
|
+
`-----------------------------------*/
|
1771
|
+
yyabortlab:
|
1772
|
+
yyresult = 1;
|
1773
|
+
goto yyreturn;
|
1774
|
+
|
1775
|
+
#if !defined yyoverflow || YYERROR_VERBOSE
|
1776
|
+
/*-------------------------------------------------.
|
1777
|
+
| yyexhaustedlab -- memory exhaustion comes here. |
|
1778
|
+
`-------------------------------------------------*/
|
1779
|
+
yyexhaustedlab:
|
1780
|
+
yyerror (YY_("memory exhausted"));
|
1781
|
+
yyresult = 2;
|
1782
|
+
/* Fall through. */
|
1783
|
+
#endif
|
1784
|
+
|
1785
|
+
yyreturn:
|
1786
|
+
if (yychar != YYEMPTY)
|
1787
|
+
{
|
1788
|
+
/* Make sure we have latest lookahead translation. See comments at
|
1789
|
+
user semantic actions for why this is necessary. */
|
1790
|
+
yytoken = YYTRANSLATE (yychar);
|
1791
|
+
yydestruct ("Cleanup: discarding lookahead",
|
1792
|
+
yytoken, &yylval);
|
1793
|
+
}
|
1794
|
+
/* Do not reclaim the symbols of the rule whose action triggered
|
1795
|
+
this YYABORT or YYACCEPT. */
|
1796
|
+
YYPOPSTACK (yylen);
|
1797
|
+
YY_STACK_PRINT (yyss, yyssp);
|
1798
|
+
while (yyssp != yyss)
|
1799
|
+
{
|
1800
|
+
yydestruct ("Cleanup: popping",
|
1801
|
+
yystos[*yyssp], yyvsp);
|
1802
|
+
YYPOPSTACK (1);
|
1803
|
+
}
|
1804
|
+
#ifndef yyoverflow
|
1805
|
+
if (yyss != yyssa)
|
1806
|
+
YYSTACK_FREE (yyss);
|
1807
|
+
#endif
|
1808
|
+
#if YYERROR_VERBOSE
|
1809
|
+
if (yymsg != yymsgbuf)
|
1810
|
+
YYSTACK_FREE (yymsg);
|
1811
|
+
#endif
|
1812
|
+
return yyresult;
|
1813
|
+
}
|