ndtypes 0.2.0dev5 → 0.2.0dev6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.md +12 -0
  3. data/Rakefile +8 -0
  4. data/ext/ruby_ndtypes/GPATH +0 -0
  5. data/ext/ruby_ndtypes/GRTAGS +0 -0
  6. data/ext/ruby_ndtypes/GTAGS +0 -0
  7. data/ext/ruby_ndtypes/extconf.rb +1 -1
  8. data/ext/ruby_ndtypes/include/ndtypes.h +231 -122
  9. data/ext/ruby_ndtypes/include/ruby_ndtypes.h +1 -1
  10. data/ext/ruby_ndtypes/lib/libndtypes.a +0 -0
  11. data/ext/ruby_ndtypes/lib/libndtypes.so.0.2.0dev3 +0 -0
  12. data/ext/ruby_ndtypes/ndtypes/Makefile +87 -0
  13. data/ext/ruby_ndtypes/ndtypes/config.h +68 -0
  14. data/ext/ruby_ndtypes/ndtypes/config.log +477 -0
  15. data/ext/ruby_ndtypes/ndtypes/config.status +1027 -0
  16. data/ext/ruby_ndtypes/ndtypes/doc/_static/style.css +7 -0
  17. data/ext/ruby_ndtypes/ndtypes/doc/_templates/layout.html +2 -0
  18. data/ext/ruby_ndtypes/ndtypes/doc/conf.py +40 -4
  19. data/ext/ruby_ndtypes/ndtypes/doc/images/xndlogo.png +0 -0
  20. data/ext/ruby_ndtypes/ndtypes/doc/ndtypes/types.rst +1 -1
  21. data/ext/ruby_ndtypes/ndtypes/doc/requirements.txt +2 -0
  22. data/ext/ruby_ndtypes/ndtypes/libndtypes/Makefile +287 -0
  23. data/ext/ruby_ndtypes/ndtypes/libndtypes/Makefile.in +20 -4
  24. data/ext/ruby_ndtypes/ndtypes/libndtypes/Makefile.vc +22 -3
  25. data/ext/ruby_ndtypes/ndtypes/libndtypes/alloc.c +1 -1
  26. data/ext/ruby_ndtypes/ndtypes/libndtypes/alloc.o +0 -0
  27. data/ext/ruby_ndtypes/ndtypes/libndtypes/attr.o +0 -0
  28. data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/Makefile +73 -0
  29. data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/bpgrammar.c +246 -229
  30. data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/bpgrammar.h +15 -11
  31. data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/bpgrammar.o +0 -0
  32. data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/bpgrammar.y +38 -28
  33. data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/bplexer.c +91 -91
  34. data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/bplexer.h +1 -1
  35. data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/bplexer.l +4 -3
  36. data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/bplexer.o +0 -0
  37. data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/export.c +8 -7
  38. data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/export.o +0 -0
  39. data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/import.c +2 -2
  40. data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/import.o +0 -0
  41. data/ext/ruby_ndtypes/ndtypes/libndtypes/context.o +0 -0
  42. data/ext/ruby_ndtypes/ndtypes/libndtypes/copy.c +263 -182
  43. data/ext/ruby_ndtypes/ndtypes/libndtypes/copy.o +0 -0
  44. data/ext/ruby_ndtypes/ndtypes/libndtypes/encodings.o +0 -0
  45. data/ext/ruby_ndtypes/ndtypes/libndtypes/equal.c +67 -7
  46. data/ext/ruby_ndtypes/ndtypes/libndtypes/equal.o +0 -0
  47. data/ext/ruby_ndtypes/ndtypes/libndtypes/grammar.c +1112 -1000
  48. data/ext/ruby_ndtypes/ndtypes/libndtypes/grammar.h +69 -58
  49. data/ext/ruby_ndtypes/ndtypes/libndtypes/grammar.o +0 -0
  50. data/ext/ruby_ndtypes/ndtypes/libndtypes/grammar.y +150 -99
  51. data/ext/ruby_ndtypes/ndtypes/libndtypes/io.c +185 -15
  52. data/ext/ruby_ndtypes/ndtypes/libndtypes/io.o +0 -0
  53. data/ext/ruby_ndtypes/ndtypes/libndtypes/lexer.c +301 -276
  54. data/ext/ruby_ndtypes/ndtypes/libndtypes/lexer.h +1 -1
  55. data/ext/ruby_ndtypes/ndtypes/libndtypes/lexer.l +9 -4
  56. data/ext/ruby_ndtypes/ndtypes/libndtypes/lexer.o +0 -0
  57. data/ext/ruby_ndtypes/ndtypes/libndtypes/libndtypes.a +0 -0
  58. data/ext/ruby_ndtypes/ndtypes/libndtypes/libndtypes.so +1 -0
  59. data/ext/ruby_ndtypes/ndtypes/libndtypes/libndtypes.so.0 +1 -0
  60. data/ext/ruby_ndtypes/ndtypes/libndtypes/libndtypes.so.0.2.0dev3 +0 -0
  61. data/ext/ruby_ndtypes/ndtypes/libndtypes/match.c +729 -228
  62. data/ext/ruby_ndtypes/ndtypes/libndtypes/match.o +0 -0
  63. data/ext/ruby_ndtypes/ndtypes/libndtypes/ndtypes.c +768 -403
  64. data/ext/ruby_ndtypes/ndtypes/libndtypes/ndtypes.h +1002 -0
  65. data/ext/ruby_ndtypes/ndtypes/libndtypes/ndtypes.h.in +231 -122
  66. data/ext/ruby_ndtypes/ndtypes/libndtypes/ndtypes.o +0 -0
  67. data/ext/ruby_ndtypes/ndtypes/libndtypes/parsefuncs.c +176 -84
  68. data/ext/ruby_ndtypes/ndtypes/libndtypes/parsefuncs.h +26 -14
  69. data/ext/ruby_ndtypes/ndtypes/libndtypes/parsefuncs.o +0 -0
  70. data/ext/ruby_ndtypes/ndtypes/libndtypes/parser.c +57 -35
  71. data/ext/ruby_ndtypes/ndtypes/libndtypes/parser.o +0 -0
  72. data/ext/ruby_ndtypes/ndtypes/libndtypes/primitive.c +420 -0
  73. data/ext/ruby_ndtypes/ndtypes/libndtypes/primitive.o +0 -0
  74. data/ext/ruby_ndtypes/ndtypes/libndtypes/seq.c +8 -8
  75. data/ext/ruby_ndtypes/ndtypes/libndtypes/seq.h +1 -1
  76. data/ext/ruby_ndtypes/ndtypes/libndtypes/seq.o +0 -0
  77. data/ext/ruby_ndtypes/ndtypes/libndtypes/serialize/Makefile +48 -0
  78. data/ext/ruby_ndtypes/ndtypes/libndtypes/serialize/deserialize.c +200 -116
  79. data/ext/ruby_ndtypes/ndtypes/libndtypes/serialize/deserialize.o +0 -0
  80. data/ext/ruby_ndtypes/ndtypes/libndtypes/serialize/serialize.c +46 -4
  81. data/ext/ruby_ndtypes/ndtypes/libndtypes/serialize/serialize.o +0 -0
  82. data/ext/ruby_ndtypes/ndtypes/libndtypes/substitute.c +58 -27
  83. data/ext/ruby_ndtypes/ndtypes/libndtypes/substitute.h +1 -1
  84. data/ext/ruby_ndtypes/ndtypes/libndtypes/substitute.o +0 -0
  85. data/ext/ruby_ndtypes/ndtypes/libndtypes/symtable.c +3 -5
  86. data/ext/ruby_ndtypes/ndtypes/libndtypes/symtable.h +12 -4
  87. data/ext/ruby_ndtypes/ndtypes/libndtypes/symtable.o +0 -0
  88. data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/Makefile +55 -0
  89. data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/Makefile.in +8 -8
  90. data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/Makefile.vc +5 -5
  91. data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/runtest.c +274 -172
  92. data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test.h +24 -4
  93. data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_array.c +2 -2
  94. data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_buffer.c +14 -14
  95. data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_match.c +32 -30
  96. data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_parse.c +37 -0
  97. data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_parse_error.c +36 -0
  98. data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_parse_roundtrip.c +16 -0
  99. data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_record.c +5 -5
  100. data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_typecheck.c +706 -253
  101. data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_unify.c +132 -0
  102. data/ext/ruby_ndtypes/ndtypes/libndtypes/unify.c +703 -0
  103. data/ext/ruby_ndtypes/ndtypes/libndtypes/unify.o +0 -0
  104. data/ext/ruby_ndtypes/ndtypes/libndtypes/util.c +335 -127
  105. data/ext/ruby_ndtypes/ndtypes/libndtypes/util.o +0 -0
  106. data/ext/ruby_ndtypes/ndtypes/libndtypes/values.c +2 -2
  107. data/ext/ruby_ndtypes/ndtypes/libndtypes/values.o +0 -0
  108. data/ext/ruby_ndtypes/ndtypes/python/ndt_randtype.py +88 -71
  109. data/ext/ruby_ndtypes/ndtypes/python/ndt_support.py +0 -1
  110. data/ext/ruby_ndtypes/ndtypes/python/ndtypes/__init__.py +10 -13
  111. data/ext/ruby_ndtypes/ndtypes/python/ndtypes/_ndtypes.c +395 -314
  112. data/ext/ruby_ndtypes/ndtypes/python/ndtypes/libndtypes.a +0 -0
  113. data/ext/ruby_ndtypes/ndtypes/python/ndtypes/libndtypes.so +1 -0
  114. data/ext/ruby_ndtypes/ndtypes/python/ndtypes/libndtypes.so.0 +1 -0
  115. data/ext/ruby_ndtypes/ndtypes/python/ndtypes/libndtypes.so.0.2.0dev3 +0 -0
  116. data/ext/ruby_ndtypes/ndtypes/python/ndtypes/ndtypes.h +1002 -0
  117. data/ext/ruby_ndtypes/ndtypes/python/ndtypes/pyndtypes.h +15 -33
  118. data/ext/ruby_ndtypes/ndtypes/python/test_ndtypes.py +340 -132
  119. data/ext/ruby_ndtypes/ndtypes/setup.py +11 -2
  120. data/ext/ruby_ndtypes/ruby_ndtypes.c +364 -241
  121. data/ext/ruby_ndtypes/ruby_ndtypes.h +1 -1
  122. data/ext/ruby_ndtypes/ruby_ndtypes_internal.h +0 -1
  123. data/lib/ndtypes.rb +11 -0
  124. data/lib/ndtypes/version.rb +2 -2
  125. data/lib/ruby_ndtypes.so +0 -0
  126. data/ndtypes.gemspec +3 -0
  127. data/spec/ndtypes_spec.rb +6 -0
  128. metadata +98 -4
  129. data/ext/ruby_ndtypes/gc_guard.c +0 -36
  130. data/ext/ruby_ndtypes/gc_guard.h +0 -12
