ndtypes 0.2.0dev5 → 0.2.0dev6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +12 -0
- data/Rakefile +8 -0
- data/ext/ruby_ndtypes/GPATH +0 -0
- data/ext/ruby_ndtypes/GRTAGS +0 -0
- data/ext/ruby_ndtypes/GTAGS +0 -0
- data/ext/ruby_ndtypes/extconf.rb +1 -1
- data/ext/ruby_ndtypes/include/ndtypes.h +231 -122
- data/ext/ruby_ndtypes/include/ruby_ndtypes.h +1 -1
- data/ext/ruby_ndtypes/lib/libndtypes.a +0 -0
- data/ext/ruby_ndtypes/lib/libndtypes.so.0.2.0dev3 +0 -0
- data/ext/ruby_ndtypes/ndtypes/Makefile +87 -0
- data/ext/ruby_ndtypes/ndtypes/config.h +68 -0
- data/ext/ruby_ndtypes/ndtypes/config.log +477 -0
- data/ext/ruby_ndtypes/ndtypes/config.status +1027 -0
- data/ext/ruby_ndtypes/ndtypes/doc/_static/style.css +7 -0
- data/ext/ruby_ndtypes/ndtypes/doc/_templates/layout.html +2 -0
- data/ext/ruby_ndtypes/ndtypes/doc/conf.py +40 -4
- data/ext/ruby_ndtypes/ndtypes/doc/images/xndlogo.png +0 -0
- data/ext/ruby_ndtypes/ndtypes/doc/ndtypes/types.rst +1 -1
- data/ext/ruby_ndtypes/ndtypes/doc/requirements.txt +2 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/Makefile +287 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/Makefile.in +20 -4
- data/ext/ruby_ndtypes/ndtypes/libndtypes/Makefile.vc +22 -3
- data/ext/ruby_ndtypes/ndtypes/libndtypes/alloc.c +1 -1
- data/ext/ruby_ndtypes/ndtypes/libndtypes/alloc.o +0 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/attr.o +0 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/Makefile +73 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/bpgrammar.c +246 -229
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/bpgrammar.h +15 -11
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/bpgrammar.o +0 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/bpgrammar.y +38 -28
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/bplexer.c +91 -91
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/bplexer.h +1 -1
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/bplexer.l +4 -3
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/bplexer.o +0 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/export.c +8 -7
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/export.o +0 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/import.c +2 -2
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/import.o +0 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/context.o +0 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/copy.c +263 -182
- data/ext/ruby_ndtypes/ndtypes/libndtypes/copy.o +0 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/encodings.o +0 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/equal.c +67 -7
- data/ext/ruby_ndtypes/ndtypes/libndtypes/equal.o +0 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/grammar.c +1112 -1000
- data/ext/ruby_ndtypes/ndtypes/libndtypes/grammar.h +69 -58
- data/ext/ruby_ndtypes/ndtypes/libndtypes/grammar.o +0 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/grammar.y +150 -99
- data/ext/ruby_ndtypes/ndtypes/libndtypes/io.c +185 -15
- data/ext/ruby_ndtypes/ndtypes/libndtypes/io.o +0 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/lexer.c +301 -276
- data/ext/ruby_ndtypes/ndtypes/libndtypes/lexer.h +1 -1
- data/ext/ruby_ndtypes/ndtypes/libndtypes/lexer.l +9 -4
- data/ext/ruby_ndtypes/ndtypes/libndtypes/lexer.o +0 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/libndtypes.a +0 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/libndtypes.so +1 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/libndtypes.so.0 +1 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/libndtypes.so.0.2.0dev3 +0 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/match.c +729 -228
- data/ext/ruby_ndtypes/ndtypes/libndtypes/match.o +0 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/ndtypes.c +768 -403
- data/ext/ruby_ndtypes/ndtypes/libndtypes/ndtypes.h +1002 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/ndtypes.h.in +231 -122
- data/ext/ruby_ndtypes/ndtypes/libndtypes/ndtypes.o +0 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/parsefuncs.c +176 -84
- data/ext/ruby_ndtypes/ndtypes/libndtypes/parsefuncs.h +26 -14
- data/ext/ruby_ndtypes/ndtypes/libndtypes/parsefuncs.o +0 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/parser.c +57 -35
- data/ext/ruby_ndtypes/ndtypes/libndtypes/parser.o +0 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/primitive.c +420 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/primitive.o +0 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/seq.c +8 -8
- data/ext/ruby_ndtypes/ndtypes/libndtypes/seq.h +1 -1
- data/ext/ruby_ndtypes/ndtypes/libndtypes/seq.o +0 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/serialize/Makefile +48 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/serialize/deserialize.c +200 -116
- data/ext/ruby_ndtypes/ndtypes/libndtypes/serialize/deserialize.o +0 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/serialize/serialize.c +46 -4
- data/ext/ruby_ndtypes/ndtypes/libndtypes/serialize/serialize.o +0 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/substitute.c +58 -27
- data/ext/ruby_ndtypes/ndtypes/libndtypes/substitute.h +1 -1
- data/ext/ruby_ndtypes/ndtypes/libndtypes/substitute.o +0 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/symtable.c +3 -5
- data/ext/ruby_ndtypes/ndtypes/libndtypes/symtable.h +12 -4
- data/ext/ruby_ndtypes/ndtypes/libndtypes/symtable.o +0 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/Makefile +55 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/Makefile.in +8 -8
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/Makefile.vc +5 -5
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/runtest.c +274 -172
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test.h +24 -4
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_array.c +2 -2
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_buffer.c +14 -14
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_match.c +32 -30
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_parse.c +37 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_parse_error.c +36 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_parse_roundtrip.c +16 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_record.c +5 -5
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_typecheck.c +706 -253
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_unify.c +132 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/unify.c +703 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/unify.o +0 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/util.c +335 -127
- data/ext/ruby_ndtypes/ndtypes/libndtypes/util.o +0 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/values.c +2 -2
- data/ext/ruby_ndtypes/ndtypes/libndtypes/values.o +0 -0
- data/ext/ruby_ndtypes/ndtypes/python/ndt_randtype.py +88 -71
- data/ext/ruby_ndtypes/ndtypes/python/ndt_support.py +0 -1
- data/ext/ruby_ndtypes/ndtypes/python/ndtypes/__init__.py +10 -13
- data/ext/ruby_ndtypes/ndtypes/python/ndtypes/_ndtypes.c +395 -314
- data/ext/ruby_ndtypes/ndtypes/python/ndtypes/libndtypes.a +0 -0
- data/ext/ruby_ndtypes/ndtypes/python/ndtypes/libndtypes.so +1 -0
- data/ext/ruby_ndtypes/ndtypes/python/ndtypes/libndtypes.so.0 +1 -0
- data/ext/ruby_ndtypes/ndtypes/python/ndtypes/libndtypes.so.0.2.0dev3 +0 -0
- data/ext/ruby_ndtypes/ndtypes/python/ndtypes/ndtypes.h +1002 -0
- data/ext/ruby_ndtypes/ndtypes/python/ndtypes/pyndtypes.h +15 -33
- data/ext/ruby_ndtypes/ndtypes/python/test_ndtypes.py +340 -132
- data/ext/ruby_ndtypes/ndtypes/setup.py +11 -2
- data/ext/ruby_ndtypes/ruby_ndtypes.c +364 -241
- data/ext/ruby_ndtypes/ruby_ndtypes.h +1 -1
- data/ext/ruby_ndtypes/ruby_ndtypes_internal.h +0 -1
- data/lib/ndtypes.rb +11 -0
- data/lib/ndtypes/version.rb +2 -2
- data/lib/ruby_ndtypes.so +0 -0
- data/ndtypes.gemspec +3 -0
- data/spec/ndtypes_spec.rb +6 -0
- metadata +98 -4
- data/ext/ruby_ndtypes/gc_guard.c +0 -36
- data/ext/ruby_ndtypes/gc_guard.h +0 -12
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
/* A Bison parser, made by GNU Bison 3.
|
|
1
|
+
/* A Bison parser, made by GNU Bison 3.3. */
|
|
2
2
|
|
|
3
3
|
/* Bison interface for Yacc-like parsers in C
|
|
4
4
|
|
|
5
|
-
Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation,
|
|
5
|
+
Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation,
|
|
6
|
+
Inc.
|
|
6
7
|
|
|
7
8
|
This program is free software: you can redistribute it and/or modify
|
|
8
9
|
it under the terms of the GNU General Public License as published by
|
|
@@ -30,6 +31,9 @@
|
|
|
30
31
|
This special exception was added by the Free Software Foundation in
|
|
31
32
|
version 2.2 of Bison. */
|
|
32
33
|
|
|
34
|
+
/* Undocumented macros, especially those whose name start with YY_,
|
|
35
|
+
are private implementation details. Do not rely on them. */
|
|
36
|
+
|
|
33
37
|
#ifndef YY_NDT_YY_GRAMMAR_H_INCLUDED
|
|
34
38
|
# define YY_NDT_YY_GRAMMAR_H_INCLUDED
|
|
35
39
|
/* Debug traces. */
|
|
@@ -40,7 +44,7 @@
|
|
|
40
44
|
extern int ndt_yydebug;
|
|
41
45
|
#endif
|
|
42
46
|
/* "%code requires" blocks. */
|
|
43
|
-
#line
|
|
47
|
+
#line 56 "grammar.y" /* yacc.c:1921 */
|
|
44
48
|
|
|
45
49
|
#include "ndtypes.h"
|
|
46
50
|
#include "seq.h"
|
|
@@ -49,7 +53,7 @@ extern int ndt_yydebug;
|
|
|
49
53
|
#define YY_TYPEDEF_YY_SCANNER_T
|
|
50
54
|
typedef void * yyscan_t;
|
|
51
55
|
|
|
52
|
-
#line
|
|
56
|
+
#line 57 "grammar.h" /* yacc.c:1921 */
|
|
53
57
|
|
|
54
58
|
/* Token type. */
|
|
55
59
|
#ifndef YYTOKENTYPE
|
|
@@ -72,53 +76,58 @@ extern int ndt_yydebug;
|
|
|
72
76
|
UINT32 = 270,
|
|
73
77
|
UINT64 = 271,
|
|
74
78
|
FLOAT_KIND = 272,
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
79
|
+
BFLOAT16 = 273,
|
|
80
|
+
FLOAT16 = 274,
|
|
81
|
+
FLOAT32 = 275,
|
|
82
|
+
FLOAT64 = 276,
|
|
83
|
+
COMPLEX_KIND = 277,
|
|
84
|
+
BCOMPLEX32 = 278,
|
|
85
|
+
COMPLEX32 = 279,
|
|
86
|
+
COMPLEX64 = 280,
|
|
87
|
+
COMPLEX128 = 281,
|
|
88
|
+
CATEGORICAL = 282,
|
|
89
|
+
NA = 283,
|
|
90
|
+
INTPTR = 284,
|
|
91
|
+
UINTPTR = 285,
|
|
92
|
+
SIZE = 286,
|
|
93
|
+
CHAR = 287,
|
|
94
|
+
STRING = 288,
|
|
95
|
+
FIXED_STRING_KIND = 289,
|
|
96
|
+
FIXED_STRING = 290,
|
|
97
|
+
BYTES = 291,
|
|
98
|
+
FIXED_BYTES_KIND = 292,
|
|
99
|
+
FIXED_BYTES = 293,
|
|
100
|
+
REF = 294,
|
|
101
|
+
FIXED = 295,
|
|
102
|
+
VAR = 296,
|
|
103
|
+
ARRAY = 297,
|
|
104
|
+
OF = 298,
|
|
105
|
+
COMMA = 299,
|
|
106
|
+
COLON = 300,
|
|
107
|
+
LPAREN = 301,
|
|
108
|
+
RPAREN = 302,
|
|
109
|
+
LBRACE = 303,
|
|
110
|
+
RBRACE = 304,
|
|
111
|
+
LBRACK = 305,
|
|
112
|
+
RBRACK = 306,
|
|
113
|
+
STAR = 307,
|
|
114
|
+
ELLIPSIS = 308,
|
|
115
|
+
RARROW = 309,
|
|
116
|
+
EQUAL = 310,
|
|
117
|
+
LESS = 311,
|
|
118
|
+
GREATER = 312,
|
|
119
|
+
QUESTIONMARK = 313,
|
|
120
|
+
BANG = 314,
|
|
121
|
+
AMPERSAND = 315,
|
|
122
|
+
BAR = 316,
|
|
123
|
+
ERRTOKEN = 317,
|
|
124
|
+
INTEGER = 318,
|
|
125
|
+
FLOATNUMBER = 319,
|
|
126
|
+
STRINGLIT = 320,
|
|
127
|
+
NAME_LOWER = 321,
|
|
128
|
+
NAME_UPPER = 322,
|
|
129
|
+
NAME_OTHER = 323,
|
|
130
|
+
BELOW_BAR = 324
|
|
122
131
|
};
|
|
123
132
|
#endif
|
|
124
133
|
|
|
@@ -127,9 +136,11 @@ extern int ndt_yydebug;
|
|
|
127
136
|
|
|
128
137
|
union YYSTYPE
|
|
129
138
|
{
|
|
130
|
-
#line
|
|
139
|
+
#line 85 "grammar.y" /* yacc.c:1921 */
|
|
131
140
|
|
|
132
|
-
ndt_t *ndt;
|
|
141
|
+
const ndt_t *ndt;
|
|
142
|
+
enum ndt tag;
|
|
143
|
+
enum ndt_alias alias;
|
|
133
144
|
ndt_field_t *field;
|
|
134
145
|
ndt_field_seq_t *field_seq;
|
|
135
146
|
ndt_value_t *typed_value;
|
|
@@ -143,7 +154,7 @@ union YYSTYPE
|
|
|
143
154
|
ndt_string_seq_t *string_seq;
|
|
144
155
|
ndt_type_seq_t *type_seq;
|
|
145
156
|
|
|
146
|
-
#line
|
|
157
|
+
#line 158 "grammar.h" /* yacc.c:1921 */
|
|
147
158
|
};
|
|
148
159
|
|
|
149
160
|
typedef union YYSTYPE YYSTYPE;
|
|
@@ -167,14 +178,14 @@ struct YYLTYPE
|
|
|
167
178
|
|
|
168
179
|
|
|
169
180
|
|
|
170
|
-
int ndt_yyparse (yyscan_t scanner, ndt_t **ast,
|
|
181
|
+
int ndt_yyparse (yyscan_t scanner, const ndt_t **ast, ndt_context_t *ctx);
|
|
171
182
|
/* "%code provides" blocks. */
|
|
172
|
-
#line
|
|
183
|
+
#line 65 "grammar.y" /* yacc.c:1921 */
|
|
173
184
|
|
|
174
185
|
#define YY_DECL extern int ndt_yylexfunc(YYSTYPE *yylval_param, YYLTYPE *yylloc_param, yyscan_t yyscanner, ndt_context_t *ctx)
|
|
175
186
|
extern int ndt_yylexfunc(YYSTYPE *, YYLTYPE *, yyscan_t, ndt_context_t *);
|
|
176
|
-
void yyerror(YYLTYPE *loc, yyscan_t scanner, ndt_t **ast,
|
|
187
|
+
void yyerror(YYLTYPE *loc, yyscan_t scanner, const ndt_t **ast, ndt_context_t *ctx, const char *msg);
|
|
177
188
|
|
|
178
|
-
#line
|
|
189
|
+
#line 190 "grammar.h" /* yacc.c:1921 */
|
|
179
190
|
|
|
180
191
|
#endif /* !YY_NDT_YY_GRAMMAR_H_INCLUDED */
|
|
Binary file
|
|
@@ -36,12 +36,11 @@
|
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
void
|
|
39
|
-
yyerror(YYLTYPE *loc, yyscan_t scanner, ndt_t **ast,
|
|
40
|
-
|
|
39
|
+
yyerror(YYLTYPE *loc, yyscan_t scanner, const ndt_t **ast, ndt_context_t *ctx,
|
|
40
|
+
const char *msg)
|
|
41
41
|
{
|
|
42
42
|
(void)scanner;
|
|
43
43
|
(void)ast;
|
|
44
|
-
(void)meta;
|
|
45
44
|
|
|
46
45
|
ndt_err_format(ctx, NDT_ParseError, "%d:%d: %s", loc->first_line,
|
|
47
46
|
loc->first_column, msg);
|
|
@@ -66,11 +65,11 @@ yylex(YYSTYPE *val, YYLTYPE *loc, yyscan_t scanner, ndt_context_t *ctx)
|
|
|
66
65
|
%code provides {
|
|
67
66
|
#define YY_DECL extern int ndt_yylexfunc(YYSTYPE *yylval_param, YYLTYPE *yylloc_param, yyscan_t yyscanner, ndt_context_t *ctx)
|
|
68
67
|
extern int ndt_yylexfunc(YYSTYPE *, YYLTYPE *, yyscan_t, ndt_context_t *);
|
|
69
|
-
void yyerror(YYLTYPE *loc, yyscan_t scanner, ndt_t **ast,
|
|
68
|
+
void yyerror(YYLTYPE *loc, yyscan_t scanner, const ndt_t **ast, ndt_context_t *ctx, const char *msg);
|
|
70
69
|
}
|
|
71
70
|
|
|
72
71
|
%pure-parser
|
|
73
|
-
%error
|
|
72
|
+
%define parse.error verbose
|
|
74
73
|
|
|
75
74
|
%locations
|
|
76
75
|
%initial-action {
|
|
@@ -81,10 +80,12 @@ yylex(YYSTYPE *val, YYLTYPE *loc, yyscan_t scanner, ndt_context_t *ctx)
|
|
|
81
80
|
}
|
|
82
81
|
|
|
83
82
|
%lex-param {yyscan_t scanner} {ndt_context_t *ctx}
|
|
84
|
-
%parse-param {yyscan_t scanner} {ndt_t **ast} {
|
|
83
|
+
%parse-param {yyscan_t scanner} {const ndt_t **ast} {ndt_context_t *ctx}
|
|
85
84
|
|
|
86
85
|
%union {
|
|
87
|
-
ndt_t *ndt;
|
|
86
|
+
const ndt_t *ndt;
|
|
87
|
+
enum ndt tag;
|
|
88
|
+
enum ndt_alias alias;
|
|
88
89
|
ndt_field_t *field;
|
|
89
90
|
ndt_field_seq_t *field_seq;
|
|
90
91
|
ndt_value_t *typed_value;
|
|
@@ -110,16 +111,20 @@ yylex(YYSTYPE *val, YYLTYPE *loc, yyscan_t scanner, ndt_context_t *ctx)
|
|
|
110
111
|
%type <ndt> dimensions_tail
|
|
111
112
|
%type <ndt> dtype
|
|
112
113
|
%type <ndt> scalar
|
|
113
|
-
|
|
114
|
-
%type <
|
|
115
|
-
%type <
|
|
116
|
-
%type <
|
|
117
|
-
%type <
|
|
114
|
+
|
|
115
|
+
%type <tag> signed
|
|
116
|
+
%type <tag> unsigned
|
|
117
|
+
%type <tag> ieee_float
|
|
118
|
+
%type <tag> ieee_complex
|
|
119
|
+
%type <alias> alias
|
|
120
|
+
|
|
118
121
|
%type <ndt> character
|
|
119
122
|
%type <ndt> string
|
|
120
123
|
%type <ndt> fixed_string
|
|
121
124
|
%type <ndt> bytes
|
|
122
125
|
%type <ndt> fixed_bytes
|
|
126
|
+
%type <ndt> array_dimensions
|
|
127
|
+
%type <ndt> array
|
|
123
128
|
%type <ndt> ref
|
|
124
129
|
|
|
125
130
|
%type <ndt> tuple_type
|
|
@@ -129,7 +134,12 @@ yylex(YYSTYPE *val, YYLTYPE *loc, yyscan_t scanner, ndt_context_t *ctx)
|
|
|
129
134
|
%type <ndt> record_type
|
|
130
135
|
%type <field> record_field
|
|
131
136
|
%type <field_seq> record_field_seq
|
|
132
|
-
|
|
137
|
+
|
|
138
|
+
%type <ndt> union_type
|
|
139
|
+
%type <field> union_member
|
|
140
|
+
%type <field_seq> union_member_seq
|
|
141
|
+
|
|
142
|
+
%type <string> field_name_or_tag
|
|
133
143
|
|
|
134
144
|
%type <ndt> categorical
|
|
135
145
|
%type <typed_value> typed_value
|
|
@@ -148,6 +158,8 @@ yylex(YYSTYPE *val, YYLTYPE *loc, yyscan_t scanner, ndt_context_t *ctx)
|
|
|
148
158
|
|
|
149
159
|
%type <ndt> function_type
|
|
150
160
|
|
|
161
|
+
%type <uint32> flags_opt
|
|
162
|
+
%type <uint32> option_opt
|
|
151
163
|
%type <uint32> endian_opt
|
|
152
164
|
%type <encoding> encoding
|
|
153
165
|
%type <variadic_flag> variadic_flag
|
|
@@ -160,8 +172,8 @@ yylex(YYSTYPE *val, YYLTYPE *loc, yyscan_t scanner, ndt_context_t *ctx)
|
|
|
160
172
|
BOOL
|
|
161
173
|
SIGNED_KIND INT8 INT16 INT32 INT64
|
|
162
174
|
UNSIGNED_KIND UINT8 UINT16 UINT32 UINT64
|
|
163
|
-
FLOAT_KIND FLOAT16 FLOAT32 FLOAT64
|
|
164
|
-
COMPLEX_KIND COMPLEX32 COMPLEX64 COMPLEX128
|
|
175
|
+
FLOAT_KIND BFLOAT16 FLOAT16 FLOAT32 FLOAT64
|
|
176
|
+
COMPLEX_KIND BCOMPLEX32 COMPLEX32 COMPLEX64 COMPLEX128
|
|
165
177
|
CATEGORICAL NA
|
|
166
178
|
INTPTR UINTPTR SIZE
|
|
167
179
|
CHAR
|
|
@@ -169,7 +181,7 @@ yylex(YYSTYPE *val, YYLTYPE *loc, yyscan_t scanner, ndt_context_t *ctx)
|
|
|
169
181
|
BYTES FIXED_BYTES_KIND FIXED_BYTES
|
|
170
182
|
REF
|
|
171
183
|
|
|
172
|
-
FIXED VAR
|
|
184
|
+
FIXED VAR ARRAY OF
|
|
173
185
|
|
|
174
186
|
COMMA COLON LPAREN RPAREN LBRACE RBRACE LBRACK RBRACK STAR ELLIPSIS
|
|
175
187
|
RARROW EQUAL LESS GREATER QUESTIONMARK BANG AMPERSAND BAR
|
|
@@ -181,7 +193,7 @@ ERRTOKEN
|
|
|
181
193
|
|
|
182
194
|
%token ENDMARKER 0 "end of file"
|
|
183
195
|
|
|
184
|
-
%destructor {
|
|
196
|
+
%destructor { ndt_decref($$); } <ndt>
|
|
185
197
|
%destructor { ndt_field_del($$); } <field>
|
|
186
198
|
%destructor { ndt_field_seq_del($$); } <field_seq>
|
|
187
199
|
%destructor { ndt_value_del($$); } <typed_value>
|
|
@@ -192,6 +204,10 @@ ERRTOKEN
|
|
|
192
204
|
%destructor { ndt_string_seq_del($$); } <string_seq>
|
|
193
205
|
%destructor { ndt_type_seq_del($$); } <type_seq>
|
|
194
206
|
|
|
207
|
+
%token BELOW_BAR
|
|
208
|
+
%precedence BELOW_BAR
|
|
209
|
+
%precedence BAR
|
|
210
|
+
|
|
195
211
|
%%
|
|
196
212
|
|
|
197
213
|
input:
|
|
@@ -201,114 +217,122 @@ input:
|
|
|
201
217
|
datashape_or_module:
|
|
202
218
|
datashape_with_ellipsis { $$ = $1; }
|
|
203
219
|
| function_type { $$ = $1; }
|
|
204
|
-
| NAME_UPPER COLON COLON datashape_with_ellipsis { $$ =
|
|
220
|
+
| NAME_UPPER COLON COLON datashape_with_ellipsis { $$ = mk_module($1, $4, ctx); if ($$ == NULL) YYABORT; }
|
|
205
221
|
|
|
206
222
|
/* types */
|
|
207
223
|
datashape_with_ellipsis:
|
|
208
224
|
datashape { $$ = $1; }
|
|
209
225
|
| fixed_ellipsis { $$ = $1; }
|
|
210
|
-
| NAME_UPPER LBRACK fixed_ellipsis RBRACK { $$ = mk_contig($1, $3, ctx); if ($$ == NULL) YYABORT; }
|
|
226
|
+
| NAME_UPPER LBRACK fixed_ellipsis RBRACK { $$ = mk_contig($1, (ndt_t *)$3, ctx); if ($$ == NULL) YYABORT; }
|
|
211
227
|
| VAR ELLIPSIS STAR dtype { $$ = mk_var_ellipsis($4, ctx); if ($$ == NULL) YYABORT; }
|
|
212
|
-
|
|
|
228
|
+
| array_dimensions { $$ = $1; }
|
|
213
229
|
|
|
214
230
|
fixed_ellipsis:
|
|
215
|
-
ELLIPSIS STAR dimensions_tail { $$ =
|
|
216
|
-
| NAME_UPPER ELLIPSIS STAR dimensions_tail { $$ =
|
|
231
|
+
ELLIPSIS STAR dimensions_tail { $$ = mk_ellipsis_dim(NULL, $3, ctx); if ($$ == NULL) YYABORT; }
|
|
232
|
+
| NAME_UPPER ELLIPSIS STAR dimensions_tail { $$ = mk_ellipsis_dim($1, $4, ctx); if ($$ == NULL) YYABORT; }
|
|
217
233
|
|
|
218
234
|
datashape:
|
|
219
235
|
dimensions { $$ = $1; }
|
|
220
236
|
| dtype { $$ = $1; }
|
|
221
|
-
| QUESTIONMARK dtype { $$ = ndt_option($2); if ($$ == NULL) YYABORT; }
|
|
222
237
|
|
|
223
238
|
dimensions:
|
|
224
239
|
dimensions_nooption { $$ = $1; }
|
|
225
|
-
|
|
|
226
|
-
| NAME_UPPER LBRACK dimensions RBRACK { $$ = mk_contig($1, $3, ctx); if ($$ == NULL) YYABORT; }
|
|
240
|
+
| NAME_UPPER LBRACK dimensions RBRACK { $$ = mk_contig($1, (ndt_t *)$3, ctx); if ($$ == NULL) YYABORT; }
|
|
227
241
|
| BANG dimensions { $$ = mk_fortran($2, ctx); if ($$ == NULL) YYABORT; }
|
|
228
242
|
|
|
229
243
|
dimensions_nooption:
|
|
230
244
|
INTEGER STAR dimensions_tail { $$ = mk_fixed_dim_from_shape($1, $3, ctx); if ($$ == NULL) YYABORT; }
|
|
231
245
|
| 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 { $$ =
|
|
233
|
-
| VAR arguments_opt STAR dimensions_tail { $$ = mk_var_dim(
|
|
246
|
+
| NAME_UPPER STAR dimensions_tail { $$ = mk_symbolic_dim($1, $3, ctx); if ($$ == NULL) YYABORT; }
|
|
247
|
+
| VAR arguments_opt STAR dimensions_tail { $$ = mk_var_dim($2, $4, false, ctx); if ($$ == NULL) YYABORT; }
|
|
248
|
+
| QUESTIONMARK VAR arguments_opt STAR dimensions_tail { $$ = mk_var_dim($3, $5, true, ctx); if ($$ == NULL) YYABORT; }
|
|
249
|
+
|
|
234
250
|
|
|
235
251
|
dimensions_tail:
|
|
236
252
|
dtype { $$ = $1; }
|
|
237
|
-
| QUESTIONMARK dtype { $$ = ndt_option($2); if ($$ == NULL) YYABORT; }
|
|
238
253
|
| dimensions { $$ = $1; }
|
|
239
254
|
|
|
240
255
|
dtype:
|
|
241
|
-
ANY_KIND
|
|
242
|
-
| SCALAR_KIND
|
|
243
|
-
| scalar
|
|
244
|
-
| tuple_type
|
|
245
|
-
| record_type
|
|
246
|
-
|
|
|
247
|
-
|
|
|
248
|
-
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
| NAME_UPPER
|
|
256
|
+
option_opt ANY_KIND { $$ = ndt_any_kind($1, ctx); if ($$ == NULL) YYABORT; }
|
|
257
|
+
| option_opt SCALAR_KIND { $$ = ndt_scalar_kind($1, ctx); if ($$ == NULL) YYABORT; }
|
|
258
|
+
| scalar { $$ = $1; }
|
|
259
|
+
| tuple_type { $$ = $1; }
|
|
260
|
+
| record_type { $$ = $1; }
|
|
261
|
+
| union_type { $$ = $1; }
|
|
262
|
+
| NAME_LOWER { $$ = ndt_nominal($1, NULL, false, ctx); if ($$ == NULL) YYABORT; }
|
|
263
|
+
| QUESTIONMARK NAME_LOWER { $$ = ndt_nominal($2, NULL, true, ctx); if ($$ == NULL) YYABORT; }
|
|
264
|
+
| NAME_UPPER LPAREN datashape RPAREN { $$ = mk_constr($1, $3, false, ctx); if ($$ == NULL) YYABORT; }
|
|
265
|
+
| QUESTIONMARK NAME_UPPER LPAREN datashape RPAREN { $$ = mk_constr($2, $4, true, ctx); if ($$ == NULL) YYABORT; }
|
|
266
|
+
| NAME_UPPER { $$ = ndt_typevar($1, ctx); if ($$ == NULL) YYABORT; }
|
|
252
267
|
|
|
253
268
|
scalar:
|
|
254
|
-
|
|
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
|
-
|
|
|
261
|
-
|
|
|
262
|
-
|
|
|
263
|
-
|
|
|
264
|
-
|
|
|
265
|
-
|
|
|
266
|
-
|
|
|
267
|
-
|
|
|
268
|
-
|
|
|
269
|
-
|
|
|
270
|
-
|
|
|
271
|
-
|
|
|
272
|
-
|
|
|
269
|
+
flags_opt BOOL { $$ = ndt_primitive(Bool, $1, ctx); if ($$ == NULL) YYABORT; }
|
|
270
|
+
| flags_opt SIGNED_KIND { $$ = ndt_signed_kind($1, ctx); if ($$ == NULL) YYABORT; }
|
|
271
|
+
| flags_opt signed { $$ = ndt_primitive($2, $1, ctx); if ($$ == NULL) YYABORT; }
|
|
272
|
+
| flags_opt UNSIGNED_KIND { $$ = ndt_unsigned_kind($1, ctx); if ($$ == NULL) YYABORT; }
|
|
273
|
+
| flags_opt unsigned { $$ = ndt_primitive($2, $1, ctx); if ($$ == NULL) YYABORT; }
|
|
274
|
+
| flags_opt FLOAT_KIND { $$ = ndt_float_kind($1, ctx); if ($$ == NULL) YYABORT; }
|
|
275
|
+
| flags_opt BFLOAT16 { $$ = ndt_primitive(BFloat16, $1, ctx); if ($$ == NULL) YYABORT; }
|
|
276
|
+
| flags_opt ieee_float { $$ = ndt_primitive($2, $1, ctx); if ($$ == NULL) YYABORT; }
|
|
277
|
+
| flags_opt COMPLEX_KIND { $$ = ndt_complex_kind($1, ctx); if ($$ == NULL) YYABORT; }
|
|
278
|
+
| flags_opt BCOMPLEX32 { $$ = ndt_primitive(BComplex32, $1, ctx); if ($$ == NULL) YYABORT; }
|
|
279
|
+
| flags_opt ieee_complex { $$ = ndt_primitive($2, $1, ctx); if ($$ == NULL) YYABORT; }
|
|
280
|
+
| flags_opt alias { $$ = ndt_from_alias($2, $1, ctx); if ($$ == NULL) YYABORT; }
|
|
281
|
+
| character { $$ = $1; }
|
|
282
|
+
| string { $$ = $1; }
|
|
283
|
+
| option_opt FIXED_STRING_KIND { $$ = ndt_fixed_string_kind($1, ctx); if ($$ == NULL) YYABORT; }
|
|
284
|
+
| fixed_string { $$ = $1; }
|
|
285
|
+
| bytes { $$ = $1; }
|
|
286
|
+
| option_opt FIXED_BYTES_KIND { $$ = ndt_fixed_bytes_kind($1, ctx); if ($$ == NULL) YYABORT; }
|
|
287
|
+
| fixed_bytes { $$ = $1; }
|
|
288
|
+
| categorical { $$ = $1; }
|
|
289
|
+
| ref { $$ = $1; }
|
|
273
290
|
|
|
274
291
|
signed:
|
|
275
|
-
|
|
276
|
-
|
|
|
277
|
-
|
|
|
278
|
-
|
|
|
292
|
+
INT8 { $$ = Int8; }
|
|
293
|
+
| INT16 { $$ = Int16; }
|
|
294
|
+
| INT32 { $$ = Int32; }
|
|
295
|
+
| INT64 { $$ = Int64; }
|
|
279
296
|
|
|
280
297
|
unsigned:
|
|
281
|
-
|
|
282
|
-
|
|
|
283
|
-
|
|
|
284
|
-
|
|
|
298
|
+
UINT8 { $$ = Uint8; }
|
|
299
|
+
| UINT16 { $$ = Uint16; }
|
|
300
|
+
| UINT32 { $$ = Uint32; }
|
|
301
|
+
| UINT64 { $$ = Uint64; }
|
|
285
302
|
|
|
286
303
|
ieee_float:
|
|
287
|
-
|
|
288
|
-
|
|
|
289
|
-
|
|
|
304
|
+
FLOAT16 { $$ = Float16; }
|
|
305
|
+
| FLOAT32 { $$ = Float32; }
|
|
306
|
+
| FLOAT64 { $$ = Float64; }
|
|
290
307
|
|
|
291
308
|
ieee_complex:
|
|
292
|
-
|
|
293
|
-
|
|
|
294
|
-
|
|
|
309
|
+
COMPLEX32 { $$ = Complex32; }
|
|
310
|
+
| COMPLEX64 { $$ = Complex64; }
|
|
311
|
+
| COMPLEX128 { $$ = Complex128; }
|
|
295
312
|
|
|
296
313
|
alias:
|
|
297
314
|
/* machine dependent */
|
|
298
|
-
|
|
299
|
-
|
|
|
300
|
-
|
|
|
315
|
+
INTPTR { $$ = Intptr; }
|
|
316
|
+
| UINTPTR { $$ = Uintptr; }
|
|
317
|
+
| SIZE { $$ = Size; }
|
|
301
318
|
|
|
302
319
|
character:
|
|
303
|
-
CHAR { $$ = ndt_char(Utf32, ctx); if ($$ == NULL) YYABORT; }
|
|
304
|
-
| CHAR LPAREN encoding RPAREN { $$ = ndt_char($
|
|
320
|
+
option_opt CHAR { $$ = ndt_char(Utf32, $1, ctx); if ($$ == NULL) YYABORT; }
|
|
321
|
+
| option_opt CHAR LPAREN encoding RPAREN { $$ = ndt_char($4, $1, ctx); if ($$ == NULL) YYABORT; }
|
|
305
322
|
|
|
306
323
|
string:
|
|
307
|
-
STRING { $$ = ndt_string(ctx); if ($$ == NULL) YYABORT; }
|
|
324
|
+
option_opt STRING { $$ = ndt_string($1, ctx); if ($$ == NULL) YYABORT; }
|
|
308
325
|
|
|
309
326
|
fixed_string:
|
|
310
|
-
FIXED_STRING LPAREN INTEGER RPAREN { $$ = mk_fixed_string($
|
|
311
|
-
| FIXED_STRING LPAREN INTEGER COMMA encoding RPAREN { $$ = mk_fixed_string($
|
|
327
|
+
option_opt FIXED_STRING LPAREN INTEGER RPAREN { $$ = mk_fixed_string($4, Utf8, $1, ctx); if ($$ == NULL) YYABORT; }
|
|
328
|
+
| option_opt FIXED_STRING LPAREN INTEGER COMMA encoding RPAREN { $$ = mk_fixed_string($4, $6, $1, ctx); if ($$ == NULL) YYABORT; }
|
|
329
|
+
|
|
330
|
+
flags_opt:
|
|
331
|
+
option_opt endian_opt { $$ = $1 | $2; }
|
|
332
|
+
|
|
333
|
+
option_opt:
|
|
334
|
+
%empty { $$ = 0; }
|
|
335
|
+
| QUESTIONMARK { $$ = NDT_OPTION; }
|
|
312
336
|
|
|
313
337
|
endian_opt:
|
|
314
338
|
%empty { $$ = 0; }
|
|
@@ -321,17 +345,26 @@ encoding:
|
|
|
321
345
|
STRINGLIT { $$ = encoding_from_string($1, ctx); if (ndt_err_occurred(ctx)) YYABORT; }
|
|
322
346
|
|
|
323
347
|
bytes:
|
|
324
|
-
BYTES arguments_opt { $$ = mk_bytes($
|
|
348
|
+
option_opt BYTES arguments_opt { $$ = mk_bytes($3, $1, ctx); if ($$ == NULL) YYABORT; }
|
|
349
|
+
|
|
350
|
+
array_dimensions:
|
|
351
|
+
array { $$ = $1; }
|
|
352
|
+
| option_opt ARRAY ELLIPSIS OF datashape { $$ = mk_array_ellipsis($5, ctx); if ($$ == NULL) YYABORT; }
|
|
353
|
+
| option_opt ARRAY ELLIPSIS OF array { $$ = mk_array_ellipsis($5, ctx); if ($$ == NULL) YYABORT; }
|
|
354
|
+
|
|
355
|
+
array:
|
|
356
|
+
option_opt ARRAY OF datashape { $$ = mk_array($4, $1, ctx); if ($$ == NULL) YYABORT; }
|
|
357
|
+
| option_opt ARRAY OF array { $$ = mk_array($4, $1, ctx); if ($$ == NULL) YYABORT; }
|
|
325
358
|
|
|
326
359
|
fixed_bytes:
|
|
327
|
-
FIXED_BYTES LPAREN attribute_seq RPAREN { $$ = mk_fixed_bytes($
|
|
360
|
+
option_opt FIXED_BYTES LPAREN attribute_seq RPAREN { $$ = mk_fixed_bytes($4, $1, ctx); if ($$ == NULL) YYABORT; }
|
|
328
361
|
|
|
329
362
|
ref:
|
|
330
|
-
REF LPAREN datashape RPAREN { $$ =
|
|
331
|
-
| AMPERSAND datashape { $$ =
|
|
363
|
+
option_opt REF LPAREN datashape RPAREN { $$ = mk_ref($4, $1, ctx); if ($$ == NULL) YYABORT; }
|
|
364
|
+
| option_opt AMPERSAND datashape { $$ = mk_ref($3, $1, ctx); if ($$ == NULL) YYABORT; }
|
|
332
365
|
|
|
333
366
|
categorical:
|
|
334
|
-
CATEGORICAL LPAREN typed_value_seq RPAREN { $$ = mk_categorical($
|
|
367
|
+
option_opt CATEGORICAL LPAREN typed_value_seq RPAREN { $$ = mk_categorical($4, $1, ctx); if ($$ == NULL) YYABORT; }
|
|
335
368
|
|
|
336
369
|
typed_value_seq:
|
|
337
370
|
typed_value { $$ = ndt_value_seq_new($1, ctx); if ($$ == NULL) YYABORT; }
|
|
@@ -353,9 +386,12 @@ comma_variadic_flag:
|
|
|
353
386
|
| COMMA ELLIPSIS { $$ = Variadic; }
|
|
354
387
|
|
|
355
388
|
tuple_type:
|
|
356
|
-
LPAREN variadic_flag RPAREN
|
|
357
|
-
| LPAREN tuple_field_seq comma_variadic_flag RPAREN
|
|
358
|
-
| LPAREN tuple_field_seq COMMA attribute_seq RPAREN
|
|
389
|
+
LPAREN variadic_flag RPAREN { $$ = mk_tuple($2, NULL, NULL, false, ctx); if ($$ == NULL) YYABORT; }
|
|
390
|
+
| LPAREN tuple_field_seq comma_variadic_flag RPAREN { $$ = mk_tuple($3, $2, NULL, false, ctx); if ($$ == NULL) YYABORT; }
|
|
391
|
+
| LPAREN tuple_field_seq COMMA attribute_seq RPAREN { $$ = mk_tuple(Nonvariadic, $2, $4, false, ctx); if ($$ == NULL) YYABORT; }
|
|
392
|
+
| QUESTIONMARK LPAREN variadic_flag RPAREN { $$ = mk_tuple($3, NULL, NULL, true, ctx); if ($$ == NULL) YYABORT; }
|
|
393
|
+
| QUESTIONMARK LPAREN tuple_field_seq comma_variadic_flag RPAREN { $$ = mk_tuple($4, $3, NULL, true, ctx); if ($$ == NULL) YYABORT; }
|
|
394
|
+
| QUESTIONMARK LPAREN tuple_field_seq COMMA attribute_seq RPAREN { $$ = mk_tuple(Nonvariadic, $3, $5, true, ctx); if ($$ == NULL) YYABORT; }
|
|
359
395
|
|
|
360
396
|
tuple_field_seq:
|
|
361
397
|
tuple_field { $$ = ndt_field_seq_new($1, ctx); if ($$ == NULL) YYABORT; }
|
|
@@ -366,23 +402,39 @@ tuple_field:
|
|
|
366
402
|
| datashape BAR attribute_seq BAR { $$ = mk_field(NULL, $1, $3, ctx); if ($$ == NULL) YYABORT; }
|
|
367
403
|
|
|
368
404
|
record_type:
|
|
369
|
-
LBRACE variadic_flag RBRACE
|
|
370
|
-
| LBRACE record_field_seq comma_variadic_flag RBRACE
|
|
371
|
-
| LBRACE record_field_seq COMMA attribute_seq RBRACE
|
|
405
|
+
LBRACE variadic_flag RBRACE { $$ = mk_record($2, NULL, NULL, false, ctx); if ($$ == NULL) YYABORT; }
|
|
406
|
+
| LBRACE record_field_seq comma_variadic_flag RBRACE { $$ = mk_record($3, $2, NULL, false, ctx); if ($$ == NULL) YYABORT; }
|
|
407
|
+
| LBRACE record_field_seq COMMA attribute_seq RBRACE { $$ = mk_record(Nonvariadic, $2, $4, false, ctx); if ($$ == NULL) YYABORT; }
|
|
408
|
+
| QUESTIONMARK LBRACE variadic_flag RBRACE { $$ = mk_record($3, NULL, NULL, true, ctx); if ($$ == NULL) YYABORT; }
|
|
409
|
+
| QUESTIONMARK LBRACE record_field_seq comma_variadic_flag RBRACE { $$ = mk_record($4, $3, NULL, true, ctx); if ($$ == NULL) YYABORT; }
|
|
410
|
+
| QUESTIONMARK LBRACE record_field_seq COMMA attribute_seq RBRACE { $$ = mk_record(Nonvariadic, $3, $5, true, ctx); if ($$ == NULL) YYABORT; }
|
|
372
411
|
|
|
373
412
|
record_field_seq:
|
|
374
413
|
record_field { $$ = ndt_field_seq_new($1, ctx); if ($$ == NULL) YYABORT; }
|
|
375
414
|
| record_field_seq COMMA record_field { $$ = ndt_field_seq_append($1, $3, ctx); if ($$ == NULL) YYABORT; }
|
|
376
415
|
|
|
377
416
|
record_field:
|
|
378
|
-
|
|
379
|
-
|
|
|
417
|
+
field_name_or_tag COLON datashape { $$ = mk_field($1, $3, NULL, ctx); if ($$ == NULL) YYABORT; }
|
|
418
|
+
| field_name_or_tag COLON datashape BAR attribute_seq BAR { $$ = mk_field($1, $3, $5, ctx); if ($$ == NULL) YYABORT; }
|
|
380
419
|
|
|
381
|
-
|
|
420
|
+
field_name_or_tag:
|
|
382
421
|
NAME_LOWER { $$ = $1; if ($$ == NULL) YYABORT; }
|
|
383
422
|
| NAME_UPPER { $$ = $1; if ($$ == NULL) YYABORT; }
|
|
384
423
|
| NAME_OTHER { $$ = $1; if ($$ == NULL) YYABORT; }
|
|
385
424
|
|
|
425
|
+
union_type:
|
|
426
|
+
union_member_seq %prec BELOW_BAR { $$ = mk_union($1, false, ctx); if ($$ == NULL) YYABORT; }
|
|
427
|
+
| LBRACK union_member_seq RBRACK { $$ = mk_union($2, false, ctx); if ($$ == NULL) YYABORT; }
|
|
428
|
+
| QUESTIONMARK union_member_seq %prec BELOW_BAR { $$ = mk_union($2, true, ctx); if ($$ == NULL) YYABORT; }
|
|
429
|
+
| QUESTIONMARK LBRACK union_member_seq RBRACK { $$ = mk_union($3, true, ctx); if ($$ == NULL) YYABORT; }
|
|
430
|
+
|
|
431
|
+
union_member_seq:
|
|
432
|
+
union_member { $$ = ndt_field_seq_new($1, ctx); if ($$ == NULL) YYABORT; }
|
|
433
|
+
| union_member_seq BAR union_member { $$ = ndt_field_seq_append($1, $3, ctx); if ($$ == NULL) YYABORT; }
|
|
434
|
+
|
|
435
|
+
union_member:
|
|
436
|
+
field_name_or_tag OF datashape { $$ = mk_field($1, $3, NULL, ctx); if ($$ == NULL) YYABORT; }
|
|
437
|
+
|
|
386
438
|
arguments_opt:
|
|
387
439
|
%empty { $$ = NULL; }
|
|
388
440
|
| LPAREN attribute_seq RPAREN { $$ = $2; if ($$ == NULL) YYABORT; }
|
|
@@ -400,8 +452,7 @@ untyped_value_seq:
|
|
|
400
452
|
| untyped_value_seq COMMA untyped_value { $$ = ndt_string_seq_append($1, $3, ctx); if ($$ == NULL) YYABORT; }
|
|
401
453
|
|
|
402
454
|
untyped_value:
|
|
403
|
-
|
|
404
|
-
| INTEGER { $$ = $1; if ($$ == NULL) YYABORT; }
|
|
455
|
+
INTEGER { $$ = $1; if ($$ == NULL) YYABORT; }
|
|
405
456
|
| FLOATNUMBER { $$ = $1; if ($$ == NULL) YYABORT; }
|
|
406
457
|
| STRINGLIT { $$ = $1; if ($$ == NULL) YYABORT; }
|
|
407
458
|
|
|
@@ -409,9 +460,9 @@ function_type:
|
|
|
409
460
|
type_seq_or_void RARROW type_seq_or_void { $$ = mk_function($1, $3, ctx); if ($$ == NULL) YYABORT; }
|
|
410
461
|
|
|
411
462
|
type_seq_or_void:
|
|
412
|
-
type_seq { $$ = $1;
|
|
463
|
+
type_seq { $$ = $1; }
|
|
413
464
|
| VOID { $$ = ndt_type_seq_empty(ctx); if ($$ == NULL) YYABORT; }
|
|
414
465
|
|
|
415
466
|
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; }
|
|
467
|
+
datashape_with_ellipsis { $$ = ndt_type_seq_new((ndt_t *)$1, ctx); if ($$ == NULL) YYABORT; }
|
|
468
|
+
| type_seq COMMA datashape_with_ellipsis { $$ = ndt_type_seq_append($1, (ndt_t *)$3, ctx); if ($$ == NULL) YYABORT; }
|