ndtypes 0.2.0dev4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CONTRIBUTING.md +50 -0
- data/Gemfile +2 -0
- data/History.md +0 -0
- data/README.md +19 -0
- data/Rakefile +125 -0
- data/ext/ruby_ndtypes/extconf.rb +55 -0
- data/ext/ruby_ndtypes/gc_guard.c +36 -0
- data/ext/ruby_ndtypes/gc_guard.h +12 -0
- data/ext/ruby_ndtypes/ndtypes/AUTHORS.txt +5 -0
- data/ext/ruby_ndtypes/ndtypes/INSTALL.txt +101 -0
- data/ext/ruby_ndtypes/ndtypes/LICENSE.txt +29 -0
- data/ext/ruby_ndtypes/ndtypes/MANIFEST.in +3 -0
- data/ext/ruby_ndtypes/ndtypes/Makefile.in +87 -0
- data/ext/ruby_ndtypes/ndtypes/README.rst +47 -0
- data/ext/ruby_ndtypes/ndtypes/config.guess +1530 -0
- data/ext/ruby_ndtypes/ndtypes/config.h.in +67 -0
- data/ext/ruby_ndtypes/ndtypes/config.sub +1782 -0
- data/ext/ruby_ndtypes/ndtypes/configure +5260 -0
- data/ext/ruby_ndtypes/ndtypes/configure.ac +161 -0
- data/ext/ruby_ndtypes/ndtypes/doc/Makefile +14 -0
- data/ext/ruby_ndtypes/ndtypes/doc/_static/copybutton.js +66 -0
- data/ext/ruby_ndtypes/ndtypes/doc/conf.py +26 -0
- data/ext/ruby_ndtypes/ndtypes/doc/grammar/grammar.rst +27 -0
- data/ext/ruby_ndtypes/ndtypes/doc/index.rst +56 -0
- data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/context.rst +131 -0
- data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/encodings.rst +68 -0
- data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/fields-values.rst +175 -0
- data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/functions.rst +72 -0
- data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/index.rst +43 -0
- data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/init.rst +48 -0
- data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/io.rst +100 -0
- data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/memory.rst +124 -0
- data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/predicates.rst +110 -0
- data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/typedef.rst +31 -0
- data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/types.rst +594 -0
- data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/util.rst +166 -0
- data/ext/ruby_ndtypes/ndtypes/doc/ndtypes/buffer-protocol.rst +27 -0
- data/ext/ruby_ndtypes/ndtypes/doc/ndtypes/index.rst +21 -0
- data/ext/ruby_ndtypes/ndtypes/doc/ndtypes/pattern-matching.rst +330 -0
- data/ext/ruby_ndtypes/ndtypes/doc/ndtypes/quickstart.rst +144 -0
- data/ext/ruby_ndtypes/ndtypes/doc/ndtypes/types.rst +544 -0
- data/ext/ruby_ndtypes/ndtypes/doc/releases/index.rst +35 -0
- data/ext/ruby_ndtypes/ndtypes/install-sh +527 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/Makefile.in +271 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/Makefile.vc +269 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/alloc.c +230 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/attr.c +268 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/attr.h +109 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/Makefile.in +73 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/Makefile.vc +70 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/README.txt +16 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/bpgrammar.c +2179 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/bpgrammar.h +134 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/bpgrammar.y +428 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/bplexer.c +2543 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/bplexer.h +735 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/bplexer.l +176 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/export.c +543 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/import.c +110 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/context.c +228 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/copy.c +634 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/encodings.c +116 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/equal.c +288 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/grammar.c +3067 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/grammar.h +180 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/grammar.y +417 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/io.c +1658 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/lexer.c +2773 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/lexer.h +734 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/lexer.l +222 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/match.c +1132 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/ndtypes.c +2323 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/ndtypes.h.in +893 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/overflow.h +161 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/parsefuncs.c +473 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/parsefuncs.h +92 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/parser.c +246 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/seq.c +269 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/seq.h +197 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/serialize/Makefile.in +48 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/serialize/Makefile.vc +46 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/serialize/deserialize.c +1007 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/serialize/serialize.c +442 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/slice.h +42 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/substitute.c +238 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/substitute.h +50 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/symtable.c +371 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/symtable.h +100 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/Makefile.in +55 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/Makefile.vc +45 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/alloc_fail.c +82 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/alloc_fail.h +49 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/runtest.c +1657 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test.h +85 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_array.c +115 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_buffer.c +137 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_indent.c +201 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_match.c +2397 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_numba.c +57 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_parse.c +349 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_parse_error.c +27839 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_parse_roundtrip.c +350 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_record.c +231 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_typecheck.c +375 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_typedef.c +65 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/valgrind.supp +30 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tools/bench.c +79 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tools/indent.c +94 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tools/print_ast.c +96 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/util.c +474 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/values.c +228 -0
- data/ext/ruby_ndtypes/ndtypes/python/bench.py +49 -0
- data/ext/ruby_ndtypes/ndtypes/python/ndt_randtype.py +409 -0
- data/ext/ruby_ndtypes/ndtypes/python/ndt_support.py +14 -0
- data/ext/ruby_ndtypes/ndtypes/python/ndtypes/__init__.py +70 -0
- data/ext/ruby_ndtypes/ndtypes/python/ndtypes/_ndtypes.c +1332 -0
- data/ext/ruby_ndtypes/ndtypes/python/ndtypes/docstrings.h +319 -0
- data/ext/ruby_ndtypes/ndtypes/python/ndtypes/pyndtypes.h +154 -0
- data/ext/ruby_ndtypes/ndtypes/python/test_ndtypes.py +1977 -0
- data/ext/ruby_ndtypes/ndtypes/setup.py +288 -0
- data/ext/ruby_ndtypes/ndtypes/vcbuild/INSTALL.txt +41 -0
- data/ext/ruby_ndtypes/ndtypes/vcbuild/runtest32.bat +15 -0
- data/ext/ruby_ndtypes/ndtypes/vcbuild/runtest64.bat +13 -0
- data/ext/ruby_ndtypes/ndtypes/vcbuild/vcbuild32.bat +38 -0
- data/ext/ruby_ndtypes/ndtypes/vcbuild/vcbuild64.bat +38 -0
- data/ext/ruby_ndtypes/ndtypes/vcbuild/vcclean.bat +13 -0
- data/ext/ruby_ndtypes/ndtypes/vcbuild/vcdistclean.bat +14 -0
- data/ext/ruby_ndtypes/ruby_ndtypes.c +1003 -0
- data/ext/ruby_ndtypes/ruby_ndtypes.h +37 -0
- data/ext/ruby_ndtypes/ruby_ndtypes_internal.h +28 -0
- data/lib/ndtypes.rb +45 -0
- data/lib/ndtypes/errors.rb +2 -0
- data/lib/ndtypes/version.rb +6 -0
- data/ndtypes.gemspec +47 -0
- data/spec/gc_table_spec.rb +10 -0
- data/spec/ndtypes_spec.rb +289 -0
- data/spec/spec_helper.rb +241 -0
- metadata +242 -0
@@ -0,0 +1,180 @@
|
|
1
|
+
/* A Bison parser, made by GNU Bison 3.0.4. */
|
2
|
+
|
3
|
+
/* Bison interface 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
|
+
#ifndef YY_NDT_YY_GRAMMAR_H_INCLUDED
|
34
|
+
# define YY_NDT_YY_GRAMMAR_H_INCLUDED
|
35
|
+
/* Debug traces. */
|
36
|
+
#ifndef YYDEBUG
|
37
|
+
# define YYDEBUG 0
|
38
|
+
#endif
|
39
|
+
#if YYDEBUG
|
40
|
+
extern int ndt_yydebug;
|
41
|
+
#endif
|
42
|
+
/* "%code requires" blocks. */
|
43
|
+
#line 57 "grammar.y" /* yacc.c:1909 */
|
44
|
+
|
45
|
+
#include "ndtypes.h"
|
46
|
+
#include "seq.h"
|
47
|
+
#include "attr.h"
|
48
|
+
#include "parsefuncs.h"
|
49
|
+
#define YY_TYPEDEF_YY_SCANNER_T
|
50
|
+
typedef void * yyscan_t;
|
51
|
+
|
52
|
+
#line 53 "grammar.h" /* yacc.c:1909 */
|
53
|
+
|
54
|
+
/* Token type. */
|
55
|
+
#ifndef YYTOKENTYPE
|
56
|
+
# define YYTOKENTYPE
|
57
|
+
enum yytokentype
|
58
|
+
{
|
59
|
+
ENDMARKER = 0,
|
60
|
+
ANY_KIND = 258,
|
61
|
+
SCALAR_KIND = 259,
|
62
|
+
VOID = 260,
|
63
|
+
BOOL = 261,
|
64
|
+
SIGNED_KIND = 262,
|
65
|
+
INT8 = 263,
|
66
|
+
INT16 = 264,
|
67
|
+
INT32 = 265,
|
68
|
+
INT64 = 266,
|
69
|
+
UNSIGNED_KIND = 267,
|
70
|
+
UINT8 = 268,
|
71
|
+
UINT16 = 269,
|
72
|
+
UINT32 = 270,
|
73
|
+
UINT64 = 271,
|
74
|
+
FLOAT_KIND = 272,
|
75
|
+
FLOAT16 = 273,
|
76
|
+
FLOAT32 = 274,
|
77
|
+
FLOAT64 = 275,
|
78
|
+
COMPLEX_KIND = 276,
|
79
|
+
COMPLEX32 = 277,
|
80
|
+
COMPLEX64 = 278,
|
81
|
+
COMPLEX128 = 279,
|
82
|
+
CATEGORICAL = 280,
|
83
|
+
NA = 281,
|
84
|
+
INTPTR = 282,
|
85
|
+
UINTPTR = 283,
|
86
|
+
SIZE = 284,
|
87
|
+
CHAR = 285,
|
88
|
+
STRING = 286,
|
89
|
+
FIXED_STRING_KIND = 287,
|
90
|
+
FIXED_STRING = 288,
|
91
|
+
BYTES = 289,
|
92
|
+
FIXED_BYTES_KIND = 290,
|
93
|
+
FIXED_BYTES = 291,
|
94
|
+
REF = 292,
|
95
|
+
FIXED = 293,
|
96
|
+
VAR = 294,
|
97
|
+
COMMA = 295,
|
98
|
+
COLON = 296,
|
99
|
+
LPAREN = 297,
|
100
|
+
RPAREN = 298,
|
101
|
+
LBRACE = 299,
|
102
|
+
RBRACE = 300,
|
103
|
+
LBRACK = 301,
|
104
|
+
RBRACK = 302,
|
105
|
+
STAR = 303,
|
106
|
+
ELLIPSIS = 304,
|
107
|
+
RARROW = 305,
|
108
|
+
EQUAL = 306,
|
109
|
+
LESS = 307,
|
110
|
+
GREATER = 308,
|
111
|
+
QUESTIONMARK = 309,
|
112
|
+
BANG = 310,
|
113
|
+
AMPERSAND = 311,
|
114
|
+
BAR = 312,
|
115
|
+
ERRTOKEN = 313,
|
116
|
+
INTEGER = 314,
|
117
|
+
FLOATNUMBER = 315,
|
118
|
+
STRINGLIT = 316,
|
119
|
+
NAME_LOWER = 317,
|
120
|
+
NAME_UPPER = 318,
|
121
|
+
NAME_OTHER = 319
|
122
|
+
};
|
123
|
+
#endif
|
124
|
+
|
125
|
+
/* Value type. */
|
126
|
+
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
127
|
+
|
128
|
+
union YYSTYPE
|
129
|
+
{
|
130
|
+
#line 86 "grammar.y" /* yacc.c:1909 */
|
131
|
+
|
132
|
+
ndt_t *ndt;
|
133
|
+
ndt_field_t *field;
|
134
|
+
ndt_field_seq_t *field_seq;
|
135
|
+
ndt_value_t *typed_value;
|
136
|
+
ndt_value_seq_t *typed_value_seq;
|
137
|
+
ndt_attr_t *attribute;
|
138
|
+
ndt_attr_seq_t *attribute_seq;
|
139
|
+
enum ndt_variadic variadic_flag;
|
140
|
+
enum ndt_encoding encoding;
|
141
|
+
uint32_t uint32;
|
142
|
+
char *string;
|
143
|
+
ndt_string_seq_t *string_seq;
|
144
|
+
ndt_type_seq_t *type_seq;
|
145
|
+
|
146
|
+
#line 147 "grammar.h" /* yacc.c:1909 */
|
147
|
+
};
|
148
|
+
|
149
|
+
typedef union YYSTYPE YYSTYPE;
|
150
|
+
# define YYSTYPE_IS_TRIVIAL 1
|
151
|
+
# define YYSTYPE_IS_DECLARED 1
|
152
|
+
#endif
|
153
|
+
|
154
|
+
/* Location type. */
|
155
|
+
#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
|
156
|
+
typedef struct YYLTYPE YYLTYPE;
|
157
|
+
struct YYLTYPE
|
158
|
+
{
|
159
|
+
int first_line;
|
160
|
+
int first_column;
|
161
|
+
int last_line;
|
162
|
+
int last_column;
|
163
|
+
};
|
164
|
+
# define YYLTYPE_IS_DECLARED 1
|
165
|
+
# define YYLTYPE_IS_TRIVIAL 1
|
166
|
+
#endif
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
int ndt_yyparse (yyscan_t scanner, ndt_t **ast, ndt_meta_t *meta, ndt_context_t *ctx);
|
171
|
+
/* "%code provides" blocks. */
|
172
|
+
#line 66 "grammar.y" /* yacc.c:1909 */
|
173
|
+
|
174
|
+
#define YY_DECL extern int ndt_yylexfunc(YYSTYPE *yylval_param, YYLTYPE *yylloc_param, yyscan_t yyscanner, ndt_context_t *ctx)
|
175
|
+
extern int ndt_yylexfunc(YYSTYPE *, YYLTYPE *, yyscan_t, ndt_context_t *);
|
176
|
+
void yyerror(YYLTYPE *loc, yyscan_t scanner, ndt_t **ast, ndt_meta_t *meta, ndt_context_t *ctx, const char *msg);
|
177
|
+
|
178
|
+
#line 179 "grammar.h" /* yacc.c:1909 */
|
179
|
+
|
180
|
+
#endif /* !YY_NDT_YY_GRAMMAR_H_INCLUDED */
|
@@ -0,0 +1,417 @@
|
|
1
|
+
%{
|
2
|
+
/*
|
3
|
+
* BSD 3-Clause License
|
4
|
+
*
|
5
|
+
* Copyright (c) 2017-2018, plures
|
6
|
+
* All rights reserved.
|
7
|
+
*
|
8
|
+
* Redistribution and use in source and binary forms, with or without
|
9
|
+
* modification, are permitted provided that the following conditions are met:
|
10
|
+
*
|
11
|
+
* 1. Redistributions of source code must retain the above copyright notice,
|
12
|
+
* this list of conditions and the following disclaimer.
|
13
|
+
*
|
14
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
15
|
+
* this list of conditions and the following disclaimer in the documentation
|
16
|
+
* and/or other materials provided with the distribution.
|
17
|
+
*
|
18
|
+
* 3. Neither the name of the copyright holder nor the names of its
|
19
|
+
* contributors may be used to endorse or promote products derived from
|
20
|
+
* this software without specific prior written permission.
|
21
|
+
*
|
22
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
23
|
+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
24
|
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
25
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
26
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
27
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
28
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
29
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
30
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
31
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
32
|
+
*/
|
33
|
+
|
34
|
+
|
35
|
+
#include "grammar.h"
|
36
|
+
|
37
|
+
|
38
|
+
void
|
39
|
+
yyerror(YYLTYPE *loc, yyscan_t scanner, ndt_t **ast, ndt_meta_t *meta,
|
40
|
+
ndt_context_t *ctx, const char *msg)
|
41
|
+
{
|
42
|
+
(void)scanner;
|
43
|
+
(void)ast;
|
44
|
+
(void)meta;
|
45
|
+
|
46
|
+
ndt_err_format(ctx, NDT_ParseError, "%d:%d: %s", loc->first_line,
|
47
|
+
loc->first_column, msg);
|
48
|
+
}
|
49
|
+
|
50
|
+
int
|
51
|
+
yylex(YYSTYPE *val, YYLTYPE *loc, yyscan_t scanner, ndt_context_t *ctx)
|
52
|
+
{
|
53
|
+
return ndt_yylexfunc(val, loc, scanner, ctx);
|
54
|
+
}
|
55
|
+
%}
|
56
|
+
|
57
|
+
%code requires {
|
58
|
+
#include "ndtypes.h"
|
59
|
+
#include "seq.h"
|
60
|
+
#include "attr.h"
|
61
|
+
#include "parsefuncs.h"
|
62
|
+
#define YY_TYPEDEF_YY_SCANNER_T
|
63
|
+
typedef void * yyscan_t;
|
64
|
+
}
|
65
|
+
|
66
|
+
%code provides {
|
67
|
+
#define YY_DECL extern int ndt_yylexfunc(YYSTYPE *yylval_param, YYLTYPE *yylloc_param, yyscan_t yyscanner, ndt_context_t *ctx)
|
68
|
+
extern int ndt_yylexfunc(YYSTYPE *, YYLTYPE *, yyscan_t, ndt_context_t *);
|
69
|
+
void yyerror(YYLTYPE *loc, yyscan_t scanner, ndt_t **ast, ndt_meta_t *meta, ndt_context_t *ctx, const char *msg);
|
70
|
+
}
|
71
|
+
|
72
|
+
%pure-parser
|
73
|
+
%error-verbose
|
74
|
+
|
75
|
+
%locations
|
76
|
+
%initial-action {
|
77
|
+
@$.first_line = 1;
|
78
|
+
@$.first_column = 1;
|
79
|
+
@$.last_line = 1;
|
80
|
+
@$.last_column = 1;
|
81
|
+
}
|
82
|
+
|
83
|
+
%lex-param {yyscan_t scanner} {ndt_context_t *ctx}
|
84
|
+
%parse-param {yyscan_t scanner} {ndt_t **ast} {ndt_meta_t *meta} {ndt_context_t *ctx}
|
85
|
+
|
86
|
+
%union {
|
87
|
+
ndt_t *ndt;
|
88
|
+
ndt_field_t *field;
|
89
|
+
ndt_field_seq_t *field_seq;
|
90
|
+
ndt_value_t *typed_value;
|
91
|
+
ndt_value_seq_t *typed_value_seq;
|
92
|
+
ndt_attr_t *attribute;
|
93
|
+
ndt_attr_seq_t *attribute_seq;
|
94
|
+
enum ndt_variadic variadic_flag;
|
95
|
+
enum ndt_encoding encoding;
|
96
|
+
uint32_t uint32;
|
97
|
+
char *string;
|
98
|
+
ndt_string_seq_t *string_seq;
|
99
|
+
ndt_type_seq_t *type_seq;
|
100
|
+
}
|
101
|
+
|
102
|
+
%start input
|
103
|
+
%type <ndt> input
|
104
|
+
%type <ndt> datashape
|
105
|
+
%type <ndt> datashape_or_module
|
106
|
+
%type <ndt> datashape_with_ellipsis
|
107
|
+
%type <ndt> fixed_ellipsis
|
108
|
+
%type <ndt> dimensions
|
109
|
+
%type <ndt> dimensions_nooption
|
110
|
+
%type <ndt> dimensions_tail
|
111
|
+
%type <ndt> dtype
|
112
|
+
%type <ndt> scalar
|
113
|
+
%type <ndt> signed
|
114
|
+
%type <ndt> unsigned
|
115
|
+
%type <ndt> ieee_float
|
116
|
+
%type <ndt> ieee_complex
|
117
|
+
%type <ndt> alias
|
118
|
+
%type <ndt> character
|
119
|
+
%type <ndt> string
|
120
|
+
%type <ndt> fixed_string
|
121
|
+
%type <ndt> bytes
|
122
|
+
%type <ndt> fixed_bytes
|
123
|
+
%type <ndt> ref
|
124
|
+
|
125
|
+
%type <ndt> tuple_type
|
126
|
+
%type <field> tuple_field
|
127
|
+
%type <field_seq> tuple_field_seq
|
128
|
+
|
129
|
+
%type <ndt> record_type
|
130
|
+
%type <field> record_field
|
131
|
+
%type <field_seq> record_field_seq
|
132
|
+
%type <string> record_field_name
|
133
|
+
|
134
|
+
%type <ndt> categorical
|
135
|
+
%type <typed_value> typed_value
|
136
|
+
%type <typed_value_seq> typed_value_seq
|
137
|
+
|
138
|
+
%type <string> untyped_value
|
139
|
+
%type <string_seq> untyped_value_seq
|
140
|
+
|
141
|
+
%type <type_seq> type_seq
|
142
|
+
%type <type_seq> type_seq_or_void
|
143
|
+
|
144
|
+
%type <attribute> attribute
|
145
|
+
%type <attribute_seq> attribute_seq
|
146
|
+
|
147
|
+
%type <attribute_seq> arguments_opt
|
148
|
+
|
149
|
+
%type <ndt> function_type
|
150
|
+
|
151
|
+
%type <uint32> endian_opt
|
152
|
+
%type <encoding> encoding
|
153
|
+
%type <variadic_flag> variadic_flag
|
154
|
+
%type <variadic_flag> comma_variadic_flag
|
155
|
+
|
156
|
+
%token
|
157
|
+
ANY_KIND
|
158
|
+
SCALAR_KIND
|
159
|
+
VOID
|
160
|
+
BOOL
|
161
|
+
SIGNED_KIND INT8 INT16 INT32 INT64
|
162
|
+
UNSIGNED_KIND UINT8 UINT16 UINT32 UINT64
|
163
|
+
FLOAT_KIND FLOAT16 FLOAT32 FLOAT64
|
164
|
+
COMPLEX_KIND COMPLEX32 COMPLEX64 COMPLEX128
|
165
|
+
CATEGORICAL NA
|
166
|
+
INTPTR UINTPTR SIZE
|
167
|
+
CHAR
|
168
|
+
STRING FIXED_STRING_KIND FIXED_STRING
|
169
|
+
BYTES FIXED_BYTES_KIND FIXED_BYTES
|
170
|
+
REF
|
171
|
+
|
172
|
+
FIXED VAR
|
173
|
+
|
174
|
+
COMMA COLON LPAREN RPAREN LBRACE RBRACE LBRACK RBRACK STAR ELLIPSIS
|
175
|
+
RARROW EQUAL LESS GREATER QUESTIONMARK BANG AMPERSAND BAR
|
176
|
+
ERRTOKEN
|
177
|
+
|
178
|
+
%token <string>
|
179
|
+
INTEGER FLOATNUMBER STRINGLIT
|
180
|
+
NAME_LOWER NAME_UPPER NAME_OTHER
|
181
|
+
|
182
|
+
%token ENDMARKER 0 "end of file"
|
183
|
+
|
184
|
+
%destructor { ndt_del($$); } <ndt>
|
185
|
+
%destructor { ndt_field_del($$); } <field>
|
186
|
+
%destructor { ndt_field_seq_del($$); } <field_seq>
|
187
|
+
%destructor { ndt_value_del($$); } <typed_value>
|
188
|
+
%destructor { ndt_value_seq_del($$); } <typed_value_seq>
|
189
|
+
%destructor { ndt_attr_del($$); } <attribute>
|
190
|
+
%destructor { ndt_attr_seq_del($$); } <attribute_seq>
|
191
|
+
%destructor { ndt_free($$); } <string>
|
192
|
+
%destructor { ndt_string_seq_del($$); } <string_seq>
|
193
|
+
%destructor { ndt_type_seq_del($$); } <type_seq>
|
194
|
+
|
195
|
+
%%
|
196
|
+
|
197
|
+
input:
|
198
|
+
datashape_or_module ENDMARKER { $$ = $1; *ast = $$; YYACCEPT; }
|
199
|
+
|
200
|
+
/* types (optionally with module qualifier) */
|
201
|
+
datashape_or_module:
|
202
|
+
datashape_with_ellipsis { $$ = $1; }
|
203
|
+
| function_type { $$ = $1; }
|
204
|
+
| NAME_UPPER COLON COLON datashape_with_ellipsis { $$ = ndt_module($1, $4, ctx); if ($$ == NULL) YYABORT; }
|
205
|
+
|
206
|
+
/* types */
|
207
|
+
datashape_with_ellipsis:
|
208
|
+
datashape { $$ = $1; }
|
209
|
+
| fixed_ellipsis { $$ = $1; }
|
210
|
+
| NAME_UPPER LBRACK fixed_ellipsis RBRACK { $$ = mk_contig($1, $3, ctx); if ($$ == NULL) YYABORT; }
|
211
|
+
| VAR ELLIPSIS STAR dtype { $$ = mk_var_ellipsis($4, ctx); if ($$ == NULL) YYABORT; }
|
212
|
+
| VAR ELLIPSIS STAR QUESTIONMARK dtype { $$ = mk_var_ellipsis(ndt_option($5), ctx); if ($$ == NULL) YYABORT; }
|
213
|
+
|
214
|
+
fixed_ellipsis:
|
215
|
+
ELLIPSIS STAR dimensions_tail { $$ = ndt_ellipsis_dim(NULL, $3, ctx); if ($$ == NULL) YYABORT; }
|
216
|
+
| NAME_UPPER ELLIPSIS STAR dimensions_tail { $$ = ndt_ellipsis_dim($1, $4, ctx); if ($$ == NULL) YYABORT; }
|
217
|
+
|
218
|
+
datashape:
|
219
|
+
dimensions { $$ = $1; }
|
220
|
+
| dtype { $$ = $1; }
|
221
|
+
| QUESTIONMARK dtype { $$ = ndt_option($2); if ($$ == NULL) YYABORT; }
|
222
|
+
|
223
|
+
dimensions:
|
224
|
+
dimensions_nooption { $$ = $1; }
|
225
|
+
| QUESTIONMARK dimensions_nooption { $$ = ndt_option($2); if ($$ == NULL) YYABORT; }
|
226
|
+
| NAME_UPPER LBRACK dimensions RBRACK { $$ = mk_contig($1, $3, ctx); if ($$ == NULL) YYABORT; }
|
227
|
+
| BANG dimensions { $$ = mk_fortran($2, ctx); if ($$ == NULL) YYABORT; }
|
228
|
+
|
229
|
+
dimensions_nooption:
|
230
|
+
INTEGER STAR dimensions_tail { $$ = mk_fixed_dim_from_shape($1, $3, ctx); if ($$ == NULL) YYABORT; }
|
231
|
+
| FIXED LPAREN attribute_seq RPAREN STAR dimensions_tail { $$ = mk_fixed_dim_from_attrs($3, $6, ctx); if ($$ == NULL) YYABORT; }
|
232
|
+
| NAME_UPPER STAR dimensions_tail { $$ = ndt_symbolic_dim($1, $3, ctx); if ($$ == NULL) YYABORT; }
|
233
|
+
| VAR arguments_opt STAR dimensions_tail { $$ = mk_var_dim(meta, $2, $4, ctx); if ($$ == NULL) YYABORT; }
|
234
|
+
|
235
|
+
dimensions_tail:
|
236
|
+
dtype { $$ = $1; }
|
237
|
+
| QUESTIONMARK dtype { $$ = ndt_option($2); if ($$ == NULL) YYABORT; }
|
238
|
+
| dimensions { $$ = $1; }
|
239
|
+
|
240
|
+
dtype:
|
241
|
+
ANY_KIND { $$ = ndt_any_kind(ctx); if ($$ == NULL) YYABORT; }
|
242
|
+
| SCALAR_KIND { $$ = ndt_scalar_kind(ctx); if ($$ == NULL) YYABORT; }
|
243
|
+
| scalar { $$ = $1; }
|
244
|
+
| tuple_type { $$ = $1; }
|
245
|
+
| record_type { $$ = $1; }
|
246
|
+
| NAME_LOWER { $$ = ndt_nominal($1, NULL, ctx); if ($$ == NULL) YYABORT; }
|
247
|
+
| NAME_UPPER LPAREN datashape RPAREN { $$ = ndt_constr($1, $3, ctx); if ($$ == NULL) YYABORT; }
|
248
|
+
| NAME_UPPER LPAREN attribute_seq RPAREN { (void)$1; (void)$3; ndt_free($1); ndt_attr_seq_del($3); $$ = NULL;
|
249
|
+
ndt_err_format(ctx, NDT_NotImplementedError, "general attributes are not implemented");
|
250
|
+
YYABORT; }
|
251
|
+
| NAME_UPPER { $$ = ndt_typevar($1, ctx); if ($$ == NULL) YYABORT; }
|
252
|
+
|
253
|
+
scalar:
|
254
|
+
endian_opt BOOL { $$ = ndt_primitive(Bool, $1, ctx); if ($$ == NULL) YYABORT; }
|
255
|
+
| SIGNED_KIND { $$ = ndt_signed_kind(ctx); if ($$ == NULL) YYABORT; }
|
256
|
+
| signed { $$ = $1; }
|
257
|
+
| UNSIGNED_KIND { $$ = ndt_unsigned_kind(ctx); if ($$ == NULL) YYABORT; }
|
258
|
+
| unsigned { $$ = $1; }
|
259
|
+
| FLOAT_KIND { $$ = ndt_float_kind(ctx); if ($$ == NULL) YYABORT; }
|
260
|
+
| ieee_float { $$ = $1; }
|
261
|
+
| COMPLEX_KIND { $$ = ndt_complex_kind(ctx); if ($$ == NULL) YYABORT; }
|
262
|
+
| ieee_complex { $$ = $1; }
|
263
|
+
| alias { $$ = $1; }
|
264
|
+
| character { $$ = $1; }
|
265
|
+
| string { $$ = $1; }
|
266
|
+
| FIXED_STRING_KIND { $$ = ndt_fixed_string_kind(ctx); if ($$ == NULL) YYABORT; }
|
267
|
+
| fixed_string { $$ = $1; }
|
268
|
+
| bytes { $$ = $1; }
|
269
|
+
| FIXED_BYTES_KIND { $$ = ndt_fixed_bytes_kind(ctx); if ($$ == NULL) YYABORT; }
|
270
|
+
| fixed_bytes { $$ = $1; }
|
271
|
+
| categorical { $$ = $1; }
|
272
|
+
| ref { $$ = $1; }
|
273
|
+
|
274
|
+
signed:
|
275
|
+
endian_opt INT8 { $$ = ndt_primitive(Int8, $1, ctx); if ($$ == NULL) YYABORT; }
|
276
|
+
| endian_opt INT16 { $$ = ndt_primitive(Int16, $1, ctx); if ($$ == NULL) YYABORT; }
|
277
|
+
| endian_opt INT32 { $$ = ndt_primitive(Int32, $1, ctx); if ($$ == NULL) YYABORT; }
|
278
|
+
| endian_opt INT64 { $$ = ndt_primitive(Int64, $1, ctx); if ($$ == NULL) YYABORT; }
|
279
|
+
|
280
|
+
unsigned:
|
281
|
+
endian_opt UINT8 { $$ = ndt_primitive(Uint8, $1, ctx); if ($$ == NULL) YYABORT; }
|
282
|
+
| endian_opt UINT16 { $$ = ndt_primitive(Uint16, $1, ctx); if ($$ == NULL) YYABORT; }
|
283
|
+
| endian_opt UINT32 { $$ = ndt_primitive(Uint32, $1, ctx); if ($$ == NULL) YYABORT; }
|
284
|
+
| endian_opt UINT64 { $$ = ndt_primitive(Uint64, $1, ctx); if ($$ == NULL) YYABORT; }
|
285
|
+
|
286
|
+
ieee_float:
|
287
|
+
endian_opt FLOAT16 { $$ = ndt_primitive(Float16, $1, ctx); if ($$ == NULL) YYABORT; }
|
288
|
+
| endian_opt FLOAT32 { $$ = ndt_primitive(Float32, $1, ctx); if ($$ == NULL) YYABORT; }
|
289
|
+
| endian_opt FLOAT64 { $$ = ndt_primitive(Float64, $1, ctx); if ($$ == NULL) YYABORT; }
|
290
|
+
|
291
|
+
ieee_complex:
|
292
|
+
endian_opt COMPLEX32 { $$ = ndt_primitive(Complex32, $1, ctx); if ($$ == NULL) YYABORT; }
|
293
|
+
| endian_opt COMPLEX64 { $$ = ndt_primitive(Complex64, $1, ctx); if ($$ == NULL) YYABORT; }
|
294
|
+
| endian_opt COMPLEX128 { $$ = ndt_primitive(Complex128, $1, ctx); if ($$ == NULL) YYABORT; }
|
295
|
+
|
296
|
+
alias:
|
297
|
+
/* machine dependent */
|
298
|
+
endian_opt INTPTR { $$ = ndt_from_alias(Intptr, $1, ctx); if ($$ == NULL) YYABORT; }
|
299
|
+
| endian_opt UINTPTR { $$ = ndt_from_alias(Uintptr, $1, ctx); if ($$ == NULL) YYABORT; }
|
300
|
+
| endian_opt SIZE { $$ = ndt_from_alias(Size, $1, ctx); if ($$ == NULL) YYABORT; }
|
301
|
+
|
302
|
+
character:
|
303
|
+
CHAR { $$ = ndt_char(Utf32, ctx); if ($$ == NULL) YYABORT; }
|
304
|
+
| CHAR LPAREN encoding RPAREN { $$ = ndt_char($3, ctx); if ($$ == NULL) YYABORT; }
|
305
|
+
|
306
|
+
string:
|
307
|
+
STRING { $$ = ndt_string(ctx); if ($$ == NULL) YYABORT; }
|
308
|
+
|
309
|
+
fixed_string:
|
310
|
+
FIXED_STRING LPAREN INTEGER RPAREN { $$ = mk_fixed_string($3, Utf8, ctx); if ($$ == NULL) YYABORT; }
|
311
|
+
| FIXED_STRING LPAREN INTEGER COMMA encoding RPAREN { $$ = mk_fixed_string($3, $5, ctx); if ($$ == NULL) YYABORT; }
|
312
|
+
|
313
|
+
endian_opt:
|
314
|
+
%empty { $$ = 0; }
|
315
|
+
| EQUAL { $$ = NDT_SYS_BIG_ENDIAN ? NDT_BIG_ENDIAN : NDT_LITTLE_ENDIAN; }
|
316
|
+
| LESS { $$ = NDT_LITTLE_ENDIAN; }
|
317
|
+
| GREATER { $$ = NDT_BIG_ENDIAN; }
|
318
|
+
| BAR { $$ = 0; }
|
319
|
+
|
320
|
+
encoding:
|
321
|
+
STRINGLIT { $$ = encoding_from_string($1, ctx); if (ndt_err_occurred(ctx)) YYABORT; }
|
322
|
+
|
323
|
+
bytes:
|
324
|
+
BYTES arguments_opt { $$ = mk_bytes($2, ctx); if ($$ == NULL) YYABORT; }
|
325
|
+
|
326
|
+
fixed_bytes:
|
327
|
+
FIXED_BYTES LPAREN attribute_seq RPAREN { $$ = mk_fixed_bytes($3, ctx); if ($$ == NULL) YYABORT; }
|
328
|
+
|
329
|
+
ref:
|
330
|
+
REF LPAREN datashape RPAREN { $$ = ndt_ref($3, ctx); if ($$ == NULL) YYABORT; }
|
331
|
+
| AMPERSAND datashape { $$ = ndt_ref($2, ctx); if ($$ == NULL) YYABORT; }
|
332
|
+
|
333
|
+
categorical:
|
334
|
+
CATEGORICAL LPAREN typed_value_seq RPAREN { $$ = mk_categorical($3, ctx); if ($$ == NULL) YYABORT; }
|
335
|
+
|
336
|
+
typed_value_seq:
|
337
|
+
typed_value { $$ = ndt_value_seq_new($1, ctx); if ($$ == NULL) YYABORT; }
|
338
|
+
| typed_value_seq COMMA typed_value { $$ = ndt_value_seq_append($1, $3, ctx); if ($$ == NULL) YYABORT; }
|
339
|
+
|
340
|
+
typed_value:
|
341
|
+
INTEGER { $$ = ndt_value_from_number(ValInt64, $1, ctx); if ($$ == NULL) YYABORT; }
|
342
|
+
| FLOATNUMBER { $$ = ndt_value_from_number(ValFloat64, $1, ctx); if ($$ == NULL) YYABORT; }
|
343
|
+
| STRINGLIT { $$ = ndt_value_from_string($1, ctx); if ($$ == NULL) YYABORT; }
|
344
|
+
| NA { $$ = ndt_value_na(ctx); if ($$ == NULL) YYABORT; }
|
345
|
+
|
346
|
+
variadic_flag:
|
347
|
+
%empty { $$ = Nonvariadic; }
|
348
|
+
| ELLIPSIS { $$ = Variadic; }
|
349
|
+
|
350
|
+
comma_variadic_flag:
|
351
|
+
%empty { $$ = Nonvariadic; }
|
352
|
+
| COMMA { $$ = Nonvariadic; }
|
353
|
+
| COMMA ELLIPSIS { $$ = Variadic; }
|
354
|
+
|
355
|
+
tuple_type:
|
356
|
+
LPAREN variadic_flag RPAREN { $$ = mk_tuple($2, NULL, NULL, ctx); if ($$ == NULL) YYABORT; }
|
357
|
+
| LPAREN tuple_field_seq comma_variadic_flag RPAREN { $$ = mk_tuple($3, $2, NULL, ctx); if ($$ == NULL) YYABORT; }
|
358
|
+
| LPAREN tuple_field_seq COMMA attribute_seq RPAREN { $$ = mk_tuple(Nonvariadic, $2, $4, ctx); if ($$ == NULL) YYABORT; }
|
359
|
+
|
360
|
+
tuple_field_seq:
|
361
|
+
tuple_field { $$ = ndt_field_seq_new($1, ctx); if ($$ == NULL) YYABORT; }
|
362
|
+
| tuple_field_seq COMMA tuple_field { $$ = ndt_field_seq_append($1, $3, ctx); if ($$ == NULL) YYABORT; }
|
363
|
+
|
364
|
+
tuple_field:
|
365
|
+
datashape { $$ = mk_field(NULL, $1, NULL, ctx); if ($$ == NULL) YYABORT; }
|
366
|
+
| datashape BAR attribute_seq BAR { $$ = mk_field(NULL, $1, $3, ctx); if ($$ == NULL) YYABORT; }
|
367
|
+
|
368
|
+
record_type:
|
369
|
+
LBRACE variadic_flag RBRACE { $$ = mk_record($2, NULL, NULL, ctx); if ($$ == NULL) YYABORT; }
|
370
|
+
| LBRACE record_field_seq comma_variadic_flag RBRACE { $$ = mk_record($3, $2, NULL, ctx); if ($$ == NULL) YYABORT; }
|
371
|
+
| LBRACE record_field_seq COMMA attribute_seq RBRACE { $$ = mk_record(Nonvariadic, $2, $4, ctx); if ($$ == NULL) YYABORT; }
|
372
|
+
|
373
|
+
record_field_seq:
|
374
|
+
record_field { $$ = ndt_field_seq_new($1, ctx); if ($$ == NULL) YYABORT; }
|
375
|
+
| record_field_seq COMMA record_field { $$ = ndt_field_seq_append($1, $3, ctx); if ($$ == NULL) YYABORT; }
|
376
|
+
|
377
|
+
record_field:
|
378
|
+
record_field_name COLON datashape { $$ = mk_field($1, $3, NULL, ctx); if ($$ == NULL) YYABORT; }
|
379
|
+
| record_field_name COLON datashape BAR attribute_seq BAR { $$ = mk_field($1, $3, $5, ctx); if ($$ == NULL) YYABORT; }
|
380
|
+
|
381
|
+
record_field_name:
|
382
|
+
NAME_LOWER { $$ = $1; if ($$ == NULL) YYABORT; }
|
383
|
+
| NAME_UPPER { $$ = $1; if ($$ == NULL) YYABORT; }
|
384
|
+
| NAME_OTHER { $$ = $1; if ($$ == NULL) YYABORT; }
|
385
|
+
|
386
|
+
arguments_opt:
|
387
|
+
%empty { $$ = NULL; }
|
388
|
+
| LPAREN attribute_seq RPAREN { $$ = $2; if ($$ == NULL) YYABORT; }
|
389
|
+
|
390
|
+
attribute_seq:
|
391
|
+
attribute { $$ = ndt_attr_seq_new($1, ctx); if ($$ == NULL) YYABORT; }
|
392
|
+
| attribute_seq COMMA attribute { $$ = ndt_attr_seq_append($1, $3, ctx); if ($$ == NULL) YYABORT; }
|
393
|
+
|
394
|
+
attribute:
|
395
|
+
NAME_LOWER EQUAL untyped_value { $$ = mk_attr($1, $3, ctx); if ($$ == NULL) YYABORT; }
|
396
|
+
| NAME_LOWER EQUAL LBRACK untyped_value_seq RBRACK { $$ = mk_attr_from_seq($1, $4, ctx); if ($$ == NULL) YYABORT; }
|
397
|
+
|
398
|
+
untyped_value_seq:
|
399
|
+
untyped_value { $$ = ndt_string_seq_new($1, ctx); if ($$ == NULL) YYABORT; }
|
400
|
+
| untyped_value_seq COMMA untyped_value { $$ = ndt_string_seq_append($1, $3, ctx); if ($$ == NULL) YYABORT; }
|
401
|
+
|
402
|
+
untyped_value:
|
403
|
+
NAME_LOWER { $$ = $1; if ($$ == NULL) YYABORT; }
|
404
|
+
| INTEGER { $$ = $1; if ($$ == NULL) YYABORT; }
|
405
|
+
| FLOATNUMBER { $$ = $1; if ($$ == NULL) YYABORT; }
|
406
|
+
| STRINGLIT { $$ = $1; if ($$ == NULL) YYABORT; }
|
407
|
+
|
408
|
+
function_type:
|
409
|
+
type_seq_or_void RARROW type_seq_or_void { $$ = mk_function($1, $3, ctx); if ($$ == NULL) YYABORT; }
|
410
|
+
|
411
|
+
type_seq_or_void:
|
412
|
+
type_seq { $$ = $1; if ($$ == NULL) YYABORT; }
|
413
|
+
| VOID { $$ = ndt_type_seq_empty(ctx); if ($$ == NULL) YYABORT; }
|
414
|
+
|
415
|
+
type_seq:
|
416
|
+
datashape_with_ellipsis { $$ = ndt_type_seq_new($1, ctx); if ($$ == NULL) YYABORT; }
|
417
|
+
| type_seq COMMA datashape_with_ellipsis { $$ = ndt_type_seq_append($1, $3, ctx); if ($$ == NULL) YYABORT; }
|