@@ -193,7 +193,7 @@ ndt_aligned_calloc(uint16_t alignment, int64_t size)
193
193
  uintptr = (uintptr_t)ptr;
194
194
  aligned = uintptr + extra;
195
195
  if (aligned < uintptr) {
196
- free(ptr);
196
+ ndt_free(ptr);
197
197
  return NULL;
198
198
  }
199
199
 
@@ -0,0 +1,73 @@
1
+
2
+ CC = gcc
3
+ LD = gcc
4
+
5
+ CONFIGURE_CFLAGS = -I.. -Wall -Wextra -std=c11 -pedantic -O2 -g
6
+ NDT_CFLAGS = $(strip $(CONFIGURE_CFLAGS) $(CFLAGS))
7
+ NDT_CFLAGS_SHARED = $(NDT_CFLAGS) -fPIC
8
+
9
+ CONFIGURE_COV_CFLAGS = -I.. -Wall -Wextra -std=c11 -pedantic -O0 -g -fno-inline -fprofile-arcs -ftest-coverage
10
+ ifeq ($(MAKECMDGOALS), coverage)
11
+ NDT_CFLAGS = $(strip $(CONFIGURE_COV_CFLAGS) $(CFLAGS))
12
+ endif
13
+
14
+
15
+ OBJS = bpgrammar.o bplexer.o import.o export.o
16
+ SHARED_OBJS = .objs/bpgrammar.o .objs/bplexer.o .objs/import.o .objs/export.o
17
+
18
+
19
+ default: $(OBJS) $(SHARED_OBJS)
20
+
21
+
22
+ bpgrammar.o:\
23
+ Makefile bpgrammar.c bpgrammar.h bplexer.h ../ndtypes.h ../seq.h
24
+ $(CC) $(NDT_CFLAGS) -c bpgrammar.c
25
+
26
+ .objs/bpgrammar.o:\
27
+ Makefile bpgrammar.c bpgrammar.h bplexer.h ../ndtypes.h ../seq.h
28
+ $(CC) $(NDT_CFLAGS_SHARED) -c bpgrammar.c -o .objs/bpgrammar.o
29
+
30
+ bplexer.o:\
31
+ Makefile bplexer.c bpgrammar.h bplexer.h
32
+ $(CC) $(NDT_CFLAGS) -c bplexer.c
33
+
34
+ .objs/bplexer.o:\
35
+ Makefile bplexer.c bpgrammar.h bplexer.h
36
+ $(CC) $(NDT_CFLAGS_SHARED) -c bplexer.c -o .objs/bplexer.o
37
+
38
+ import.o:\
39
+ Makefile import.c bpgrammar.h bplexer.h ../ndtypes.h ../seq.h
40
+ $(CC) $(NDT_CFLAGS) -c import.c
41
+
42
+ .objs/import.o:\
43
+ Makefile import.c bpgrammar.h bplexer.h ../ndtypes.h ../seq.h
44
+ $(CC) $(NDT_CFLAGS_SHARED) -c import.c -o .objs/import.o
45
+
46
+ export.o:\
47
+ Makefile export.c bpgrammar.h bplexer.h ../ndtypes.h ../seq.h
48
+ $(CC) $(NDT_CFLAGS) -c export.c
49
+
50
+ .objs/export.o:\
51
+ Makefile export.c bpgrammar.h bplexer.h ../ndtypes.h ../seq.h
52
+ $(CC) $(NDT_CFLAGS_SHARED) -c export.c -o .objs/export.o
53
+
54
+
55
+ # Without these, GNU make automatically builds the parser.
56
+ %.c: %.y
57
+ %.c: %.l
58
+
59
+ parser: FORCE
60
+ bison -Wall -o bpgrammar.c -pndt_bp --defines=bpgrammar.h bpgrammar.y
61
+ flex -o bplexer.c -Pndt_bp --header-file=bplexer.h bplexer.l
62
+
63
+
64
+ FORCE:
65
+
66
+ clean: FORCE
67
+ rm -f *.o *.so *.gch *.gcda *.gcno *.gcov *.dyn *.dpi *.lock
68
+ cd .objs && rm -f *.o *.so *.gch *.gcda *.gcno *.gcov *.dyn *.dpi *.lock
69
+
70
+ distclean: clean
71
+ rm -f Makefile
72
+
73
+
@@ -1,8 +1,9 @@
1
- /* A Bison parser, made by GNU Bison 3.0.4. */
1
+ /* A Bison parser, made by GNU Bison 3.3. */
2
2
 
3
3
  /* Bison implementation for Yacc-like parsers in C
4
4
 
5
- Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
5
+ Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation,
6
+ Inc.
6
7
 
7
8
  This program is free software: you can redistribute it and/or modify
8
9
  it under the terms of the GNU General Public License as published by
@@ -40,11 +41,14 @@
40
41
  define necessary library symbols; they are noted "INFRINGES ON
41
42
  USER NAME SPACE" below. */
42
43
 
44
+ /* Undocumented macros, especially those whose name start with YY_,
45
+ are private implementation details. Do not rely on them. */
46
+
43
47
  /* Identify Bison output. */
44
48
  #define YYBISON 1
45
49
 
46
50
  /* Bison version. */
47
- #define YYBISON_VERSION "3.0.4"
51
+ #define YYBISON_VERSION "3.3"
48
52
 
49
53
  /* Skeleton name. */
50
54
  #define YYSKELETON_NAME "yacc.c"
@@ -67,8 +71,8 @@
67
71
  #define yynerrs ndt_bpnerrs
68
72
 
69
73
 
70
- /* Copy the first part of user declarations. */
71
- #line 1 "bpgrammar.y" /* yacc.c:339 */
74
+ /* First part of user prologue. */
75
+ #line 1 "bpgrammar.y" /* yacc.c:337 */
72
76
 
