ndtypes 0.2.0dev4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (139) hide show
  1. checksums.yaml +7 -0
  2. data/CONTRIBUTING.md +50 -0
  3. data/Gemfile +2 -0
  4. data/History.md +0 -0
  5. data/README.md +19 -0
  6. data/Rakefile +125 -0
  7. data/ext/ruby_ndtypes/extconf.rb +55 -0
  8. data/ext/ruby_ndtypes/gc_guard.c +36 -0
  9. data/ext/ruby_ndtypes/gc_guard.h +12 -0
  10. data/ext/ruby_ndtypes/ndtypes/AUTHORS.txt +5 -0
  11. data/ext/ruby_ndtypes/ndtypes/INSTALL.txt +101 -0
  12. data/ext/ruby_ndtypes/ndtypes/LICENSE.txt +29 -0
  13. data/ext/ruby_ndtypes/ndtypes/MANIFEST.in +3 -0
  14. data/ext/ruby_ndtypes/ndtypes/Makefile.in +87 -0
  15. data/ext/ruby_ndtypes/ndtypes/README.rst +47 -0
  16. data/ext/ruby_ndtypes/ndtypes/config.guess +1530 -0
  17. data/ext/ruby_ndtypes/ndtypes/config.h.in +67 -0
  18. data/ext/ruby_ndtypes/ndtypes/config.sub +1782 -0
  19. data/ext/ruby_ndtypes/ndtypes/configure +5260 -0
  20. data/ext/ruby_ndtypes/ndtypes/configure.ac +161 -0
  21. data/ext/ruby_ndtypes/ndtypes/doc/Makefile +14 -0
  22. data/ext/ruby_ndtypes/ndtypes/doc/_static/copybutton.js +66 -0
  23. data/ext/ruby_ndtypes/ndtypes/doc/conf.py +26 -0
  24. data/ext/ruby_ndtypes/ndtypes/doc/grammar/grammar.rst +27 -0
  25. data/ext/ruby_ndtypes/ndtypes/doc/index.rst +56 -0
  26. data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/context.rst +131 -0
  27. data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/encodings.rst +68 -0
  28. data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/fields-values.rst +175 -0
  29. data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/functions.rst +72 -0
  30. data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/index.rst +43 -0
  31. data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/init.rst +48 -0
  32. data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/io.rst +100 -0
  33. data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/memory.rst +124 -0
  34. data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/predicates.rst +110 -0
  35. data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/typedef.rst +31 -0
  36. data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/types.rst +594 -0
  37. data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/util.rst +166 -0
  38. data/ext/ruby_ndtypes/ndtypes/doc/ndtypes/buffer-protocol.rst +27 -0
  39. data/ext/ruby_ndtypes/ndtypes/doc/ndtypes/index.rst +21 -0
  40. data/ext/ruby_ndtypes/ndtypes/doc/ndtypes/pattern-matching.rst +330 -0
  41. data/ext/ruby_ndtypes/ndtypes/doc/ndtypes/quickstart.rst +144 -0
  42. data/ext/ruby_ndtypes/ndtypes/doc/ndtypes/types.rst +544 -0
  43. data/ext/ruby_ndtypes/ndtypes/doc/releases/index.rst +35 -0
  44. data/ext/ruby_ndtypes/ndtypes/install-sh +527 -0
  45. data/ext/ruby_ndtypes/ndtypes/libndtypes/Makefile.in +271 -0
  46. data/ext/ruby_ndtypes/ndtypes/libndtypes/Makefile.vc +269 -0
  47. data/ext/ruby_ndtypes/ndtypes/libndtypes/alloc.c +230 -0
  48. data/ext/ruby_ndtypes/ndtypes/libndtypes/attr.c +268 -0
  49. data/ext/ruby_ndtypes/ndtypes/libndtypes/attr.h +109 -0
  50. data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/Makefile.in +73 -0
  51. data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/Makefile.vc +70 -0
  52. data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/README.txt +16 -0
  53. data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/bpgrammar.c +2179 -0
  54. data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/bpgrammar.h +134 -0
  55. data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/bpgrammar.y +428 -0
  56. data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/bplexer.c +2543 -0
  57. data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/bplexer.h +735 -0
  58. data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/bplexer.l +176 -0
  59. data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/export.c +543 -0
  60. data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/import.c +110 -0
  61. data/ext/ruby_ndtypes/ndtypes/libndtypes/context.c +228 -0
  62. data/ext/ruby_ndtypes/ndtypes/libndtypes/copy.c +634 -0
  63. data/ext/ruby_ndtypes/ndtypes/libndtypes/encodings.c +116 -0
  64. data/ext/ruby_ndtypes/ndtypes/libndtypes/equal.c +288 -0
  65. data/ext/ruby_ndtypes/ndtypes/libndtypes/grammar.c +3067 -0
  66. data/ext/ruby_ndtypes/ndtypes/libndtypes/grammar.h +180 -0
  67. data/ext/ruby_ndtypes/ndtypes/libndtypes/grammar.y +417 -0
  68. data/ext/ruby_ndtypes/ndtypes/libndtypes/io.c +1658 -0
  69. data/ext/ruby_ndtypes/ndtypes/libndtypes/lexer.c +2773 -0
  70. data/ext/ruby_ndtypes/ndtypes/libndtypes/lexer.h +734 -0
  71. data/ext/ruby_ndtypes/ndtypes/libndtypes/lexer.l +222 -0
  72. data/ext/ruby_ndtypes/ndtypes/libndtypes/match.c +1132 -0
  73. data/ext/ruby_ndtypes/ndtypes/libndtypes/ndtypes.c +2323 -0
  74. data/ext/ruby_ndtypes/ndtypes/libndtypes/ndtypes.h.in +893 -0
  75. data/ext/ruby_ndtypes/ndtypes/libndtypes/overflow.h +161 -0
  76. data/ext/ruby_ndtypes/ndtypes/libndtypes/parsefuncs.c +473 -0
  77. data/ext/ruby_ndtypes/ndtypes/libndtypes/parsefuncs.h +92 -0
  78. data/ext/ruby_ndtypes/ndtypes/libndtypes/parser.c +246 -0
  79. data/ext/ruby_ndtypes/ndtypes/libndtypes/seq.c +269 -0
  80. data/ext/ruby_ndtypes/ndtypes/libndtypes/seq.h +197 -0
  81. data/ext/ruby_ndtypes/ndtypes/libndtypes/serialize/Makefile.in +48 -0
  82. data/ext/ruby_ndtypes/ndtypes/libndtypes/serialize/Makefile.vc +46 -0
  83. data/ext/ruby_ndtypes/ndtypes/libndtypes/serialize/deserialize.c +1007 -0
  84. data/ext/ruby_ndtypes/ndtypes/libndtypes/serialize/serialize.c +442 -0
  85. data/ext/ruby_ndtypes/ndtypes/libndtypes/slice.h +42 -0
  86. data/ext/ruby_ndtypes/ndtypes/libndtypes/substitute.c +238 -0
  87. data/ext/ruby_ndtypes/ndtypes/libndtypes/substitute.h +50 -0
  88. data/ext/ruby_ndtypes/ndtypes/libndtypes/symtable.c +371 -0
  89. data/ext/ruby_ndtypes/ndtypes/libndtypes/symtable.h +100 -0
  90. data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/Makefile.in +55 -0
  91. data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/Makefile.vc +45 -0
  92. data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/alloc_fail.c +82 -0
  93. data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/alloc_fail.h +49 -0
  94. data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/runtest.c +1657 -0
  95. data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test.h +85 -0
  96. data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_array.c +115 -0
  97. data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_buffer.c +137 -0
  98. data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_indent.c +201 -0
  99. data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_match.c +2397 -0
  100. data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_numba.c +57 -0
  101. data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_parse.c +349 -0
  102. data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_parse_error.c +27839 -0
  103. data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_parse_roundtrip.c +350 -0
  104. data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_record.c +231 -0
  105. data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_typecheck.c +375 -0
  106. data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_typedef.c +65 -0
  107. data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/valgrind.supp +30 -0
  108. data/ext/ruby_ndtypes/ndtypes/libndtypes/tools/bench.c +79 -0
  109. data/ext/ruby_ndtypes/ndtypes/libndtypes/tools/indent.c +94 -0
  110. data/ext/ruby_ndtypes/ndtypes/libndtypes/tools/print_ast.c +96 -0
  111. data/ext/ruby_ndtypes/ndtypes/libndtypes/util.c +474 -0
  112. data/ext/ruby_ndtypes/ndtypes/libndtypes/values.c +228 -0
  113. data/ext/ruby_ndtypes/ndtypes/python/bench.py +49 -0
  114. data/ext/ruby_ndtypes/ndtypes/python/ndt_randtype.py +409 -0
  115. data/ext/ruby_ndtypes/ndtypes/python/ndt_support.py +14 -0
  116. data/ext/ruby_ndtypes/ndtypes/python/ndtypes/__init__.py +70 -0
  117. data/ext/ruby_ndtypes/ndtypes/python/ndtypes/_ndtypes.c +1332 -0
  118. data/ext/ruby_ndtypes/ndtypes/python/ndtypes/docstrings.h +319 -0
  119. data/ext/ruby_ndtypes/ndtypes/python/ndtypes/pyndtypes.h +154 -0
  120. data/ext/ruby_ndtypes/ndtypes/python/test_ndtypes.py +1977 -0
  121. data/ext/ruby_ndtypes/ndtypes/setup.py +288 -0
  122. data/ext/ruby_ndtypes/ndtypes/vcbuild/INSTALL.txt +41 -0
  123. data/ext/ruby_ndtypes/ndtypes/vcbuild/runtest32.bat +15 -0
  124. data/ext/ruby_ndtypes/ndtypes/vcbuild/runtest64.bat +13 -0
  125. data/ext/ruby_ndtypes/ndtypes/vcbuild/vcbuild32.bat +38 -0
  126. data/ext/ruby_ndtypes/ndtypes/vcbuild/vcbuild64.bat +38 -0
  127. data/ext/ruby_ndtypes/ndtypes/vcbuild/vcclean.bat +13 -0
  128. data/ext/ruby_ndtypes/ndtypes/vcbuild/vcdistclean.bat +14 -0
  129. data/ext/ruby_ndtypes/ruby_ndtypes.c +1003 -0
  130. data/ext/ruby_ndtypes/ruby_ndtypes.h +37 -0
  131. data/ext/ruby_ndtypes/ruby_ndtypes_internal.h +28 -0
  132. data/lib/ndtypes.rb +45 -0
  133. data/lib/ndtypes/errors.rb +2 -0
  134. data/lib/ndtypes/version.rb +6 -0
  135. data/ndtypes.gemspec +47 -0
  136. data/spec/gc_table_spec.rb +10 -0
  137. data/spec/ndtypes_spec.rb +289 -0
  138. data/spec/spec_helper.rb +241 -0
  139. metadata +242 -0