73
77
  /*
74
78
  * BSD 3-Clause License
@@ -108,7 +112,7 @@
108
112
 
109
113
 
110
114
  void
111
- yyerror(YYLTYPE *loc, yyscan_t scanner, ndt_t **ast, ndt_context_t *ctx,
115
+ yyerror(YYLTYPE *loc, yyscan_t scanner, const ndt_t **ast, ndt_context_t *ctx,
112
116
  const char *msg)
113
117
  {
114
118
  (void)scanner;
@@ -138,13 +142,13 @@ add_uint16(uint16_t a, uint16_t b, ndt_context_t *ctx)
138
142
  return c;
139
143
  }
140
144
 
141
- static ndt_t *
145
+ static const ndt_t *
142
146
  primitive_native(char dtype, ndt_context_t *ctx)
143
147
  {
144
148
  switch (dtype) {
145
149
  case '?': return ndt_primitive(Bool, 0, ctx);
146
150
 
147
- case 'c': return ndt_char(Ascii, ctx);
151
+ case 'c': return ndt_char(Ascii, false, ctx);
148
152
  case 'b': return ndt_primitive(Int8, 0, ctx);
149
153
  case 'B': return ndt_primitive(Uint8, 0, ctx);
150
154
 
@@ -175,13 +179,13 @@ primitive_native(char dtype, ndt_context_t *ctx)
175
179
  }
176
180
  }
177
181
 
178
- static ndt_t *
182
+ static const ndt_t *
179
183
  primitive_fixed(char dtype, uint32_t flags, ndt_context_t *ctx)
180
184
  {
181
185
  switch (dtype) {
182
186
  case '?': return ndt_primitive(Bool, flags, ctx);
183
187
 
184
- case 'c': return ndt_char(Ascii, ctx);
188
+ case 'c': return ndt_char(Ascii, false, ctx);
185
189
  case 'b': return ndt_primitive(Int8, flags, ctx);
186
190
  case 'B': return ndt_primitive(Uint8, flags, ctx);
187
191
 
@@ -210,7 +214,7 @@ primitive_fixed(char dtype, uint32_t flags, ndt_context_t *ctx)
210
214
  }
211
215
  }
212
216
 
213
- static ndt_t *
217
+ static const ndt_t *
214
218
  make_dtype(char modifier, char dtype, ndt_context_t *ctx)
215
219
  {
216
220
  switch (modifier) {
@@ -231,7 +235,7 @@ make_dtype(char modifier, char dtype, ndt_context_t *ctx)
231
235
  }
232
236
  }
233
237
 
234
- static ndt_t *
238
+ static const ndt_t *
235
239
  make_fixed_bytes(char *v, ndt_context_t *ctx)
236
240
  {
237
241
  uint16_opt_t align = {None, 0};
@@ -251,13 +255,13 @@ make_fixed_bytes(char *v, ndt_context_t *ctx)
251
255
  return NULL;
252
256
  }
253
257
 
254
- return ndt_fixed_bytes(datasize, align, ctx);
258
+ return ndt_fixed_bytes(datasize, align, false, ctx);
255
259
  }
256
260
 
257
- static ndt_t *
258
- make_dimensions(ndt_string_seq_t *seq, ndt_t *type, ndt_context_t *ctx)
261
+ static const ndt_t *
262
+ make_dimensions(ndt_string_seq_t *seq, const ndt_t *type, ndt_context_t *ctx)
259
263
  {
260
- ndt_t *t;
264
+ const ndt_t *t;
261
265
  int64_t shape;
262
266
  int64_t i;
263
267
 
@@ -265,18 +269,21 @@ make_dimensions(ndt_string_seq_t *seq, ndt_t *type, ndt_context_t *ctx)
265
269
  ndt_err_format(ctx, NDT_ValueError,
266
270
  "number of dimensions must be between 1 and %d", NDT_MAX_DIM);
267
271
  ndt_string_seq_del(seq);
268
- ndt_del(type);
272
+ ndt_decref(type);
269
273
  return NULL;
270
274
  }
271
275
 
276
+
272
277
  for (i=seq->len-1, t=type; i>=0; i--, type=t) {
273
278
  shape = ndt_strtoll(seq->ptr[i], 0, INT_MAX, ctx);
274
279
  if (ndt_err_occurred(ctx)) {
275
280
  ndt_string_seq_del(seq);
281
+ ndt_decref(type);
276
282
  return NULL;
277
283
  }
278
284
 
279
285
  t = ndt_fixed_dim(type, shape, INT64_MAX, ctx);
286
+ ndt_decref(type);
280
287
  if (t == NULL) {
281
288
  ndt_string_seq_del(seq);
282
289
  return NULL;
@@ -289,27 +296,32 @@ make_dimensions(ndt_string_seq_t *seq, ndt_t *type, ndt_context_t *ctx)
289
296
  }
290
297
 
291
298
  static ndt_field_t *
292
- make_field(char *name, ndt_t *type, uint16_t padding, ndt_context_t *ctx)
299
+ make_field(char *name, const ndt_t *type, uint16_t padding, ndt_context_t *ctx)
293
300
  {
294
301
  uint16_opt_t align = {None, 0};
295
302
  uint16_opt_t pack = {None, 0};
296
303
  uint16_opt_t pad = {Some, 0};
304
+ ndt_field_t *f;
297
305
 
298
306
  pad.Some = padding;
299
- return ndt_field(name, type, align, pack, pad, ctx);
307
+ f = ndt_field(name, type, align, pack, pad, ctx);
308
+ ndt_decref(type);
309
+ return f;
300
310
  }
301
311
 
302
- static ndt_t *
312
+ static const ndt_t *
303
313
  make_record(ndt_field_seq_t *fields, ndt_context_t *ctx)
304
314
  {
305
315
  uint16_opt_t align = {None, 0};
306
316
  uint16_opt_t pack = {None, 0};
307
- ndt_t *t;
317
+ const ndt_t *t;
308
318
  int64_t i;
309
319
 
310
320
  fields = ndt_field_seq_finalize(fields);
311
321
  if (fields == NULL) {
312
- return ndt_record(Nonvariadic, NULL, 0, align, pack, ctx);
322
+ t = ndt_record(Nonvariadic, NULL, 0, align, pack, false, ctx);
323
+ ndt_field_seq_del(fields);
324
+ return t;
313
325
  }
314
326
 
315
327
  assert(fields->len >= 1);
@@ -326,18 +338,19 @@ make_record(ndt_field_seq_t *fields, ndt_context_t *ctx)
326
338
  fields->ptr[i].Concrete.explicit_align = true;
327
339
  }
328
340
 
329
- t = ndt_record(Nonvariadic, fields->ptr, fields->len, align, pack, ctx);
330
- ndt_free(fields);
341
+ t = ndt_record(Nonvariadic, fields->ptr, fields->len, align, pack, false, ctx);
342
+ ndt_field_seq_del(fields);
331
343
 
332
344
  return t;
333
345
  }
334
346
 
335
347
  static ndt_type_seq_t *
336
- broadcast_seq_new(ndt_t *type, ndt_context_t *ctx)
348
+ broadcast_seq_new(const ndt_t *type, ndt_context_t *ctx)
337
349
  {
338
350
  ndt_t *t;
339
351
 
340
- t = ndt_ellipsis_dim(NULL, type, ctx);
352
+ t = (ndt_t *)ndt_ellipsis_dim(NULL, type, ctx);
353
+ ndt_decref(type);
341
354
  if (t == NULL) {
342
355
  return NULL;
343
356
  }
@@ -346,11 +359,12 @@ broadcast_seq_new(ndt_t *type, ndt_context_t *ctx)
346
359
  }
347
360
 
348
361
  static ndt_type_seq_t *
349
- broadcast_seq_append(ndt_type_seq_t *seq, ndt_t *type, ndt_context_t *ctx)
362
+ broadcast_seq_append(ndt_type_seq_t *seq, const ndt_t *type, ndt_context_t *ctx)
350
363
  {
351
364
  ndt_t *t;
352
365
 
353
- t = ndt_ellipsis_dim(NULL, type, ctx);
366
+ t = (ndt_t *)ndt_ellipsis_dim(NULL, type, ctx);
367
+ ndt_decref(type);
354
368
  if (t == NULL) {
355
369
  ndt_type_seq_del(seq);
356
370
  return NULL;
@@ -359,13 +373,16 @@ broadcast_seq_append(ndt_type_seq_t *seq, ndt_t *type, ndt_context_t *ctx)
359
373
  return ndt_type_seq_append(seq, t, ctx);
360
374
  }
361
375
 
362
- #line 363 "bpgrammar.c" /* yacc.c:339 */
363
-
376
+ #line 377 "bpgrammar.c" /* yacc.c:337 */
364
377
  # ifndef YY_NULLPTR
365
- # if defined __cplusplus && 201103L <= __cplusplus
366
- # define YY_NULLPTR nullptr
378
+ # if defined __cplusplus
379
+ # if 201103L <= __cplusplus
380
+ # define YY_NULLPTR nullptr
381
+ # else
382
+ # define YY_NULLPTR 0
383
+ # endif
367
384
  # else
368
- # define YY_NULLPTR 0
385
+ # define YY_NULLPTR ((void*)0)
369
386
  # endif
370
387
  # endif
371
388
 
@@ -389,7 +406,7 @@ broadcast_seq_append(ndt_type_seq_t *seq, ndt_t *type, ndt_context_t *ctx)
389
406
  extern int ndt_bpdebug;
390
407
  #endif
391
408
  /* "%code requires" blocks. */
392
- #line 292 "bpgrammar.y" /* yacc.c:355 */
409
+ #line 302 "bpgrammar.y" /* yacc.c:352 */
393
410
 
394
411
  #include <ctype.h>
395
412
  #include <assert.h>
@@ -400,7 +417,7 @@ extern int ndt_bpdebug;
400
417
  #define YY_TYPEDEF_YY_SCANNER_T
401
418
  typedef void * yyscan_t;
402
419
 
403
- #line 404 "bpgrammar.c" /* yacc.c:355 */
420
+ #line 421 "bpgrammar.c" /* yacc.c:352 */
404
421
 
405
422
  /* Token type. */
406
423
  #ifndef YYTOKENTYPE
@@ -435,9 +452,9 @@ extern int ndt_bpdebug;
435
452
 
436
453
  union YYSTYPE
437
454
  {
438
- #line 325 "bpgrammar.y" /* yacc.c:355 */
455
+ #line 335 "bpgrammar.y" /* yacc.c:352 */
439
456
 
440
- ndt_t *ndt;
457
+ const ndt_t *ndt;
441
458
  ndt_field_t *field;
442
459
  ndt_field_seq_t *field_seq;
443
460
  ndt_string_seq_t *string_seq;
@@ -446,7 +463,7 @@ union YYSTYPE
446
463
  unsigned char uchar;
447
464
  uint16_t uint16;
448
465
 
449
- #line 450 "bpgrammar.c" /* yacc.c:355 */
466
+ #line 467 "bpgrammar.c" /* yacc.c:352 */
450
467
  };
451
468
 
452
469
  typedef union YYSTYPE YYSTYPE;
@@ -470,21 +487,19 @@ struct YYLTYPE
470
487
 
471
488
 
472
489
 
473
- int ndt_bpparse (yyscan_t scanner, ndt_t **ast, ndt_context_t *ctx);
490
+ int ndt_bpparse (yyscan_t scanner, const ndt_t **ast, ndt_context_t *ctx);
474
491
  /* "%code provides" blocks. */
475
- #line 303 "bpgrammar.y" /* yacc.c:355 */
492
+ #line 313 "bpgrammar.y" /* yacc.c:352 */
476
493
 
477
494
  #define YY_DECL extern int ndt_bplexfunc(YYSTYPE *yylval_param, YYLTYPE *yylloc_param, yyscan_t yyscanner, ndt_context_t *ctx)
478
495
  extern int ndt_bplexfunc(YYSTYPE *, YYLTYPE *, yyscan_t, ndt_context_t *);
479
- void yyerror(YYLTYPE *loc, yyscan_t scanner, ndt_t **ast, ndt_context_t *ctx, const char *msg);
496
+ void yyerror(YYLTYPE *loc, yyscan_t scanner, const ndt_t **ast, ndt_context_t *ctx, const char *msg);
480
497
 
481
- #line 482 "bpgrammar.c" /* yacc.c:355 */
498
+ #line 499 "bpgrammar.c" /* yacc.c:352 */
482
499
 
483
500
  #endif /* !YY_NDT_BP_BPGRAMMAR_H_INCLUDED */
484
501
 
485
- /* Copy the second part of user declarations. */
486
502
 
487
- #line 488 "bpgrammar.c" /* yacc.c:358 */
488
503
 
489
504
  #ifdef short
490
505
  # undef short
@@ -505,13 +520,13 @@ typedef signed char yytype_int8;
505
520
  #ifdef YYTYPE_UINT16
506
521
  typedef YYTYPE_UINT16 yytype_uint16;
507
522
  #else
508
- typedef unsigned short int yytype_uint16;
523
+ typedef unsigned short yytype_uint16;
509
524
  #endif
510
525
 
511
526
  #ifdef YYTYPE_INT16
512
527
  typedef YYTYPE_INT16 yytype_int16;
513
528
  #else
514
- typedef short int yytype_int16;
529
+ typedef short yytype_int16;
515
530
  #endif
516
531
 
517
532
  #ifndef YYSIZE_T
@@ -523,7 +538,7 @@ typedef short int yytype_int16;
523
538
  # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
524
539
  # define YYSIZE_T size_t
525
540
  # else
526
- # define YYSIZE_T unsigned int
541
+ # define YYSIZE_T unsigned
527
542
  # endif
528
543
  #endif
529
544
 
@@ -559,15 +574,6 @@ typedef short int yytype_int16;
559
574
  # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
560
575
  #endif
561
576
 
562
- #if !defined _Noreturn \
563
- && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
564
- # if defined _MSC_VER && 1200 <= _MSC_VER
565
- # define _Noreturn __declspec (noreturn)
566
- # else
567
- # define _Noreturn YY_ATTRIBUTE ((__noreturn__))
568
- # endif
569
- #endif
570
-
571
577
  /* Suppress unused-variable warnings by "using" E. */
572
578
  #if ! defined lint || defined __GNUC__
573
579
  # define YYUSE(E) ((void) (E))
@@ -575,7 +581,7 @@ typedef short int yytype_int16;
575
581
  # define YYUSE(E) /* empty */
576
582
  #endif
577
583
 
578
- #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
584
+ #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
579
585
  /* Suppress an incorrect diagnostic about yylval being uninitialized. */
580
586
  # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
581
587
  _Pragma ("GCC diagnostic push") \
@@ -739,16 +745,16 @@ union yyalloc
739
745
  /* YYNSTATES -- Number of states. */
740
746
  #define YYNSTATES 42
741
747
 
742
- /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
743
- by yylex, with out-of-bounds checking. */
744
748
  #define YYUNDEFTOK 2
745
749
  #define YYMAXUTOK 276
746
750
 
751
+ /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
752
+ as returned by yylex, with out-of-bounds checking. */
747
753
  #define YYTRANSLATE(YYX) \
748
- ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
754
+ ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
749
755
 
750
756
  /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
751
- as returned by yylex, without out-of-bounds checking. */
757
+ as returned by yylex. */
752
758
  static const yytype_uint8 yytranslate[] =
753
759
  {
754
760
  0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -785,9 +791,9 @@ static const yytype_uint8 yytranslate[] =
785
791
  /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
786
792
  static const yytype_uint16 yyrline[] =
787
793
  {
788
- 0, 379, 379, 382, 383, 384, 387, 388, 391, 392,
789
- 393, 396, 399, 400, 403, 406, 409, 410, 413, 414,
790
- 415, 416, 417, 418, 421, 422, 425, 426
794
+ 0, 389, 389, 392, 393, 394, 397, 398, 401, 402,
795
+ 403, 406, 409, 410, 413, 416, 419, 420, 423, 424,
796
+ 425, 426, 427, 428, 431, 432, 435, 436
791
797
  };
792
798
  #endif
793
799
 
@@ -932,22 +938,22 @@ static const yytype_uint8 yyr2[] =
932
938
 
933
939
  #define YYRECOVERING() (!!yyerrstatus)
934
940
 
935
- #define YYBACKUP(Token, Value) \
936
- do \
937
- if (yychar == YYEMPTY) \
938
- { \
939
- yychar = (Token); \
940
- yylval = (Value); \
941
- YYPOPSTACK (yylen); \
942
- yystate = *yyssp; \
943
- goto yybackup; \
944
- } \
945
- else \
946
- { \
947
- yyerror (&yylloc, scanner, ast, ctx, YY_("syntax error: cannot back up")); \
948
- YYERROR; \
949
- } \
950
- while (0)
941
+ #define YYBACKUP(Token, Value) \
942
+ do \
943
+ if (yychar == YYEMPTY) \
944
+ { \
945
+ yychar = (Token); \
946
+ yylval = (Value); \
947
+ YYPOPSTACK (yylen); \
948
+ yystate = *yyssp; \
949
+ goto yybackup; \
950
+ } \
951
+ else \
952
+ { \
953
+ yyerror (&yylloc, scanner, ast, ctx, YY_("syntax error: cannot back up")); \
954
+ YYERROR; \
955
+ } \
956
+ while (0)
951
957
 
952
958
  /* Error token number */
953
959
  #define YYTERROR 1
@@ -1006,10 +1012,10 @@ do { \
1006
1012
  /* Print *YYLOCP on YYO. Private, do not rely on its existence. */
1007
1013
 
1008
1014
  YY_ATTRIBUTE_UNUSED
1009
- static unsigned
1015
+ static int
1010
1016
  yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
1011
1017
  {
1012
- unsigned res = 0;
1018
+ int res = 0;
1013
1019
  int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
1014
1020
  if (0 <= yylocp->first_line)
1015
1021
  {
@@ -1052,15 +1058,15 @@ do { \
1052
1058
  } while (0)
1053
1059
 
1054
1060
 
1055
- /*----------------------------------------.
1056
- | Print this symbol's value on YYOUTPUT. |
1057
- `----------------------------------------*/
1061
+ /*-----------------------------------.
1062
+ | Print this symbol's value on YYO. |
1063
+ `-----------------------------------*/
1058
1064
 
1059
1065
  static void
1060
- yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, yyscan_t scanner, ndt_t **ast, ndt_context_t *ctx)
1066
+ yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, yyscan_t scanner, const ndt_t **ast, ndt_context_t *ctx)
1061
1067
  {
1062
- FILE *yyo = yyoutput;
1063
- YYUSE (yyo);
1068
+ FILE *yyoutput = yyo;
1069
+ YYUSE (yyoutput);
1064
1070
  YYUSE (yylocationp);
1065
1071
  YYUSE (scanner);
1066
1072
  YYUSE (ast);
@@ -1069,26 +1075,26 @@ yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvalue
1069
1075
  return;
1070
1076
  # ifdef YYPRINT
1071
1077
  if (yytype < YYNTOKENS)
1072
- YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1078
+ YYPRINT (yyo, yytoknum[yytype], *yyvaluep);
1073
1079
  # endif
1074
1080
  YYUSE (yytype);
1075
1081
  }
1076
1082
 
1077
1083
 
1078
- /*--------------------------------.
1079
- | Print this symbol on YYOUTPUT. |
1080
- `--------------------------------*/
1084
+ /*---------------------------.
1085
+ | Print this symbol on YYO. |
1086
+ `---------------------------*/
1081
1087
 
1082
1088
  static void
1083
- yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, yyscan_t scanner, ndt_t **ast, ndt_context_t *ctx)
1089
+ yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, yyscan_t scanner, const ndt_t **ast, ndt_context_t *ctx)
1084
1090
  {
1085
- YYFPRINTF (yyoutput, "%s %s (",
1091
+ YYFPRINTF (yyo, "%s %s (",
1086
1092
  yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
1087
1093
 
1088
- YY_LOCATION_PRINT (yyoutput, *yylocationp);
1089
- YYFPRINTF (yyoutput, ": ");
1090
- yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, scanner, ast, ctx);
1091
- YYFPRINTF (yyoutput, ")");
1094
+ YY_LOCATION_PRINT (yyo, *yylocationp);
1095
+ YYFPRINTF (yyo, ": ");
1096
+ yy_symbol_value_print (yyo, yytype, yyvaluep, yylocationp, scanner, ast, ctx);
1097
+ YYFPRINTF (yyo, ")");
1092
1098
  }
1093
1099
 
1094
1100
  /*------------------------------------------------------------------.
@@ -1120,9 +1126,9 @@ do { \
1120
1126
  `------------------------------------------------*/
1121
1127
 
1122
1128
  static void
1123
- yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, yyscan_t scanner, ndt_t **ast, ndt_context_t *ctx)
1129
+ yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, yyscan_t scanner, const ndt_t **ast, ndt_context_t *ctx)
1124
1130
  {
1125
- unsigned long int yylno = yyrline[yyrule];
1131
+ unsigned long yylno = yyrline[yyrule];
1126
1132
  int yynrhs = yyr2[yyrule];
1127
1133
  int yyi;
1128
1134
  YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
@@ -1133,7 +1139,7 @@ yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule
1133
1139
  YYFPRINTF (stderr, " $%d = ", yyi + 1);
1134
1140
  yy_symbol_print (stderr,
1135
1141
  yystos[yyssp[yyi + 1 - yynrhs]],
1136
- &(yyvsp[(yyi + 1) - (yynrhs)])
1142
+ &yyvsp[(yyi + 1) - (yynrhs)]
1137
1143
  , &(yylsp[(yyi + 1) - (yynrhs)]) , scanner, ast, ctx);
1138
1144
  YYFPRINTF (stderr, "\n");
1139
1145
  }