@@ -0,0 +1,116 @@
1
+ /*
2
+ * BSD 3-Clause License
3
+ *
4
+ * Copyright (c) 2017-2018, plures
5
+ * All rights reserved.
6
+ *
7
+ * Redistribution and use in source and binary forms, with or without
8
+ * modification, are permitted provided that the following conditions are met:
9
+ *
10
+ * 1. Redistributions of source code must retain the above copyright notice,
11
+ * this list of conditions and the following disclaimer.
12
+ *
13
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
14
+ * this list of conditions and the following disclaimer in the documentation
15
+ * and/or other materials provided with the distribution.
16
+ *
17
+ * 3. Neither the name of the copyright holder nor the names of its
18
+ * contributors may be used to endorse or promote products derived from
19
+ * this software without specific prior written permission.
20
+ *
21
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ */
32
+
33
+
34
+ #include "string.h"
35
+ #include "ndtypes.h"
36
+
37
+
38
+ /******************************************************************************/
39
+ /* Encodings */
40
+ /******************************************************************************/
41
+
42
+ enum ndt_encoding
43
+ ndt_encoding_from_string(const char *s, ndt_context_t *ctx)
44
+ {
45
+ if (strcmp(s, "A") == 0 ||
46
+ strcmp(s, "ascii") == 0 ||
47
+ strcmp(s, "us-ascii") == 0) {
48
+ return Ascii;
49
+ }
50
+ else if (strcmp(s, "U8") == 0 ||
51
+ strcmp(s, "utf8") == 0 ||
52
+ strcmp(s, "utf-8") == 0) {
53
+ return Utf8;
54
+ }
55
+ else if (strcmp(s, "U16") == 0 ||
56
+ strcmp(s, "utf16") == 0 ||
57
+ strcmp(s, "utf-16") == 0) {
58
+ return Utf16;
59
+ }
60
+ else if (strcmp(s, "U32") == 0 ||
61
+ strcmp(s, "utf32") == 0 ||
62
+ strcmp(s, "utf-32") == 0) {
63
+ return Utf32;
64
+ }
65
+ else if (strcmp(s, "ucs2") == 0 ||
66
+ strcmp(s, "ucs-2") == 0 ||
67
+ strcmp(s, "ucs_2") == 0) {
68
+ return Ucs2;
69
+ }
70
+ else {
71
+ ndt_err_format(ctx, NDT_ValueError, "invalid encoding: '%s'", s);
72
+ return Ascii;
73
+ }
74
+ }
75
+
76
+ const char *
77
+ ndt_encoding_as_string(enum ndt_encoding encoding)
78
+ {
79
+ switch (encoding) {
80
+ case Ascii:
81
+ return "'ascii'";
82
+ case Utf8:
83
+ return "'utf8'";
84
+ case Utf16:
85
+ return "'utf16'";
86
+ case Utf32:
87
+ return "'utf32'";
88
+ case Ucs2:
89
+ return "'ucs2'";
90
+ }
91
+
92
+ /* NOT REACHED: tags should be exhaustive. */
93
+ ndt_internal_error("invalid encoding");
94
+ }
95
+
96
+ size_t
97
+ ndt_sizeof_encoding(enum ndt_encoding encoding)
98
+ {
99
+ switch (encoding) {
100
+ case Ascii: case Utf8:
101
+ return 1;
102
+ case Utf16: case Ucs2:
103
+ return 2;
104
+ case Utf32:
105
+ return 4;
106
+ }
107
+
108
+ /* NOT REACHED: tags should be exhaustive. */
109
+ ndt_internal_error("invalid encoding");
110
+ }
111
+
112
+ uint16_t
113
+ ndt_alignof_encoding(enum ndt_encoding encoding)
114
+ {
115
+ return (uint16_t)ndt_sizeof_encoding(encoding);
116
+ }
@@ -0,0 +1,288 @@
1
+ /*
2
+ * BSD 3-Clause License
3
+ *
4
+ * Copyright (c) 2017-2018, plures
5
+ * All rights reserved.
6
+ *
7
+ * Redistribution and use in source and binary forms, with or without
8
+ * modification, are permitted provided that the following conditions are met:
9
+ *
10
+ * 1. Redistributions of source code must retain the above copyright notice,
11
+ * this list of conditions and the following disclaimer.
12
+ *
13
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
14
+ * this list of conditions and the following disclaimer in the documentation
15
+ * and/or other materials provided with the distribution.
16
+ *
17
+ * 3. Neither the name of the copyright holder nor the names of its
18
+ * contributors may be used to endorse or promote products derived from
19
+ * this software without specific prior written permission.
20
+ *
21
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ */
32
+
33
+
34
+ #include <stdio.h>
35
+ #include <stdlib.h>
36
+ #include <string.h>
37
+ #include <assert.h>
38
+ #include "ndtypes.h"
39
+
40
+
41
+ /*****************************************************************************/
42
+ /* Structural equality */
43
+ /*****************************************************************************/
44
+
45
+ static inline int
46
+ ndt_common_equal(const ndt_t *t, const ndt_t *u)
47
+ {
48
+ return t->tag == u->tag &&
49
+ t->access == u->access &&
50
+ t->flags == u->flags &&
51
+ t->ndim == u->ndim &&
52
+ t->datasize == u->datasize &&
53
+ t->align == u->align;
54
+ }
55
+
56
+ static int
57
+ function_types_equal(const ndt_t *t, const ndt_t *u, int64_t nargs)
58
+ {
59
+ int64_t i;
60
+
61
+ assert(t->tag == Function && u->tag == Function);
62
+
63
+ for (i = 0; i < nargs; i++) {
64
+ if (!ndt_equal(t->Function.types[i], u->Function.types[i])) {
65
+ return 0;
66
+ }
67
+ }
68
+
69
+ return 1;
70
+ }
71
+
72
+ static int
73
+ tuple_fields_equal(const ndt_t *t, const ndt_t *u, int64_t shape)
74
+ {
75
+ int64_t i;
76
+
77
+ assert(t->tag == Tuple && u->tag == Tuple);
78
+
79
+ for (i = 0; i < shape; i++) {
80
+ if (t->Concrete.Tuple.offset[i] != u->Concrete.Tuple.offset[i] ||
81
+ t->Concrete.Tuple.align[i] != u->Concrete.Tuple.align[i] ||
82
+ t->Concrete.Tuple.pad[i] != u->Concrete.Tuple.pad[i]) {
83
+ return 0;
84
+ }
85
+ }
86
+
87
+ for (i = 0; i < shape; i++) {
88
+ if (!ndt_equal(t->Tuple.types[i], u->Tuple.types[i])) {
89
+ return 0;
90
+ }
91
+ }
92
+
93
+ return 1;
94
+ }
95
+
96
+ static int
97
+ record_fields_equal(const ndt_t *t, const ndt_t *u, int64_t shape)
98
+ {
99
+ int64_t i;
100
+
101
+ assert(t->tag == Record && u->tag == Record);
102
+
103
+ for (i = 0; i < shape; i++) {
104
+ if (t->Concrete.Record.offset[i] != u->Concrete.Record.offset[i] ||
105
+ t->Concrete.Record.align[i] != u->Concrete.Record.align[i] ||
106
+ t->Concrete.Record.pad[i] != u->Concrete.Record.pad[i]) {
107
+ return 0;
108
+ }
109
+ }
110
+
111
+ for (i = 0; i < shape; i++) {
112
+ if (strcmp(t->Record.names[i], u->Record.names[i]) != 0) {
113
+ return 0;
114
+ }
115
+
116
+ if (!ndt_equal(t->Record.types[i], u->Record.types[i])) {
117
+ return 0;
118
+ }
119
+ }
120
+
121
+ return 1;
122
+ }
123
+
124
+ static int
125
+ categorical_equal(ndt_value_t *t, ndt_value_t *u, int64_t shape)
126
+ {
127
+ int64_t i;
128
+
129
+ for (i = 0; i < shape; i++) {
130
+ if (!ndt_value_mem_equal(t+i, u+i)) {
131
+ return 0;
132
+ }
133
+ }
134
+
135
+ return 1;
136
+ }
137
+
138
+ int
139
+ ndt_equal(const ndt_t *t, const ndt_t *u)
140
+ {
141
+ if (!ndt_common_equal(t, u)) {
142
+ return 0;
143
+ }
144
+
145
+ switch (t->tag) {
146
+ case Module: {
147
+ return strcmp(t->Module.name, u->Module.name) == 0 &&
148
+ ndt_equal(t->Module.type, u->Module.type);
149
+ }
150
+
151
+ case Function: {
152
+ if (t->Function.nin != u->Function.nin ||
153
+ t->Function.nout != u->Function.nout ||
154
+ t->Function.nargs != u->Function.nargs) {
155
+ return 0;
156
+ }
157
+
158
+ return function_types_equal(t, u, t->Function.nargs);
159
+ }
160
+
161
+ case FixedDim: {
162
+ return t->FixedDim.tag == u->FixedDim.tag &&
163
+ t->FixedDim.shape == u->FixedDim.shape &&
164
+ t->Concrete.FixedDim.itemsize == u->Concrete.FixedDim.itemsize &&
165
+ t->Concrete.FixedDim.step == u->Concrete.FixedDim.step &&
166
+ ndt_equal(t->FixedDim.type, u->FixedDim.type);
167
+ }
168
+
169
+ case VarDim: {
170
+ if (t->Concrete.VarDim.itemsize != u->Concrete.VarDim.itemsize ||
171
+ t->Concrete.VarDim.noffsets != u->Concrete.VarDim.noffsets ||
172
+ t->Concrete.VarDim.nslices != u->Concrete.VarDim.nslices) {
173
+ return 0;
174
+ }
175
+
176
+ if (memcmp(t->Concrete.VarDim.offsets, u->Concrete.VarDim.offsets,
177
+ t->Concrete.VarDim.noffsets * (sizeof *t->Concrete.VarDim.offsets)) ||
178
+ memcmp(t->Concrete.VarDim.slices, u->Concrete.VarDim.slices,
179
+ t->Concrete.VarDim.nslices * (sizeof *t->Concrete.VarDim.slices))) {
180
+ return 0;
181
+ }
182
+
183
+ return ndt_equal(t->VarDim.type, u->VarDim.type);
184
+ }
185
+
186
+ case SymbolicDim: {
187
+ return t->SymbolicDim.tag == u->SymbolicDim.tag &&
188
+ strcmp(t->SymbolicDim.name, u->SymbolicDim.name) == 0 &&
189
+ ndt_equal(t->SymbolicDim.type, u->SymbolicDim.type);
190
+ }
191
+
192
+ case EllipsisDim: {
193
+ if (t->EllipsisDim.tag != u->EllipsisDim.tag) {
194
+ return 0;
195
+ }
196
+
197
+ if (!!t->EllipsisDim.name != !!u->EllipsisDim.name) {
198
+ return 0;
199
+ }
200
+
201
+ if (t->EllipsisDim.name &&
202
+ strcmp(t->EllipsisDim.name, u->EllipsisDim.name) != 0) {
203
+ return 0;
204
+ }
205
+
206
+ return ndt_equal(t->EllipsisDim.type, u->EllipsisDim.type);
207
+ }
208
+
209
+ case Tuple: {
210
+ if (t->Tuple.flag != u->Tuple.flag ||
211
+ t->Tuple.shape != u->Tuple.shape) {
212
+ return 0;
213
+ }
214
+
215
+ return tuple_fields_equal(t, u, t->Tuple.shape);
216
+ }
217
+
218
+ case Record: {
219
+ if (t->Record.flag != u->Record.flag ||
220
+ t->Record.shape != u->Record.shape) {
221
+ return 0;
222
+ }
223
+
224
+ return record_fields_equal(t, u, t->Record.shape);
225
+ }
226
+
227
+ case Ref: {
228
+ return ndt_equal(t->Ref.type, u->Ref.type);
229
+ }
230
+
231
+ case Constr: {
232
+ return strcmp(t->Constr.name, u->Constr.name) == 0 &&
233
+ ndt_equal(t->Constr.type, u->Constr.type);
234
+ }
235
+
236
+ case Nominal: {
237
+ return strcmp(t->Nominal.name, u->Nominal.name) == 0 &&
238
+ ndt_equal(t->Nominal.type, u->Nominal.type);
239
+ }
240
+
241
+ case Categorical: {
242
+ if (t->Categorical.ntypes != u->Categorical.ntypes) {
243
+ return 0;
244
+ }
245
+
246
+ return categorical_equal(t->Categorical.types, u->Categorical.types,
247
+ t->Categorical.ntypes);
248
+ }
249
+
250
+ case FixedString: {
251
+ return t->FixedString.size == u->FixedString.size &&
252
+ t->FixedString.encoding == u->FixedString.encoding;
253
+ }
254
+
255
+ case FixedBytes: {
256
+ return t->FixedBytes.size == u->FixedBytes.size &&
257
+ t->FixedBytes.align == u->FixedBytes.align;
258
+ }
259
+
260
+ case Bytes: {
261
+ return t->Bytes.target_align == u->Bytes.target_align;
262
+ }
263
+
264
+ case Char: {
265
+ return t->Char.encoding == u->Char.encoding;
266
+ }
267
+
268
+ case Typevar: {
269
+ return strcmp(t->Typevar.name, u->Typevar.name) == 0;
270
+ }
271
+
272
+ case AnyKind:
273
+ case ScalarKind:
274
+ case SignedKind: case UnsignedKind:
275
+ case FloatKind: case ComplexKind:
276
+ case FixedStringKind: case FixedBytesKind:
277
+ case Bool:
278
+ case Int8: case Int16: case Int32: case Int64:
279
+ case Uint8: case Uint16: case Uint32: case Uint64:
280
+ case Float16: case Float32: case Float64:
281
+ case Complex32: case Complex64: case Complex128:
282
+ case String:
283
+ return 1;
284
+ }
285
+
286
+ /* NOT REACHED: tags should be exhaustive. */
287
+ ndt_internal_error("invalid type");
288
+ }
@@ -0,0 +1,3067 @@
1
+ /* A Bison parser, made by GNU Bison 3.0.4. */
2
+
3
+ /* Bison implementation for Yacc-like parsers in C
4
+
5
+ Copyright (C) 1984, 1989-1990, 2000-2015 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.4"
48
+
49
+ /* Skeleton name. */
50
+ #define YYSKELETON_NAME "yacc.c"
51
+
52
+ /* Pure parsers. */
53
+ #define YYPURE 1
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 ndt_yyparse
64
+ #define yylex ndt_yylex
65
+ #define yyerror ndt_yyerror
66
+ #define yydebug ndt_yydebug
67
+ #define yynerrs ndt_yynerrs
68
+
69
+
70
+ /* Copy the first part of user declarations. */
71
+ #line 1 "grammar.y" /* yacc.c:339 */
72
+
73
+ /*
74
+ * BSD 3-Clause License
75
+ *
76
+ * Copyright (c) 2017-2018, plures
77
+ * All rights reserved.
78
+ *
79
+ * Redistribution and use in source and binary forms, with or without
80
+ * modification, are permitted provided that the following conditions are met:
81
+ *
82
+ * 1. Redistributions of source code must retain the above copyright notice,
83
+ * this list of conditions and the following disclaimer.
84
+ *
85
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
86
+ * this list of conditions and the following disclaimer in the documentation
87
+ * and/or other materials provided with the distribution.
88
+ *
89
+ * 3. Neither the name of the copyright holder nor the names of its
90
+ * contributors may be used to endorse or promote products derived from
91
+ * this software without specific prior written permission.
92
+ *
93
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
94
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
95
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
96
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
97
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
98
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
99
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
100
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
101
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
102
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
103
+ */
104
+
105
+
106
+ #include "grammar.h"
107
+
108
+
109
+ void
110
+ yyerror(YYLTYPE *loc, yyscan_t scanner, ndt_t **ast, ndt_meta_t *meta,
111
+ ndt_context_t *ctx, const char *msg)
112
+ {
113
+ (void)scanner;
114
+ (void)ast;
115
+ (void)meta;
116
+
117
+ ndt_err_format(ctx, NDT_ParseError, "%d:%d: %s", loc->first_line,
118
+ loc->first_column, msg);
119
+ }
120
+
121
+ int
122
+ yylex(YYSTYPE *val, YYLTYPE *loc, yyscan_t scanner, ndt_context_t *ctx)
123
+ {
124
+ return ndt_yylexfunc(val, loc, scanner, ctx);
125
+ }
126
+
127
+ #line 128 "grammar.c" /* yacc.c:339 */
128
+
129
+ # ifndef YY_NULLPTR
130
+ # if defined __cplusplus && 201103L <= __cplusplus
131
+ # define YY_NULLPTR nullptr
132
+ # else
133
+ # define YY_NULLPTR 0
134
+ # endif
135
+ # endif
136
+
137
+ /* Enabling verbose error messages. */
138
+ #ifdef YYERROR_VERBOSE
139
+ # undef YYERROR_VERBOSE
140
+ # define YYERROR_VERBOSE 1
141
+ #else
142
+ # define YYERROR_VERBOSE 1
143
+ #endif
144
+
145
+ /* In a future release of Bison, this section will be replaced
146
+ by #include "grammar.h". */
147
+ #ifndef YY_NDT_YY_GRAMMAR_H_INCLUDED
148
+ # define YY_NDT_YY_GRAMMAR_H_INCLUDED
149
+ /* Debug traces. */
150
+ #ifndef YYDEBUG
151
+ # define YYDEBUG 0
152
+ #endif
153
+ #if YYDEBUG
154
+ extern int ndt_yydebug;
155
+ #endif
156
+ /* "%code requires" blocks. */
157
+ #line 57 "grammar.y" /* yacc.c:355 */
158
+
159
+ #include "ndtypes.h"
160
+ #include "seq.h"
161
+ #include "attr.h"
162
+ #include "parsefuncs.h"
163
+ #define YY_TYPEDEF_YY_SCANNER_T
164
+ typedef void * yyscan_t;
165
+
166
+ #line 167 "grammar.c" /* yacc.c:355 */
167
+
168
+ /* Token type. */
169
+ #ifndef YYTOKENTYPE
170
+ # define YYTOKENTYPE
171
+ enum yytokentype
172
+ {
173
+ ENDMARKER = 0,
174
+ ANY_KIND = 258,
175
+ SCALAR_KIND = 259,
176
+ VOID = 260,
177
+ BOOL = 261,
178
+ SIGNED_KIND = 262,
179
+ INT8 = 263,
180
+ INT16 = 264,
181
+ INT32 = 265,
182
+ INT64 = 266,
183
+ UNSIGNED_KIND = 267,
184
+ UINT8 = 268,
185
+ UINT16 = 269,
186
+ UINT32 = 270,
187
+ UINT64 = 271,
188
+ FLOAT_KIND = 272,
189
+ FLOAT16 = 273,
190
+ FLOAT32 = 274,
191
+ FLOAT64 = 275,
192
+ COMPLEX_KIND = 276,
193
+ COMPLEX32 = 277,
194
+ COMPLEX64 = 278,
195
+ COMPLEX128 = 279,
196
+ CATEGORICAL = 280,
197
+ NA = 281,
198
+ INTPTR = 282,
199
+ UINTPTR = 283,
200
+ SIZE = 284,
201
+ CHAR = 285,
202
+ STRING = 286,
203
+ FIXED_STRING_KIND = 287,
204
+ FIXED_STRING = 288,
205
+ BYTES = 289,
206
+ FIXED_BYTES_KIND = 290,
207
+ FIXED_BYTES = 291,
208
+ REF = 292,
209
+ FIXED = 293,
210
+ VAR = 294,
211
+ COMMA = 295,
212
+ COLON = 296,
213
+ LPAREN = 297,
214
+ RPAREN = 298,
215
+ LBRACE = 299,
216
+ RBRACE = 300,
217
+ LBRACK = 301,
218
+ RBRACK = 302,
219
+ STAR = 303,
220
+ ELLIPSIS = 304,
221
+ RARROW = 305,
222
+ EQUAL = 306,
223
+ LESS = 307,
224
+ GREATER = 308,
225
+ QUESTIONMARK = 309,
226
+ BANG = 310,
227
+ AMPERSAND = 311,
228
+ BAR = 312,
229
+ ERRTOKEN = 313,
230
+ INTEGER = 314,
231
+ FLOATNUMBER = 315,
232
+ STRINGLIT = 316,
233
+ NAME_LOWER = 317,
234
+ NAME_UPPER = 318,
235
+ NAME_OTHER = 319
236
+ };
237
+ #endif
238
+
239
+ /* Value type. */
240
+ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
241
+
242
+ union YYSTYPE
243
+ {
244
+ #line 86 "grammar.y" /* yacc.c:355 */
245
+
246
+ ndt_t *ndt;
247
+ ndt_field_t *field;
248
+ ndt_field_seq_t *field_seq;
249
+ ndt_value_t *typed_value;
250
+ ndt_value_seq_t *typed_value_seq;
251
+ ndt_attr_t *attribute;
252
+ ndt_attr_seq_t *attribute_seq;
253
+ enum ndt_variadic variadic_flag;
254
+ enum ndt_encoding encoding;
255
+ uint32_t uint32;
256
+ char *string;
257
+ ndt_string_seq_t *string_seq;
258
+ ndt_type_seq_t *type_seq;
259
+
260
+ #line 261 "grammar.c" /* yacc.c:355 */
261
+ };
262
+
263
+ typedef union YYSTYPE YYSTYPE;
264
+ # define YYSTYPE_IS_TRIVIAL 1
265
+ # define YYSTYPE_IS_DECLARED 1
266
+ #endif
267
+
268
+ /* Location type. */
269
+ #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
270
+ typedef struct YYLTYPE YYLTYPE;
271
+ struct YYLTYPE
272
+ {
273
+ int first_line;
274
+ int first_column;
275
+ int last_line;
276
+ int last_column;
277
+ };
278
+ # define YYLTYPE_IS_DECLARED 1
279
+ # define YYLTYPE_IS_TRIVIAL 1
280
+ #endif
281
+
282
+
283
+
284
+ int ndt_yyparse (yyscan_t scanner, ndt_t **ast, ndt_meta_t *meta, ndt_context_t *ctx);
285
+ /* "%code provides" blocks. */
286
+ #line 66 "grammar.y" /* yacc.c:355 */
287
+
288
+ #define YY_DECL extern int ndt_yylexfunc(YYSTYPE *yylval_param, YYLTYPE *yylloc_param, yyscan_t yyscanner, ndt_context_t *ctx)
289
+ extern int ndt_yylexfunc(YYSTYPE *, YYLTYPE *, yyscan_t, ndt_context_t *);
290
+ void yyerror(YYLTYPE *loc, yyscan_t scanner, ndt_t **ast, ndt_meta_t *meta, ndt_context_t *ctx, const char *msg);
291
+
292
+ #line 293 "grammar.c" /* yacc.c:355 */
293
+
294
+ #endif /* !YY_NDT_YY_GRAMMAR_H_INCLUDED */
295
+
296
+ /* Copy the second part of user declarations. */
297
+
298
+ #line 299 "grammar.c" /* yacc.c:358 */
299
+
300
+ #ifdef short
301
+ # undef short
302
+ #endif
303
+
304
+ #ifdef YYTYPE_UINT8
305
+ typedef YYTYPE_UINT8 yytype_uint8;
306
+ #else
307
+ typedef unsigned char yytype_uint8;
308
+ #endif
309
+
310
+ #ifdef YYTYPE_INT8
311
+ typedef YYTYPE_INT8 yytype_int8;
312
+ #else
313
+ typedef signed char yytype_int8;
314
+ #endif
315
+
316
+ #ifdef YYTYPE_UINT16
317
+ typedef YYTYPE_UINT16 yytype_uint16;
318
+ #else
319
+ typedef unsigned short int yytype_uint16;
320
+ #endif
321
+
322
+ #ifdef YYTYPE_INT16
323
+ typedef YYTYPE_INT16 yytype_int16;
324
+ #else
325
+ typedef short int yytype_int16;
326
+ #endif
327
+
328
+ #ifndef YYSIZE_T
329
+ # ifdef __SIZE_TYPE__
330
+ # define YYSIZE_T __SIZE_TYPE__
331
+ # elif defined size_t
332
+ # define YYSIZE_T size_t
333
+ # elif ! defined YYSIZE_T
334
+ # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
335
+ # define YYSIZE_T size_t
336
+ # else
337
+ # define YYSIZE_T unsigned int
338
+ # endif
339
+ #endif
340
+
341
+ #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
342
+
343
+ #ifndef YY_
344
+ # if defined YYENABLE_NLS && YYENABLE_NLS
345
+ # if ENABLE_NLS
346
+ # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
347
+ # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
348
+ # endif
349
+ # endif
350
+ # ifndef YY_
351
+ # define YY_(Msgid) Msgid
352
+ # endif
353
+ #endif
354
+
355
+ #ifndef YY_ATTRIBUTE
356
+ # if (defined __GNUC__ \
357
+ && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
358
+ || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
359
+ # define YY_ATTRIBUTE(Spec) __attribute__(Spec)
360
+ # else
361
+ # define YY_ATTRIBUTE(Spec) /* empty */
362
+ # endif
363
+ #endif
364
+
365
+ #ifndef YY_ATTRIBUTE_PURE
366
+ # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
367
+ #endif
368
+
369
+ #ifndef YY_ATTRIBUTE_UNUSED
370
+ # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
371
+ #endif
372
+
373
+ #if !defined _Noreturn \
374
+ && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
375
+ # if defined _MSC_VER && 1200 <= _MSC_VER
376
+ # define _Noreturn __declspec (noreturn)
377
+ # else
378
+ # define _Noreturn YY_ATTRIBUTE ((__noreturn__))
379
+ # endif
380
+ #endif
381
+
382
+ /* Suppress unused-variable warnings by "using" E. */
383
+ #if ! defined lint || defined __GNUC__
384
+ # define YYUSE(E) ((void) (E))
385
+ #else
386
+ # define YYUSE(E) /* empty */
387
+ #endif
388
+
389
+ #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
390
+ /* Suppress an incorrect diagnostic about yylval being uninitialized. */
391
+ # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
392
+ _Pragma ("GCC diagnostic push") \
393
+ _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
394
+ _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
395
+ # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
396
+ _Pragma ("GCC diagnostic pop")
397
+ #else
398
+ # define YY_INITIAL_VALUE(Value) Value
399
+ #endif
400
+ #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
401
+ # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
402
+ # define YY_IGNORE_MAYBE_UNINITIALIZED_END
403
+ #endif
404
+ #ifndef YY_INITIAL_VALUE
405
+ # define YY_INITIAL_VALUE(Value) /* Nothing. */
406
+ #endif
407
+
408
+
409
+ #if ! defined yyoverflow || YYERROR_VERBOSE
410
+
411
+ /* The parser invokes alloca or malloc; define the necessary symbols. */
412
+
413
+ # ifdef YYSTACK_USE_ALLOCA
414
+ # if YYSTACK_USE_ALLOCA
415
+ # ifdef __GNUC__
416
+ # define YYSTACK_ALLOC __builtin_alloca
417
+ # elif defined __BUILTIN_VA_ARG_INCR
418
+ # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
419
+ # elif defined _AIX
420
+ # define YYSTACK_ALLOC __alloca
421
+ # elif defined _MSC_VER
422
+ # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
423
+ # define alloca _alloca
424
+ # else
425
+ # define YYSTACK_ALLOC alloca
426
+ # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
427
+ # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
428
+ /* Use EXIT_SUCCESS as a witness for stdlib.h. */
429
+ # ifndef EXIT_SUCCESS
430
+ # define EXIT_SUCCESS 0
431
+ # endif
432
+ # endif
433
+ # endif
434
+ # endif
435
+ # endif
436
+
437
+ # ifdef YYSTACK_ALLOC
438
+ /* Pacify GCC's 'empty if-body' warning. */
439
+ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
440
+ # ifndef YYSTACK_ALLOC_MAXIMUM
441
+ /* The OS might guarantee only one guard page at the bottom of the stack,
442
+ and a page size can be as small as 4096 bytes. So we cannot safely
443
+ invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
444
+ to allow for a few compiler-allocated temporary stack slots. */
445
+ # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
446
+ # endif
447
+ # else
448
+ # define YYSTACK_ALLOC YYMALLOC
449
+ # define YYSTACK_FREE YYFREE
450
+ # ifndef YYSTACK_ALLOC_MAXIMUM
451
+ # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
452
+ # endif
453
+ # if (defined __cplusplus && ! defined EXIT_SUCCESS \
454
+ && ! ((defined YYMALLOC || defined malloc) \
455
+ && (defined YYFREE || defined free)))
456
+ # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
457
+ # ifndef EXIT_SUCCESS
458
+ # define EXIT_SUCCESS 0
459
+ # endif
460
+ # endif
461
+ # ifndef YYMALLOC
462
+ # define YYMALLOC malloc
463
+ # if ! defined malloc && ! defined EXIT_SUCCESS
464
+ void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
465
+ # endif
466
+ # endif
467
+ # ifndef YYFREE
468
+ # define YYFREE free
469
+ # if ! defined free && ! defined EXIT_SUCCESS
470
+ void free (void *); /* INFRINGES ON USER NAME SPACE */
471
+ # endif
472
+ # endif
473
+ # endif
474
+ #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
475
+
476
+
477
+ #if (! defined yyoverflow \
478
+ && (! defined __cplusplus \
479
+ || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
480
+ && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
481
+
482
+ /* A type that is properly aligned for any stack member. */
483
+ union yyalloc
484
+ {
485
+ yytype_int16 yyss_alloc;
486
+ YYSTYPE yyvs_alloc;
487
+ YYLTYPE yyls_alloc;
488
+ };
489
+
490
+ /* The size of the maximum gap between one aligned stack and the next. */
491
+ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
492
+
493
+ /* The size of an array large to enough to hold all stacks, each with
494
+ N elements. */
495
+ # define YYSTACK_BYTES(N) \
496
+ ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
497
+ + 2 * YYSTACK_GAP_MAXIMUM)
498
+
499
+ # define YYCOPY_NEEDED 1
500
+
501
+ /* Relocate STACK from its old location to the new one. The
502
+ local variables YYSIZE and YYSTACKSIZE give the old and new number of
503
+ elements in the stack, and YYPTR gives the new location of the
504
+ stack. Advance YYPTR to a properly aligned location for the next
505
+ stack. */
506
+ # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
507
+ do \
508
+ { \
509
+ YYSIZE_T yynewbytes; \
510
+ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
511
+ Stack = &yyptr->Stack_alloc; \
512
+ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
513
+ yyptr += yynewbytes / sizeof (*yyptr); \
514
+ } \
515
+ while (0)
516
+
517
+ #endif
518
+
519
+ #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
520
+ /* Copy COUNT objects from SRC to DST. The source and destination do
521
+ not overlap. */
522
+ # ifndef YYCOPY
523
+ # if defined __GNUC__ && 1 < __GNUC__
524
+ # define YYCOPY(Dst, Src, Count) \
525
+ __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
526
+ # else
527
+ # define YYCOPY(Dst, Src, Count) \
528
+ do \
529
+ { \
530
+ YYSIZE_T yyi; \
531
+ for (yyi = 0; yyi < (Count); yyi++) \
532
+ (Dst)[yyi] = (Src)[yyi]; \
533
+ } \
534
+ while (0)
535
+ # endif
536
+ # endif
537
+ #endif /* !YYCOPY_NEEDED */
538
+
539
+ /* YYFINAL -- State number of the termination state. */
540
+ #define YYFINAL 97
541
+ /* YYLAST -- Last index in YYTABLE. */
542
+ #define YYLAST 743
543
+
544
+ /* YYNTOKENS -- Number of terminals. */
545
+ #define YYNTOKENS 65
546
+ /* YYNNTS -- Number of nonterminals. */
547
+ #define YYNNTS 44
548
+ /* YYNRULES -- Number of rules. */
549
+ #define YYNRULES 132
550
+ /* YYNSTATES -- Number of states. */
551
+ #define YYNSTATES 220
552
+
553
+ /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
554
+ by yylex, with out-of-bounds checking. */
555
+ #define YYUNDEFTOK 2
556
+ #define YYMAXUTOK 319
557
+
558
+ #define YYTRANSLATE(YYX) \
559
+ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
560
+
561
+ /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
562
+ as returned by yylex, without out-of-bounds checking. */
563
+ static const yytype_uint8 yytranslate[] =
564
+ {
565
+ 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
566
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
567
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
568
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
569
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
570
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
571
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
572
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
573
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
574
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
575
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
576
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
577
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
578
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
579
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
580
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
581
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
582
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
583
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
584
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
585
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
586
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
587
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
588
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
589
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
590
+ 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
591
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
592
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
593
+ 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
594
+ 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
595
+ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
596
+ 55, 56, 57, 58, 59, 60, 61, 62, 63, 64
597
+ };
598
+
599
+ #if YYDEBUG
600
+ /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
601
+ static const yytype_uint16 yyrline[] =
602
+ {
603
+ 0, 198, 198, 202, 203, 204, 208, 209, 210, 211,
604
+ 212, 215, 216, 219, 220, 221, 224, 225, 226, 227,
605
+ 230, 231, 232, 233, 236, 237, 238, 241, 242, 243,
606
+ 244, 245, 246, 247, 248, 251, 254, 255, 256, 257,
607
+ 258, 259, 260, 261, 262, 263, 264, 265, 266, 267,
608
+ 268, 269, 270, 271, 272, 275, 276, 277, 278, 281,
609
+ 282, 283, 284, 287, 288, 289, 292, 293, 294, 298,
610
+ 299, 300, 303, 304, 307, 310, 311, 314, 315, 316,
611
+ 317, 318, 321, 324, 327, 330, 331, 334, 337, 338,
612
+ 341, 342, 343, 344, 347, 348, 351, 352, 353, 356,
613
+ 357, 358, 361, 362, 365, 366, 369, 370, 371, 374,
614
+ 375, 378, 379, 382, 383, 384, 387, 388, 391, 392,
615
+ 395, 396, 399, 400, 403, 404, 405, 406, 409, 412,
616
+ 413, 416, 417
617
+ };
618
+ #endif
619
+
620
+ #if YYDEBUG || YYERROR_VERBOSE || 1
621
+ /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
622
+ First, the terminals, then, starting at YYNTOKENS, nonterminals. */
623
+ static const char *const yytname[] =
624
+ {
625
+ "\"end of file\"", "error", "$undefined", "ANY_KIND", "SCALAR_KIND",
626
+ "VOID", "BOOL", "SIGNED_KIND", "INT8", "INT16", "INT32", "INT64",
627
+ "UNSIGNED_KIND", "UINT8", "UINT16", "UINT32", "UINT64", "FLOAT_KIND",
628
+ "FLOAT16", "FLOAT32", "FLOAT64", "COMPLEX_KIND", "COMPLEX32",
629
+ "COMPLEX64", "COMPLEX128", "CATEGORICAL", "NA", "INTPTR", "UINTPTR",
630
+ "SIZE", "CHAR", "STRING", "FIXED_STRING_KIND", "FIXED_STRING", "BYTES",
631
+ "FIXED_BYTES_KIND", "FIXED_BYTES", "REF", "FIXED", "VAR", "COMMA",
632
+ "COLON", "LPAREN", "RPAREN", "LBRACE", "RBRACE", "LBRACK", "RBRACK",
633
+ "STAR", "ELLIPSIS", "RARROW", "EQUAL", "LESS", "GREATER", "QUESTIONMARK",
634
+ "BANG", "AMPERSAND", "BAR", "ERRTOKEN", "INTEGER", "FLOATNUMBER",
635
+ "STRINGLIT", "NAME_LOWER", "NAME_UPPER", "NAME_OTHER", "$accept",
636
+ "input", "datashape_or_module", "datashape_with_ellipsis",
637
+ "fixed_ellipsis", "datashape", "dimensions", "dimensions_nooption",
638
+ "dimensions_tail", "dtype", "scalar", "signed", "unsigned", "ieee_float",
639
+ "ieee_complex", "alias", "character", "string", "fixed_string",
640
+ "endian_opt", "encoding", "bytes", "fixed_bytes", "ref", "categorical",
641
+ "typed_value_seq", "typed_value", "variadic_flag", "comma_variadic_flag",
642
+ "tuple_type", "tuple_field_seq", "tuple_field", "record_type",
643
+ "record_field_seq", "record_field", "record_field_name", "arguments_opt",
644
+ "attribute_seq", "attribute", "untyped_value_seq", "untyped_value",
645
+ "function_type", "type_seq_or_void", "type_seq", YY_NULLPTR
646
+ };
647
+ #endif
648
+
649
+ # ifdef YYPRINT
650
+ /* YYTOKNUM[NUM] -- (External) token number corresponding to the
651
+ (internal) symbol number NUM (which must be that of a token). */
652
+ static const yytype_uint16 yytoknum[] =
653
+ {
654
+ 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
655
+ 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
656
+ 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
657
+ 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
658
+ 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
659
+ 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
660
+ 315, 316, 317, 318, 319
661
+ };
662
+ # endif
663
+
664
+ #define YYPACT_NINF -192
665
+
666
+ #define yypact_value_is_default(Yystate) \
667
+ (!!((Yystate) == (-192)))
668
+
669
+ #define YYTABLE_NINF -98
670
+
671
+ #define yytable_value_is_error(Yytable_value) \
672
+ 0
673
+
674
+ /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
675
+ STATE-NUM. */
676
+ static const yytype_int16 yypact[] =
677
+ {
678
+ 134, -192, -192, -192, -192, -192, -192, -192, -16, 5,
679
+ -192, -192, 14, 23, -192, 27, 32, 36, -22, 191,
680
+ 52, 34, -192, -192, -192, 594, -9, 423, -192, 39,
681
+ -192, -27, 96, 100, 111, -192, -192, -192, -192, -192,
682
+ -192, -192, -192, -192, -192, -192, -192, -192, -192, 75,
683
+ -192, -192, -192, -192, -192, -192, -192, 67, 79, -20,
684
+ 63, 76, 64, -192, 64, 423, 64, 80, 92, 23,
685
+ -192, 81, 90, 110, 122, -192, -192, -192, -192, 129,
686
+ 135, -192, 136, 480, 25, -192, -192, -15, -11, -192,
687
+ -192, 480, 138, 537, -21, 480, 144, -192, -192, -192,
688
+ -192, -192, -192, -192, -192, -192, -192, -192, -192, -192,
689
+ -192, -192, -192, -192, -192, -192, -192, 252, 366, -192,
690
+ -192, -192, -192, 109, -192, -192, 157, 118, 154, 120,
691
+ -192, 141, 164, 159, 637, 480, -9, 64, -192, 309,
692
+ 167, -192, 69, 168, 423, 594, -192, -192, -192, 163,
693
+ -192, 366, 154, 171, 161, 108, 170, 172, -192, 480,
694
+ 13, -192, -192, -192, -20, -192, -192, 63, -192, 46,
695
+ 64, -192, -192, -192, 183, 680, 173, -192, -192, -8,
696
+ -192, -192, 166, -192, 154, -192, -29, -192, 175, -192,
697
+ -192, -192, -192, -192, -192, -192, -192, 177, 83, -192,
698
+ -192, -192, -192, -192, -192, 480, -192, -192, -192, -192,
699
+ 64, -192, 17, -192, -192, -4, 83, -192, -192, -192
700
+ };
701
+
702
+ /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
703
+ Performed when YYTABLE does not specify something else to do. Zero
704
+ means the default is an error. */
705
+ static const yytype_uint8 yydefact[] =
706
+ {
707
+ 77, 27, 28, 130, 37, 39, 41, 43, 0, 72,
708
+ 74, 48, 0, 116, 51, 0, 0, 0, 116, 77,
709
+ 94, 0, 78, 79, 80, 77, 0, 77, 81, 0,
710
+ 32, 35, 0, 0, 131, 7, 6, 13, 16, 14,
711
+ 29, 38, 40, 42, 44, 45, 46, 47, 49, 0,
712
+ 50, 52, 54, 53, 30, 31, 4, 0, 129, 0,
713
+ 0, 0, 0, 83, 0, 77, 0, 0, 0, 116,
714
+ 95, 35, 104, 0, 96, 102, 113, 114, 115, 0,
715
+ 96, 109, 0, 77, 35, 17, 15, 0, 0, 19,
716
+ 86, 77, 0, 77, 0, 77, 0, 1, 2, 36,
717
+ 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
718
+ 65, 66, 67, 68, 69, 70, 71, 77, 77, 93,
719
+ 90, 91, 92, 0, 88, 82, 0, 0, 0, 0,
720
+ 118, 0, 0, 0, 77, 77, 0, 0, 99, 77,
721
+ 0, 106, 97, 0, 77, 77, 26, 11, 24, 0,
722
+ 20, 77, 32, 0, 0, 0, 0, 0, 22, 77,
723
+ 35, 131, 128, 132, 0, 87, 73, 0, 75, 0,
724
+ 0, 117, 84, 85, 0, 77, 35, 9, 23, 0,
725
+ 98, 103, 0, 100, 113, 110, 0, 107, 111, 25,
726
+ 5, 33, 34, 8, 18, 12, 89, 0, 0, 125,
727
+ 126, 127, 124, 120, 119, 77, 10, 105, 101, 108,
728
+ 0, 76, 0, 122, 21, 0, 0, 121, 112, 123
729
+ };
730
+
731
+ /* YYPGOTO[NTERM-NUM]. */
732
+ static const yytype_int16 yypgoto[] =
733
+ {
734
+ -192, -192, -192, -108, 124, -14, -23, -24, -83, -25,
735
+ -192, -192, -192, -192, -192, -192, -192, -192, -192, -192,
736
+ 70, -192, -192, -192, -192, -192, 72, 218, 169, -192,
737
+ -192, 102, -192, -192, 97, -192, 238, -62, 82, -192,
738
+ -191, -192, 143, -192
739
+ };
740
+
741
+ /* YYDEFGOTO[NTERM-NUM]. */
742
+ static const yytype_int16 yydefgoto[] =
743
+ {
744
+ -1, 32, 33, 34, 35, 36, 37, 38, 147, 39,
745
+ 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
746
+ 126, 50, 51, 52, 53, 123, 124, 73, 140, 54,
747
+ 74, 75, 55, 80, 81, 82, 68, 129, 130, 212,
748
+ 203, 56, 57, 58
749
+ };
750
+
751
+ /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
752
+ positive, shift that token. If negative, reduce the rule whose
753
+ number is the opposite. If YYTABLE_NINF, syntax error. */
754
+ static const yytype_int16 yytable[] =
755
+ {
756
+ 86, 85, 131, 89, 133, 72, 119, 213, 150, 161,
757
+ 163, 170, 158, 90, 92, 93, 209, 17, 69, 94,
758
+ 62, 95, 96, 17, 69, 219, 59, 67, 21, 17,
759
+ 69, 154, 170, 87, 26, 136, 170, 95, 29, 120,
760
+ 121, 122, 155, 190, 29, 87, 26, 60, 149, 207,
761
+ 29, 132, 178, 218, 88, 93, 61, 216, 148, 94,
762
+ 146, 95, 96, 85, 217, 62, 148, 93, 146, 64,
763
+ 148, 157, 146, 95, 65, 179, 195, 182, 66, 153,
764
+ 186, 99, 83, 100, 101, 102, 103, 91, 104, 105,
765
+ 106, 107, 198, 108, 109, 110, 97, 111, 112, 113,
766
+ 98, 70, 114, 115, 116, 199, 200, 201, 202, 177,
767
+ 148, -3, 146, 157, 76, 77, 78, 117, 180, 118,
768
+ 189, 85, 214, 93, 125, 72, 128, 136, 134, 95,
769
+ 188, 184, 77, 78, 148, 127, 146, 1, 2, 3,
770
+ 135, 4, 199, 200, 201, 202, 5, 137, 215, 164,
771
+ 206, 6, 165, 138, 136, 7, 95, 96, 167, 8,
772
+ 170, 168, 139, 171, 9, 10, 11, 12, 13, 14,
773
+ 15, 16, 17, 18, 141, 142, 19, 144, 20, 151,
774
+ 148, 170, 146, 21, 172, 22, 23, 24, 25, 26,
775
+ 27, 28, 159, 29, 1, 2, 30, 31, 4, 170,
776
+ 166, 170, 174, 5, 192, 169, 170, 173, 6, 208,
777
+ 183, 95, 7, 187, 191, 93, 8, 193, 156, 194,
778
+ 211, 9, 10, 11, 12, 13, 14, 15, 16, 17,
779
+ 69, 205, 210, 19, -94, 20, 196, 197, 79, 185,
780
+ 70, 181, 22, 23, 24, 25, 26, 27, 28, 143,
781
+ 29, 63, 204, 30, 71, 1, 2, 3, 0, 4,
782
+ 162, 0, 0, 0, 5, 0, 0, 0, 0, 6,
783
+ 0, 0, 0, 7, 0, 0, 0, 8, 0, 0,
784
+ 0, 0, 9, 10, 11, 12, 13, 14, 15, 16,
785
+ 17, 18, 0, 0, 19, 0, 20, 0, 0, 0,
786
+ 0, 21, 0, 22, 23, 24, 25, 26, 27, 28,
787
+ 0, 29, 1, 2, 30, 160, 4, 0, 0, 0,
788
+ 0, 5, 0, 0, 0, 0, 6, 0, 0, 0,
789
+ 7, 0, 0, 0, 8, 0, 0, 0, 0, 9,
790
+ 10, 11, 12, 13, 14, 15, 16, 17, 69, 0,
791
+ 0, 19, -97, 20, 0, 0, 0, 0, 180, 0,
792
+ 22, 23, 24, 25, 26, 27, 28, 0, 29, 1,
793
+ 2, 152, 71, 4, 0, 0, 0, 0, 5, 0,
794
+ 0, 0, 0, 6, 0, 0, 0, 7, 0, 0,
795
+ 0, 8, 0, 0, 0, 0, 9, 10, 11, 12,
796
+ 13, 14, 15, 16, 17, 18, 0, 0, 19, 0,
797
+ 20, 0, 0, 0, 0, 21, 0, 22, 23, 24,
798
+ 25, 26, 27, 28, 0, 29, 1, 2, 30, 160,
799
+ 4, 0, 0, 0, 0, 5, 0, 0, 0, 0,
800
+ 6, 0, 0, 0, 7, 0, 0, 0, 8, 0,
801
+ 0, 0, 0, 9, 10, 11, 12, 13, 14, 15,
802
+ 16, 17, 69, 0, 0, 19, 0, 20, 0, 0,
803
+ 0, 0, 0, 0, 22, 23, 24, 25, 26, 27,
804
+ 28, 0, 29, 1, 2, 30, 71, 4, 0, 0,
805
+ 0, 0, 5, 0, 0, 0, 0, 6, 0, 0,
806
+ 0, 7, 0, 0, 0, 8, 0, 0, 0, 0,
807
+ 9, 10, 11, 12, 13, 14, 15, 16, 17, 69,
808
+ 0, 0, 19, 0, 20, 0, 0, 0, 0, 0,
809
+ 0, 22, 23, 24, 145, 26, 27, 28, 0, 29,
810
+ 1, 2, 30, 71, 4, 0, 0, 0, 0, 5,
811
+ 0, 0, 0, 0, 6, 0, 0, 0, 7, 0,
812
+ 0, 0, 8, 0, 0, 0, 0, 9, 10, 11,
813
+ 12, 13, 14, 15, 16, 17, 69, 0, 0, 19,
814
+ 0, 20, 0, 0, 0, 0, 0, 0, 22, 23,
815
+ 24, 25, 26, 27, 28, 0, 29, 1, 2, 152,
816
+ 71, 4, 0, 0, 0, 0, 5, 0, 0, 0,
817
+ 0, 6, 0, 0, 0, 7, 0, 0, 0, 8,
818
+ 0, 0, 0, 0, 9, 10, 11, 12, 13, 14,
819
+ 15, 16, 17, 69, 0, 0, 19, 0, 20, 0,
820
+ 1, 2, 0, 0, 4, 22, 23, 24, 0, 5,
821
+ 27, 28, 0, 29, 6, 0, 30, 84, 7, 0,
822
+ 0, 0, 8, 0, 0, 0, 0, 9, 10, 11,
823
+ 12, 13, 14, 15, 16, 0, 0, 0, 0, 19,
824
+ 0, 20, 0, 1, 2, 0, 0, 4, 22, 23,
825
+ 24, 175, 5, 27, 28, 0, 0, 6, 0, 30,
826
+ 176, 7, 0, 0, 0, 8, 0, 0, 0, 0,
827
+ 9, 10, 11, 12, 13, 14, 15, 16, 0, 0,
828
+ 0, 0, 19, 0, 20, 0, 0, 0, 0, 0,
829
+ 0, 22, 23, 24, 0, 0, 27, 28, 0, 0,
830
+ 0, 0, 30, 176
831
+ };
832
+
833
+ static const yytype_int16 yycheck[] =
834
+ {
835
+ 25, 25, 64, 26, 66, 19, 26, 198, 91, 117,
836
+ 118, 40, 95, 27, 41, 42, 45, 38, 39, 46,
837
+ 42, 48, 49, 38, 39, 216, 42, 49, 49, 38,
838
+ 39, 93, 40, 54, 55, 46, 40, 48, 59, 59,
839
+ 60, 61, 63, 151, 59, 54, 55, 42, 63, 57,
840
+ 59, 65, 135, 57, 63, 42, 42, 40, 83, 46,
841
+ 83, 48, 49, 87, 47, 42, 91, 42, 91, 42,
842
+ 95, 94, 95, 48, 42, 137, 159, 139, 42, 93,
843
+ 142, 6, 48, 8, 9, 10, 11, 48, 13, 14,
844
+ 15, 16, 46, 18, 19, 20, 0, 22, 23, 24,
845
+ 0, 49, 27, 28, 29, 59, 60, 61, 62, 134,
846
+ 135, 0, 135, 136, 62, 63, 64, 50, 49, 40,
847
+ 145, 145, 205, 42, 61, 139, 62, 46, 48, 48,
848
+ 144, 62, 63, 64, 159, 59, 159, 3, 4, 5,
849
+ 48, 7, 59, 60, 61, 62, 12, 57, 210, 40,
850
+ 175, 17, 43, 43, 46, 21, 48, 49, 40, 25,
851
+ 40, 43, 40, 43, 30, 31, 32, 33, 34, 35,
852
+ 36, 37, 38, 39, 45, 40, 42, 41, 44, 41,
853
+ 205, 40, 205, 49, 43, 51, 52, 53, 54, 55,
854
+ 56, 57, 48, 59, 3, 4, 62, 63, 7, 40,
855
+ 43, 40, 43, 12, 43, 51, 40, 43, 17, 43,
856
+ 43, 48, 21, 45, 43, 42, 25, 47, 94, 47,
857
+ 43, 30, 31, 32, 33, 34, 35, 36, 37, 38,
858
+ 39, 48, 57, 42, 43, 44, 164, 167, 20, 142,
859
+ 49, 139, 51, 52, 53, 54, 55, 56, 57, 80,
860
+ 59, 13, 170, 62, 63, 3, 4, 5, -1, 7,
861
+ 117, -1, -1, -1, 12, -1, -1, -1, -1, 17,
862
+ -1, -1, -1, 21, -1, -1, -1, 25, -1, -1,
863
+ -1, -1, 30, 31, 32, 33, 34, 35, 36, 37,
864
+ 38, 39, -1, -1, 42, -1, 44, -1, -1, -1,
865
+ -1, 49, -1, 51, 52, 53, 54, 55, 56, 57,
866
+ -1, 59, 3, 4, 62, 63, 7, -1, -1, -1,
867
+ -1, 12, -1, -1, -1, -1, 17, -1, -1, -1,
868
+ 21, -1, -1, -1, 25, -1, -1, -1, -1, 30,
869
+ 31, 32, 33, 34, 35, 36, 37, 38, 39, -1,
870
+ -1, 42, 43, 44, -1, -1, -1, -1, 49, -1,
871
+ 51, 52, 53, 54, 55, 56, 57, -1, 59, 3,
872
+ 4, 62, 63, 7, -1, -1, -1, -1, 12, -1,
873
+ -1, -1, -1, 17, -1, -1, -1, 21, -1, -1,
874
+ -1, 25, -1, -1, -1, -1, 30, 31, 32, 33,
875
+ 34, 35, 36, 37, 38, 39, -1, -1, 42, -1,
876
+ 44, -1, -1, -1, -1, 49, -1, 51, 52, 53,
877
+ 54, 55, 56, 57, -1, 59, 3, 4, 62, 63,
878
+ 7, -1, -1, -1, -1, 12, -1, -1, -1, -1,
879
+ 17, -1, -1, -1, 21, -1, -1, -1, 25, -1,
880
+ -1, -1, -1, 30, 31, 32, 33, 34, 35, 36,
881
+ 37, 38, 39, -1, -1, 42, -1, 44, -1, -1,
882
+ -1, -1, -1, -1, 51, 52, 53, 54, 55, 56,
883
+ 57, -1, 59, 3, 4, 62, 63, 7, -1, -1,
884
+ -1, -1, 12, -1, -1, -1, -1, 17, -1, -1,
885
+ -1, 21, -1, -1, -1, 25, -1, -1, -1, -1,
886
+ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
887
+ -1, -1, 42, -1, 44, -1, -1, -1, -1, -1,
888
+ -1, 51, 52, 53, 54, 55, 56, 57, -1, 59,
889
+ 3, 4, 62, 63, 7, -1, -1, -1, -1, 12,
890
+ -1, -1, -1, -1, 17, -1, -1, -1, 21, -1,
891
+ -1, -1, 25, -1, -1, -1, -1, 30, 31, 32,
892
+ 33, 34, 35, 36, 37, 38, 39, -1, -1, 42,
893
+ -1, 44, -1, -1, -1, -1, -1, -1, 51, 52,
894
+ 53, 54, 55, 56, 57, -1, 59, 3, 4, 62,
895
+ 63, 7, -1, -1, -1, -1, 12, -1, -1, -1,
896
+ -1, 17, -1, -1, -1, 21, -1, -1, -1, 25,
897
+ -1, -1, -1, -1, 30, 31, 32, 33, 34, 35,
898
+ 36, 37, 38, 39, -1, -1, 42, -1, 44, -1,
899
+ 3, 4, -1, -1, 7, 51, 52, 53, -1, 12,
900
+ 56, 57, -1, 59, 17, -1, 62, 63, 21, -1,
901
+ -1, -1, 25, -1, -1, -1, -1, 30, 31, 32,
902
+ 33, 34, 35, 36, 37, -1, -1, -1, -1, 42,
903
+ -1, 44, -1, 3, 4, -1, -1, 7, 51, 52,
904
+ 53, 54, 12, 56, 57, -1, -1, 17, -1, 62,
905
+ 63, 21, -1, -1, -1, 25, -1, -1, -1, -1,
906
+ 30, 31, 32, 33, 34, 35, 36, 37, -1, -1,
907
+ -1, -1, 42, -1, 44, -1, -1, -1, -1, -1,
908
+ -1, 51, 52, 53, -1, -1, 56, 57, -1, -1,
909
+ -1, -1, 62, 63
910
+ };
911
+
912
+ /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
913
+ symbol of state STATE-NUM. */
914
+ static const yytype_uint8 yystos[] =
915
+ {
916
+ 0, 3, 4, 5, 7, 12, 17, 21, 25, 30,
917
+ 31, 32, 33, 34, 35, 36, 37, 38, 39, 42,
918
+ 44, 49, 51, 52, 53, 54, 55, 56, 57, 59,
919
+ 62, 63, 66, 67, 68, 69, 70, 71, 72, 74,
920
+ 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
921
+ 86, 87, 88, 89, 94, 97, 106, 107, 108, 42,
922
+ 42, 42, 42, 101, 42, 42, 42, 49, 101, 39,
923
+ 49, 63, 70, 92, 95, 96, 62, 63, 64, 92,
924
+ 98, 99, 100, 48, 63, 72, 74, 54, 63, 71,
925
+ 70, 48, 41, 42, 46, 48, 49, 0, 0, 6,
926
+ 8, 9, 10, 11, 13, 14, 15, 16, 18, 19,
927
+ 20, 22, 23, 24, 27, 28, 29, 50, 40, 26,
928
+ 59, 60, 61, 90, 91, 61, 85, 59, 62, 102,
929
+ 103, 102, 70, 102, 48, 48, 46, 57, 43, 40,
930
+ 93, 45, 40, 93, 41, 54, 71, 73, 74, 63,
931
+ 73, 41, 62, 70, 102, 63, 69, 71, 73, 48,
932
+ 63, 68, 107, 68, 40, 43, 43, 40, 43, 51,
933
+ 40, 43, 43, 43, 43, 54, 63, 74, 73, 102,
934
+ 49, 96, 102, 43, 62, 99, 102, 45, 70, 74,
935
+ 68, 43, 43, 47, 47, 73, 91, 85, 46, 59,
936
+ 60, 61, 62, 105, 103, 48, 74, 57, 43, 45,
937
+ 57, 43, 104, 105, 73, 102, 40, 47, 57, 105
938
+ };
939
+
940
+ /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
941
+ static const yytype_uint8 yyr1[] =
942
+ {
943
+ 0, 65, 66, 67, 67, 67, 68, 68, 68, 68,
944
+ 68, 69, 69, 70, 70, 70, 71, 71, 71, 71,
945
+ 72, 72, 72, 72, 73, 73, 73, 74, 74, 74,
946
+ 74, 74, 74, 74, 74, 74, 75, 75, 75, 75,
947
+ 75, 75, 75, 75, 75, 75, 75, 75, 75, 75,
948
+ 75, 75, 75, 75, 75, 76, 76, 76, 76, 77,
949
+ 77, 77, 77, 78, 78, 78, 79, 79, 79, 80,
950
+ 80, 80, 81, 81, 82, 83, 83, 84, 84, 84,
951
+ 84, 84, 85, 86, 87, 88, 88, 89, 90, 90,
952
+ 91, 91, 91, 91, 92, 92, 93, 93, 93, 94,
953
+ 94, 94, 95, 95, 96, 96, 97, 97, 97, 98,
954
+ 98, 99, 99, 100, 100, 100, 101, 101, 102, 102,
955
+ 103, 103, 104, 104, 105, 105, 105, 105, 106, 107,
956
+ 107, 108, 108
957
+ };
958
+
959
+ /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
960
+ static const yytype_uint8 yyr2[] =
961
+ {
962
+ 0, 2, 2, 1, 1, 4, 1, 1, 4, 4,
963
+ 5, 3, 4, 1, 1, 2, 1, 2, 4, 2,
964
+ 3, 6, 3, 4, 1, 2, 1, 1, 1, 1,
965
+ 1, 1, 1, 4, 4, 1, 2, 1, 1, 1,
966
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
967
+ 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
968
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
969
+ 2, 2, 1, 4, 1, 4, 6, 0, 1, 1,
970
+ 1, 1, 1, 2, 4, 4, 2, 4, 1, 3,
971
+ 1, 1, 1, 1, 0, 1, 0, 1, 2, 3,
972
+ 4, 5, 1, 3, 1, 4, 3, 4, 5, 1,
973
+ 3, 3, 6, 1, 1, 1, 0, 3, 1, 3,
974
+ 3, 5, 1, 3, 1, 1, 1, 1, 3, 1,
975
+ 1, 1, 3
976
+ };
977
+
978
+
979
+ #define yyerrok (yyerrstatus = 0)
980
+ #define yyclearin (yychar = YYEMPTY)
981
+ #define YYEMPTY (-2)
982
+ #define YYEOF 0
983
+
984
+ #define YYACCEPT goto yyacceptlab
985
+ #define YYABORT goto yyabortlab
986
+ #define YYERROR goto yyerrorlab
987
+
988
+
989
+ #define YYRECOVERING() (!!yyerrstatus)
990
+
991
+ #define YYBACKUP(Token, Value) \
992
+ do \
993
+ if (yychar == YYEMPTY) \
994
+ { \
995
+ yychar = (Token); \
996
+ yylval = (Value); \
997
+ YYPOPSTACK (yylen); \
998
+ yystate = *yyssp; \
999
+ goto yybackup; \
1000
+ } \
1001
+ else \
1002
+ { \
1003
+ yyerror (&yylloc, scanner, ast, meta, ctx, YY_("syntax error: cannot back up")); \
1004
+ YYERROR; \
1005
+ } \
1006
+ while (0)
1007
+
1008
+ /* Error token number */
1009
+ #define YYTERROR 1
1010
+ #define YYERRCODE 256
1011
+
1012
+
1013
+ /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
1014
+ If N is 0, then set CURRENT to the empty location which ends
1015
+ the previous symbol: RHS[0] (always defined). */
1016
+
1017
+ #ifndef YYLLOC_DEFAULT
1018
+ # define YYLLOC_DEFAULT(Current, Rhs, N) \
1019
+ do \
1020
+ if (N) \
1021
+ { \
1022
+ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
1023
+ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
1024
+ (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
1025
+ (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
1026
+ } \
1027
+ else \
1028
+ { \
1029
+ (Current).first_line = (Current).last_line = \
1030
+ YYRHSLOC (Rhs, 0).last_line; \
1031
+ (Current).first_column = (Current).last_column = \
1032
+ YYRHSLOC (Rhs, 0).last_column; \
1033
+ } \
1034
+ while (0)
1035
+ #endif
1036
+
1037
+ #define YYRHSLOC(Rhs, K) ((Rhs)[K])
1038
+
1039
+
1040
+ /* Enable debugging if requested. */
1041
+ #if YYDEBUG
1042
+
1043
+ # ifndef YYFPRINTF
1044
+ # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1045
+ # define YYFPRINTF fprintf
1046
+ # endif
1047
+
1048
+ # define YYDPRINTF(Args) \
1049
+ do { \
1050
+ if (yydebug) \
1051
+ YYFPRINTF Args; \
1052
+ } while (0)
1053
+
1054
+
1055
+ /* YY_LOCATION_PRINT -- Print the location on the stream.
1056
+ This macro was not mandated originally: define only if we know
1057
+ we won't break user code: when these are the locations we know. */
1058
+
1059
+ #ifndef YY_LOCATION_PRINT
1060
+ # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
1061
+
1062
+ /* Print *YYLOCP on YYO. Private, do not rely on its existence. */
1063
+
1064
+ YY_ATTRIBUTE_UNUSED
1065
+ static unsigned
1066
+ yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
1067
+ {
1068
+ unsigned res = 0;
1069
+ int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
1070
+ if (0 <= yylocp->first_line)
1071
+ {
1072
+ res += YYFPRINTF (yyo, "%d", yylocp->first_line);
1073
+ if (0 <= yylocp->first_column)
1074
+ res += YYFPRINTF (yyo, ".%d", yylocp->first_column);
1075
+ }
1076
+ if (0 <= yylocp->last_line)
1077
+ {
1078
+ if (yylocp->first_line < yylocp->last_line)
1079
+ {
1080
+ res += YYFPRINTF (yyo, "-%d", yylocp->last_line);
1081
+ if (0 <= end_col)
1082
+ res += YYFPRINTF (yyo, ".%d", end_col);
1083
+ }
1084
+ else if (0 <= end_col && yylocp->first_column < end_col)
1085
+ res += YYFPRINTF (yyo, "-%d", end_col);
1086
+ }
1087
+ return res;
1088
+ }
1089
+
1090
+ # define YY_LOCATION_PRINT(File, Loc) \
1091
+ yy_location_print_ (File, &(Loc))
1092
+
1093
+ # else
1094
+ # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1095
+ # endif
1096
+ #endif
1097
+
1098
+
1099
+ # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
1100
+ do { \
1101
+ if (yydebug) \
1102
+ { \
1103
+ YYFPRINTF (stderr, "%s ", Title); \
1104
+ yy_symbol_print (stderr, \
1105
+ Type, Value, Location, scanner, ast, meta, ctx); \
1106
+ YYFPRINTF (stderr, "\n"); \
1107
+ } \
1108
+ } while (0)
1109
+
1110
+
1111
+ /*----------------------------------------.
1112
+ | Print this symbol's value on YYOUTPUT. |
1113
+ `----------------------------------------*/
1114
+
1115
+ static void
1116
+ yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, yyscan_t scanner, ndt_t **ast, ndt_meta_t *meta, ndt_context_t *ctx)
1117
+ {
1118
+ FILE *yyo = yyoutput;
1119
+ YYUSE (yyo);
1120
+ YYUSE (yylocationp);
1121
+ YYUSE (scanner);
1122
+ YYUSE (ast);
1123
+ YYUSE (meta);
1124
+ YYUSE (ctx);
1125
+ if (!yyvaluep)
1126
+ return;
1127
+ # ifdef YYPRINT
1128
+ if (yytype < YYNTOKENS)
1129
+ YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1130
+ # endif
1131
+ YYUSE (yytype);
1132
+ }
1133
+
1134
+
1135
+ /*--------------------------------.
1136
+ | Print this symbol on YYOUTPUT. |
1137
+ `--------------------------------*/
1138
+
1139
+ static void
1140
+ yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, yyscan_t scanner, ndt_t **ast, ndt_meta_t *meta, ndt_context_t *ctx)
1141
+ {
1142
+ YYFPRINTF (yyoutput, "%s %s (",
1143
+ yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
1144
+
1145
+ YY_LOCATION_PRINT (yyoutput, *yylocationp);
1146
+ YYFPRINTF (yyoutput, ": ");
1147
+ yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, scanner, ast, meta, ctx);
1148
+ YYFPRINTF (yyoutput, ")");
1149
+ }
1150
+
1151
+ /*------------------------------------------------------------------.
1152
+ | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1153
+ | TOP (included). |
1154
+ `------------------------------------------------------------------*/
1155
+
1156
+ static void
1157
+ yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
1158
+ {
1159
+ YYFPRINTF (stderr, "Stack now");
1160
+ for (; yybottom <= yytop; yybottom++)
1161
+ {
1162
+ int yybot = *yybottom;
1163
+ YYFPRINTF (stderr, " %d", yybot);
1164
+ }
1165
+ YYFPRINTF (stderr, "\n");
1166
+ }
1167
+
1168
+ # define YY_STACK_PRINT(Bottom, Top) \
1169
+ do { \
1170
+ if (yydebug) \
1171
+ yy_stack_print ((Bottom), (Top)); \
1172
+ } while (0)
1173
+
1174
+
1175
+ /*------------------------------------------------.
1176
+ | Report that the YYRULE is going to be reduced. |
1177
+ `------------------------------------------------*/
1178
+
1179
+ static void
1180
+ yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, yyscan_t scanner, ndt_t **ast, ndt_meta_t *meta, ndt_context_t *ctx)
1181
+ {
1182
+ unsigned long int yylno = yyrline[yyrule];
1183
+ int yynrhs = yyr2[yyrule];
1184
+ int yyi;
1185
+ YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1186
+ yyrule - 1, yylno);
1187
+ /* The symbols being reduced. */
1188
+ for (yyi = 0; yyi < yynrhs; yyi++)
1189
+ {
1190
+ YYFPRINTF (stderr, " $%d = ", yyi + 1);
1191
+ yy_symbol_print (stderr,
1192
+ yystos[yyssp[yyi + 1 - yynrhs]],
1193
+ &(yyvsp[(yyi + 1) - (yynrhs)])
1194
+ , &(yylsp[(yyi + 1) - (yynrhs)]) , scanner, ast, meta, ctx);
1195
+ YYFPRINTF (stderr, "\n");
1196
+ }
1197
+ }
1198
+
1199
+ # define YY_REDUCE_PRINT(Rule) \
1200
+ do { \
1201
+ if (yydebug) \
1202
+ yy_reduce_print (yyssp, yyvsp, yylsp, Rule, scanner, ast, meta, ctx); \
1203
+ } while (0)
1204
+
1205
+ /* Nonzero means print parse trace. It is left uninitialized so that
1206
+ multiple parsers can coexist. */
1207
+ int yydebug;
1208
+ #else /* !YYDEBUG */
1209
+ # define YYDPRINTF(Args)
1210
+ # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1211
+ # define YY_STACK_PRINT(Bottom, Top)
1212
+ # define YY_REDUCE_PRINT(Rule)
1213
+ #endif /* !YYDEBUG */
1214
+
1215
+
1216
+ /* YYINITDEPTH -- initial size of the parser's stacks. */
1217
+ #ifndef YYINITDEPTH
1218
+ # define YYINITDEPTH 200
1219
+ #endif
1220
+
1221
+ /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1222
+ if the built-in stack extension method is used).
1223
+
1224
+ Do not make this value too large; the results are undefined if
1225
+ YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1226
+ evaluated with infinite-precision integer arithmetic. */
1227
+
1228
+ #ifndef YYMAXDEPTH
1229
+ # define YYMAXDEPTH 10000
1230
+ #endif
1231
+
1232
+
1233
+ #if YYERROR_VERBOSE
1234
+
1235
+ # ifndef yystrlen
1236
+ # if defined __GLIBC__ && defined _STRING_H
1237
+ # define yystrlen strlen
1238
+ # else
1239
+ /* Return the length of YYSTR. */
1240
+ static YYSIZE_T
1241
+ yystrlen (const char *yystr)
1242
+ {
1243
+ YYSIZE_T yylen;
1244
+ for (yylen = 0; yystr[yylen]; yylen++)
1245
+ continue;
1246
+ return yylen;
1247
+ }
1248
+ # endif
1249
+ # endif
1250
+
1251
+ # ifndef yystpcpy
1252
+ # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1253
+ # define yystpcpy stpcpy
1254
+ # else
1255
+ /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1256
+ YYDEST. */
1257
+ static char *
1258
+ yystpcpy (char *yydest, const char *yysrc)
1259
+ {
1260
+ char *yyd = yydest;
1261
+ const char *yys = yysrc;
1262
+
1263
+ while ((*yyd++ = *yys++) != '\0')
1264
+ continue;
1265
+
1266
+ return yyd - 1;
1267
+ }
1268
+ # endif
1269
+ # endif
1270
+
1271
+ # ifndef yytnamerr
1272
+ /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1273
+ quotes and backslashes, so that it's suitable for yyerror. The
1274
+ heuristic is that double-quoting is unnecessary unless the string
1275
+ contains an apostrophe, a comma, or backslash (other than
1276
+ backslash-backslash). YYSTR is taken from yytname. If YYRES is
1277
+ null, do not copy; instead, return the length of what the result
1278
+ would have been. */
1279
+ static YYSIZE_T
1280
+ yytnamerr (char *yyres, const char *yystr)
1281
+ {
1282
+ if (*yystr == '"')
1283
+ {
1284
+ YYSIZE_T yyn = 0;
1285
+ char const *yyp = yystr;
1286
+
1287
+ for (;;)
1288
+ switch (*++yyp)
1289
+ {
1290
+ case '\'':
1291
+ case ',':
1292
+ goto do_not_strip_quotes;
1293
+
1294
+ case '\\':
1295
+ if (*++yyp != '\\')
1296
+ goto do_not_strip_quotes;
1297
+ /* Fall through. */
1298
+ default:
1299
+ if (yyres)
1300
+ yyres[yyn] = *yyp;
1301
+ yyn++;
1302
+ break;
1303
+
1304
+ case '"':
1305
+ if (yyres)
1306
+ yyres[yyn] = '\0';
1307
+ return yyn;
1308
+ }
1309
+ do_not_strip_quotes: ;
1310
+ }
1311
+
1312
+ if (! yyres)
1313
+ return yystrlen (yystr);
1314
+
1315
+ return yystpcpy (yyres, yystr) - yyres;
1316
+ }
1317
+ # endif
1318
+
1319
+ /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1320
+ about the unexpected token YYTOKEN for the state stack whose top is
1321
+ YYSSP.
1322
+
1323
+ Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1324
+ not large enough to hold the message. In that case, also set
1325
+ *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1326
+ required number of bytes is too large to store. */
1327
+ static int
1328
+ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1329
+ yytype_int16 *yyssp, int yytoken)
1330
+ {
1331
+ YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
1332
+ YYSIZE_T yysize = yysize0;
1333
+ enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1334
+ /* Internationalized format string. */
1335
+ const char *yyformat = YY_NULLPTR;
1336
+ /* Arguments of yyformat. */
1337
+ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1338
+ /* Number of reported tokens (one for the "unexpected", one per
1339
+ "expected"). */
1340
+ int yycount = 0;
1341
+
1342
+ /* There are many possibilities here to consider:
1343
+ - If this state is a consistent state with a default action, then
1344
+ the only way this function was invoked is if the default action
1345
+ is an error action. In that case, don't check for expected
1346
+ tokens because there are none.
1347
+ - The only way there can be no lookahead present (in yychar) is if
1348
+ this state is a consistent state with a default action. Thus,
1349
+ detecting the absence of a lookahead is sufficient to determine
1350
+ that there is no unexpected or expected token to report. In that
1351
+ case, just report a simple "syntax error".
1352
+ - Don't assume there isn't a lookahead just because this state is a
1353
+ consistent state with a default action. There might have been a
1354
+ previous inconsistent state, consistent state with a non-default
1355
+ action, or user semantic action that manipulated yychar.
1356
+ - Of course, the expected token list depends on states to have
1357
+ correct lookahead information, and it depends on the parser not
1358
+ to perform extra reductions after fetching a lookahead from the
1359
+ scanner and before detecting a syntax error. Thus, state merging
1360
+ (from LALR or IELR) and default reductions corrupt the expected
1361
+ token list. However, the list is correct for canonical LR with
1362
+ one exception: it will still contain any token that will not be
1363
+ accepted due to an error action in a later state.
1364
+ */
1365
+ if (yytoken != YYEMPTY)
1366
+ {
1367
+ int yyn = yypact[*yyssp];
1368
+ yyarg[yycount++] = yytname[yytoken];
1369
+ if (!yypact_value_is_default (yyn))
1370
+ {
1371
+ /* Start YYX at -YYN if negative to avoid negative indexes in
1372
+ YYCHECK. In other words, skip the first -YYN actions for
1373
+ this state because they are default actions. */
1374
+ int yyxbegin = yyn < 0 ? -yyn : 0;
1375
+ /* Stay within bounds of both yycheck and yytname. */
1376
+ int yychecklim = YYLAST - yyn + 1;
1377
+ int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1378
+ int yyx;
1379
+
1380
+ for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1381
+ if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1382
+ && !yytable_value_is_error (yytable[yyx + yyn]))
1383
+ {
1384
+ if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1385
+ {
1386
+ yycount = 1;
1387
+ yysize = yysize0;
1388
+ break;
1389
+ }
1390
+ yyarg[yycount++] = yytname[yyx];
1391
+ {
1392
+ YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
1393
+ if (! (yysize <= yysize1
1394
+ && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1395
+ return 2;
1396
+ yysize = yysize1;
1397
+ }
1398
+ }
1399
+ }
1400
+ }
1401
+
1402
+ switch (yycount)
1403
+ {
1404
+ # define YYCASE_(N, S) \
1405
+ case N: \
1406
+ yyformat = S; \
1407
+ break
1408
+ YYCASE_(0, YY_("syntax error"));
1409
+ YYCASE_(1, YY_("syntax error, unexpected %s"));
1410
+ YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1411
+ YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1412
+ YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1413
+ YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1414
+ # undef YYCASE_
1415
+ }
1416
+
1417
+ {
1418
+ YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
1419
+ if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1420
+ return 2;
1421
+ yysize = yysize1;
1422
+ }
1423
+
1424
+ if (*yymsg_alloc < yysize)
1425
+ {
1426
+ *yymsg_alloc = 2 * yysize;
1427
+ if (! (yysize <= *yymsg_alloc
1428
+ && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1429
+ *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1430
+ return 1;
1431
+ }
1432
+
1433
+ /* Avoid sprintf, as that infringes on the user's name space.
1434
+ Don't have undefined behavior even if the translation
1435
+ produced a string with the wrong number of "%s"s. */
1436
+ {
1437
+ char *yyp = *yymsg;
1438
+ int yyi = 0;
1439
+ while ((*yyp = *yyformat) != '\0')
1440
+ if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1441
+ {
1442
+ yyp += yytnamerr (yyp, yyarg[yyi++]);
1443
+ yyformat += 2;
1444
+ }
1445
+ else
1446
+ {
1447
+ yyp++;
1448
+ yyformat++;
1449
+ }
1450
+ }
1451
+ return 0;
1452
+ }
1453
+ #endif /* YYERROR_VERBOSE */
1454
+
1455
+ /*-----------------------------------------------.
1456
+ | Release the memory associated to this symbol. |
1457
+ `-----------------------------------------------*/
1458
+
1459
+ static void
1460
+ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, yyscan_t scanner, ndt_t **ast, ndt_meta_t *meta, ndt_context_t *ctx)
1461
+ {
1462
+ YYUSE (yyvaluep);
1463
+ YYUSE (yylocationp);
1464
+ YYUSE (scanner);
1465
+ YYUSE (ast);
1466
+ YYUSE (meta);
1467
+ YYUSE (ctx);
1468
+ if (!yymsg)
1469
+ yymsg = "Deleting";
1470
+ YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1471
+
1472
+ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1473
+ switch (yytype)
1474
+ {
1475
+ case 59: /* INTEGER */
1476
+ #line 191 "grammar.y" /* yacc.c:1257 */
1477
+ { ndt_free(((*yyvaluep).string)); }
1478
+ #line 1479 "grammar.c" /* yacc.c:1257 */
1479
+ break;
1480
+
1481
+ case 60: /* FLOATNUMBER */
1482
+ #line 191 "grammar.y" /* yacc.c:1257 */
1483
+ { ndt_free(((*yyvaluep).string)); }
1484
+ #line 1485 "grammar.c" /* yacc.c:1257 */
1485
+ break;
1486
+
1487
+ case 61: /* STRINGLIT */
1488
+ #line 191 "grammar.y" /* yacc.c:1257 */
1489
+ { ndt_free(((*yyvaluep).string)); }
1490
+ #line 1491 "grammar.c" /* yacc.c:1257 */
1491
+ break;
1492
+
1493
+ case 62: /* NAME_LOWER */
1494
+ #line 191 "grammar.y" /* yacc.c:1257 */
1495
+ { ndt_free(((*yyvaluep).string)); }
1496
+ #line 1497 "grammar.c" /* yacc.c:1257 */
1497
+ break;
1498
+
1499
+ case 63: /* NAME_UPPER */
1500
+ #line 191 "grammar.y" /* yacc.c:1257 */
1501
+ { ndt_free(((*yyvaluep).string)); }
1502
+ #line 1503 "grammar.c" /* yacc.c:1257 */
1503
+ break;
1504
+
1505
+ case 64: /* NAME_OTHER */
1506
+ #line 191 "grammar.y" /* yacc.c:1257 */
1507
+ { ndt_free(((*yyvaluep).string)); }
1508
+ #line 1509 "grammar.c" /* yacc.c:1257 */
1509
+ break;
1510
+
1511
+ case 66: /* input */
1512
+ #line 184 "grammar.y" /* yacc.c:1257 */
1513
+ { ndt_del(((*yyvaluep).ndt)); }
1514
+ #line 1515 "grammar.c" /* yacc.c:1257 */
1515
+ break;
1516
+
1517
+ case 67: /* datashape_or_module */
1518
+ #line 184 "grammar.y" /* yacc.c:1257 */
1519
+ { ndt_del(((*yyvaluep).ndt)); }
1520
+ #line 1521 "grammar.c" /* yacc.c:1257 */
1521
+ break;
1522
+
1523
+ case 68: /* datashape_with_ellipsis */
1524
+ #line 184 "grammar.y" /* yacc.c:1257 */
1525
+ { ndt_del(((*yyvaluep).ndt)); }
1526
+ #line 1527 "grammar.c" /* yacc.c:1257 */
1527
+ break;
1528
+
1529
+ case 69: /* fixed_ellipsis */
1530
+ #line 184 "grammar.y" /* yacc.c:1257 */
1531
+ { ndt_del(((*yyvaluep).ndt)); }
1532
+ #line 1533 "grammar.c" /* yacc.c:1257 */
1533
+ break;
1534
+
1535
+ case 70: /* datashape */
1536
+ #line 184 "grammar.y" /* yacc.c:1257 */
1537
+ { ndt_del(((*yyvaluep).ndt)); }
1538
+ #line 1539 "grammar.c" /* yacc.c:1257 */
1539
+ break;
1540
+
1541
+ case 71: /* dimensions */
1542
+ #line 184 "grammar.y" /* yacc.c:1257 */
1543
+ { ndt_del(((*yyvaluep).ndt)); }
1544
+ #line 1545 "grammar.c" /* yacc.c:1257 */
1545
+ break;
1546
+
1547
+ case 72: /* dimensions_nooption */
1548
+ #line 184 "grammar.y" /* yacc.c:1257 */
1549
+ { ndt_del(((*yyvaluep).ndt)); }
1550
+ #line 1551 "grammar.c" /* yacc.c:1257 */
1551
+ break;
1552
+
1553
+ case 73: /* dimensions_tail */
1554
+ #line 184 "grammar.y" /* yacc.c:1257 */
1555
+ { ndt_del(((*yyvaluep).ndt)); }
1556
+ #line 1557 "grammar.c" /* yacc.c:1257 */
1557
+ break;
1558
+
1559
+ case 74: /* dtype */
1560
+ #line 184 "grammar.y" /* yacc.c:1257 */
1561
+ { ndt_del(((*yyvaluep).ndt)); }
1562
+ #line 1563 "grammar.c" /* yacc.c:1257 */
1563
+ break;
1564
+
1565
+ case 75: /* scalar */
1566
+ #line 184 "grammar.y" /* yacc.c:1257 */
1567
+ { ndt_del(((*yyvaluep).ndt)); }
1568
+ #line 1569 "grammar.c" /* yacc.c:1257 */
1569
+ break;
1570
+
1571
+ case 76: /* signed */
1572
+ #line 184 "grammar.y" /* yacc.c:1257 */
1573
+ { ndt_del(((*yyvaluep).ndt)); }
1574
+ #line 1575 "grammar.c" /* yacc.c:1257 */
1575
+ break;
1576
+
1577
+ case 77: /* unsigned */
1578
+ #line 184 "grammar.y" /* yacc.c:1257 */
1579
+ { ndt_del(((*yyvaluep).ndt)); }
1580
+ #line 1581 "grammar.c" /* yacc.c:1257 */
1581
+ break;
1582
+
1583
+ case 78: /* ieee_float */
1584
+ #line 184 "grammar.y" /* yacc.c:1257 */
1585
+ { ndt_del(((*yyvaluep).ndt)); }
1586
+ #line 1587 "grammar.c" /* yacc.c:1257 */
1587
+ break;
1588
+
1589
+ case 79: /* ieee_complex */
1590
+ #line 184 "grammar.y" /* yacc.c:1257 */
1591
+ { ndt_del(((*yyvaluep).ndt)); }
1592
+ #line 1593 "grammar.c" /* yacc.c:1257 */
1593
+ break;
1594
+
1595
+ case 80: /* alias */
1596
+ #line 184 "grammar.y" /* yacc.c:1257 */
1597
+ { ndt_del(((*yyvaluep).ndt)); }
1598
+ #line 1599 "grammar.c" /* yacc.c:1257 */
1599
+ break;
1600
+
1601
+ case 81: /* character */
1602
+ #line 184 "grammar.y" /* yacc.c:1257 */
1603
+ { ndt_del(((*yyvaluep).ndt)); }
1604
+ #line 1605 "grammar.c" /* yacc.c:1257 */
1605
+ break;
1606
+
1607
+ case 82: /* string */
1608
+ #line 184 "grammar.y" /* yacc.c:1257 */
1609
+ { ndt_del(((*yyvaluep).ndt)); }
1610
+ #line 1611 "grammar.c" /* yacc.c:1257 */
1611
+ break;
1612
+
1613
+ case 83: /* fixed_string */
1614
+ #line 184 "grammar.y" /* yacc.c:1257 */
1615
+ { ndt_del(((*yyvaluep).ndt)); }
1616
+ #line 1617 "grammar.c" /* yacc.c:1257 */
1617
+ break;
1618
+
1619
+ case 86: /* bytes */
1620
+ #line 184 "grammar.y" /* yacc.c:1257 */
1621
+ { ndt_del(((*yyvaluep).ndt)); }
1622
+ #line 1623 "grammar.c" /* yacc.c:1257 */
1623
+ break;
1624
+
1625
+ case 87: /* fixed_bytes */
1626
+ #line 184 "grammar.y" /* yacc.c:1257 */
1627
+ { ndt_del(((*yyvaluep).ndt)); }
1628
+ #line 1629 "grammar.c" /* yacc.c:1257 */
1629
+ break;
1630
+
1631
+ case 88: /* ref */
1632
+ #line 184 "grammar.y" /* yacc.c:1257 */
1633
+ { ndt_del(((*yyvaluep).ndt)); }
1634
+ #line 1635 "grammar.c" /* yacc.c:1257 */
1635
+ break;
1636
+
1637
+ case 89: /* categorical */
1638
+ #line 184 "grammar.y" /* yacc.c:1257 */
1639
+ { ndt_del(((*yyvaluep).ndt)); }
1640
+ #line 1641 "grammar.c" /* yacc.c:1257 */
1641
+ break;
1642
+
1643
+ case 90: /* typed_value_seq */
1644
+ #line 188 "grammar.y" /* yacc.c:1257 */
1645
+ { ndt_value_seq_del(((*yyvaluep).typed_value_seq)); }
1646
+ #line 1647 "grammar.c" /* yacc.c:1257 */
1647
+ break;
1648
+
1649
+ case 91: /* typed_value */
1650
+ #line 187 "grammar.y" /* yacc.c:1257 */
1651
+ { ndt_value_del(((*yyvaluep).typed_value)); }
1652
+ #line 1653 "grammar.c" /* yacc.c:1257 */
1653
+ break;
1654
+
1655
+ case 94: /* tuple_type */
1656
+ #line 184 "grammar.y" /* yacc.c:1257 */
1657
+ { ndt_del(((*yyvaluep).ndt)); }
1658
+ #line 1659 "grammar.c" /* yacc.c:1257 */
1659
+ break;
1660
+
1661
+ case 95: /* tuple_field_seq */
1662
+ #line 186 "grammar.y" /* yacc.c:1257 */
1663
+ { ndt_field_seq_del(((*yyvaluep).field_seq)); }
1664
+ #line 1665 "grammar.c" /* yacc.c:1257 */
1665
+ break;
1666
+
1667
+ case 96: /* tuple_field */
1668
+ #line 185 "grammar.y" /* yacc.c:1257 */
1669
+ { ndt_field_del(((*yyvaluep).field)); }
1670
+ #line 1671 "grammar.c" /* yacc.c:1257 */
1671
+ break;
1672
+
1673
+ case 97: /* record_type */
1674
+ #line 184 "grammar.y" /* yacc.c:1257 */
1675
+ { ndt_del(((*yyvaluep).ndt)); }
1676
+ #line 1677 "grammar.c" /* yacc.c:1257 */
1677
+ break;
1678
+
1679
+ case 98: /* record_field_seq */
1680
+ #line 186 "grammar.y" /* yacc.c:1257 */
1681
+ { ndt_field_seq_del(((*yyvaluep).field_seq)); }
1682
+ #line 1683 "grammar.c" /* yacc.c:1257 */
1683
+ break;
1684
+
1685
+ case 99: /* record_field */
1686
+ #line 185 "grammar.y" /* yacc.c:1257 */
1687
+ { ndt_field_del(((*yyvaluep).field)); }
1688
+ #line 1689 "grammar.c" /* yacc.c:1257 */
1689
+ break;
1690
+
1691
+ case 100: /* record_field_name */
1692
+ #line 191 "grammar.y" /* yacc.c:1257 */
1693
+ { ndt_free(((*yyvaluep).string)); }
1694
+ #line 1695 "grammar.c" /* yacc.c:1257 */
1695
+ break;
1696
+
1697
+ case 101: /* arguments_opt */
1698
+ #line 190 "grammar.y" /* yacc.c:1257 */
1699
+ { ndt_attr_seq_del(((*yyvaluep).attribute_seq)); }
1700
+ #line 1701 "grammar.c" /* yacc.c:1257 */
1701
+ break;
1702
+
1703
+ case 102: /* attribute_seq */
1704
+ #line 190 "grammar.y" /* yacc.c:1257 */
1705
+ { ndt_attr_seq_del(((*yyvaluep).attribute_seq)); }
1706
+ #line 1707 "grammar.c" /* yacc.c:1257 */
1707
+ break;
1708
+
1709
+ case 103: /* attribute */
1710
+ #line 189 "grammar.y" /* yacc.c:1257 */
1711
+ { ndt_attr_del(((*yyvaluep).attribute)); }
1712
+ #line 1713 "grammar.c" /* yacc.c:1257 */
1713
+ break;
1714
+
1715
+ case 104: /* untyped_value_seq */
1716
+ #line 192 "grammar.y" /* yacc.c:1257 */
1717
+ { ndt_string_seq_del(((*yyvaluep).string_seq)); }
1718
+ #line 1719 "grammar.c" /* yacc.c:1257 */
1719
+ break;
1720
+
1721
+ case 105: /* untyped_value */
1722
+ #line 191 "grammar.y" /* yacc.c:1257 */
1723
+ { ndt_free(((*yyvaluep).string)); }
1724
+ #line 1725 "grammar.c" /* yacc.c:1257 */
1725
+ break;
1726
+
1727
+ case 106: /* function_type */
1728
+ #line 184 "grammar.y" /* yacc.c:1257 */
1729
+ { ndt_del(((*yyvaluep).ndt)); }
1730
+ #line 1731 "grammar.c" /* yacc.c:1257 */
1731
+ break;
1732
+
1733
+ case 107: /* type_seq_or_void */
1734
+ #line 193 "grammar.y" /* yacc.c:1257 */
1735
+ { ndt_type_seq_del(((*yyvaluep).type_seq)); }
1736
+ #line 1737 "grammar.c" /* yacc.c:1257 */
1737
+ break;
1738
+
1739
+ case 108: /* type_seq */
1740
+ #line 193 "grammar.y" /* yacc.c:1257 */
1741
+ { ndt_type_seq_del(((*yyvaluep).type_seq)); }
1742
+ #line 1743 "grammar.c" /* yacc.c:1257 */
1743
+ break;
1744
+
1745
+
1746
+ default:
1747
+ break;
1748
+ }
1749
+ YY_IGNORE_MAYBE_UNINITIALIZED_END
1750
+ }
1751
+
1752
+
1753
+
1754
+
1755
+ /*----------.
1756
+ | yyparse. |
1757
+ `----------*/
1758
+
1759
+ int
1760
+ yyparse (yyscan_t scanner, ndt_t **ast, ndt_meta_t *meta, ndt_context_t *ctx)
1761
+ {
1762
+ /* The lookahead symbol. */
1763
+ int yychar;
1764
+
1765
+
1766
+ /* The semantic value of the lookahead symbol. */
1767
+ /* Default value used for initialization, for pacifying older GCCs
1768
+ or non-GCC compilers. */
1769
+ YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
1770
+ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
1771
+
1772
+ /* Location data for the lookahead symbol. */
1773
+ static YYLTYPE yyloc_default
1774
+ # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
1775
+ = { 1, 1, 1, 1 }
1776
+ # endif
1777
+ ;
1778
+ YYLTYPE yylloc = yyloc_default;
1779
+
1780
+ /* Number of syntax errors so far. */
1781
+ int yynerrs;
1782
+
1783
+ int yystate;
1784
+ /* Number of tokens to shift before error messages enabled. */
1785
+ int yyerrstatus;
1786
+
1787
+ /* The stacks and their tools:
1788
+ 'yyss': related to states.
1789
+ 'yyvs': related to semantic values.
1790
+ 'yyls': related to locations.
1791
+
1792
+ Refer to the stacks through separate pointers, to allow yyoverflow
1793
+ to reallocate them elsewhere. */
1794
+
1795
+ /* The state stack. */
1796
+ yytype_int16 yyssa[YYINITDEPTH];
1797
+ yytype_int16 *yyss;
1798
+ yytype_int16 *yyssp;
1799
+
1800
+ /* The semantic value stack. */
1801
+ YYSTYPE yyvsa[YYINITDEPTH];
1802
+ YYSTYPE *yyvs;
1803
+ YYSTYPE *yyvsp;
1804
+
1805
+ /* The location stack. */
1806
+ YYLTYPE yylsa[YYINITDEPTH];
1807
+ YYLTYPE *yyls;
1808
+ YYLTYPE *yylsp;
1809
+
1810
+ /* The locations where the error started and ended. */
1811
+ YYLTYPE yyerror_range[3];
1812
+
1813
+ YYSIZE_T yystacksize;
1814
+
1815
+ int yyn;
1816
+ int yyresult;
1817
+ /* Lookahead token as an internal (translated) token number. */
1818
+ int yytoken = 0;
1819
+ /* The variables used to return semantic value and location from the
1820
+ action routines. */
1821
+ YYSTYPE yyval;
1822
+ YYLTYPE yyloc;
1823
+
1824
+ #if YYERROR_VERBOSE
1825
+ /* Buffer for error messages, and its allocated size. */
1826
+ char yymsgbuf[128];
1827
+ char *yymsg = yymsgbuf;
1828
+ YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1829
+ #endif
1830
+
1831
+ #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
1832
+
1833
+ /* The number of symbols on the RHS of the reduced rule.
1834
+ Keep to zero when no symbol should be popped. */
1835
+ int yylen = 0;
1836
+
1837
+ yyssp = yyss = yyssa;
1838
+ yyvsp = yyvs = yyvsa;
1839
+ yylsp = yyls = yylsa;
1840
+ yystacksize = YYINITDEPTH;
1841
+
1842
+ YYDPRINTF ((stderr, "Starting parse\n"));
1843
+
1844
+ yystate = 0;
1845
+ yyerrstatus = 0;
1846
+ yynerrs = 0;
1847
+ yychar = YYEMPTY; /* Cause a token to be read. */
1848
+
1849
+ /* User initialization code. */
1850
+ #line 76 "grammar.y" /* yacc.c:1429 */
1851
+ {
1852
+ yylloc.first_line = 1;
1853
+ yylloc.first_column = 1;
1854
+ yylloc.last_line = 1;
1855
+ yylloc.last_column = 1;
1856
+ }
1857
+
1858
+ #line 1859 "grammar.c" /* yacc.c:1429 */
1859
+ yylsp[0] = yylloc;
1860
+ goto yysetstate;
1861
+
1862
+ /*------------------------------------------------------------.
1863
+ | yynewstate -- Push a new state, which is found in yystate. |
1864
+ `------------------------------------------------------------*/
1865
+ yynewstate:
1866
+ /* In all cases, when you get here, the value and location stacks
1867
+ have just been pushed. So pushing a state here evens the stacks. */
1868
+ yyssp++;
1869
+
1870
+ yysetstate:
1871
+ *yyssp = yystate;
1872
+
1873
+ if (yyss + yystacksize - 1 <= yyssp)
1874
+ {
1875
+ /* Get the current used size of the three stacks, in elements. */
1876
+ YYSIZE_T yysize = yyssp - yyss + 1;
1877
+
1878
+ #ifdef yyoverflow
1879
+ {
1880
+ /* Give user a chance to reallocate the stack. Use copies of
1881
+ these so that the &'s don't force the real ones into
1882
+ memory. */
1883
+ YYSTYPE *yyvs1 = yyvs;
1884
+ yytype_int16 *yyss1 = yyss;
1885
+ YYLTYPE *yyls1 = yyls;
1886
+
1887
+ /* Each stack pointer address is followed by the size of the
1888
+ data in use in that stack, in bytes. This used to be a
1889
+ conditional around just the two extra args, but that might
1890
+ be undefined if yyoverflow is a macro. */
1891
+ yyoverflow (YY_("memory exhausted"),
1892
+ &yyss1, yysize * sizeof (*yyssp),
1893
+ &yyvs1, yysize * sizeof (*yyvsp),
1894
+ &yyls1, yysize * sizeof (*yylsp),
1895
+ &yystacksize);
1896
+
1897
+ yyls = yyls1;
1898
+ yyss = yyss1;
1899
+ yyvs = yyvs1;
1900
+ }
1901
+ #else /* no yyoverflow */
1902
+ # ifndef YYSTACK_RELOCATE
1903
+ goto yyexhaustedlab;
1904
+ # else
1905
+ /* Extend the stack our own way. */
1906
+ if (YYMAXDEPTH <= yystacksize)
1907
+ goto yyexhaustedlab;
1908
+ yystacksize *= 2;
1909
+ if (YYMAXDEPTH < yystacksize)
1910
+ yystacksize = YYMAXDEPTH;
1911
+
1912
+ {
1913
+ yytype_int16 *yyss1 = yyss;
1914
+ union yyalloc *yyptr =
1915
+ (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1916
+ if (! yyptr)
1917
+ goto yyexhaustedlab;
1918
+ YYSTACK_RELOCATE (yyss_alloc, yyss);
1919
+ YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1920
+ YYSTACK_RELOCATE (yyls_alloc, yyls);
1921
+ # undef YYSTACK_RELOCATE
1922
+ if (yyss1 != yyssa)
1923
+ YYSTACK_FREE (yyss1);
1924
+ }
1925
+ # endif
1926
+ #endif /* no yyoverflow */
1927
+
1928
+ yyssp = yyss + yysize - 1;
1929
+ yyvsp = yyvs + yysize - 1;
1930
+ yylsp = yyls + yysize - 1;
1931
+
1932
+ YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1933
+ (unsigned long int) yystacksize));
1934
+
1935
+ if (yyss + yystacksize - 1 <= yyssp)
1936
+ YYABORT;
1937
+ }
1938
+
1939
+ YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1940
+
1941
+ if (yystate == YYFINAL)
1942
+ YYACCEPT;
1943
+
1944
+ goto yybackup;
1945
+
1946
+ /*-----------.
1947
+ | yybackup. |
1948
+ `-----------*/
1949
+ yybackup:
1950
+
1951
+ /* Do appropriate processing given the current state. Read a
1952
+ lookahead token if we need one and don't already have one. */
1953
+
1954
+ /* First try to decide what to do without reference to lookahead token. */
1955
+ yyn = yypact[yystate];
1956
+ if (yypact_value_is_default (yyn))
1957
+ goto yydefault;
1958
+
1959
+ /* Not known => get a lookahead token if don't already have one. */
1960
+
1961
+ /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1962
+ if (yychar == YYEMPTY)
1963
+ {
1964
+ YYDPRINTF ((stderr, "Reading a token: "));
1965
+ yychar = yylex (&yylval, &yylloc, scanner, ctx);
1966
+ }
1967
+
1968
+ if (yychar <= YYEOF)
1969
+ {
1970
+ yychar = yytoken = YYEOF;
1971
+ YYDPRINTF ((stderr, "Now at end of input.\n"));
1972
+ }
1973
+ else
1974
+ {
1975
+ yytoken = YYTRANSLATE (yychar);
1976
+ YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1977
+ }
1978
+
1979
+ /* If the proper action on seeing token YYTOKEN is to reduce or to
1980
+ detect an error, take that action. */
1981
+ yyn += yytoken;
1982
+ if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1983
+ goto yydefault;
1984
+ yyn = yytable[yyn];
1985
+ if (yyn <= 0)
1986
+ {
1987
+ if (yytable_value_is_error (yyn))
1988
+ goto yyerrlab;
1989
+ yyn = -yyn;
1990
+ goto yyreduce;
1991
+ }
1992
+
1993
+ /* Count tokens shifted since error; after three, turn off error
1994
+ status. */
1995
+ if (yyerrstatus)
1996
+ yyerrstatus--;
1997
+
1998
+ /* Shift the lookahead token. */
1999
+ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
2000
+
2001
+ /* Discard the shifted token. */
2002
+ yychar = YYEMPTY;
2003
+
2004
+ yystate = yyn;
2005
+ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2006
+ *++yyvsp = yylval;
2007
+ YY_IGNORE_MAYBE_UNINITIALIZED_END
2008
+ *++yylsp = yylloc;
2009
+ goto yynewstate;
2010
+
2011
+
2012
+ /*-----------------------------------------------------------.
2013
+ | yydefault -- do the default action for the current state. |
2014
+ `-----------------------------------------------------------*/
2015
+ yydefault:
2016
+ yyn = yydefact[yystate];
2017
+ if (yyn == 0)
2018
+ goto yyerrlab;
2019
+ goto yyreduce;
2020
+
2021
+
2022
+ /*-----------------------------.
2023
+ | yyreduce -- Do a reduction. |
2024
+ `-----------------------------*/
2025
+ yyreduce:
2026
+ /* yyn is the number of a rule to reduce with. */
2027
+ yylen = yyr2[yyn];
2028
+
2029
+ /* If YYLEN is nonzero, implement the default value of the action:
2030
+ '$$ = $1'.
2031
+
2032
+ Otherwise, the following line sets YYVAL to garbage.
2033
+ This behavior is undocumented and Bison
2034
+ users should not rely upon it. Assigning to YYVAL
2035
+ unconditionally makes the parser a bit smaller, and it avoids a
2036
+ GCC warning that YYVAL may be used uninitialized. */
2037
+ yyval = yyvsp[1-yylen];
2038
+
2039
+ /* Default location. */
2040
+ YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
2041
+ YY_REDUCE_PRINT (yyn);
2042
+ switch (yyn)
2043
+ {
2044
+ case 2:
2045
+ #line 198 "grammar.y" /* yacc.c:1646 */
2046
+ { (yyval.ndt) = (yyvsp[-1].ndt); *ast = (yyval.ndt); YYACCEPT; }
2047
+ #line 2048 "grammar.c" /* yacc.c:1646 */
2048
+ break;
2049
+
2050
+ case 3:
2051
+ #line 202 "grammar.y" /* yacc.c:1646 */
2052
+ { (yyval.ndt) = (yyvsp[0].ndt); }
2053
+ #line 2054 "grammar.c" /* yacc.c:1646 */
2054
+ break;
2055
+
2056
+ case 4:
2057
+ #line 203 "grammar.y" /* yacc.c:1646 */
2058
+ { (yyval.ndt) = (yyvsp[0].ndt); }
2059
+ #line 2060 "grammar.c" /* yacc.c:1646 */
2060
+ break;
2061
+
2062
+ case 5:
2063
+ #line 204 "grammar.y" /* yacc.c:1646 */
2064
+ { (yyval.ndt) = ndt_module((yyvsp[-3].string), (yyvsp[0].ndt), ctx); if ((yyval.ndt) == NULL) YYABORT; }
2065
+ #line 2066 "grammar.c" /* yacc.c:1646 */
2066
+ break;
2067
+
2068
+ case 6:
2069
+ #line 208 "grammar.y" /* yacc.c:1646 */
2070
+ { (yyval.ndt) = (yyvsp[0].ndt); }
2071
+ #line 2072 "grammar.c" /* yacc.c:1646 */
2072
+ break;
2073
+
2074
+ case 7:
2075
+ #line 209 "grammar.y" /* yacc.c:1646 */
2076
+ { (yyval.ndt) = (yyvsp[0].ndt); }
2077
+ #line 2078 "grammar.c" /* yacc.c:1646 */
2078
+ break;
2079
+
2080
+ case 8:
2081
+ #line 210 "grammar.y" /* yacc.c:1646 */
2082
+ { (yyval.ndt) = mk_contig((yyvsp[-3].string), (yyvsp[-1].ndt), ctx); if ((yyval.ndt) == NULL) YYABORT; }
2083
+ #line 2084 "grammar.c" /* yacc.c:1646 */
2084
+ break;
2085
+
2086
+ case 9:
2087
+ #line 211 "grammar.y" /* yacc.c:1646 */
2088
+ { (yyval.ndt) = mk_var_ellipsis((yyvsp[0].ndt), ctx); if ((yyval.ndt) == NULL) YYABORT; }
2089
+ #line 2090 "grammar.c" /* yacc.c:1646 */
2090
+ break;
2091
+
2092
+ case 10:
2093
+ #line 212 "grammar.y" /* yacc.c:1646 */
2094
+ { (yyval.ndt) = mk_var_ellipsis(ndt_option((yyvsp[0].ndt)), ctx); if ((yyval.ndt) == NULL) YYABORT; }
2095
+ #line 2096 "grammar.c" /* yacc.c:1646 */
2096
+ break;
2097
+
2098
+ case 11:
2099
+ #line 215 "grammar.y" /* yacc.c:1646 */
2100
+ { (yyval.ndt) = ndt_ellipsis_dim(NULL, (yyvsp[0].ndt), ctx); if ((yyval.ndt) == NULL) YYABORT; }
2101
+ #line 2102 "grammar.c" /* yacc.c:1646 */
2102
+ break;
2103
+
2104
+ case 12:
2105
+ #line 216 "grammar.y" /* yacc.c:1646 */
2106
+ { (yyval.ndt) = ndt_ellipsis_dim((yyvsp[-3].string), (yyvsp[0].ndt), ctx); if ((yyval.ndt) == NULL) YYABORT; }
2107
+ #line 2108 "grammar.c" /* yacc.c:1646 */
2108
+ break;
2109
+
2110
+ case 13:
2111
+ #line 219 "grammar.y" /* yacc.c:1646 */
2112
+ { (yyval.ndt) = (yyvsp[0].ndt); }
2113
+ #line 2114 "grammar.c" /* yacc.c:1646 */
2114
+ break;
2115
+
2116
+ case 14:
2117
+ #line 220 "grammar.y" /* yacc.c:1646 */
2118
+ { (yyval.ndt) = (yyvsp[0].ndt); }
2119
+ #line 2120 "grammar.c" /* yacc.c:1646 */
2120
+ break;
2121
+
2122
+ case 15:
2123
+ #line 221 "grammar.y" /* yacc.c:1646 */
2124
+ { (yyval.ndt) = ndt_option((yyvsp[0].ndt)); if ((yyval.ndt) == NULL) YYABORT; }
2125
+ #line 2126 "grammar.c" /* yacc.c:1646 */
2126
+ break;
2127
+
2128
+ case 16:
2129
+ #line 224 "grammar.y" /* yacc.c:1646 */
2130
+ { (yyval.ndt) = (yyvsp[0].ndt); }
2131
+ #line 2132 "grammar.c" /* yacc.c:1646 */
2132
+ break;
2133
+
2134
+ case 17:
2135
+ #line 225 "grammar.y" /* yacc.c:1646 */
2136
+ { (yyval.ndt) = ndt_option((yyvsp[0].ndt)); if ((yyval.ndt) == NULL) YYABORT; }
2137
+ #line 2138 "grammar.c" /* yacc.c:1646 */
2138
+ break;
2139
+
2140
+ case 18:
2141
+ #line 226 "grammar.y" /* yacc.c:1646 */
2142
+ { (yyval.ndt) = mk_contig((yyvsp[-3].string), (yyvsp[-1].ndt), ctx); if ((yyval.ndt) == NULL) YYABORT; }
2143
+ #line 2144 "grammar.c" /* yacc.c:1646 */
2144
+ break;
2145
+
2146
+ case 19:
2147
+ #line 227 "grammar.y" /* yacc.c:1646 */
2148
+ { (yyval.ndt) = mk_fortran((yyvsp[0].ndt), ctx); if ((yyval.ndt) == NULL) YYABORT; }
2149
+ #line 2150 "grammar.c" /* yacc.c:1646 */
2150
+ break;
2151
+
2152
+ case 20:
2153
+ #line 230 "grammar.y" /* yacc.c:1646 */
2154
+ { (yyval.ndt) = mk_fixed_dim_from_shape((yyvsp[-2].string), (yyvsp[0].ndt), ctx); if ((yyval.ndt) == NULL) YYABORT; }
2155
+ #line 2156 "grammar.c" /* yacc.c:1646 */
2156
+ break;
2157
+
2158
+ case 21:
2159
+ #line 231 "grammar.y" /* yacc.c:1646 */
2160
+ { (yyval.ndt) = mk_fixed_dim_from_attrs((yyvsp[-3].attribute_seq), (yyvsp[0].ndt), ctx); if ((yyval.ndt) == NULL) YYABORT; }
2161
+ #line 2162 "grammar.c" /* yacc.c:1646 */
2162
+ break;
2163
+
2164
+ case 22:
2165
+ #line 232 "grammar.y" /* yacc.c:1646 */
2166
+ { (yyval.ndt) = ndt_symbolic_dim((yyvsp[-2].string), (yyvsp[0].ndt), ctx); if ((yyval.ndt) == NULL) YYABORT; }
2167
+ #line 2168 "grammar.c" /* yacc.c:1646 */
2168
+ break;
2169
+
2170
+ case 23:
2171
+ #line 233 "grammar.y" /* yacc.c:1646 */
2172
+ { (yyval.ndt) = mk_var_dim(meta, (yyvsp[-2].attribute_seq), (yyvsp[0].ndt), ctx); if ((yyval.ndt) == NULL) YYABORT; }
2173
+ #line 2174 "grammar.c" /* yacc.c:1646 */
2174
+ break;
2175
+
2176
+ case 24:
2177
+ #line 236 "grammar.y" /* yacc.c:1646 */
2178
+ { (yyval.ndt) = (yyvsp[0].ndt); }
2179
+ #line 2180 "grammar.c" /* yacc.c:1646 */
2180
+ break;
2181
+
2182
+ case 25:
2183
+ #line 237 "grammar.y" /* yacc.c:1646 */
2184
+ { (yyval.ndt) = ndt_option((yyvsp[0].ndt)); if ((yyval.ndt) == NULL) YYABORT; }
2185
+ #line 2186 "grammar.c" /* yacc.c:1646 */
2186
+ break;
2187
+
2188
+ case 26:
2189
+ #line 238 "grammar.y" /* yacc.c:1646 */
2190
+ { (yyval.ndt) = (yyvsp[0].ndt); }
2191
+ #line 2192 "grammar.c" /* yacc.c:1646 */
2192
+ break;
2193
+
2194
+ case 27:
2195
+ #line 241 "grammar.y" /* yacc.c:1646 */
2196
+ { (yyval.ndt) = ndt_any_kind(ctx); if ((yyval.ndt) == NULL) YYABORT; }
2197
+ #line 2198 "grammar.c" /* yacc.c:1646 */
2198
+ break;
2199
+
2200
+ case 28:
2201
+ #line 242 "grammar.y" /* yacc.c:1646 */
2202
+ { (yyval.ndt) = ndt_scalar_kind(ctx); if ((yyval.ndt) == NULL) YYABORT; }
2203
+ #line 2204 "grammar.c" /* yacc.c:1646 */
2204
+ break;
2205
+
2206
+ case 29:
2207
+ #line 243 "grammar.y" /* yacc.c:1646 */
2208
+ { (yyval.ndt) = (yyvsp[0].ndt); }
2209
+ #line 2210 "grammar.c" /* yacc.c:1646 */
2210
+ break;
2211
+
2212
+ case 30:
2213
+ #line 244 "grammar.y" /* yacc.c:1646 */
2214
+ { (yyval.ndt) = (yyvsp[0].ndt); }
2215
+ #line 2216 "grammar.c" /* yacc.c:1646 */
2216
+ break;
2217
+
2218
+ case 31:
2219
+ #line 245 "grammar.y" /* yacc.c:1646 */
2220
+ { (yyval.ndt) = (yyvsp[0].ndt); }
2221
+ #line 2222 "grammar.c" /* yacc.c:1646 */
2222
+ break;
2223
+
2224
+ case 32:
2225
+ #line 246 "grammar.y" /* yacc.c:1646 */
2226
+ { (yyval.ndt) = ndt_nominal((yyvsp[0].string), NULL, ctx); if ((yyval.ndt) == NULL) YYABORT; }
2227
+ #line 2228 "grammar.c" /* yacc.c:1646 */
2228
+ break;
2229
+
2230
+ case 33:
2231
+ #line 247 "grammar.y" /* yacc.c:1646 */
2232
+ { (yyval.ndt) = ndt_constr((yyvsp[-3].string), (yyvsp[-1].ndt), ctx); if ((yyval.ndt) == NULL) YYABORT; }
2233
+ #line 2234 "grammar.c" /* yacc.c:1646 */
2234
+ break;
2235
+
2236
+ case 34:
2237
+ #line 248 "grammar.y" /* yacc.c:1646 */
2238
+ { (void)(yyvsp[-3].string); (void)(yyvsp[-1].attribute_seq); ndt_free((yyvsp[-3].string)); ndt_attr_seq_del((yyvsp[-1].attribute_seq)); (yyval.ndt) = NULL;
2239
+ ndt_err_format(ctx, NDT_NotImplementedError, "general attributes are not implemented");
2240
+ YYABORT; }
2241
+ #line 2242 "grammar.c" /* yacc.c:1646 */
2242
+ break;
2243
+
2244
+ case 35:
2245
+ #line 251 "grammar.y" /* yacc.c:1646 */
2246
+ { (yyval.ndt) = ndt_typevar((yyvsp[0].string), ctx); if ((yyval.ndt) == NULL) YYABORT; }
2247
+ #line 2248 "grammar.c" /* yacc.c:1646 */
2248
+ break;
2249
+
2250
+ case 36:
2251
+ #line 254 "grammar.y" /* yacc.c:1646 */
2252
+ { (yyval.ndt) = ndt_primitive(Bool, (yyvsp[-1].uint32), ctx); if ((yyval.ndt) == NULL) YYABORT; }
2253
+ #line 2254 "grammar.c" /* yacc.c:1646 */
2254
+ break;
2255
+
2256
+ case 37:
2257
+ #line 255 "grammar.y" /* yacc.c:1646 */
2258
+ { (yyval.ndt) = ndt_signed_kind(ctx); if ((yyval.ndt) == NULL) YYABORT; }
2259
+ #line 2260 "grammar.c" /* yacc.c:1646 */
2260
+ break;
2261
+
2262
+ case 38:
2263
+ #line 256 "grammar.y" /* yacc.c:1646 */
2264
+ { (yyval.ndt) = (yyvsp[0].ndt); }
2265
+ #line 2266 "grammar.c" /* yacc.c:1646 */
2266
+ break;
2267
+
2268
+ case 39:
2269
+ #line 257 "grammar.y" /* yacc.c:1646 */
2270
+ { (yyval.ndt) = ndt_unsigned_kind(ctx); if ((yyval.ndt) == NULL) YYABORT; }
2271
+ #line 2272 "grammar.c" /* yacc.c:1646 */
2272
+ break;
2273
+
2274
+ case 40:
2275
+ #line 258 "grammar.y" /* yacc.c:1646 */
2276
+ { (yyval.ndt) = (yyvsp[0].ndt); }
2277
+ #line 2278 "grammar.c" /* yacc.c:1646 */
2278
+ break;
2279
+
2280
+ case 41:
2281
+ #line 259 "grammar.y" /* yacc.c:1646 */
2282
+ { (yyval.ndt) = ndt_float_kind(ctx); if ((yyval.ndt) == NULL) YYABORT; }
2283
+ #line 2284 "grammar.c" /* yacc.c:1646 */
2284
+ break;
2285
+
2286
+ case 42:
2287
+ #line 260 "grammar.y" /* yacc.c:1646 */
2288
+ { (yyval.ndt) = (yyvsp[0].ndt); }
2289
+ #line 2290 "grammar.c" /* yacc.c:1646 */
2290
+ break;
2291
+
2292
+ case 43:
2293
+ #line 261 "grammar.y" /* yacc.c:1646 */
2294
+ { (yyval.ndt) = ndt_complex_kind(ctx); if ((yyval.ndt) == NULL) YYABORT; }
2295
+ #line 2296 "grammar.c" /* yacc.c:1646 */
2296
+ break;
2297
+
2298
+ case 44:
2299
+ #line 262 "grammar.y" /* yacc.c:1646 */
2300
+ { (yyval.ndt) = (yyvsp[0].ndt); }
2301
+ #line 2302 "grammar.c" /* yacc.c:1646 */
2302
+ break;
2303
+
2304
+ case 45:
2305
+ #line 263 "grammar.y" /* yacc.c:1646 */
2306
+ { (yyval.ndt) = (yyvsp[0].ndt); }
2307
+ #line 2308 "grammar.c" /* yacc.c:1646 */
2308
+ break;
2309
+
2310
+ case 46:
2311
+ #line 264 "grammar.y" /* yacc.c:1646 */
2312
+ { (yyval.ndt) = (yyvsp[0].ndt); }
2313
+ #line 2314 "grammar.c" /* yacc.c:1646 */
2314
+ break;
2315
+
2316
+ case 47:
2317
+ #line 265 "grammar.y" /* yacc.c:1646 */
2318
+ { (yyval.ndt) = (yyvsp[0].ndt); }
2319
+ #line 2320 "grammar.c" /* yacc.c:1646 */
2320
+ break;
2321
+
2322
+ case 48:
2323
+ #line 266 "grammar.y" /* yacc.c:1646 */
2324
+ { (yyval.ndt) = ndt_fixed_string_kind(ctx); if ((yyval.ndt) == NULL) YYABORT; }
2325
+ #line 2326 "grammar.c" /* yacc.c:1646 */
2326
+ break;
2327
+
2328
+ case 49:
2329
+ #line 267 "grammar.y" /* yacc.c:1646 */
2330
+ { (yyval.ndt) = (yyvsp[0].ndt); }
2331
+ #line 2332 "grammar.c" /* yacc.c:1646 */
2332
+ break;
2333
+
2334
+ case 50:
2335
+ #line 268 "grammar.y" /* yacc.c:1646 */
2336
+ { (yyval.ndt) = (yyvsp[0].ndt); }
2337
+ #line 2338 "grammar.c" /* yacc.c:1646 */
2338
+ break;
2339
+
2340
+ case 51:
2341
+ #line 269 "grammar.y" /* yacc.c:1646 */
2342
+ { (yyval.ndt) = ndt_fixed_bytes_kind(ctx); if ((yyval.ndt) == NULL) YYABORT; }
2343
+ #line 2344 "grammar.c" /* yacc.c:1646 */
2344
+ break;
2345
+
2346
+ case 52:
2347
+ #line 270 "grammar.y" /* yacc.c:1646 */
2348
+ { (yyval.ndt) = (yyvsp[0].ndt); }
2349
+ #line 2350 "grammar.c" /* yacc.c:1646 */
2350
+ break;
2351
+
2352
+ case 53:
2353
+ #line 271 "grammar.y" /* yacc.c:1646 */
2354
+ { (yyval.ndt) = (yyvsp[0].ndt); }
2355
+ #line 2356 "grammar.c" /* yacc.c:1646 */
2356
+ break;
2357
+
2358
+ case 54:
2359
+ #line 272 "grammar.y" /* yacc.c:1646 */
2360
+ { (yyval.ndt) = (yyvsp[0].ndt); }
2361
+ #line 2362 "grammar.c" /* yacc.c:1646 */
2362
+ break;
2363
+
2364
+ case 55:
2365
+ #line 275 "grammar.y" /* yacc.c:1646 */
2366
+ { (yyval.ndt) = ndt_primitive(Int8, (yyvsp[-1].uint32), ctx); if ((yyval.ndt) == NULL) YYABORT; }
2367
+ #line 2368 "grammar.c" /* yacc.c:1646 */
2368
+ break;
2369
+
2370
+ case 56:
2371
+ #line 276 "grammar.y" /* yacc.c:1646 */
2372
+ { (yyval.ndt) = ndt_primitive(Int16, (yyvsp[-1].uint32), ctx); if ((yyval.ndt) == NULL) YYABORT; }
2373
+ #line 2374 "grammar.c" /* yacc.c:1646 */
2374
+ break;
2375
+
2376
+ case 57:
2377
+ #line 277 "grammar.y" /* yacc.c:1646 */
2378
+ { (yyval.ndt) = ndt_primitive(Int32, (yyvsp[-1].uint32), ctx); if ((yyval.ndt) == NULL) YYABORT; }
2379
+ #line 2380 "grammar.c" /* yacc.c:1646 */
2380
+ break;
2381
+
2382
+ case 58:
2383
+ #line 278 "grammar.y" /* yacc.c:1646 */
2384
+ { (yyval.ndt) = ndt_primitive(Int64, (yyvsp[-1].uint32), ctx); if ((yyval.ndt) == NULL) YYABORT; }
2385
+ #line 2386 "grammar.c" /* yacc.c:1646 */
2386
+ break;
2387
+
2388
+ case 59:
2389
+ #line 281 "grammar.y" /* yacc.c:1646 */
2390
+ { (yyval.ndt) = ndt_primitive(Uint8, (yyvsp[-1].uint32), ctx); if ((yyval.ndt) == NULL) YYABORT; }
2391
+ #line 2392 "grammar.c" /* yacc.c:1646 */
2392
+ break;
2393
+
2394
+ case 60:
2395
+ #line 282 "grammar.y" /* yacc.c:1646 */
2396
+ { (yyval.ndt) = ndt_primitive(Uint16, (yyvsp[-1].uint32), ctx); if ((yyval.ndt) == NULL) YYABORT; }
2397
+ #line 2398 "grammar.c" /* yacc.c:1646 */
2398
+ break;
2399
+
2400
+ case 61:
2401
+ #line 283 "grammar.y" /* yacc.c:1646 */
2402
+ { (yyval.ndt) = ndt_primitive(Uint32, (yyvsp[-1].uint32), ctx); if ((yyval.ndt) == NULL) YYABORT; }
2403
+ #line 2404 "grammar.c" /* yacc.c:1646 */
2404
+ break;
2405
+
2406
+ case 62:
2407
+ #line 284 "grammar.y" /* yacc.c:1646 */
2408
+ { (yyval.ndt) = ndt_primitive(Uint64, (yyvsp[-1].uint32), ctx); if ((yyval.ndt) == NULL) YYABORT; }
2409
+ #line 2410 "grammar.c" /* yacc.c:1646 */
2410
+ break;
2411
+
2412
+ case 63:
2413
+ #line 287 "grammar.y" /* yacc.c:1646 */
2414
+ { (yyval.ndt) = ndt_primitive(Float16, (yyvsp[-1].uint32), ctx); if ((yyval.ndt) == NULL) YYABORT; }
2415
+ #line 2416 "grammar.c" /* yacc.c:1646 */
2416
+ break;
2417
+
2418
+ case 64:
2419
+ #line 288 "grammar.y" /* yacc.c:1646 */
2420
+ { (yyval.ndt) = ndt_primitive(Float32, (yyvsp[-1].uint32), ctx); if ((yyval.ndt) == NULL) YYABORT; }
2421
+ #line 2422 "grammar.c" /* yacc.c:1646 */
2422
+ break;
2423
+
2424
+ case 65:
2425
+ #line 289 "grammar.y" /* yacc.c:1646 */
2426
+ { (yyval.ndt) = ndt_primitive(Float64, (yyvsp[-1].uint32), ctx); if ((yyval.ndt) == NULL) YYABORT; }
2427
+ #line 2428 "grammar.c" /* yacc.c:1646 */
2428
+ break;
2429
+
2430
+ case 66:
2431
+ #line 292 "grammar.y" /* yacc.c:1646 */
2432
+ { (yyval.ndt) = ndt_primitive(Complex32, (yyvsp[-1].uint32), ctx); if ((yyval.ndt) == NULL) YYABORT; }
2433
+ #line 2434 "grammar.c" /* yacc.c:1646 */
2434
+ break;
2435
+
2436
+ case 67:
2437
+ #line 293 "grammar.y" /* yacc.c:1646 */
2438
+ { (yyval.ndt) = ndt_primitive(Complex64, (yyvsp[-1].uint32), ctx); if ((yyval.ndt) == NULL) YYABORT; }
2439
+ #line 2440 "grammar.c" /* yacc.c:1646 */
2440
+ break;
2441
+
2442
+ case 68:
2443
+ #line 294 "grammar.y" /* yacc.c:1646 */
2444
+ { (yyval.ndt) = ndt_primitive(Complex128, (yyvsp[-1].uint32), ctx); if ((yyval.ndt) == NULL) YYABORT; }
2445
+ #line 2446 "grammar.c" /* yacc.c:1646 */
2446
+ break;
2447
+
2448
+ case 69:
2449
+ #line 298 "grammar.y" /* yacc.c:1646 */
2450
+ { (yyval.ndt) = ndt_from_alias(Intptr, (yyvsp[-1].uint32), ctx); if ((yyval.ndt) == NULL) YYABORT; }
2451
+ #line 2452 "grammar.c" /* yacc.c:1646 */
2452
+ break;
2453
+
2454
+ case 70:
2455
+ #line 299 "grammar.y" /* yacc.c:1646 */
2456
+ { (yyval.ndt) = ndt_from_alias(Uintptr, (yyvsp[-1].uint32), ctx); if ((yyval.ndt) == NULL) YYABORT; }
2457
+ #line 2458 "grammar.c" /* yacc.c:1646 */
2458
+ break;
2459
+
2460
+ case 71:
2461
+ #line 300 "grammar.y" /* yacc.c:1646 */
2462
+ { (yyval.ndt) = ndt_from_alias(Size, (yyvsp[-1].uint32), ctx); if ((yyval.ndt) == NULL) YYABORT; }
2463
+ #line 2464 "grammar.c" /* yacc.c:1646 */
2464
+ break;
2465
+
2466
+ case 72:
2467
+ #line 303 "grammar.y" /* yacc.c:1646 */
2468
+ { (yyval.ndt) = ndt_char(Utf32, ctx); if ((yyval.ndt) == NULL) YYABORT; }
2469
+ #line 2470 "grammar.c" /* yacc.c:1646 */
2470
+ break;
2471
+
2472
+ case 73:
2473
+ #line 304 "grammar.y" /* yacc.c:1646 */
2474
+ { (yyval.ndt) = ndt_char((yyvsp[-1].encoding), ctx); if ((yyval.ndt) == NULL) YYABORT; }
2475
+ #line 2476 "grammar.c" /* yacc.c:1646 */
2476
+ break;
2477
+
2478
+ case 74:
2479
+ #line 307 "grammar.y" /* yacc.c:1646 */
2480
+ { (yyval.ndt) = ndt_string(ctx); if ((yyval.ndt) == NULL) YYABORT; }
2481
+ #line 2482 "grammar.c" /* yacc.c:1646 */
2482
+ break;
2483
+
2484
+ case 75:
2485
+ #line 310 "grammar.y" /* yacc.c:1646 */
2486
+ { (yyval.ndt) = mk_fixed_string((yyvsp[-1].string), Utf8, ctx); if ((yyval.ndt) == NULL) YYABORT; }
2487
+ #line 2488 "grammar.c" /* yacc.c:1646 */
2488
+ break;
2489
+
2490
+ case 76:
2491
+ #line 311 "grammar.y" /* yacc.c:1646 */
2492
+ { (yyval.ndt) = mk_fixed_string((yyvsp[-3].string), (yyvsp[-1].encoding), ctx); if ((yyval.ndt) == NULL) YYABORT; }
2493
+ #line 2494 "grammar.c" /* yacc.c:1646 */
2494
+ break;
2495
+
2496
+ case 77:
2497
+ #line 314 "grammar.y" /* yacc.c:1646 */
2498
+ { (yyval.uint32) = 0; }
2499
+ #line 2500 "grammar.c" /* yacc.c:1646 */
2500
+ break;
2501
+
2502
+ case 78:
2503
+ #line 315 "grammar.y" /* yacc.c:1646 */
2504
+ { (yyval.uint32) = NDT_SYS_BIG_ENDIAN ? NDT_BIG_ENDIAN : NDT_LITTLE_ENDIAN; }
2505
+ #line 2506 "grammar.c" /* yacc.c:1646 */
2506
+ break;
2507
+
2508
+ case 79:
2509
+ #line 316 "grammar.y" /* yacc.c:1646 */
2510
+ { (yyval.uint32) = NDT_LITTLE_ENDIAN; }
2511
+ #line 2512 "grammar.c" /* yacc.c:1646 */
2512
+ break;
2513
+
2514
+ case 80:
2515
+ #line 317 "grammar.y" /* yacc.c:1646 */
2516
+ { (yyval.uint32) = NDT_BIG_ENDIAN; }
2517
+ #line 2518 "grammar.c" /* yacc.c:1646 */
2518
+ break;
2519
+
2520
+ case 81:
2521
+ #line 318 "grammar.y" /* yacc.c:1646 */
2522
+ { (yyval.uint32) = 0; }
2523
+ #line 2524 "grammar.c" /* yacc.c:1646 */
2524
+ break;
2525
+
2526
+ case 82:
2527
+ #line 321 "grammar.y" /* yacc.c:1646 */
2528
+ { (yyval.encoding) = encoding_from_string((yyvsp[0].string), ctx); if (ndt_err_occurred(ctx)) YYABORT; }
2529
+ #line 2530 "grammar.c" /* yacc.c:1646 */
2530
+ break;
2531
+
2532
+ case 83:
2533
+ #line 324 "grammar.y" /* yacc.c:1646 */
2534
+ { (yyval.ndt) = mk_bytes((yyvsp[0].attribute_seq), ctx); if ((yyval.ndt) == NULL) YYABORT; }
2535
+ #line 2536 "grammar.c" /* yacc.c:1646 */
2536
+ break;
2537
+
2538
+ case 84:
2539
+ #line 327 "grammar.y" /* yacc.c:1646 */
2540
+ { (yyval.ndt) = mk_fixed_bytes((yyvsp[-1].attribute_seq), ctx); if ((yyval.ndt) == NULL) YYABORT; }
2541
+ #line 2542 "grammar.c" /* yacc.c:1646 */
2542
+ break;
2543
+
2544
+ case 85:
2545
+ #line 330 "grammar.y" /* yacc.c:1646 */
2546
+ { (yyval.ndt) = ndt_ref((yyvsp[-1].ndt), ctx); if ((yyval.ndt) == NULL) YYABORT; }
2547
+ #line 2548 "grammar.c" /* yacc.c:1646 */
2548
+ break;
2549
+
2550
+ case 86:
2551
+ #line 331 "grammar.y" /* yacc.c:1646 */
2552
+ { (yyval.ndt) = ndt_ref((yyvsp[0].ndt), ctx); if ((yyval.ndt) == NULL) YYABORT; }
2553
+ #line 2554 "grammar.c" /* yacc.c:1646 */
2554
+ break;
2555
+
2556
+ case 87:
2557
+ #line 334 "grammar.y" /* yacc.c:1646 */
2558
+ { (yyval.ndt) = mk_categorical((yyvsp[-1].typed_value_seq), ctx); if ((yyval.ndt) == NULL) YYABORT; }
2559
+ #line 2560 "grammar.c" /* yacc.c:1646 */
2560
+ break;
2561
+
2562
+ case 88:
2563
+ #line 337 "grammar.y" /* yacc.c:1646 */
2564
+ { (yyval.typed_value_seq) = ndt_value_seq_new((yyvsp[0].typed_value), ctx); if ((yyval.typed_value_seq) == NULL) YYABORT; }
2565
+ #line 2566 "grammar.c" /* yacc.c:1646 */
2566
+ break;
2567
+
2568
+ case 89:
2569
+ #line 338 "grammar.y" /* yacc.c:1646 */
2570
+ { (yyval.typed_value_seq) = ndt_value_seq_append((yyvsp[-2].typed_value_seq), (yyvsp[0].typed_value), ctx); if ((yyval.typed_value_seq) == NULL) YYABORT; }
2571
+ #line 2572 "grammar.c" /* yacc.c:1646 */
2572
+ break;
2573
+
2574
+ case 90:
2575
+ #line 341 "grammar.y" /* yacc.c:1646 */
2576
+ { (yyval.typed_value) = ndt_value_from_number(ValInt64, (yyvsp[0].string), ctx); if ((yyval.typed_value) == NULL) YYABORT; }
2577
+ #line 2578 "grammar.c" /* yacc.c:1646 */
2578
+ break;
2579
+
2580
+ case 91:
2581
+ #line 342 "grammar.y" /* yacc.c:1646 */
2582
+ { (yyval.typed_value) = ndt_value_from_number(ValFloat64, (yyvsp[0].string), ctx); if ((yyval.typed_value) == NULL) YYABORT; }
2583
+ #line 2584 "grammar.c" /* yacc.c:1646 */
2584
+ break;
2585
+
2586
+ case 92:
2587
+ #line 343 "grammar.y" /* yacc.c:1646 */
2588
+ { (yyval.typed_value) = ndt_value_from_string((yyvsp[0].string), ctx); if ((yyval.typed_value) == NULL) YYABORT; }
2589
+ #line 2590 "grammar.c" /* yacc.c:1646 */
2590
+ break;
2591
+
2592
+ case 93:
2593
+ #line 344 "grammar.y" /* yacc.c:1646 */
2594
+ { (yyval.typed_value) = ndt_value_na(ctx); if ((yyval.typed_value) == NULL) YYABORT; }
2595
+ #line 2596 "grammar.c" /* yacc.c:1646 */
2596
+ break;
2597
+
2598
+ case 94:
2599
+ #line 347 "grammar.y" /* yacc.c:1646 */
2600
+ { (yyval.variadic_flag) = Nonvariadic; }
2601
+ #line 2602 "grammar.c" /* yacc.c:1646 */
2602
+ break;
2603
+
2604
+ case 95:
2605
+ #line 348 "grammar.y" /* yacc.c:1646 */
2606
+ { (yyval.variadic_flag) = Variadic; }
2607
+ #line 2608 "grammar.c" /* yacc.c:1646 */
2608
+ break;
2609
+
2610
+ case 96:
2611
+ #line 351 "grammar.y" /* yacc.c:1646 */
2612
+ { (yyval.variadic_flag) = Nonvariadic; }
2613
+ #line 2614 "grammar.c" /* yacc.c:1646 */
2614
+ break;
2615
+
2616
+ case 97:
2617
+ #line 352 "grammar.y" /* yacc.c:1646 */
2618
+ { (yyval.variadic_flag) = Nonvariadic; }
2619
+ #line 2620 "grammar.c" /* yacc.c:1646 */
2620
+ break;
2621
+
2622
+ case 98:
2623
+ #line 353 "grammar.y" /* yacc.c:1646 */
2624
+ { (yyval.variadic_flag) = Variadic; }
2625
+ #line 2626 "grammar.c" /* yacc.c:1646 */
2626
+ break;
2627
+
2628
+ case 99:
2629
+ #line 356 "grammar.y" /* yacc.c:1646 */
2630
+ { (yyval.ndt) = mk_tuple((yyvsp[-1].variadic_flag), NULL, NULL, ctx); if ((yyval.ndt) == NULL) YYABORT; }
2631
+ #line 2632 "grammar.c" /* yacc.c:1646 */
2632
+ break;
2633
+
2634
+ case 100:
2635
+ #line 357 "grammar.y" /* yacc.c:1646 */
2636
+ { (yyval.ndt) = mk_tuple((yyvsp[-1].variadic_flag), (yyvsp[-2].field_seq), NULL, ctx); if ((yyval.ndt) == NULL) YYABORT; }
2637
+ #line 2638 "grammar.c" /* yacc.c:1646 */
2638
+ break;
2639
+
2640
+ case 101:
2641
+ #line 358 "grammar.y" /* yacc.c:1646 */
2642
+ { (yyval.ndt) = mk_tuple(Nonvariadic, (yyvsp[-3].field_seq), (yyvsp[-1].attribute_seq), ctx); if ((yyval.ndt) == NULL) YYABORT; }
2643
+ #line 2644 "grammar.c" /* yacc.c:1646 */
2644
+ break;
2645
+
2646
+ case 102:
2647
+ #line 361 "grammar.y" /* yacc.c:1646 */
2648
+ { (yyval.field_seq) = ndt_field_seq_new((yyvsp[0].field), ctx); if ((yyval.field_seq) == NULL) YYABORT; }
2649
+ #line 2650 "grammar.c" /* yacc.c:1646 */
2650
+ break;
2651
+
2652
+ case 103:
2653
+ #line 362 "grammar.y" /* yacc.c:1646 */
2654
+ { (yyval.field_seq) = ndt_field_seq_append((yyvsp[-2].field_seq), (yyvsp[0].field), ctx); if ((yyval.field_seq) == NULL) YYABORT; }
2655
+ #line 2656 "grammar.c" /* yacc.c:1646 */
2656
+ break;
2657
+
2658
+ case 104:
2659
+ #line 365 "grammar.y" /* yacc.c:1646 */
2660
+ { (yyval.field) = mk_field(NULL, (yyvsp[0].ndt), NULL, ctx); if ((yyval.field) == NULL) YYABORT; }
2661
+ #line 2662 "grammar.c" /* yacc.c:1646 */
2662
+ break;
2663
+
2664
+ case 105:
2665
+ #line 366 "grammar.y" /* yacc.c:1646 */
2666
+ { (yyval.field) = mk_field(NULL, (yyvsp[-3].ndt), (yyvsp[-1].attribute_seq), ctx); if ((yyval.field) == NULL) YYABORT; }
2667
+ #line 2668 "grammar.c" /* yacc.c:1646 */
2668
+ break;
2669
+
2670
+ case 106:
2671
+ #line 369 "grammar.y" /* yacc.c:1646 */
2672
+ { (yyval.ndt) = mk_record((yyvsp[-1].variadic_flag), NULL, NULL, ctx); if ((yyval.ndt) == NULL) YYABORT; }
2673
+ #line 2674 "grammar.c" /* yacc.c:1646 */
2674
+ break;
2675
+
2676
+ case 107:
2677
+ #line 370 "grammar.y" /* yacc.c:1646 */
2678
+ { (yyval.ndt) = mk_record((yyvsp[-1].variadic_flag), (yyvsp[-2].field_seq), NULL, ctx); if ((yyval.ndt) == NULL) YYABORT; }
2679
+ #line 2680 "grammar.c" /* yacc.c:1646 */
2680
+ break;
2681
+
2682
+ case 108:
2683
+ #line 371 "grammar.y" /* yacc.c:1646 */
2684
+ { (yyval.ndt) = mk_record(Nonvariadic, (yyvsp[-3].field_seq), (yyvsp[-1].attribute_seq), ctx); if ((yyval.ndt) == NULL) YYABORT; }
2685
+ #line 2686 "grammar.c" /* yacc.c:1646 */
2686
+ break;
2687
+
2688
+ case 109:
2689
+ #line 374 "grammar.y" /* yacc.c:1646 */
2690
+ { (yyval.field_seq) = ndt_field_seq_new((yyvsp[0].field), ctx); if ((yyval.field_seq) == NULL) YYABORT; }
2691
+ #line 2692 "grammar.c" /* yacc.c:1646 */
2692
+ break;
2693
+
2694
+ case 110:
2695
+ #line 375 "grammar.y" /* yacc.c:1646 */
2696
+ { (yyval.field_seq) = ndt_field_seq_append((yyvsp[-2].field_seq), (yyvsp[0].field), ctx); if ((yyval.field_seq) == NULL) YYABORT; }
2697
+ #line 2698 "grammar.c" /* yacc.c:1646 */
2698
+ break;
2699
+
2700
+ case 111:
2701
+ #line 378 "grammar.y" /* yacc.c:1646 */
2702
+ { (yyval.field) = mk_field((yyvsp[-2].string), (yyvsp[0].ndt), NULL, ctx); if ((yyval.field) == NULL) YYABORT; }
2703
+ #line 2704 "grammar.c" /* yacc.c:1646 */
2704
+ break;
2705
+
2706
+ case 112:
2707
+ #line 379 "grammar.y" /* yacc.c:1646 */
2708
+ { (yyval.field) = mk_field((yyvsp[-5].string), (yyvsp[-3].ndt), (yyvsp[-1].attribute_seq), ctx); if ((yyval.field) == NULL) YYABORT; }
2709
+ #line 2710 "grammar.c" /* yacc.c:1646 */
2710
+ break;
2711
+
2712
+ case 113:
2713
+ #line 382 "grammar.y" /* yacc.c:1646 */
2714
+ { (yyval.string) = (yyvsp[0].string); if ((yyval.string) == NULL) YYABORT; }
2715
+ #line 2716 "grammar.c" /* yacc.c:1646 */
2716
+ break;
2717
+
2718
+ case 114:
2719
+ #line 383 "grammar.y" /* yacc.c:1646 */
2720
+ { (yyval.string) = (yyvsp[0].string); if ((yyval.string) == NULL) YYABORT; }
2721
+ #line 2722 "grammar.c" /* yacc.c:1646 */
2722
+ break;
2723
+
2724
+ case 115:
2725
+ #line 384 "grammar.y" /* yacc.c:1646 */
2726
+ { (yyval.string) = (yyvsp[0].string); if ((yyval.string) == NULL) YYABORT; }
2727
+ #line 2728 "grammar.c" /* yacc.c:1646 */
2728
+ break;
2729
+
2730
+ case 116:
2731
+ #line 387 "grammar.y" /* yacc.c:1646 */
2732
+ { (yyval.attribute_seq) = NULL; }
2733
+ #line 2734 "grammar.c" /* yacc.c:1646 */
2734
+ break;
2735
+
2736
+ case 117:
2737
+ #line 388 "grammar.y" /* yacc.c:1646 */
2738
+ { (yyval.attribute_seq) = (yyvsp[-1].attribute_seq); if ((yyval.attribute_seq) == NULL) YYABORT; }
2739
+ #line 2740 "grammar.c" /* yacc.c:1646 */
2740
+ break;
2741
+
2742
+ case 118:
2743
+ #line 391 "grammar.y" /* yacc.c:1646 */
2744
+ { (yyval.attribute_seq) = ndt_attr_seq_new((yyvsp[0].attribute), ctx); if ((yyval.attribute_seq) == NULL) YYABORT; }
2745
+ #line 2746 "grammar.c" /* yacc.c:1646 */
2746
+ break;
2747
+
2748
+ case 119:
2749
+ #line 392 "grammar.y" /* yacc.c:1646 */
2750
+ { (yyval.attribute_seq) = ndt_attr_seq_append((yyvsp[-2].attribute_seq), (yyvsp[0].attribute), ctx); if ((yyval.attribute_seq) == NULL) YYABORT; }
2751
+ #line 2752 "grammar.c" /* yacc.c:1646 */
2752
+ break;
2753
+
2754
+ case 120:
2755
+ #line 395 "grammar.y" /* yacc.c:1646 */
2756
+ { (yyval.attribute) = mk_attr((yyvsp[-2].string), (yyvsp[0].string), ctx); if ((yyval.attribute) == NULL) YYABORT; }
2757
+ #line 2758 "grammar.c" /* yacc.c:1646 */
2758
+ break;
2759
+
2760
+ case 121:
2761
+ #line 396 "grammar.y" /* yacc.c:1646 */
2762
+ { (yyval.attribute) = mk_attr_from_seq((yyvsp[-4].string), (yyvsp[-1].string_seq), ctx); if ((yyval.attribute) == NULL) YYABORT; }
2763
+ #line 2764 "grammar.c" /* yacc.c:1646 */
2764
+ break;
2765
+
2766
+ case 122:
2767
+ #line 399 "grammar.y" /* yacc.c:1646 */
2768
+ { (yyval.string_seq) = ndt_string_seq_new((yyvsp[0].string), ctx); if ((yyval.string_seq) == NULL) YYABORT; }
2769
+ #line 2770 "grammar.c" /* yacc.c:1646 */
2770
+ break;
2771
+
2772
+ case 123:
2773
+ #line 400 "grammar.y" /* yacc.c:1646 */
2774
+ { (yyval.string_seq) = ndt_string_seq_append((yyvsp[-2].string_seq), (yyvsp[0].string), ctx); if ((yyval.string_seq) == NULL) YYABORT; }
2775
+ #line 2776 "grammar.c" /* yacc.c:1646 */
2776
+ break;
2777
+
2778
+ case 124:
2779
+ #line 403 "grammar.y" /* yacc.c:1646 */
2780
+ { (yyval.string) = (yyvsp[0].string); if ((yyval.string) == NULL) YYABORT; }
2781
+ #line 2782 "grammar.c" /* yacc.c:1646 */
2782
+ break;
2783
+
2784
+ case 125:
2785
+ #line 404 "grammar.y" /* yacc.c:1646 */
2786
+ { (yyval.string) = (yyvsp[0].string); if ((yyval.string) == NULL) YYABORT; }
2787
+ #line 2788 "grammar.c" /* yacc.c:1646 */
2788
+ break;
2789
+
2790
+ case 126:
2791
+ #line 405 "grammar.y" /* yacc.c:1646 */
2792
+ { (yyval.string) = (yyvsp[0].string); if ((yyval.string) == NULL) YYABORT; }
2793
+ #line 2794 "grammar.c" /* yacc.c:1646 */
2794
+ break;
2795
+
2796
+ case 127:
2797
+ #line 406 "grammar.y" /* yacc.c:1646 */
2798
+ { (yyval.string) = (yyvsp[0].string); if ((yyval.string) == NULL) YYABORT; }
2799
+ #line 2800 "grammar.c" /* yacc.c:1646 */
2800
+ break;
2801
+
2802
+ case 128:
2803
+ #line 409 "grammar.y" /* yacc.c:1646 */
2804
+ { (yyval.ndt) = mk_function((yyvsp[-2].type_seq), (yyvsp[0].type_seq), ctx); if ((yyval.ndt) == NULL) YYABORT; }
2805
+ #line 2806 "grammar.c" /* yacc.c:1646 */
2806
+ break;
2807
+
2808
+ case 129:
2809
+ #line 412 "grammar.y" /* yacc.c:1646 */
2810
+ { (yyval.type_seq) = (yyvsp[0].type_seq); if ((yyval.type_seq) == NULL) YYABORT; }
2811
+ #line 2812 "grammar.c" /* yacc.c:1646 */
2812
+ break;
2813
+
2814
+ case 130:
2815
+ #line 413 "grammar.y" /* yacc.c:1646 */
2816
+ { (yyval.type_seq) = ndt_type_seq_empty(ctx); if ((yyval.type_seq) == NULL) YYABORT; }
2817
+ #line 2818 "grammar.c" /* yacc.c:1646 */
2818
+ break;
2819
+
2820
+ case 131:
2821
+ #line 416 "grammar.y" /* yacc.c:1646 */
2822
+ { (yyval.type_seq) = ndt_type_seq_new((yyvsp[0].ndt), ctx); if ((yyval.type_seq) == NULL) YYABORT; }
2823
+ #line 2824 "grammar.c" /* yacc.c:1646 */
2824
+ break;
2825
+
2826
+ case 132:
2827
+ #line 417 "grammar.y" /* yacc.c:1646 */
2828
+ { (yyval.type_seq) = ndt_type_seq_append((yyvsp[-2].type_seq), (yyvsp[0].ndt), ctx); if ((yyval.type_seq) == NULL) YYABORT; }
2829
+ #line 2830 "grammar.c" /* yacc.c:1646 */
2830
+ break;
2831
+
2832
+
2833
+ #line 2834 "grammar.c" /* yacc.c:1646 */
2834
+ default: break;
2835
+ }
2836
+ /* User semantic actions sometimes alter yychar, and that requires
2837
+ that yytoken be updated with the new translation. We take the
2838
+ approach of translating immediately before every use of yytoken.
2839
+ One alternative is translating here after every semantic action,
2840
+ but that translation would be missed if the semantic action invokes
2841
+ YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2842
+ if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2843
+ incorrect destructor might then be invoked immediately. In the
2844
+ case of YYERROR or YYBACKUP, subsequent parser actions might lead
2845
+ to an incorrect destructor call or verbose syntax error message
2846
+ before the lookahead is translated. */
2847
+ YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2848
+
2849
+ YYPOPSTACK (yylen);
2850
+ yylen = 0;
2851
+ YY_STACK_PRINT (yyss, yyssp);
2852
+
2853
+ *++yyvsp = yyval;
2854
+ *++yylsp = yyloc;
2855
+
2856
+ /* Now 'shift' the result of the reduction. Determine what state
2857
+ that goes to, based on the state we popped back to and the rule
2858
+ number reduced by. */
2859
+
2860
+ yyn = yyr1[yyn];
2861
+
2862
+ yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2863
+ if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2864
+ yystate = yytable[yystate];
2865
+ else
2866
+ yystate = yydefgoto[yyn - YYNTOKENS];
2867
+
2868
+ goto yynewstate;
2869
+
2870
+
2871
+ /*--------------------------------------.
2872
+ | yyerrlab -- here on detecting error. |
2873
+ `--------------------------------------*/
2874
+ yyerrlab:
2875
+ /* Make sure we have latest lookahead translation. See comments at
2876
+ user semantic actions for why this is necessary. */
2877
+ yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
2878
+
2879
+ /* If not already recovering from an error, report this error. */
2880
+ if (!yyerrstatus)
2881
+ {
2882
+ ++yynerrs;
2883
+ #if ! YYERROR_VERBOSE
2884
+ yyerror (&yylloc, scanner, ast, meta, ctx, YY_("syntax error"));
2885
+ #else
2886
+ # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
2887
+ yyssp, yytoken)
2888
+ {
2889
+ char const *yymsgp = YY_("syntax error");
2890
+ int yysyntax_error_status;
2891
+ yysyntax_error_status = YYSYNTAX_ERROR;
2892
+ if (yysyntax_error_status == 0)
2893
+ yymsgp = yymsg;
2894
+ else if (yysyntax_error_status == 1)
2895
+ {
2896
+ if (yymsg != yymsgbuf)
2897
+ YYSTACK_FREE (yymsg);
2898
+ yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
2899
+ if (!yymsg)
2900
+ {
2901
+ yymsg = yymsgbuf;
2902
+ yymsg_alloc = sizeof yymsgbuf;
2903
+ yysyntax_error_status = 2;
2904
+ }
2905
+ else
2906
+ {
2907
+ yysyntax_error_status = YYSYNTAX_ERROR;
2908
+ yymsgp = yymsg;
2909
+ }
2910
+ }
2911
+ yyerror (&yylloc, scanner, ast, meta, ctx, yymsgp);
2912
+ if (yysyntax_error_status == 2)
2913
+ goto yyexhaustedlab;
2914
+ }
2915
+ # undef YYSYNTAX_ERROR
2916
+ #endif
2917
+ }
2918
+
2919
+ yyerror_range[1] = yylloc;
2920
+
2921
+ if (yyerrstatus == 3)
2922
+ {
2923
+ /* If just tried and failed to reuse lookahead token after an
2924
+ error, discard it. */
2925
+
2926
+ if (yychar <= YYEOF)
2927
+ {
2928
+ /* Return failure if at end of input. */
2929
+ if (yychar == YYEOF)
2930
+ YYABORT;
2931
+ }
2932
+ else
2933
+ {
2934
+ yydestruct ("Error: discarding",
2935
+ yytoken, &yylval, &yylloc, scanner, ast, meta, ctx);
2936
+ yychar = YYEMPTY;
2937
+ }
2938
+ }
2939
+
2940
+ /* Else will try to reuse lookahead token after shifting the error
2941
+ token. */
2942
+ goto yyerrlab1;
2943
+
2944
+
2945
+ /*---------------------------------------------------.
2946
+ | yyerrorlab -- error raised explicitly by YYERROR. |
2947
+ `---------------------------------------------------*/
2948
+ yyerrorlab:
2949
+
2950
+ /* Pacify compilers like GCC when the user code never invokes
2951
+ YYERROR and the label yyerrorlab therefore never appears in user
2952
+ code. */
2953
+ if (/*CONSTCOND*/ 0)
2954
+ goto yyerrorlab;
2955
+
2956
+ yyerror_range[1] = yylsp[1-yylen];
2957
+ /* Do not reclaim the symbols of the rule whose action triggered
2958
+ this YYERROR. */
2959
+ YYPOPSTACK (yylen);
2960
+ yylen = 0;
2961
+ YY_STACK_PRINT (yyss, yyssp);
2962
+ yystate = *yyssp;
2963
+ goto yyerrlab1;
2964
+
2965
+
2966
+ /*-------------------------------------------------------------.
2967
+ | yyerrlab1 -- common code for both syntax error and YYERROR. |
2968
+ `-------------------------------------------------------------*/
2969
+ yyerrlab1:
2970
+ yyerrstatus = 3; /* Each real token shifted decrements this. */
2971
+
2972
+ for (;;)
2973
+ {
2974
+ yyn = yypact[yystate];
2975
+ if (!yypact_value_is_default (yyn))
2976
+ {
2977
+ yyn += YYTERROR;
2978
+ if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2979
+ {
2980
+ yyn = yytable[yyn];
2981
+ if (0 < yyn)
2982
+ break;
2983
+ }
2984
+ }
2985
+
2986
+ /* Pop the current state because it cannot handle the error token. */
2987
+ if (yyssp == yyss)
2988
+ YYABORT;
2989
+
2990
+ yyerror_range[1] = *yylsp;
2991
+ yydestruct ("Error: popping",
2992
+ yystos[yystate], yyvsp, yylsp, scanner, ast, meta, ctx);
2993
+ YYPOPSTACK (1);
2994
+ yystate = *yyssp;
2995
+ YY_STACK_PRINT (yyss, yyssp);
2996
+ }
2997
+
2998
+ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2999
+ *++yyvsp = yylval;
3000
+ YY_IGNORE_MAYBE_UNINITIALIZED_END
3001
+
3002
+ yyerror_range[2] = yylloc;
3003
+ /* Using YYLLOC is tempting, but would change the location of
3004
+ the lookahead. YYLOC is available though. */
3005
+ YYLLOC_DEFAULT (yyloc, yyerror_range, 2);
3006
+ *++yylsp = yyloc;
3007
+
3008
+ /* Shift the error token. */
3009
+ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
3010
+
3011
+ yystate = yyn;
3012
+ goto yynewstate;
3013
+
3014
+
3015
+ /*-------------------------------------.
3016
+ | yyacceptlab -- YYACCEPT comes here. |
3017
+ `-------------------------------------*/
3018
+ yyacceptlab:
3019
+ yyresult = 0;
3020
+ goto yyreturn;
3021
+
3022
+ /*-----------------------------------.
3023
+ | yyabortlab -- YYABORT comes here. |
3024
+ `-----------------------------------*/
3025
+ yyabortlab:
3026
+ yyresult = 1;
3027
+ goto yyreturn;
3028
+
3029
+ #if !defined yyoverflow || YYERROR_VERBOSE
3030
+ /*-------------------------------------------------.
3031
+ | yyexhaustedlab -- memory exhaustion comes here. |
3032
+ `-------------------------------------------------*/
3033
+ yyexhaustedlab:
3034
+ yyerror (&yylloc, scanner, ast, meta, ctx, YY_("memory exhausted"));
3035
+ yyresult = 2;
3036
+ /* Fall through. */
3037
+ #endif
3038
+
3039
+ yyreturn:
3040
+ if (yychar != YYEMPTY)
3041
+ {
3042
+ /* Make sure we have latest lookahead translation. See comments at
3043
+ user semantic actions for why this is necessary. */
3044
+ yytoken = YYTRANSLATE (yychar);
3045
+ yydestruct ("Cleanup: discarding lookahead",
3046
+ yytoken, &yylval, &yylloc, scanner, ast, meta, ctx);
3047
+ }
3048
+ /* Do not reclaim the symbols of the rule whose action triggered
3049
+ this YYABORT or YYACCEPT. */
3050
+ YYPOPSTACK (yylen);
3051
+ YY_STACK_PRINT (yyss, yyssp);
3052
+ while (yyssp != yyss)
3053
+ {
3054
+ yydestruct ("Cleanup: popping",
3055
+ yystos[*yyssp], yyvsp, yylsp, scanner, ast, meta, ctx);
3056
+ YYPOPSTACK (1);
3057
+ }
3058
+ #ifndef yyoverflow
3059
+ if (yyss != yyssa)
3060
+ YYSTACK_FREE (yyss);
3061
+ #endif
3062
+ #if YYERROR_VERBOSE
3063
+ if (yymsg != yymsgbuf)
3064
+ YYSTACK_FREE (yymsg);
3065
+ #endif
3066
+ return yyresult;
3067
+ }