@@ -1237,7 +1243,10 @@ yytnamerr (char *yyres, const char *yystr)
1237
1243
  case '\\':
1238
1244
  if (*++yyp != '\\')
1239
1245
  goto do_not_strip_quotes;
1240
- /* Fall through. */
1246
+ else
1247
+ goto append;
1248
+
1249
+ append:
1241
1250
  default:
1242
1251
  if (yyres)
1243
1252
  yyres[yyn] = *yyp;
@@ -1255,7 +1264,7 @@ yytnamerr (char *yyres, const char *yystr)
1255
1264
  if (! yyres)
1256
1265
  return yystrlen (yystr);
1257
1266
 
1258
- return yystpcpy (yyres, yystr) - yyres;
1267
+ return (YYSIZE_T) (yystpcpy (yyres, yystr) - yyres);
1259
1268
  }
1260
1269
  # endif
1261
1270
 
@@ -1333,10 +1342,10 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1333
1342
  yyarg[yycount++] = yytname[yyx];
1334
1343
  {
1335
1344
  YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
1336
- if (! (yysize <= yysize1
1337
- && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1345
+ if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
1346
+ yysize = yysize1;
1347
+ else
1338
1348
  return 2;
1339
- yysize = yysize1;
1340
1349
  }
1341
1350
  }
1342
1351
  }
@@ -1348,6 +1357,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1348
1357
  case N: \
1349
1358
  yyformat = S; \
1350
1359
  break
1360
+ default: /* Avoid compiler warnings. */
1351
1361
  YYCASE_(0, YY_("syntax error"));
1352
1362
  YYCASE_(1, YY_("syntax error, unexpected %s"));
1353
1363
  YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
@@ -1359,9 +1369,10 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1359
1369
 
1360
1370
  {
1361
1371
  YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
1362
- if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1372
+ if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
1373
+ yysize = yysize1;
1374
+ else
1363
1375
  return 2;
1364
- yysize = yysize1;
1365
1376
  }
1366
1377
 
1367
1378
  if (*yymsg_alloc < yysize)
@@ -1400,7 +1411,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1400
1411
  `-----------------------------------------------*/
1401
1412
 
1402
1413
  static void
1403
- yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, yyscan_t scanner, ndt_t **ast, ndt_context_t *ctx)
1414
+ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, yyscan_t scanner, const ndt_t **ast, ndt_context_t *ctx)
1404
1415
  {
1405
1416
  YYUSE (yyvaluep);
1406
1417
  YYUSE (yylocationp);
@@ -1414,79 +1425,78 @@ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocatio
1414
1425
  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1415
1426
  switch (yytype)
1416
1427
  {
1417
- case 20: /* INTEGER */
1418
- #line 374 "bpgrammar.y" /* yacc.c:1257 */
1428
+ case 20: /* INTEGER */
1429
+ #line 384 "bpgrammar.y" /* yacc.c:1257 */
1419
1430
  { ndt_free(((*yyvaluep).string)); }
1420
- #line 1421 "bpgrammar.c" /* yacc.c:1257 */
1431
+ #line 1432 "bpgrammar.c" /* yacc.c:1257 */
1421
1432
  break;
1422
1433
 
1423
1434
  case 21: /* NAME */
1424
- #line 374 "bpgrammar.y" /* yacc.c:1257 */
1435
+ #line 384 "bpgrammar.y" /* yacc.c:1257 */
1425
1436
  { ndt_free(((*yyvaluep).string)); }
1426
- #line 1427 "bpgrammar.c" /* yacc.c:1257 */
1437
+ #line 1438 "bpgrammar.c" /* yacc.c:1257 */
1427
1438
  break;
1428
1439
 
1429
1440
  case 23: /* input */
1430
- #line 369 "bpgrammar.y" /* yacc.c:1257 */
1431
- { ndt_del(((*yyvaluep).ndt)); }
1432
- #line 1433 "bpgrammar.c" /* yacc.c:1257 */
1441
+ #line 379 "bpgrammar.y" /* yacc.c:1257 */
1442
+ { ndt_decref(((*yyvaluep).ndt)); }
1443
+ #line 1444 "bpgrammar.c" /* yacc.c:1257 */
1433
1444
  break;
1434
1445
 
1435
1446
  case 24: /* datatype */
1436
- #line 369 "bpgrammar.y" /* yacc.c:1257 */
1437
- { ndt_del(((*yyvaluep).ndt)); }
1438
- #line 1439 "bpgrammar.c" /* yacc.c:1257 */
1447
+ #line 379 "bpgrammar.y" /* yacc.c:1257 */
1448
+ { ndt_decref(((*yyvaluep).ndt)); }
1449
+ #line 1450 "bpgrammar.c" /* yacc.c:1257 */
1439
1450
  break;
1440
1451
 
1441
1452
  case 25: /* dimensions */
1442
- #line 372 "bpgrammar.y" /* yacc.c:1257 */
1453
+ #line 382 "bpgrammar.y" /* yacc.c:1257 */
1443
1454
  { ndt_string_seq_del(((*yyvaluep).string_seq)); }
1444
- #line 1445 "bpgrammar.c" /* yacc.c:1257 */
1455
+ #line 1456 "bpgrammar.c" /* yacc.c:1257 */
1445
1456
  break;
1446
1457
 
1447
1458
  case 26: /* dtype */
1448
- #line 369 "bpgrammar.y" /* yacc.c:1257 */
1449
- { ndt_del(((*yyvaluep).ndt)); }
1450
- #line 1451 "bpgrammar.c" /* yacc.c:1257 */
1459
+ #line 379 "bpgrammar.y" /* yacc.c:1257 */
1460
+ { ndt_decref(((*yyvaluep).ndt)); }
1461
+ #line 1462 "bpgrammar.c" /* yacc.c:1257 */
1451
1462
  break;
1452
1463
 
1453
1464
  case 27: /* record */
1454
- #line 369 "bpgrammar.y" /* yacc.c:1257 */
1455
- { ndt_del(((*yyvaluep).ndt)); }
1456
- #line 1457 "bpgrammar.c" /* yacc.c:1257 */
1465
+ #line 379 "bpgrammar.y" /* yacc.c:1257 */
1466
+ { ndt_decref(((*yyvaluep).ndt)); }
1467
+ #line 1468 "bpgrammar.c" /* yacc.c:1257 */
1457
1468
  break;
1458
1469
 
1459
1470
  case 28: /* field_seq */
1460
- #line 371 "bpgrammar.y" /* yacc.c:1257 */
1471
+ #line 381 "bpgrammar.y" /* yacc.c:1257 */
1461
1472
  { ndt_field_seq_del(((*yyvaluep).field_seq)); }
1462
- #line 1463 "bpgrammar.c" /* yacc.c:1257 */
1473
+ #line 1474 "bpgrammar.c" /* yacc.c:1257 */
1463
1474
  break;
1464
1475
 
1465
1476
  case 29: /* field */
1466
- #line 370 "bpgrammar.y" /* yacc.c:1257 */
1477
+ #line 380 "bpgrammar.y" /* yacc.c:1257 */
1467
1478
  { ndt_field_del(((*yyvaluep).field)); }
1468
- #line 1469 "bpgrammar.c" /* yacc.c:1257 */
1479
+ #line 1480 "bpgrammar.c" /* yacc.c:1257 */
1469
1480
  break;
1470
1481
 
1471
1482
  case 30: /* function */
1472
- #line 369 "bpgrammar.y" /* yacc.c:1257 */
1473
- { ndt_del(((*yyvaluep).ndt)); }
1474
- #line 1475 "bpgrammar.c" /* yacc.c:1257 */
1483
+ #line 379 "bpgrammar.y" /* yacc.c:1257 */
1484
+ { ndt_decref(((*yyvaluep).ndt)); }
1485
+ #line 1486 "bpgrammar.c" /* yacc.c:1257 */
1475
1486
  break;
1476
1487
 
1477
1488
  case 31: /* dtype_seq */
1478
- #line 373 "bpgrammar.y" /* yacc.c:1257 */
1489
+ #line 383 "bpgrammar.y" /* yacc.c:1257 */
1479
1490
  { ndt_type_seq_del(((*yyvaluep).type_seq)); }
1480
- #line 1481 "bpgrammar.c" /* yacc.c:1257 */
1491
+ #line 1492 "bpgrammar.c" /* yacc.c:1257 */
1481
1492
  break;
1482
1493
 
1483
1494
  case 33: /* repeat */
1484
- #line 374 "bpgrammar.y" /* yacc.c:1257 */
1495
+ #line 384 "bpgrammar.y" /* yacc.c:1257 */
1485
1496
  { ndt_free(((*yyvaluep).string)); }
1486
- #line 1487 "bpgrammar.c" /* yacc.c:1257 */
1497
+ #line 1498 "bpgrammar.c" /* yacc.c:1257 */
1487
1498
  break;
1488
1499
 
1489
-
1490
1500
  default:
1491
1501
  break;
1492
1502
  }
@@ -1501,7 +1511,7 @@ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocatio
1501
1511
  `----------*/
1502
1512
 
1503
1513
  int
1504
- yyparse (yyscan_t scanner, ndt_t **ast, ndt_context_t *ctx)
1514
+ yyparse (yyscan_t scanner, const ndt_t **ast, ndt_context_t *ctx)
1505
1515
  {
1506
1516
  /* The lookahead symbol. */
1507
1517
  int yychar;
@@ -1591,7 +1601,7 @@ YYLTYPE yylloc = yyloc_default;
1591
1601
  yychar = YYEMPTY; /* Cause a token to be read. */
1592
1602
 
1593
1603
  /* User initialization code. */
1594
- #line 315 "bpgrammar.y" /* yacc.c:1429 */
1604
+ #line 325 "bpgrammar.y" /* yacc.c:1431 */
1595
1605
  {
1596
1606
  yylloc.first_line = 1;
1597
1607
  yylloc.first_column = 1;
@@ -1599,27 +1609,35 @@ YYLTYPE yylloc = yyloc_default;
1599
1609
  yylloc.last_column = 1;
1600
1610
  }
1601
1611
 
1602
- #line 1603 "bpgrammar.c" /* yacc.c:1429 */
1612
+ #line 1613 "bpgrammar.c" /* yacc.c:1431 */
1603
1613
  yylsp[0] = yylloc;
1604
1614
  goto yysetstate;
1605
1615
 
1616
+
1606
1617
  /*------------------------------------------------------------.
1607
- | yynewstate -- Push a new state, which is found in yystate. |
1618
+ | yynewstate -- push a new state, which is found in yystate. |
1608
1619
  `------------------------------------------------------------*/
1609
- yynewstate:
1620
+ yynewstate:
1610
1621
  /* In all cases, when you get here, the value and location stacks
1611
1622
  have just been pushed. So pushing a state here evens the stacks. */
1612
1623
  yyssp++;
1613
1624
 
1614
- yysetstate:
1615
- *yyssp = yystate;
1625
+
1626
+ /*--------------------------------------------------------------------.
1627
+ | yynewstate -- set current state (the top of the stack) to yystate. |
1628
+ `--------------------------------------------------------------------*/
1629
+ yysetstate:
1630
+ *yyssp = (yytype_int16) yystate;
1616
1631
 
1617
1632
  if (yyss + yystacksize - 1 <= yyssp)
1633
+ #if !defined yyoverflow && !defined YYSTACK_RELOCATE
1634
+ goto yyexhaustedlab;
1635
+ #else
1618
1636
  {
1619
1637
  /* Get the current used size of the three stacks, in elements. */
1620
- YYSIZE_T yysize = yyssp - yyss + 1;
1638
+ YYSIZE_T yysize = (YYSIZE_T) (yyssp - yyss + 1);
1621
1639
 
1622
- #ifdef yyoverflow
1640
+ # if defined yyoverflow
1623
1641
  {
1624
1642
  /* Give user a chance to reallocate the stack. Use copies of
1625
1643
  these so that the &'s don't force the real ones into
@@ -1637,15 +1655,11 @@ YYLTYPE yylloc = yyloc_default;
1637
1655
  &yyvs1, yysize * sizeof (*yyvsp),
1638
1656
  &yyls1, yysize * sizeof (*yylsp),
1639
1657
  &yystacksize);
1640
-
1641
- yyls = yyls1;
1642
1658
  yyss = yyss1;
1643
1659
  yyvs = yyvs1;
1660
+ yyls = yyls1;
1644
1661
  }
1645
- #else /* no yyoverflow */
1646
- # ifndef YYSTACK_RELOCATE
1647
- goto yyexhaustedlab;
1648
- # else
1662
+ # else /* defined YYSTACK_RELOCATE */
1649
1663
  /* Extend the stack our own way. */
1650
1664
  if (YYMAXDEPTH <= yystacksize)
1651
1665
  goto yyexhaustedlab;
@@ -1662,23 +1676,23 @@ YYLTYPE yylloc = yyloc_default;
1662
1676
  YYSTACK_RELOCATE (yyss_alloc, yyss);
1663
1677
  YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1664
1678
  YYSTACK_RELOCATE (yyls_alloc, yyls);
1665
- # undef YYSTACK_RELOCATE
1679
+ # undef YYSTACK_RELOCATE
1666
1680
  if (yyss1 != yyssa)
1667
1681
  YYSTACK_FREE (yyss1);
1668
1682
  }
1669
1683
  # endif
1670
- #endif /* no yyoverflow */
1671
1684
 
1672
1685
  yyssp = yyss + yysize - 1;
1673
1686
  yyvsp = yyvs + yysize - 1;
1674
1687
  yylsp = yyls + yysize - 1;
1675
1688
 
1676
1689
  YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1677
- (unsigned long int) yystacksize));
1690
+ (unsigned long) yystacksize));
1678
1691
 
1679
1692
  if (yyss + yystacksize - 1 <= yyssp)
1680
1693
  YYABORT;
1681
1694
  }
1695
+ #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
1682
1696
 
1683
1697
  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1684
1698
 
@@ -1687,11 +1701,11 @@ YYLTYPE yylloc = yyloc_default;
1687
1701
 
1688
1702
  goto yybackup;
1689
1703
 
1704
+
1690
1705
  /*-----------.
1691
1706
  | yybackup. |
1692
1707
  `-----------*/
1693
1708
  yybackup:
1694
-
1695
1709
  /* Do appropriate processing given the current state. Read a
1696
1710
  lookahead token if we need one and don't already have one. */
1697
1711
 
@@ -1764,7 +1778,7 @@ yydefault:
1764
1778
 
1765
1779
 
1766
1780
  /*-----------------------------.
1767
- | yyreduce -- Do a reduction. |
1781
+ | yyreduce -- do a reduction. |
1768
1782
  `-----------------------------*/
1769
1783
  yyreduce:
1770
1784
  /* yyn is the number of a rule to reduce with. */
@@ -1780,169 +1794,170 @@ yyreduce:
1780
1794
  GCC warning that YYVAL may be used uninitialized. */
1781
1795
  yyval = yyvsp[1-yylen];
1782
1796
 
1783
- /* Default location. */
1797
+ /* Default location. */
1784
1798
  YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
1799
+ yyerror_range[1] = yyloc;
1785
1800
  YY_REDUCE_PRINT (yyn);
1786
1801
  switch (yyn)
1787
1802
  {
1788
1803
  case 2:
1789
- #line 379 "bpgrammar.y" /* yacc.c:1646 */
1804
+ #line 389 "bpgrammar.y" /* yacc.c:1652 */
1790
1805
  { (yyval.ndt) = (yyvsp[-1].ndt); *ast = (yyval.ndt); YYACCEPT; }
1791
- #line 1792 "bpgrammar.c" /* yacc.c:1646 */
1806
+ #line 1807 "bpgrammar.c" /* yacc.c:1652 */
1792
1807
  break;
1793
1808
 
1794
1809
  case 3:
1795
- #line 382 "bpgrammar.y" /* yacc.c:1646 */
1810
+ #line 392 "bpgrammar.y" /* yacc.c:1652 */
1796
1811
  { (yyval.ndt) = make_dimensions((yyvsp[-2].string_seq), (yyvsp[0].ndt), ctx); if ((yyval.ndt) == NULL) YYABORT; }
1797
- #line 1798 "bpgrammar.c" /* yacc.c:1646 */
1812
+ #line 1813 "bpgrammar.c" /* yacc.c:1652 */
1798
1813
  break;
1799
1814
 
1800
1815
  case 4:
1801
- #line 383 "bpgrammar.y" /* yacc.c:1646 */
1816
+ #line 393 "bpgrammar.y" /* yacc.c:1652 */
1802
1817
  { (yyval.ndt) = (yyvsp[0].ndt); }
1803
- #line 1804 "bpgrammar.c" /* yacc.c:1646 */
1818
+ #line 1819 "bpgrammar.c" /* yacc.c:1652 */
1804
1819
  break;
1805
1820
 
1806
1821
  case 5:
1807
- #line 384 "bpgrammar.y" /* yacc.c:1646 */
1822
+ #line 394 "bpgrammar.y" /* yacc.c:1652 */
1808
1823
  { (yyval.ndt) = (yyvsp[0].ndt); }
1809
- #line 1810 "bpgrammar.c" /* yacc.c:1646 */
1824
+ #line 1825 "bpgrammar.c" /* yacc.c:1652 */
1810
1825
  break;
1811
1826
 
1812
1827
  case 6:
1813
- #line 387 "bpgrammar.y" /* yacc.c:1646 */
1828
+ #line 397 "bpgrammar.y" /* yacc.c:1652 */
1814
1829
  { (yyval.string_seq) = ndt_string_seq_new((yyvsp[0].string), ctx); if ((yyval.string_seq) == NULL) YYABORT; }
1815
- #line 1816 "bpgrammar.c" /* yacc.c:1646 */
1830
+ #line 1831 "bpgrammar.c" /* yacc.c:1652 */
1816
1831
  break;
1817
1832
 
1818
1833
  case 7:
1819
- #line 388 "bpgrammar.y" /* yacc.c:1646 */
1834
+ #line 398 "bpgrammar.y" /* yacc.c:1652 */
1820
1835
  { (yyval.string_seq) = ndt_string_seq_append((yyvsp[-2].string_seq), (yyvsp[0].string), ctx); if ((yyval.string_seq) == NULL) YYABORT; }
1821
- #line 1822 "bpgrammar.c" /* yacc.c:1646 */
1836
+ #line 1837 "bpgrammar.c" /* yacc.c:1652 */
1822
1837
  break;
1823
1838
 
1824
1839
  case 8:
1825
- #line 391 "bpgrammar.y" /* yacc.c:1646 */
1840
+ #line 401 "bpgrammar.y" /* yacc.c:1652 */
1826
1841
  { (yyval.ndt) = make_dtype((yyvsp[-1].uchar), (yyvsp[0].uchar), ctx); if ((yyval.ndt) == NULL) YYABORT; }
1827
- #line 1828 "bpgrammar.c" /* yacc.c:1646 */
1842
+ #line 1843 "bpgrammar.c" /* yacc.c:1652 */
1828
1843
  break;
1829
1844
 
1830
1845
  case 9:
1831
- #line 392 "bpgrammar.y" /* yacc.c:1646 */
1846
+ #line 402 "bpgrammar.y" /* yacc.c:1652 */
1832
1847
  { (yyval.ndt) = make_fixed_bytes((yyvsp[-1].string), ctx); if ((yyval.ndt) == NULL) YYABORT; }
1833
- #line 1834 "bpgrammar.c" /* yacc.c:1646 */
1848
+ #line 1849 "bpgrammar.c" /* yacc.c:1652 */
1834
1849
  break;
1835
1850
 
1836
1851
  case 10:
1837
- #line 393 "bpgrammar.y" /* yacc.c:1646 */
1852
+ #line 403 "bpgrammar.y" /* yacc.c:1652 */
1838
1853
  { (yyval.ndt) = (yyvsp[0].ndt); }
1839
- #line 1840 "bpgrammar.c" /* yacc.c:1646 */
1854
+ #line 1855 "bpgrammar.c" /* yacc.c:1652 */
1840
1855
  break;
1841
1856
 
1842
1857
  case 11:
1843
- #line 396 "bpgrammar.y" /* yacc.c:1646 */
1858
+ #line 406 "bpgrammar.y" /* yacc.c:1652 */
1844
1859
  { (yyval.ndt) = make_record((yyvsp[-1].field_seq), ctx); if ((yyval.ndt) == NULL) YYABORT; }
1845
- #line 1846 "bpgrammar.c" /* yacc.c:1646 */
1860
+ #line 1861 "bpgrammar.c" /* yacc.c:1652 */
1846
1861
  break;
1847
1862
 
1848
1863
  case 12:
1849
- #line 399 "bpgrammar.y" /* yacc.c:1646 */
1864
+ #line 409 "bpgrammar.y" /* yacc.c:1652 */
1850
1865
  { (yyval.field_seq) = ndt_field_seq_new((yyvsp[0].field), ctx); if ((yyval.field_seq) == NULL) YYABORT; }
1851
- #line 1852 "bpgrammar.c" /* yacc.c:1646 */
1866
+ #line 1867 "bpgrammar.c" /* yacc.c:1652 */
1852
1867
  break;
1853
1868
 
1854
1869
  case 13:
1855
- #line 400 "bpgrammar.y" /* yacc.c:1646 */
1870
+ #line 410 "bpgrammar.y" /* yacc.c:1652 */
1856
1871
  { (yyval.field_seq) = ndt_field_seq_append((yyvsp[-1].field_seq), (yyvsp[0].field), ctx); if ((yyval.field_seq) == NULL) YYABORT; }
1857
- #line 1858 "bpgrammar.c" /* yacc.c:1646 */
1872
+ #line 1873 "bpgrammar.c" /* yacc.c:1652 */
1858
1873
  break;
1859
1874
 
1860
1875
  case 14:
1861
- #line 403 "bpgrammar.y" /* yacc.c:1646 */
1876
+ #line 413 "bpgrammar.y" /* yacc.c:1652 */
1862
1877
  { (yyval.field) = make_field((yyvsp[-2].string), (yyvsp[-4].ndt), (yyvsp[0].uint16), ctx); if ((yyval.field) == NULL) YYABORT; }
1863
- #line 1864 "bpgrammar.c" /* yacc.c:1646 */
1878
+ #line 1879 "bpgrammar.c" /* yacc.c:1652 */
1864
1879
  break;
1865
1880
 
1866
1881
  case 15:
1867
- #line 406 "bpgrammar.y" /* yacc.c:1646 */
1882
+ #line 416 "bpgrammar.y" /* yacc.c:1652 */
1868
1883
  { (yyval.ndt) = mk_function((yyvsp[-2].type_seq), (yyvsp[0].type_seq), ctx); if ((yyval.ndt) == NULL) YYABORT; }
1869
- #line 1870 "bpgrammar.c" /* yacc.c:1646 */
1884
+ #line 1885 "bpgrammar.c" /* yacc.c:1652 */
1870
1885
  break;
1871
1886
 
1872
1887
  case 16:
1873
- #line 409 "bpgrammar.y" /* yacc.c:1646 */
1888
+ #line 419 "bpgrammar.y" /* yacc.c:1652 */
1874
1889
  { (yyval.type_seq) = broadcast_seq_new((yyvsp[0].ndt), ctx); if ((yyval.type_seq) == NULL) YYABORT; }
1875
- #line 1876 "bpgrammar.c" /* yacc.c:1646 */
1890
+ #line 1891 "bpgrammar.c" /* yacc.c:1652 */
1876
1891
  break;
1877
1892
 
1878
1893
  case 17:
1879
- #line 410 "bpgrammar.y" /* yacc.c:1646 */
1894
+ #line 420 "bpgrammar.y" /* yacc.c:1652 */
1880
1895
  { (yyval.type_seq) = broadcast_seq_append((yyvsp[-1].type_seq), (yyvsp[0].ndt), ctx); if ((yyval.type_seq) == NULL) YYABORT; }
1881
- #line 1882 "bpgrammar.c" /* yacc.c:1646 */
1896
+ #line 1897 "bpgrammar.c" /* yacc.c:1652 */
1882
1897
  break;
1883
1898
 
1884
1899
  case 18:
1885
- #line 413 "bpgrammar.y" /* yacc.c:1646 */
1900
+ #line 423 "bpgrammar.y" /* yacc.c:1652 */
1886
1901
  { (yyval.uchar) = '@'; }
1887
- #line 1888 "bpgrammar.c" /* yacc.c:1646 */
1902
+ #line 1903 "bpgrammar.c" /* yacc.c:1652 */
1888
1903
  break;
1889
1904
 
1890
1905
  case 19:
1891
- #line 414 "bpgrammar.y" /* yacc.c:1646 */
1906
+ #line 424 "bpgrammar.y" /* yacc.c:1652 */
1892
1907
  { (yyval.uchar) = '@'; }
1893
- #line 1894 "bpgrammar.c" /* yacc.c:1646 */
1908
+ #line 1909 "bpgrammar.c" /* yacc.c:1652 */
1894
1909
  break;
1895
1910
 
1896
1911
  case 20:
1897
- #line 415 "bpgrammar.y" /* yacc.c:1646 */
1912
+ #line 425 "bpgrammar.y" /* yacc.c:1652 */
1898
1913
  { (yyval.uchar) = '='; }
1899
- #line 1900 "bpgrammar.c" /* yacc.c:1646 */
1914
+ #line 1915 "bpgrammar.c" /* yacc.c:1652 */
1900
1915
  break;
1901
1916
 
1902
1917
  case 21:
1903
- #line 416 "bpgrammar.y" /* yacc.c:1646 */
1918
+ #line 426 "bpgrammar.y" /* yacc.c:1652 */
1904
1919
  { (yyval.uchar) = '<'; }
1905
- #line 1906 "bpgrammar.c" /* yacc.c:1646 */
1920
+ #line 1921 "bpgrammar.c" /* yacc.c:1652 */
1906
1921
  break;
1907
1922
 
1908
1923
  case 22:
1909
- #line 417 "bpgrammar.y" /* yacc.c:1646 */
1924
+ #line 427 "bpgrammar.y" /* yacc.c:1652 */
1910
1925
  { (yyval.uchar) = '>'; }
1911
- #line 1912 "bpgrammar.c" /* yacc.c:1646 */
1926
+ #line 1927 "bpgrammar.c" /* yacc.c:1652 */
1912
1927
  break;
1913
1928
 
1914
1929
  case 23:
1915
- #line 418 "bpgrammar.y" /* yacc.c:1646 */
1930
+ #line 428 "bpgrammar.y" /* yacc.c:1652 */
1916
1931
  { (yyval.uchar) = '!'; }
1917
- #line 1918 "bpgrammar.c" /* yacc.c:1646 */
1932
+ #line 1933 "bpgrammar.c" /* yacc.c:1652 */
1918
1933
  break;
1919
1934
 
1920
1935
  case 24:
1921
- #line 421 "bpgrammar.y" /* yacc.c:1646 */
1936
+ #line 431 "bpgrammar.y" /* yacc.c:1652 */
1922
1937
  { (yyval.string) = NULL; }
1923
- #line 1924 "bpgrammar.c" /* yacc.c:1646 */
1938
+ #line 1939 "bpgrammar.c" /* yacc.c:1652 */
1924
1939
  break;
1925
1940
 
1926
1941
  case 25:
1927
- #line 422 "bpgrammar.y" /* yacc.c:1646 */
1942
+ #line 432 "bpgrammar.y" /* yacc.c:1652 */
1928
1943
  { (yyval.string) = (yyvsp[0].string); if ((yyval.string) == NULL) YYABORT; }
1929
- #line 1930 "bpgrammar.c" /* yacc.c:1646 */
1944
+ #line 1945 "bpgrammar.c" /* yacc.c:1652 */
1930
1945
  break;
1931
1946
 
1932
1947
  case 26:
1933
- #line 425 "bpgrammar.y" /* yacc.c:1646 */
1948
+ #line 435 "bpgrammar.y" /* yacc.c:1652 */
1934
1949
  { (yyval.uint16) = 0; }
1935
- #line 1936 "bpgrammar.c" /* yacc.c:1646 */
1950
+ #line 1951 "bpgrammar.c" /* yacc.c:1652 */
1936
1951
  break;
1937
1952
 
1938
1953
  case 27:
1939
- #line 426 "bpgrammar.y" /* yacc.c:1646 */
1954
+ #line 436 "bpgrammar.y" /* yacc.c:1652 */
1940
1955
  { (yyval.uint16) = add_uint16((yyvsp[-1].uint16), 1, ctx); if (ndt_err_occurred(ctx)) YYABORT; }
1941
- #line 1942 "bpgrammar.c" /* yacc.c:1646 */
1956
+ #line 1957 "bpgrammar.c" /* yacc.c:1652 */
1942
1957
  break;
1943
1958
 
1944
1959
 
1945
- #line 1946 "bpgrammar.c" /* yacc.c:1646 */
1960
+ #line 1961 "bpgrammar.c" /* yacc.c:1652 */
1946
1961
  default: break;
1947
1962
  }
1948
1963
  /* User semantic actions sometimes alter yychar, and that requires
@@ -1968,14 +1983,13 @@ yyreduce:
1968
1983
  /* Now 'shift' the result of the reduction. Determine what state
1969
1984
  that goes to, based on the state we popped back to and the rule
1970
1985
  number reduced by. */
1971
-
1972
- yyn = yyr1[yyn];
1973
-
1974
- yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1975
- if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1976
- yystate = yytable[yystate];
1977
- else
1978
- yystate = yydefgoto[yyn - YYNTOKENS];
1986
+ {
1987
+ const int yylhs = yyr1[yyn] - YYNTOKENS;
1988
+ const int yyi = yypgoto[yylhs] + *yyssp;
1989
+ yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
1990
+ ? yytable[yyi]
1991
+ : yydefgoto[yylhs]);
1992
+ }
1979
1993
 
1980
1994
  goto yynewstate;
1981
1995
 
@@ -2058,14 +2072,11 @@ yyerrlab:
2058
2072
  | yyerrorlab -- error raised explicitly by YYERROR. |
2059
2073
  `---------------------------------------------------*/
2060
2074
  yyerrorlab:
2075
+ /* Pacify compilers when the user code never invokes YYERROR and the
2076
+ label yyerrorlab therefore never appears in user code. */
2077
+ if (0)
2078
+ YYERROR;
2061
2079
 
2062
- /* Pacify compilers like GCC when the user code never invokes
2063
- YYERROR and the label yyerrorlab therefore never appears in user
2064
- code. */
2065
- if (/*CONSTCOND*/ 0)
2066
- goto yyerrorlab;
2067
-
2068
- yyerror_range[1] = yylsp[1-yylen];
2069
2080
  /* Do not reclaim the symbols of the rule whose action triggered
2070
2081
  this YYERROR. */
2071
2082
  YYPOPSTACK (yylen);
@@ -2131,6 +2142,7 @@ yyacceptlab:
2131
2142
  yyresult = 0;
2132
2143
  goto yyreturn;
2133
2144
 
2145
+
2134
2146
  /*-----------------------------------.
2135
2147
  | yyabortlab -- YYABORT comes here. |
2136
2148
  `-----------------------------------*/
@@ -2138,6 +2150,7 @@ yyabortlab:
2138
2150
  yyresult = 1;
2139
2151
  goto yyreturn;
2140
2152
 
2153
+
2141
2154
  #if !defined yyoverflow || YYERROR_VERBOSE
2142
2155
  /*-------------------------------------------------.
2143
2156
  | yyexhaustedlab -- memory exhaustion comes here. |
@@ -2148,6 +2161,10 @@ yyexhaustedlab:
2148
2161
  /* Fall through. */
2149
2162
  #endif
2150
2163
 
2164
+
2165
+ /*-----------------------------------------------------.
2166
+ | yyreturn -- parsing is finished, return the result. |
2167
+ `-----------------------------------------------------*/
2151
2168
  yyreturn:
2152
2169
  if (yychar != YYEMPTY)
2153
2170
  {