Coverage Report

Created: 2025-07-07 10:01

/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx
Line
Count
Source (jump to first uncovered line)
1
/* A Bison parser, made by GNU Bison 3.5.1.  */
2
3
/* Bison implementation for Yacc-like parsers in C
4
5
   Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation,
6
   Inc.
7
8
   This program is free software: you can redistribute it and/or modify
9
   it under the terms of the GNU General Public License as published by
10
   the Free Software Foundation, either version 3 of the License, or
11
   (at your option) any later version.
12
13
   This program is distributed in the hope that it will be useful,
14
   but WITHOUT ANY WARRANTY; without even the implied warranty of
15
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
   GNU General Public License for more details.
17
18
   You should have received a copy of the GNU General Public License
19
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
20
21
/* As a special exception, you may create a larger work that contains
22
   part or all of the Bison parser skeleton and distribute that work
23
   under terms of your choice, so long as that work isn't itself a
24
   parser generator using the skeleton or a modified version thereof
25
   as a parser skeleton.  Alternatively, if you modify or redistribute
26
   the parser skeleton itself, you may (at your option) remove this
27
   special exception, which will cause the skeleton and the resulting
28
   Bison output files to be licensed under the GNU General Public
29
   License without this special exception.
30
31
   This special exception was added by the Free Software Foundation in
32
   version 2.2 of Bison.  */
33
34
/* C LALR(1) parser skeleton written by Richard Stallman, by
35
   simplifying the original so-called "semantic" parser.  */
36
37
/* All symbols defined below should begin with yy or YY, to avoid
38
   infringing on user name space.  This should be done even for local
39
   variables, as they might otherwise be expanded by user macros.
40
   There are some unavoidable exceptions within include files to
41
   define necessary library symbols; they are noted "INFRINGES ON
42
   USER NAME SPACE" below.  */
43
44
/* Undocumented macros, especially those whose name start with YY_,
45
   are private implementation details.  Do not rely on them.  */
46
47
/* Identify Bison output.  */
48
#define YYBISON 1
49
50
/* Bison version.  */
51
#define YYBISON_VERSION "3.5.1"
52
53
/* Skeleton name.  */
54
#define YYSKELETON_NAME "yacc.c"
55
56
/* Pure parsers.  */
57
#define YYPURE 1
58
59
/* Push parsers.  */
60
#define YYPUSH 0
61
62
/* Pull parsers.  */
63
#define YYPULL 1
64
65
66
67
68
/* First part of user prologue.  */
69
#line 15 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
70
71
72
#include <sal/config.h>
73
74
#include <o3tl/unreachable.hxx>
75
#include <o3tl/string_view.hxx>
76
#include <rtl/ustrbuf.hxx>
77
#include <unoidl/unoidl.hxx>
78
79
#include <algorithm>
80
#include <cassert>
81
#include <cerrno>
82
#include <cstddef>
83
#include <cstdlib>
84
#include <limits>
85
#include <new>
86
#include <utility>
87
#include <vector>
88
89
#include "sourceprovider-parser-requires.hxx"
90
91
92
#line 93 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
93
94
# ifndef YY_CAST
95
#  ifdef __cplusplus
96
0
#   define YY_CAST(Type, Val) static_cast<Type> (Val)
97
#   define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
98
#  else
99
#   define YY_CAST(Type, Val) ((Type) (Val))
100
#   define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
101
#  endif
102
# endif
103
# ifndef YY_NULLPTR
104
#  if defined __cplusplus
105
#   if 201103L <= __cplusplus
106
#    define YY_NULLPTR nullptr
107
#   else
108
#    define YY_NULLPTR 0
109
#   endif
110
#  else
111
#   define YY_NULLPTR ((void*)0)
112
#  endif
113
# endif
114
115
/* Enabling verbose error messages.  */
116
#ifdef YYERROR_VERBOSE
117
# undef YYERROR_VERBOSE
118
# define YYERROR_VERBOSE 1
119
#else
120
# define YYERROR_VERBOSE 0
121
#endif
122
123
/* Use api.header.include to #include this header
124
   instead of duplicating it here.  */
125
#ifndef YY_YY_WORK_WORKDIR_YACCTARGET_UNOIDL_SOURCE_SOURCEPROVIDER_PARSER_HXX_INCLUDED
126
# define YY_YY_WORK_WORKDIR_YACCTARGET_UNOIDL_SOURCE_SOURCEPROVIDER_PARSER_HXX_INCLUDED
127
/* Debug traces.  */
128
#ifndef YYDEBUG
129
# define YYDEBUG 0
130
#endif
131
#if YYDEBUG
132
extern int yydebug;
133
#endif
134
135
/* Token type.  */
136
#ifndef YYTOKENTYPE
137
# define YYTOKENTYPE
138
  enum yytokentype
139
  {
140
    TOK_ELLIPSIS = 258,
141
    TOK_COLONS = 259,
142
    TOK_LEFTSHIFT = 260,
143
    TOK_RIGHTSHIFT = 261,
144
    TOK_FALSE = 262,
145
    TOK_TRUE = 263,
146
    TOK_ANY = 264,
147
    TOK_ATTRIBUTE = 265,
148
    TOK_BOOLEAN = 266,
149
    TOK_BOUND = 267,
150
    TOK_BYTE = 268,
151
    TOK_CHAR = 269,
152
    TOK_CONST = 270,
153
    TOK_CONSTANTS = 271,
154
    TOK_CONSTRAINED = 272,
155
    TOK_DOUBLE = 273,
156
    TOK_ENUM = 274,
157
    TOK_EXCEPTION = 275,
158
    TOK_FLOAT = 276,
159
    TOK_GET = 277,
160
    TOK_HYPER = 278,
161
    TOK_IN = 279,
162
    TOK_INOUT = 280,
163
    TOK_INTERFACE = 281,
164
    TOK_LONG = 282,
165
    TOK_MAYBEAMBIGUOUS = 283,
166
    TOK_MAYBEDEFAULT = 284,
167
    TOK_MAYBEVOID = 285,
168
    TOK_MODULE = 286,
169
    TOK_OPTIONAL = 287,
170
    TOK_OUT = 288,
171
    TOK_PROPERTY = 289,
172
    TOK_PUBLISHED = 290,
173
    TOK_RAISES = 291,
174
    TOK_READONLY = 292,
175
    TOK_REMOVABLE = 293,
176
    TOK_SEQUENCE = 294,
177
    TOK_SERVICE = 295,
178
    TOK_SET = 296,
179
    TOK_SHORT = 297,
180
    TOK_SINGLETON = 298,
181
    TOK_STRING = 299,
182
    TOK_STRUCT = 300,
183
    TOK_TRANSIENT = 301,
184
    TOK_TYPE = 302,
185
    TOK_TYPEDEF = 303,
186
    TOK_UNSIGNED = 304,
187
    TOK_VOID = 305,
188
    TOK_IDENTIFIER = 306,
189
    TOK_INTEGER = 307,
190
    TOK_FLOATING = 308,
191
    TOK_DEPRECATED = 309,
192
    TOK_ERROR = 310
193
  };
194
#endif
195
196
/* Value type.  */
197
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
198
union YYSTYPE
199
{
200
#line 38 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
201
202
    sal_uInt64 ival;
203
    double fval;
204
    OString * sval;
205
206
    bool bval;
207
    std::vector<OUString> * excns;
208
    unoidl::detail::SourceProviderAccessDecls decls;
209
    unoidl::InterfaceTypeEntity::Method::Parameter::Direction dir;
210
    unoidl::detail::SourceProviderFlags flags;
211
    unoidl::detail::SourceProviderExpr expr;
212
    unoidl::detail::SourceProviderType * type;
213
    std::vector<unoidl::detail::SourceProviderType> * types;
214
215
#line 216 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
216
217
};
218
typedef union YYSTYPE YYSTYPE;
219
# define YYSTYPE_IS_TRIVIAL 1
220
# define YYSTYPE_IS_DECLARED 1
221
#endif
222
223
/* Location type.  */
224
#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
225
typedef struct YYLTYPE YYLTYPE;
226
struct YYLTYPE
227
{
228
  int first_line;
229
  int first_column;
230
  int last_line;
231
  int last_column;
232
};
233
# define YYLTYPE_IS_DECLARED 1
234
# define YYLTYPE_IS_TRIVIAL 1
235
#endif
236
237
238
239
int yyparse (yyscan_t yyscanner);
240
241
#endif /* !YY_YY_WORK_WORKDIR_YACCTARGET_UNOIDL_SOURCE_SOURCEPROVIDER_PARSER_HXX_INCLUDED  */
242
243
/* Second part of user prologue.  */
244
#line 58 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
245
246
247
#include <osl/file.h>
248
#include <osl/thread.h>
249
#include <sal/log.hxx>
250
251
#include "sourceprovider-scanner.hxx"
252
253
#define YYLLOC_DEFAULT(Current, Rhs, N) \
254
0
    do { (Current) = YYRHSLOC((Rhs), (N) ? 1 : 0); } while (0)
255
256
0
static void yyerror(YYLTYPE * locp, yyscan_t yyscanner, char const * msg) {
257
0
    assert(locp != nullptr);
258
0
    unoidl::detail::SourceProviderScannerData * data = yyget_extra(yyscanner);
259
0
    data->errorLine = *locp;
260
0
    data->parserError = OString(msg);
261
0
}
262
263
namespace {
264
265
0
void error(YYLTYPE location, yyscan_t yyscanner, OUString const & message) {
266
0
    unoidl::detail::SourceProviderScannerData * data = yyget_extra(yyscanner);
267
0
    data->errorLine = location;
268
0
    data->errorMessage = message;
269
0
}
270
271
0
OUString flagName(unoidl::detail::SourceProviderFlags flag) {
272
0
    switch (flag) {
273
0
    case unoidl::detail::FLAG_ATTRIBUTE:
274
0
        return u"attribute"_ustr;
275
0
    case unoidl::detail::FLAG_BOUND:
276
0
        return u"bound"_ustr;
277
0
    case unoidl::detail::FLAG_CONSTRAINED:
278
0
        return u"constrained"_ustr;
279
0
    case unoidl::detail::FLAG_MAYBEAMBIGUOUS:
280
0
        return u"maybeambiguous"_ustr;
281
0
    case unoidl::detail::FLAG_MAYBEDEFAULT:
282
0
        return u"maybedefault"_ustr;
283
0
    case unoidl::detail::FLAG_MAYBEVOID:
284
0
        return u"maybevoid"_ustr;
285
0
    case unoidl::detail::FLAG_OPTIONAL:
286
0
        return u"optional"_ustr;
287
0
    case unoidl::detail::FLAG_PROPERTY:
288
0
        return u"property"_ustr;
289
0
    case unoidl::detail::FLAG_READONLY:
290
0
        return u"readonly"_ustr;
291
0
    case unoidl::detail::FLAG_REMOVABLE:
292
0
        return u"removable"_ustr;
293
0
    case unoidl::detail::FLAG_TRANSIENT:
294
0
        return u"transient"_ustr;
295
0
    default:
296
0
        assert(false && "this cannot happen"); for (;;) { std::abort(); }
297
0
    }
298
0
}
299
300
0
OUString convertName(OString const * name) {
301
0
    assert(name != nullptr);
302
0
    OUString s(OStringToOUString(*name, RTL_TEXTENCODING_ASCII_US));
303
0
    delete name;
304
0
    return s;
305
0
}
306
307
OUString convertToFullName(
308
    unoidl::detail::SourceProviderScannerData const * data,
309
    OString const * identifier)
310
0
{
311
0
    assert(data != nullptr);
312
0
    OUString pref;
313
0
    if (!data->modules.empty()) {
314
0
        pref = data->modules.back() + ".";
315
0
    }
316
0
    return pref + convertName(identifier);
317
0
}
318
319
void convertToCurrentName(
320
    unoidl::detail::SourceProviderScannerData * data,
321
    OString const * identifier)
322
0
{
323
0
    assert(data != nullptr);
324
0
    assert(data->currentName.isEmpty());
325
0
    data->currentName = convertToFullName(data, identifier);
326
0
    assert(!data->currentName.isEmpty());
327
0
}
328
329
0
void clearCurrentState(unoidl::detail::SourceProviderScannerData * data) {
330
0
    assert(data != nullptr);
331
0
    data->currentName.clear();
332
0
    data->publishedContext = false;
333
0
}
334
335
unoidl::detail::SourceProviderEntity * getCurrentEntity(
336
    unoidl::detail::SourceProviderScannerData * data)
337
0
{
338
0
    assert(data != nullptr);
339
0
    assert(!data->currentName.isEmpty());
340
0
    std::map<OUString, unoidl::detail::SourceProviderEntity>::iterator i(
341
0
        data->entities.find(data->currentName));
342
0
    assert(i != data->entities.end());
343
0
    assert(i->second.kind == unoidl::detail::SourceProviderEntity::KIND_LOCAL);
344
0
    assert(i->second.pad.is());
345
0
    return &i->second;
346
0
}
347
348
template<typename T> rtl::Reference<T> getCurrentPad(
349
    unoidl::detail::SourceProviderScannerData * data)
350
0
{
351
0
    rtl::Reference<T> pad(dynamic_cast<T *>(getCurrentEntity(data)->pad.get()));
352
0
    assert(pad.is());
353
0
    return pad;
354
0
}
Unexecuted instantiation: sourceprovider-parser.cxx:rtl::Reference<unoidl::detail::SourceProviderEnumTypeEntityPad> (anonymous namespace)::getCurrentPad<unoidl::detail::SourceProviderEnumTypeEntityPad>(unoidl::detail::SourceProviderScannerData*)
Unexecuted instantiation: sourceprovider-parser.cxx:rtl::Reference<unoidl::detail::SourceProviderPolymorphicStructTypeTemplateEntityPad> (anonymous namespace)::getCurrentPad<unoidl::detail::SourceProviderPolymorphicStructTypeTemplateEntityPad>(unoidl::detail::SourceProviderScannerData*)
Unexecuted instantiation: sourceprovider-parser.cxx:rtl::Reference<unoidl::detail::SourceProviderInterfaceTypeEntityPad> (anonymous namespace)::getCurrentPad<unoidl::detail::SourceProviderInterfaceTypeEntityPad>(unoidl::detail::SourceProviderScannerData*)
Unexecuted instantiation: sourceprovider-parser.cxx:rtl::Reference<unoidl::detail::SourceProviderConstantGroupEntityPad> (anonymous namespace)::getCurrentPad<unoidl::detail::SourceProviderConstantGroupEntityPad>(unoidl::detail::SourceProviderScannerData*)
Unexecuted instantiation: sourceprovider-parser.cxx:rtl::Reference<unoidl::detail::SourceProviderSingleInterfaceBasedServiceEntityPad> (anonymous namespace)::getCurrentPad<unoidl::detail::SourceProviderSingleInterfaceBasedServiceEntityPad>(unoidl::detail::SourceProviderScannerData*)
Unexecuted instantiation: sourceprovider-parser.cxx:rtl::Reference<unoidl::detail::SourceProviderAccumulationBasedServiceEntityPad> (anonymous namespace)::getCurrentPad<unoidl::detail::SourceProviderAccumulationBasedServiceEntityPad>(unoidl::detail::SourceProviderScannerData*)
355
356
bool nameHasSameIdentifierAs(std::u16string_view name, std::u16string_view identifier)
357
0
{
358
0
    std::u16string_view::size_type pos = name.rfind('.');
359
0
    size_t i = (pos != std::u16string_view::npos) ? pos + 1 : 0;
360
0
    return identifier.size() == name.size() - i
361
0
        && o3tl::starts_with(name.substr(i), identifier);
362
0
}
363
364
bool coerce(
365
    YYLTYPE location, yyscan_t yyscanner,
366
    unoidl::detail::SourceProviderExpr * lhs,
367
    unoidl::detail::SourceProviderExpr * rhs)
368
0
{
369
0
    assert(lhs != nullptr);
370
0
    assert(rhs != nullptr);
371
0
    bool ok = bool(); // avoid warnings
372
0
    switch (lhs->type) {
373
0
    case unoidl::detail::SourceProviderExpr::TYPE_BOOL:
374
0
        ok = rhs->type != unoidl::detail::SourceProviderExpr::TYPE_BOOL;
375
0
        break;
376
0
    case unoidl::detail::SourceProviderExpr::TYPE_INT:
377
0
        switch (rhs->type) {
378
0
        case unoidl::detail::SourceProviderExpr::TYPE_BOOL:
379
0
            ok = false;
380
0
            break;
381
0
        case unoidl::detail::SourceProviderExpr::TYPE_INT:
382
0
            ok = true;
383
0
            break;
384
0
        case unoidl::detail::SourceProviderExpr::TYPE_UINT:
385
0
            if (lhs->ival >= 0) {
386
0
                lhs->type = unoidl::detail::SourceProviderExpr::TYPE_UINT;
387
0
                ok = true;
388
0
            } else if (rhs->uval <= SAL_MAX_INT64) {
389
0
                rhs->type = unoidl::detail::SourceProviderExpr::TYPE_INT;
390
0
                ok = true;
391
0
            } else {
392
0
                ok = false;
393
0
            }
394
0
            break;
395
0
        case unoidl::detail::SourceProviderExpr::TYPE_FLOAT:
396
0
            {
397
0
                auto tmp = lhs->ival;
398
0
                lhs->fval = tmp;
399
0
                ok = true;
400
0
            }
401
0
            break;
402
0
        }
403
0
        break;
404
0
    case unoidl::detail::SourceProviderExpr::TYPE_UINT:
405
0
        switch (rhs->type) {
406
0
        case unoidl::detail::SourceProviderExpr::TYPE_BOOL:
407
0
            ok = false;
408
0
            break;
409
0
        case unoidl::detail::SourceProviderExpr::TYPE_INT:
410
0
            if (rhs->ival >= 0) {
411
0
                rhs->type = unoidl::detail::SourceProviderExpr::TYPE_UINT;
412
0
                ok = true;
413
0
            } else if (lhs->uval <= SAL_MAX_INT64) {
414
0
                lhs->type = unoidl::detail::SourceProviderExpr::TYPE_INT;
415
0
                ok = true;
416
0
            } else {
417
0
                ok = false;
418
0
            }
419
0
            break;
420
0
        case unoidl::detail::SourceProviderExpr::TYPE_UINT:
421
0
            ok = true;
422
0
            break;
423
0
        case unoidl::detail::SourceProviderExpr::TYPE_FLOAT:
424
0
            {
425
0
                auto nTmp = lhs->uval;
426
0
                lhs->fval = nTmp;
427
0
                ok = true;
428
0
            }
429
0
            break;
430
0
        }
431
0
        break;
432
0
    case unoidl::detail::SourceProviderExpr::TYPE_FLOAT:
433
0
        switch (rhs->type) {
434
0
        case unoidl::detail::SourceProviderExpr::TYPE_BOOL:
435
0
            ok = false;
436
0
            break;
437
0
        case unoidl::detail::SourceProviderExpr::TYPE_INT:
438
0
            {
439
0
                auto tmp = rhs->ival;
440
0
                rhs->fval = tmp;
441
0
                ok = true;
442
0
            }
443
0
            break;
444
0
        case unoidl::detail::SourceProviderExpr::TYPE_UINT:
445
0
            {
446
0
                auto tmp = rhs->uval;
447
0
                rhs->fval = tmp;
448
0
                ok = true;
449
0
            }
450
0
            break;
451
0
        case unoidl::detail::SourceProviderExpr::TYPE_FLOAT:
452
0
            ok = true;
453
0
            break;
454
0
        }
455
0
        break;
456
0
    }
457
0
    if (!ok) {
458
0
        error(location, yyscanner, u"cannot coerce binary expression arguments"_ustr);
459
0
    }
460
0
    return ok;
461
0
}
462
463
unoidl::detail::SourceProviderEntity * findEntity_(
464
    unoidl::detail::SourceProviderScannerData * data, OUString * name)
465
0
{
466
0
    assert(data != nullptr);
467
0
    assert(name != nullptr);
468
0
    OUString n;
469
0
    if (!name->startsWith(".", &n)) {
470
0
        for (auto i(data->modules.rbegin()); i != data->modules.rend(); ++i) {
471
0
            n = *i + "." + *name;
472
0
            std::map<OUString, unoidl::detail::SourceProviderEntity>::iterator j(
473
0
                data->entities.find(n));
474
0
            if (j != data->entities.end()) {
475
0
                *name = n;
476
0
                return &j->second;
477
0
            }
478
0
            rtl::Reference<unoidl::Entity> ent(data->manager->findEntity(n));
479
0
            if (ent.is()) {
480
0
                std::map<OUString, unoidl::detail::SourceProviderEntity>::iterator
481
0
                    k(data->entities.emplace(
482
0
                              n,
483
0
                              unoidl::detail::SourceProviderEntity(
484
0
                                  unoidl::detail::SourceProviderEntity::KIND_EXTERNAL,
485
0
                                  ent)).
486
0
                      first);
487
0
                *name = n;
488
0
                return &k->second;
489
0
            }
490
0
        }
491
0
        n = *name;
492
0
    }
493
0
    std::map<OUString, unoidl::detail::SourceProviderEntity>::iterator i(
494
0
        data->entities.find(n));
495
0
    if (i != data->entities.end()) {
496
0
        *name = n;
497
0
        return &i->second;
498
0
    }
499
0
    rtl::Reference<unoidl::Entity> ent(data->manager->findEntity(n));
500
0
    if (ent.is()) {
501
0
        std::map<OUString, unoidl::detail::SourceProviderEntity>::iterator
502
0
            j(data->entities.emplace(
503
0
                      n,
504
0
                      unoidl::detail::SourceProviderEntity(
505
0
                          unoidl::detail::SourceProviderEntity::KIND_EXTERNAL,
506
0
                          ent)).
507
0
              first);
508
0
        *name = n;
509
0
        return &j->second;
510
0
    }
511
0
    return nullptr;
512
0
}
513
514
enum Found { FOUND_ERROR, FOUND_TYPE, FOUND_ENTITY };
515
516
Found findEntity(
517
    YYLTYPE location, yyscan_t yyscanner,
518
    unoidl::detail::SourceProviderScannerData * data,
519
    bool resolveInterfaceDefinitions, OUString * name,
520
    unoidl::detail::SourceProviderEntity const ** entity, bool * typedefed,
521
    unoidl::detail::SourceProviderType * typedefedType)
522
0
{
523
    //TODO: avoid recursion
524
0
    assert(data != nullptr);
525
0
    assert(name != nullptr);
526
0
    assert(entity != nullptr);
527
0
    unoidl::detail::SourceProviderEntity * e = findEntity_(data, name);
528
0
    OUString n(*name);
529
0
    OUString typeNucleus;
530
0
    std::size_t rank = 0;
531
0
    std::vector<unoidl::detail::SourceProviderType> args;
532
0
    for (;;) {
533
0
        if (e != nullptr) {
534
0
            switch (e->kind) {
535
0
            case unoidl::detail::SourceProviderEntity::KIND_LOCAL:
536
0
                if (e->pad.is()) {
537
0
                    break;
538
0
                }
539
0
                assert(e->entity.is());
540
0
                [[fallthrough]];
541
0
            case unoidl::detail::SourceProviderEntity::KIND_EXTERNAL:
542
0
                if (e->entity->getSort() == unoidl::Entity::SORT_TYPEDEF) {
543
0
                    if (typedefed != nullptr) {
544
0
                        *typedefed = true;
545
0
                    }
546
0
                    if (data->publishedContext
547
0
                        && !static_cast<unoidl::TypedefEntity *>(
548
0
                            e->entity.get())->isPublished())
549
0
                    {
550
0
                        error(
551
0
                            location, yyscanner,
552
0
                            ("type " + *name + " based on unpublished typedef "
553
0
                             + n + " used in published context"));
554
0
                        return FOUND_ERROR;
555
0
                    }
556
0
                    OUString t(
557
0
                        static_cast<unoidl::TypedefEntity *>(e->entity.get())
558
0
                        ->getType());
559
0
                    typeNucleus = t;
560
0
                    while (typeNucleus.startsWith("[]", &typeNucleus)) {
561
0
                        if (!args.empty()) {
562
0
                            error(
563
0
                                location, yyscanner,
564
0
                                ("inconsistent type manager: bad type " + *name
565
0
                                 + (" based on instantiated polymorphic struct"
566
0
                                    " type based on sequence type named ")
567
0
                                 + t));
568
0
                            return FOUND_ERROR;
569
0
                        }
570
0
                        if (rank == std::numeric_limits<std::size_t>::max()) {
571
0
                            error(
572
0
                                location, yyscanner,
573
0
                                ("bad type " + *name
574
0
                                 + " based on sequence type of too high rank"));
575
0
                            return FOUND_ERROR;
576
0
                        }
577
0
                        ++rank;
578
0
                    }
579
0
                    sal_Int32 i = typeNucleus.indexOf('<');
580
0
                    if (i != -1) {
581
0
                        if (!args.empty()) {
582
0
                            error(
583
0
                                location, yyscanner,
584
0
                                ("inconsistent type manager: bad type " + *name
585
0
                                 + (" based on instantiated polymorphic struct"
586
0
                                    " type based on instantiated polymorphic"
587
0
                                    " struct type named ")
588
0
                                 + t));
589
0
                            return FOUND_ERROR;
590
0
                        }
591
0
                        std::u16string_view tmpl(typeNucleus.subView(0, i));
592
0
                        do {
593
0
                            ++i; // skip '<' or ','
594
0
                            sal_Int32 j = i;
595
0
                            for (sal_Int32 level = 0;
596
0
                                 j != typeNucleus.getLength(); ++j)
597
0
                            {
598
0
                                sal_Unicode c = typeNucleus[j];
599
0
                                if (c == ',') {
600
0
                                    if (level == 0) {
601
0
                                        break;
602
0
                                    }
603
0
                                } else if (c == '<') {
604
0
                                    ++level;
605
0
                                } else if (c == '>') {
606
0
                                    if (level == 0) {
607
0
                                        break;
608
0
                                    }
609
0
                                    --level;
610
0
                                }
611
0
                            }
612
0
                            if (j != typeNucleus.getLength()) {
613
0
                                OUString argName(typeNucleus.copy(i, j - i));
614
0
                                unoidl::detail::SourceProviderEntity const *
615
0
                                    argEnt;
616
0
                                unoidl::detail::SourceProviderType argType;
617
0
                                switch (
618
0
                                    findEntity(
619
0
                                        location, yyscanner, data, false,
620
0
                                        &argName, &argEnt, nullptr, &argType))
621
0
                                {
622
0
                                case FOUND_ERROR:
623
0
                                    return FOUND_ERROR;
624
0
                                case FOUND_TYPE:
625
0
                                    break;
626
0
                                case FOUND_ENTITY:
627
0
                                    if (argEnt == nullptr) {
628
0
                                        error(
629
0
                                            location, yyscanner,
630
0
                                            (("inconsistent type manager: bad"
631
0
                                              " instantiated polymorphic struct"
632
0
                                              " type template type argument ")
633
0
                                             + argName));
634
0
                                        return FOUND_ERROR;
635
0
                                    } else {
636
0
                                        unoidl::detail::SourceProviderType::Type
637
0
                                            argT
638
0
                                            = unoidl::detail::SourceProviderType::Type();
639
                                            // avoid warnings
640
0
                                        switch (argEnt->kind) {
641
0
                                        case unoidl::detail::SourceProviderEntity::KIND_LOCAL:
642
0
                                            if (e->pad.is()) {
643
0
                                                error(
644
0
                                                    location, yyscanner,
645
0
                                                    (("inconsistent type"
646
0
                                                      " manager: bad"
647
0
                                                      " instantiated"
648
0
                                                      " polymorphic struct type"
649
0
                                                      " template type"
650
0
                                                      " argument ")
651
0
                                                     + argName));
652
0
                                                return FOUND_ERROR;
653
0
                                            }
654
0
                                            assert(e->entity.is());
655
0
                                            [[fallthrough]];
656
0
                                        case unoidl::detail::SourceProviderEntity::KIND_EXTERNAL:
657
0
                                            switch (e->entity->getSort()) {
658
0
                                            case unoidl::Entity::SORT_ENUM_TYPE:
659
0
                                                argT = unoidl::detail::SourceProviderType::TYPE_ENUM;
660
0
                                                break;
661
0
                                            case unoidl::Entity::SORT_PLAIN_STRUCT_TYPE:
662
0
                                                argT = unoidl::detail::SourceProviderType::TYPE_PLAIN_STRUCT;
663
0
                                                break;
664
0
                                            case unoidl::Entity::SORT_INTERFACE_TYPE:
665
0
                                                argT = unoidl::detail::SourceProviderType::TYPE_INTERFACE;
666
0
                                                break;
667
0
                                            default:
668
0
                                                error(
669
0
                                                    location, yyscanner,
670
0
                                                    (("inconsistent type"
671
0
                                                      "manager: bad"
672
0
                                                      " instantiated"
673
0
                                                      " polymorphic struct type"
674
0
                                                      " template type"
675
0
                                                      " argument ")
676
0
                                                     + argName));
677
0
                                                return FOUND_ERROR;
678
0
                                            }
679
0
                                            break;
680
0
                                        case unoidl::detail::SourceProviderEntity::KIND_INTERFACE_DECL:
681
0
                                        case unoidl::detail::SourceProviderEntity::KIND_PUBLISHED_INTERFACE_DECL:
682
0
                                            argT = unoidl::detail::SourceProviderType::TYPE_INTERFACE;
683
0
                                            break;
684
0
                                        case unoidl::detail::SourceProviderEntity::KIND_MODULE:
685
0
                                            assert(false && "this cannot happen");
686
0
                                        }
687
0
                                        argType
688
0
                                            = unoidl::detail::SourceProviderType(
689
0
                                                argT, argName, argEnt);
690
0
                                    }
691
0
                                    break;
692
0
                                }
693
0
                                args.push_back(argType);
694
0
                            }
695
0
                            i = j;
696
0
                        } while (i != typeNucleus.getLength()
697
0
                                 && typeNucleus[i] != '>');
698
0
                        if (i != typeNucleus.getLength() - 1
699
0
                            || typeNucleus[i] != '>')
700
0
                        {
701
0
                            error(
702
0
                                location, yyscanner,
703
0
                                ("inconsistent type manager: bad type name \""
704
0
                                 + t + "\""));
705
0
                            return FOUND_ERROR;
706
0
                        }
707
0
                        assert(!args.empty());
708
0
                        typeNucleus = tmpl;
709
0
                    }
710
0
                    if (typeNucleus.isEmpty()) {
711
0
                        error(
712
0
                            location, yyscanner,
713
0
                            ("inconsistent type manager: bad type name \"" + t
714
0
                             + "\""));
715
0
                        return FOUND_ERROR;
716
0
                    }
717
0
                    if (typeNucleus == "void") {
718
0
                        error(
719
0
                            location, yyscanner,
720
0
                            ("inconsistent type manager: bad type " + *name
721
0
                             + " based on void"));
722
0
                        return FOUND_ERROR;
723
0
                    }
724
0
                    if (typeNucleus == "boolean" || typeNucleus == "byte"
725
0
                        || typeNucleus == "short"
726
0
                        || typeNucleus == "unsigned short"
727
0
                        || typeNucleus == "long"
728
0
                        || typeNucleus == "unsigned long"
729
0
                        || typeNucleus == "hyper"
730
0
                        || typeNucleus == "unsigned hyper"
731
0
                        || typeNucleus == "float" || typeNucleus == "double"
732
0
                        || typeNucleus == "char" || typeNucleus == "string"
733
0
                        || typeNucleus == "type" || typeNucleus == "any")
734
0
                    {
735
0
                        if (!args.empty()) {
736
0
                            error(
737
0
                                location, yyscanner,
738
0
                                ("inconsistent type manager: bad type " + *name
739
0
                                 + (" based on instantiated polymorphic struct"
740
0
                                    " type based on ")
741
0
                                 + typeNucleus));
742
0
                            return FOUND_ERROR;
743
0
                        }
744
0
                        break;
745
0
                    }
746
0
                    n = "." + typeNucleus;
747
0
                    typeNucleus.clear();
748
0
                    e = findEntity_(data, &n);
749
0
                    continue;
750
0
                }
751
0
                break;
752
0
            case unoidl::detail::SourceProviderEntity::KIND_INTERFACE_DECL:
753
0
            case unoidl::detail::SourceProviderEntity::KIND_PUBLISHED_INTERFACE_DECL:
754
0
                if (resolveInterfaceDefinitions) {
755
0
                    rtl::Reference<unoidl::Entity> ent(
756
0
                        data->manager->findEntity(n));
757
                    // Do not allow ent to be of SORT_TYPEDEF:
758
0
                    if (!ent.is()
759
0
                        || (ent->getSort()
760
0
                            != unoidl::Entity::SORT_INTERFACE_TYPE))
761
0
                    {
762
0
                        error(
763
0
                            location, yyscanner,
764
0
                            (*name + " is based on interface declaration " + n
765
0
                             + " that is not an interface type entity"));
766
0
                        return FOUND_ERROR;
767
0
                    }
768
0
                    e->kind
769
0
                        = unoidl::detail::SourceProviderEntity::KIND_EXTERNAL;
770
0
                    e->entity = std::move(ent);
771
0
                }
772
0
                break;
773
0
            case unoidl::detail::SourceProviderEntity::KIND_MODULE:
774
0
                error(
775
0
                    location, yyscanner,
776
0
                    *name + " is based on module entity " + n);
777
0
                return FOUND_ERROR;
778
0
            }
779
0
        }
780
0
        if (!typeNucleus.isEmpty() || rank != 0 || !args.empty()) {
781
0
            if (typeNucleus.isEmpty() && e == nullptr) {
782
                // Found a type name based on an unknown entity:
783
0
                *entity = nullptr;
784
0
                return FOUND_ENTITY;
785
0
            }
786
0
            unoidl::detail::SourceProviderType t;
787
0
            if (args.empty()) {
788
0
                if (typeNucleus == "boolean") {
789
0
                    t = unoidl::detail::SourceProviderType(
790
0
                        unoidl::detail::SourceProviderType::TYPE_BOOLEAN);
791
0
                } else if (typeNucleus == "byte") {
792
0
                    t = unoidl::detail::SourceProviderType(
793
0
                        unoidl::detail::SourceProviderType::TYPE_BYTE);
794
0
                } else if (typeNucleus == "short") {
795
0
                    t = unoidl::detail::SourceProviderType(
796
0
                        unoidl::detail::SourceProviderType::TYPE_SHORT);
797
0
                } else if (typeNucleus == "unsigned short") {
798
0
                    t = unoidl::detail::SourceProviderType(
799
0
                        unoidl::detail::SourceProviderType::TYPE_UNSIGNED_SHORT);
800
0
                } else if (typeNucleus == "long") {
801
0
                    t = unoidl::detail::SourceProviderType(
802
0
                        unoidl::detail::SourceProviderType::TYPE_LONG);
803
0
                } else if (typeNucleus == "unsigned long") {
804
0
                    t = unoidl::detail::SourceProviderType(
805
0
                        unoidl::detail::SourceProviderType::TYPE_UNSIGNED_LONG);
806
0
                } else if (typeNucleus == "hyper") {
807
0
                    t = unoidl::detail::SourceProviderType(
808
0
                        unoidl::detail::SourceProviderType::TYPE_HYPER);
809
0
                } else if (typeNucleus == "unsigned hyper") {
810
0
                    t = unoidl::detail::SourceProviderType(
811
0
                        unoidl::detail::SourceProviderType::TYPE_UNSIGNED_HYPER);
812
0
                } else if (typeNucleus == "float") {
813
0
                    t = unoidl::detail::SourceProviderType(
814
0
                        unoidl::detail::SourceProviderType::TYPE_FLOAT);
815
0
                } else if (typeNucleus == "double") {
816
0
                    t = unoidl::detail::SourceProviderType(
817
0
                        unoidl::detail::SourceProviderType::TYPE_DOUBLE);
818
0
                } else if (typeNucleus == "char") {
819
0
                    t = unoidl::detail::SourceProviderType(
820
0
                        unoidl::detail::SourceProviderType::TYPE_CHAR);
821
0
                } else if (typeNucleus == "string") {
822
0
                    t = unoidl::detail::SourceProviderType(
823
0
                        unoidl::detail::SourceProviderType::TYPE_STRING);
824
0
                } else if (typeNucleus == "type") {
825
0
                    t = unoidl::detail::SourceProviderType(
826
0
                        unoidl::detail::SourceProviderType::TYPE_TYPE);
827
0
                } else if (typeNucleus == "any") {
828
0
                    t = unoidl::detail::SourceProviderType(
829
0
                        unoidl::detail::SourceProviderType::TYPE_ANY);
830
0
                } else {
831
0
                    assert(typeNucleus.isEmpty());
832
0
                    assert(e != nullptr);
833
0
                    switch (e->kind) {
834
0
                    case unoidl::detail::SourceProviderEntity::KIND_LOCAL:
835
0
                        if (e->pad.is()) {
836
0
                            if (dynamic_cast<unoidl::detail::SourceProviderEnumTypeEntityPad *>(
837
0
                                    e->pad.get())
838
0
                                != nullptr)
839
0
                            {
840
0
                                t = unoidl::detail::SourceProviderType(
841
0
                                    unoidl::detail::SourceProviderType::TYPE_ENUM,
842
0
                                    n, e);
843
0
                            } else if (dynamic_cast<unoidl::detail::SourceProviderPlainStructTypeEntityPad *>(
844
0
                                           e->pad.get())
845
0
                                       != nullptr)
846
0
                            {
847
0
                                t = unoidl::detail::SourceProviderType(
848
0
                                    unoidl::detail::SourceProviderType::TYPE_PLAIN_STRUCT,
849
0
                                    n, e);
850
0
                            } else if (dynamic_cast<unoidl::detail::SourceProviderPolymorphicStructTypeTemplateEntityPad *>(
851
0
                                           e->pad.get())
852
0
                                       != nullptr)
853
0
                            {
854
0
                                error(
855
0
                                    location, yyscanner,
856
0
                                    ("bad type " + *name
857
0
                                     + (" based on recursive reference to"
858
0
                                        " polymorphic struct type template ")
859
0
                                     + n));
860
0
                                return FOUND_ERROR;
861
0
                            } else if (dynamic_cast<unoidl::detail::SourceProviderExceptionTypeEntityPad *>(
862
0
                                           e->pad.get())
863
0
                                       != nullptr)
864
0
                            {
865
0
                                t = unoidl::detail::SourceProviderType(
866
0
                                    unoidl::detail::SourceProviderType::TYPE_EXCEPTION,
867
0
                                    n, e);
868
0
                            } else if (dynamic_cast<unoidl::detail::SourceProviderInterfaceTypeEntityPad *>(
869
0
                                           e->pad.get())
870
0
                                       != nullptr)
871
0
                            {
872
0
                                t = unoidl::detail::SourceProviderType(
873
0
                                    unoidl::detail::SourceProviderType::TYPE_INTERFACE,
874
0
                                    n, e);
875
0
                            } else {
876
0
                                error(
877
0
                                    location, yyscanner,
878
0
                                    ("bad type " + *name
879
0
                                     + " based on non-type entity " + n));
880
0
                                return FOUND_ERROR;
881
0
                            }
882
0
                            break;
883
0
                        }
884
0
                        assert(e->entity.is());
885
0
                        [[fallthrough]];
886
0
                    case unoidl::detail::SourceProviderEntity::KIND_EXTERNAL:
887
0
                        switch (e->entity->getSort()) {
888
0
                        case unoidl::Entity::SORT_ENUM_TYPE:
889
0
                            t = unoidl::detail::SourceProviderType(
890
0
                                unoidl::detail::SourceProviderType::TYPE_ENUM,
891
0
                                n, e);
892
0
                            break;
893
0
                        case unoidl::Entity::SORT_PLAIN_STRUCT_TYPE:
894
0
                            t = unoidl::detail::SourceProviderType(
895
0
                                unoidl::detail::SourceProviderType::TYPE_PLAIN_STRUCT,
896
0
                                n, e);
897
0
                            break;
898
0
                        case unoidl::Entity::SORT_POLYMORPHIC_STRUCT_TYPE_TEMPLATE:
899
0
                            error(
900
0
                                location, yyscanner,
901
0
                                ("bad type " + *name
902
0
                                 + " based on polymorphic struct type template "
903
0
                                 + n + " without type arguments"));
904
0
                            return FOUND_ERROR;
905
0
                        case unoidl::Entity::SORT_EXCEPTION_TYPE:
906
0
                            t = unoidl::detail::SourceProviderType(
907
0
                                unoidl::detail::SourceProviderType::TYPE_EXCEPTION,
908
0
                                n, e);
909
0
                            break;
910
0
                        case unoidl::Entity::SORT_INTERFACE_TYPE:
911
0
                            t = unoidl::detail::SourceProviderType(
912
0
                                unoidl::detail::SourceProviderType::TYPE_INTERFACE,
913
0
                                n, e);
914
0
                            break;
915
0
                        default:
916
0
                            error(
917
0
                                location, yyscanner,
918
0
                                ("bad type " + *name
919
0
                                 + " based on non-type entity " + n));
920
0
                            return FOUND_ERROR;
921
0
                        }
922
0
                        break;
923
0
                    case unoidl::detail::SourceProviderEntity::KIND_INTERFACE_DECL:
924
0
                    case unoidl::detail::SourceProviderEntity::KIND_PUBLISHED_INTERFACE_DECL:
925
0
                        t = unoidl::detail::SourceProviderType(
926
0
                            unoidl::detail::SourceProviderType::TYPE_INTERFACE,
927
0
                            n, e);
928
0
                        break;
929
0
                    case unoidl::detail::SourceProviderEntity::KIND_MODULE:
930
0
                        assert(false && "this cannot happen");
931
0
                    }
932
0
                }
933
0
            } else {
934
0
                assert(typeNucleus.isEmpty());
935
0
                assert(e != nullptr);
936
0
                switch (e->kind) {
937
0
                case unoidl::detail::SourceProviderEntity::KIND_LOCAL:
938
0
                    if (e->pad.is()) {
939
0
                        error(
940
0
                            location, yyscanner,
941
0
                            ("bad type " + *name
942
0
                             + (" based on instantiated polymorphic struct type"
943
0
                                " based on ")
944
0
                             + n
945
0
                             + (" that is either not a polymorphic struct type"
946
0
                                " template or a recursive reference to a"
947
0
                                " polymorphic struct type template")));
948
0
                        return FOUND_ERROR;
949
0
                    }
950
0
                    assert(e->entity.is());
951
0
                    [[fallthrough]];
952
0
                case unoidl::detail::SourceProviderEntity::KIND_EXTERNAL:
953
0
                    if (e->entity->getSort()
954
0
                        == unoidl::Entity::SORT_POLYMORPHIC_STRUCT_TYPE_TEMPLATE)
955
0
                    {
956
0
                        if (args.size()
957
0
                            != (static_cast<
958
0
                                    unoidl::PolymorphicStructTypeTemplateEntity *>(
959
0
                                        e->entity.get())
960
0
                                ->getTypeParameters().size()))
961
0
                        {
962
0
                            error(
963
0
                                location, yyscanner,
964
0
                                ("bad type " + *name
965
0
                                 + (" based on instantiated polymorphic struct"
966
0
                                    " type with ")
967
0
                                 + OUString::number(args.size())
968
0
                                 + (" type arguments based on polymorphic"
969
0
                                    " struct type template ")
970
0
                                 + n + " with "
971
0
                                 + OUString::number(
972
0
                                     static_cast<
973
0
                                         unoidl::PolymorphicStructTypeTemplateEntity *>(
974
0
                                             e->entity.get())
975
0
                                     ->getTypeParameters().size())
976
0
                                 + " type parameters"));
977
0
                            return FOUND_ERROR;
978
0
                        }
979
0
                        t = unoidl::detail::SourceProviderType(n, e, std::move(args));
980
0
                        break;
981
0
                    }
982
0
                    [[fallthrough]];
983
0
                case unoidl::detail::SourceProviderEntity::KIND_INTERFACE_DECL:
984
0
                case unoidl::detail::SourceProviderEntity::KIND_PUBLISHED_INTERFACE_DECL:
985
0
                    error(
986
0
                        location, yyscanner,
987
0
                        ("bad type " + *name
988
0
                         + (" based on instantiated polymorphic struct type"
989
0
                            " based on ")
990
0
                         + n
991
0
                         + " that is not a polymorphic struct type template"));
992
0
                    return FOUND_ERROR;
993
0
                case unoidl::detail::SourceProviderEntity::KIND_MODULE:
994
0
                    assert(false && "this cannot happen");
995
0
                }
996
0
            }
997
0
            if (typedefedType != nullptr) {
998
0
                for (std::size_t i = 0; i != rank; ++i) {
999
0
                    t = unoidl::detail::SourceProviderType(&t);
1000
0
                }
1001
0
                *typedefedType = std::move(t);
1002
0
                typedefedType->typedefName = *name;
1003
0
            }
1004
0
            *entity = nullptr;
1005
0
            return FOUND_TYPE;
1006
0
        }
1007
0
        *entity = e;
1008
0
        return FOUND_ENTITY;
1009
0
    }
1010
0
}
1011
1012
1013
bool checkTypeArgument(
1014
    YYLTYPE location, yyscan_t yyscanner,
1015
    unoidl::detail::SourceProviderType const & type)
1016
0
{
1017
0
    switch (type.type) {
1018
0
    case unoidl::detail::SourceProviderType::TYPE_VOID:
1019
0
    case unoidl::detail::SourceProviderType::TYPE_UNSIGNED_SHORT:
1020
0
    case unoidl::detail::SourceProviderType::TYPE_UNSIGNED_LONG:
1021
0
    case unoidl::detail::SourceProviderType::TYPE_UNSIGNED_HYPER:
1022
0
    case unoidl::detail::SourceProviderType::TYPE_EXCEPTION:
1023
0
    case unoidl::detail::SourceProviderType::TYPE_PARAMETER: //TODO?
1024
0
        error(
1025
0
            location, yyscanner,
1026
0
            u"bad instantiated polymorphic struct type argument"_ustr);
1027
0
        return false;
1028
0
    case unoidl::detail::SourceProviderType::TYPE_SEQUENCE:
1029
0
        return checkTypeArgument(location, yyscanner, type.subtypes.front());
1030
0
    default:
1031
0
        return true;
1032
0
    }
1033
0
}
1034
1035
bool checkInstantiatedPolymorphicStructTypeArgument(
1036
    unoidl::detail::SourceProviderType const & type, OUString const & name)
1037
0
{
1038
0
    if (type.type
1039
0
        == unoidl::detail::SourceProviderType::TYPE_INSTANTIATED_POLYMORPHIC_STRUCT)
1040
0
    {
1041
0
        for (auto & i: type.subtypes) {
1042
0
            if (checkInstantiatedPolymorphicStructTypeArgument(i, name)
1043
0
                || i.getName() == name) // no need to worry about typedef
1044
0
            {
1045
0
                return true;
1046
0
            }
1047
0
        }
1048
0
    }
1049
0
    return false;
1050
0
}
1051
1052
0
std::vector<OUString> annotations(bool deprecated) {
1053
0
    std::vector<OUString> ann;
1054
0
    if (deprecated) {
1055
0
        ann.push_back(u"deprecated"_ustr);
1056
0
    }
1057
0
    return ann;
1058
0
}
1059
1060
}
1061
1062
1063
#line 1064 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
1064
1065
1066
#ifdef short
1067
# undef short
1068
#endif
1069
1070
/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
1071
   <limits.h> and (if available) <stdint.h> are included
1072
   so that the code can choose integer types of a good width.  */
1073
1074
#ifndef __PTRDIFF_MAX__
1075
# include <limits.h> /* INFRINGES ON USER NAME SPACE */
1076
# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
1077
#  include <stdint.h> /* INFRINGES ON USER NAME SPACE */
1078
#  define YY_STDINT_H
1079
# endif
1080
#endif
1081
1082
/* Narrow types that promote to a signed type and that can represent a
1083
   signed or unsigned integer of at least N bits.  In tables they can
1084
   save space and decrease cache pressure.  Promoting to a signed type
1085
   helps avoid bugs in integer arithmetic.  */
1086
1087
#ifdef __INT_LEAST8_MAX__
1088
typedef __INT_LEAST8_TYPE__ yytype_int8;
1089
#elif defined YY_STDINT_H
1090
typedef int_least8_t yytype_int8;
1091
#else
1092
typedef signed char yytype_int8;
1093
#endif
1094
1095
#ifdef __INT_LEAST16_MAX__
1096
typedef __INT_LEAST16_TYPE__ yytype_int16;
1097
#elif defined YY_STDINT_H
1098
typedef int_least16_t yytype_int16;
1099
#else
1100
typedef short yytype_int16;
1101
#endif
1102
1103
#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
1104
typedef __UINT_LEAST8_TYPE__ yytype_uint8;
1105
#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
1106
       && UINT_LEAST8_MAX <= INT_MAX)
1107
typedef uint_least8_t yytype_uint8;
1108
#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
1109
typedef unsigned char yytype_uint8;
1110
#else
1111
typedef short yytype_uint8;
1112
#endif
1113
1114
#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
1115
typedef __UINT_LEAST16_TYPE__ yytype_uint16;
1116
#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
1117
       && UINT_LEAST16_MAX <= INT_MAX)
1118
typedef uint_least16_t yytype_uint16;
1119
#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
1120
typedef unsigned short yytype_uint16;
1121
#else
1122
typedef int yytype_uint16;
1123
#endif
1124
1125
#ifndef YYPTRDIFF_T
1126
# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
1127
0
#  define YYPTRDIFF_T __PTRDIFF_TYPE__
1128
#  define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
1129
# elif defined PTRDIFF_MAX
1130
#  ifndef ptrdiff_t
1131
#   include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1132
#  endif
1133
#  define YYPTRDIFF_T ptrdiff_t
1134
#  define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
1135
# else
1136
#  define YYPTRDIFF_T long
1137
#  define YYPTRDIFF_MAXIMUM LONG_MAX
1138
# endif
1139
#endif
1140
1141
#ifndef YYSIZE_T
1142
# ifdef __SIZE_TYPE__
1143
#  define YYSIZE_T __SIZE_TYPE__
1144
# elif defined size_t
1145
#  define YYSIZE_T size_t
1146
# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
1147
#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1148
#  define YYSIZE_T size_t
1149
# else
1150
#  define YYSIZE_T unsigned
1151
# endif
1152
#endif
1153
1154
#define YYSIZE_MAXIMUM                                  \
1155
  YY_CAST (YYPTRDIFF_T,                                 \
1156
           (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1)  \
1157
            ? YYPTRDIFF_MAXIMUM                         \
1158
            : YY_CAST (YYSIZE_T, -1)))
1159
1160
#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
1161
1162
/* Stored state numbers (used for stacks). */
1163
typedef yytype_int16 yy_state_t;
1164
1165
/* State numbers in computations.  */
1166
typedef int yy_state_fast_t;
1167
1168
#ifndef YY_
1169
# if defined YYENABLE_NLS && YYENABLE_NLS
1170
#  if ENABLE_NLS
1171
#   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1172
#   define YY_(Msgid) dgettext ("bison-runtime", Msgid)
1173
#  endif
1174
# endif
1175
# ifndef YY_
1176
0
#  define YY_(Msgid) Msgid
1177
# endif
1178
#endif
1179
1180
#ifndef YY_ATTRIBUTE_PURE
1181
# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
1182
#  define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
1183
# else
1184
#  define YY_ATTRIBUTE_PURE
1185
# endif
1186
#endif
1187
1188
#ifndef YY_ATTRIBUTE_UNUSED
1189
# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
1190
#  define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
1191
# else
1192
#  define YY_ATTRIBUTE_UNUSED
1193
# endif
1194
#endif
1195
1196
/* Suppress unused-variable warnings by "using" E.  */
1197
#if ! defined lint || defined __GNUC__
1198
0
# define YYUSE(E) ((void) (E))
1199
#else
1200
# define YYUSE(E) /* empty */
1201
#endif
1202
1203
#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
1204
/* Suppress an incorrect diagnostic about yylval being uninitialized.  */
1205
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN                            \
1206
    _Pragma ("GCC diagnostic push")                                     \
1207
    _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")              \
1208
    _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
1209
# define YY_IGNORE_MAYBE_UNINITIALIZED_END      \
1210
    _Pragma ("GCC diagnostic pop")
1211
#else
1212
0
# define YY_INITIAL_VALUE(Value) Value
1213
#endif
1214
#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1215
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1216
# define YY_IGNORE_MAYBE_UNINITIALIZED_END
1217
#endif
1218
#ifndef YY_INITIAL_VALUE
1219
# define YY_INITIAL_VALUE(Value) /* Nothing. */
1220
#endif
1221
1222
#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
1223
# define YY_IGNORE_USELESS_CAST_BEGIN                          \
1224
    _Pragma ("GCC diagnostic push")                            \
1225
    _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
1226
# define YY_IGNORE_USELESS_CAST_END            \
1227
    _Pragma ("GCC diagnostic pop")
1228
#endif
1229
#ifndef YY_IGNORE_USELESS_CAST_BEGIN
1230
# define YY_IGNORE_USELESS_CAST_BEGIN
1231
# define YY_IGNORE_USELESS_CAST_END
1232
#endif
1233
1234
1235
0
#define YY_ASSERT(E) ((void) (0 && (E)))
1236
1237
#if ! defined yyoverflow || YYERROR_VERBOSE
1238
1239
/* The parser invokes alloca or malloc; define the necessary symbols.  */
1240
1241
# ifdef YYSTACK_USE_ALLOCA
1242
#  if YYSTACK_USE_ALLOCA
1243
#   ifdef __GNUC__
1244
#    define YYSTACK_ALLOC __builtin_alloca
1245
#   elif defined __BUILTIN_VA_ARG_INCR
1246
#    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
1247
#   elif defined _AIX
1248
#    define YYSTACK_ALLOC __alloca
1249
#   elif defined _MSC_VER
1250
#    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
1251
#    define alloca _alloca
1252
#   else
1253
#    define YYSTACK_ALLOC alloca
1254
#    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
1255
#     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1256
      /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
1257
#     ifndef EXIT_SUCCESS
1258
#      define EXIT_SUCCESS 0
1259
#     endif
1260
#    endif
1261
#   endif
1262
#  endif
1263
# endif
1264
1265
# ifdef YYSTACK_ALLOC
1266
   /* Pacify GCC's 'empty if-body' warning.  */
1267
#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
1268
#  ifndef YYSTACK_ALLOC_MAXIMUM
1269
    /* The OS might guarantee only one guard page at the bottom of the stack,
1270
       and a page size can be as small as 4096 bytes.  So we cannot safely
1271
       invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
1272
       to allow for a few compiler-allocated temporary stack slots.  */
1273
#   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
1274
#  endif
1275
# else
1276
#  define YYSTACK_ALLOC YYMALLOC
1277
0
#  define YYSTACK_FREE YYFREE
1278
#  ifndef YYSTACK_ALLOC_MAXIMUM
1279
#   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
1280
#  endif
1281
#  if (defined __cplusplus && ! defined EXIT_SUCCESS \
1282
       && ! ((defined YYMALLOC || defined malloc) \
1283
             && (defined YYFREE || defined free)))
1284
#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1285
#   ifndef EXIT_SUCCESS
1286
#    define EXIT_SUCCESS 0
1287
#   endif
1288
#  endif
1289
#  ifndef YYMALLOC
1290
#   define YYMALLOC malloc
1291
#   if ! defined malloc && ! defined EXIT_SUCCESS
1292
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1293
#   endif
1294
#  endif
1295
#  ifndef YYFREE
1296
0
#   define YYFREE free
1297
#   if ! defined free && ! defined EXIT_SUCCESS
1298
void free (void *); /* INFRINGES ON USER NAME SPACE */
1299
#   endif
1300
#  endif
1301
# endif
1302
#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
1303
1304
1305
#if (! defined yyoverflow \
1306
     && (! defined __cplusplus \
1307
         || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
1308
             && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1309
1310
/* A type that is properly aligned for any stack member.  */
1311
union yyalloc
1312
{
1313
  yy_state_t yyss_alloc;
1314
  YYSTYPE yyvs_alloc;
1315
  YYLTYPE yyls_alloc;
1316
};
1317
1318
/* The size of the maximum gap between one aligned stack and the next.  */
1319
# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
1320
1321
/* The size of an array large to enough to hold all stacks, each with
1322
   N elements.  */
1323
# define YYSTACK_BYTES(N) \
1324
     ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE) \
1325
             + YYSIZEOF (YYLTYPE)) \
1326
      + 2 * YYSTACK_GAP_MAXIMUM)
1327
1328
# define YYCOPY_NEEDED 1
1329
1330
/* Relocate STACK from its old location to the new one.  The
1331
   local variables YYSIZE and YYSTACKSIZE give the old and new number of
1332
   elements in the stack, and YYPTR gives the new location of the
1333
   stack.  Advance YYPTR to a properly aligned location for the next
1334
   stack.  */
1335
# define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
1336
    do                                                                  \
1337
      {                                                                 \
1338
        YYPTRDIFF_T yynewbytes;                                         \
1339
        YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
1340
        Stack = &yyptr->Stack_alloc;                                    \
1341
        yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
1342
        yyptr += yynewbytes / YYSIZEOF (*yyptr);                        \
1343
      }                                                                 \
1344
    while (0)
1345
1346
#endif
1347
1348
#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
1349
/* Copy COUNT objects from SRC to DST.  The source and destination do
1350
   not overlap.  */
1351
# ifndef YYCOPY
1352
#  if defined __GNUC__ && 1 < __GNUC__
1353
#   define YYCOPY(Dst, Src, Count) \
1354
      __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
1355
#  else
1356
#   define YYCOPY(Dst, Src, Count)              \
1357
      do                                        \
1358
        {                                       \
1359
          YYPTRDIFF_T yyi;                      \
1360
          for (yyi = 0; yyi < (Count); yyi++)   \
1361
            (Dst)[yyi] = (Src)[yyi];            \
1362
        }                                       \
1363
      while (0)
1364
#  endif
1365
# endif
1366
#endif /* !YYCOPY_NEEDED */
1367
1368
/* YYFINAL -- State number of the termination state.  */
1369
0
#define YYFINAL  2
1370
/* YYLAST -- Last index in YYTABLE.  */
1371
0
#define YYLAST   309
1372
1373
/* YYNTOKENS -- Number of terminals.  */
1374
0
#define YYNTOKENS  77
1375
/* YYNNTS -- Number of nonterminals.  */
1376
#define YYNNTS  83
1377
/* YYNRULES -- Number of rules.  */
1378
#define YYNRULES  178
1379
/* YYNSTATES -- Number of states.  */
1380
#define YYNSTATES  313
1381
1382
0
#define YYUNDEFTOK  2
1383
0
#define YYMAXUTOK   310
1384
1385
1386
/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
1387
   as returned by yylex, with out-of-bounds checking.  */
1388
#define YYTRANSLATE(YYX)                                                \
1389
0
  (0 <= (YYX) && (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1390
1391
/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
1392
   as returned by yylex.  */
1393
static const yytype_int8 yytranslate[] =
1394
{
1395
       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1396
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1397
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1398
       2,     2,     2,     2,     2,     2,     2,    75,    70,     2,
1399
      63,    64,    73,    71,    59,    72,     2,    74,     2,     2,
1400
       2,     2,     2,     2,     2,     2,     2,     2,    67,    58,
1401
      61,    60,    62,     2,     2,     2,     2,     2,     2,     2,
1402
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1403
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1404
       2,    65,     2,    66,    69,     2,     2,     2,     2,     2,
1405
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1406
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1407
       2,     2,     2,    56,    68,    57,    76,     2,     2,     2,
1408
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1409
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1410
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1411
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1412
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1413
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1414
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1415
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1416
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1417
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1418
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1419
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1420
       2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
1421
       5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
1422
      15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
1423
      25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
1424
      35,    36,    37,    38,    39,    40,    41,    42,    43,    44,
1425
      45,    46,    47,    48,    49,    50,    51,    52,    53,    54,
1426
      55
1427
};
1428
1429
#if YYDEBUG
1430
  /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
1431
static const yytype_int16 yyrline[] =
1432
{
1433
       0,   951,   951,   952,   956,   957,   958,   959,   960,   961,
1434
     962,   963,   964,   965,   966,   967,   968,   973,   972,   995,
1435
     994,  1025,  1026,  1027,  1031,  1053,  1095,  1094,  1159,  1158,
1436
    1192,  1211,  1225,  1224,  1286,  1287,  1291,  1495,  1494,  1624,
1437
    1625,  1629,  1630,  1631,  1635,  1701,  1700,  1750,  1751,  1755,
1438
    1764,  1768,  1779,  1803,  1802,  1842,  1843,  1847,  1848,  1852,
1439
    1890,  1891,  1893,  1898,  1969,  1968,  2000,  2001,  2005,  2287,
1440
    2286,  2379,  2380,  2384,  2385,  2390,  2389,  2453,  2454,  2458,
1441
    2459,  2463,  2540,  2541,  2545,  2544,  2579,  2580,  2584,  2585,
1442
    2586,  2590,  2648,  2725,  2815,  2881,  2931,  2932,  2935,  2939,
1443
    2940,  2943,  2947,  2987,  3020,  3069,  3070,  3074,  3075,  3078,
1444
    3082,  3090,  3094,  3095,  3096,  3097,  3098,  3099,  3100,  3101,
1445
    3102,  3103,  3104,  3107,  3111,  3129,  3133,  3151,  3155,  3173,
1446
    3177,  3225,  3267,  3271,  3292,  3313,  3317,  3338,  3371,  3397,
1447
    3401,  3409,  3443,  3458,  3462,  3463,  3464,  3465,  3466,  3467,
1448
    3604,  3615,  3628,  3633,  3638,  3643,  3648,  3653,  3658,  3663,
1449
    3668,  3673,  3678,  3683,  3688,  3693,  3698,  3703,  3718,  3890,
1450
    3964,  3965,  3966,  3970,  3971,  3972,  3973,  3977,  3978
1451
};
1452
#endif
1453
1454
#if YYDEBUG || YYERROR_VERBOSE || 0
1455
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1456
   First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
1457
static const char *const yytname[] =
1458
{
1459
  "$end", "error", "$undefined", "TOK_ELLIPSIS", "TOK_COLONS",
1460
  "TOK_LEFTSHIFT", "TOK_RIGHTSHIFT", "TOK_FALSE", "TOK_TRUE", "TOK_ANY",
1461
  "TOK_ATTRIBUTE", "TOK_BOOLEAN", "TOK_BOUND", "TOK_BYTE", "TOK_CHAR",
1462
  "TOK_CONST", "TOK_CONSTANTS", "TOK_CONSTRAINED", "TOK_DOUBLE",
1463
  "TOK_ENUM", "TOK_EXCEPTION", "TOK_FLOAT", "TOK_GET", "TOK_HYPER",
1464
  "TOK_IN", "TOK_INOUT", "TOK_INTERFACE", "TOK_LONG", "TOK_MAYBEAMBIGUOUS",
1465
  "TOK_MAYBEDEFAULT", "TOK_MAYBEVOID", "TOK_MODULE", "TOK_OPTIONAL",
1466
  "TOK_OUT", "TOK_PROPERTY", "TOK_PUBLISHED", "TOK_RAISES", "TOK_READONLY",
1467
  "TOK_REMOVABLE", "TOK_SEQUENCE", "TOK_SERVICE", "TOK_SET", "TOK_SHORT",
1468
  "TOK_SINGLETON", "TOK_STRING", "TOK_STRUCT", "TOK_TRANSIENT", "TOK_TYPE",
1469
  "TOK_TYPEDEF", "TOK_UNSIGNED", "TOK_VOID", "TOK_IDENTIFIER",
1470
  "TOK_INTEGER", "TOK_FLOATING", "TOK_DEPRECATED", "TOK_ERROR", "'{'",
1471
  "'}'", "';'", "','", "'='", "'<'", "'>'", "'('", "')'", "'['", "']'",
1472
  "':'", "'|'", "'^'", "'&'", "'+'", "'-'", "'*'", "'/'", "'%'", "'~'",
1473
  "$accept", "definitions", "definition", "moduleDecl", "$@1", "enumDefn",
1474
  "$@2", "enumMembers", "enumMember", "plainStructDefn", "$@3",
1475
  "polymorphicStructTemplateDefn", "$@4", "typeParameters",
1476
  "exceptionDefn", "$@5", "structMembers", "structMember", "interfaceDefn",
1477
  "$@6", "interfaceMembers", "interfaceMember", "interfaceBase",
1478
  "interfaceAttribute", "$@7", "attributeAccessDecls_opt",
1479
  "attributeAccessDecls", "attributeAccessDecl", "interfaceMethod", "$@8",
1480
  "methodParams_opt", "methodParams", "methodParam", "direction",
1481
  "typedefDefn", "constantGroupDefn", "$@9", "constants", "constant",
1482
  "singleInterfaceBasedServiceDefn", "$@10", "ctors_opt", "ctors", "ctor",
1483
  "$@11", "ctorParams_opt", "ctorParams", "ctorParam", "ellipsis_opt",
1484
  "accumulationBasedServiceDefn", "$@12", "serviceMembers",
1485
  "serviceMember", "serviceBase", "serviceInterfaceBase",
1486
  "serviceProperty", "interfaceBasedSingletonDefn",
1487
  "serviceBasedSingletonDefn", "singleInheritance_opt",
1488
  "singleInheritance", "exceptionSpec_opt", "exceptionSpec", "exceptions",
1489
  "interfaceDecl", "published_opt", "flagSection_opt", "flagSection",
1490
  "flags", "flag", "expr", "orExpr", "xorExpr", "andExpr", "shiftExpr",
1491
  "addExpr", "multExpr", "unaryExpr", "primaryExpr", "typeArguments",
1492
  "type", "name", "identifier", "deprecated_opt", YY_NULLPTR
1493
};
1494
#endif
1495
1496
# ifdef YYPRINT
1497
/* YYTOKNUM[NUM] -- (External) token number corresponding to the
1498
   (internal) symbol number NUM (which must be that of a token).  */
1499
static const yytype_int16 yytoknum[] =
1500
{
1501
       0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
1502
     265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
1503
     275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
1504
     285,   286,   287,   288,   289,   290,   291,   292,   293,   294,
1505
     295,   296,   297,   298,   299,   300,   301,   302,   303,   304,
1506
     305,   306,   307,   308,   309,   310,   123,   125,    59,    44,
1507
      61,    60,    62,    40,    41,    91,    93,    58,   124,    94,
1508
      38,    43,    45,    42,    47,    37,   126
1509
};
1510
# endif
1511
1512
0
#define YYPACT_NINF (-181)
1513
1514
#define yypact_value_is_default(Yyn) \
1515
0
  ((Yyn) == YYPACT_NINF)
1516
1517
#define YYTABLE_NINF (-22)
1518
1519
#define yytable_value_is_error(Yyn) \
1520
0
  0
1521
1522
  /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1523
     STATE-NUM.  */
1524
static const yytype_int16 yypact[] =
1525
{
1526
    -181,     8,  -181,    63,  -181,  -181,  -181,  -181,  -181,  -181,
1527
    -181,  -181,  -181,  -181,  -181,  -181,  -181,  -181,  -181,    -1,
1528
    -181,  -181,  -181,  -181,  -181,  -181,   208,    62,    63,    63,
1529
      63,    63,    63,    63,    63,   191,  -181,  -181,  -181,    53,
1530
     -47,    53,   -18,   -15,    63,  -181,  -181,  -181,  -181,  -181,
1531
    -181,  -181,  -181,    78,  -181,  -181,  -181,    61,  -181,    63,
1532
       0,  -181,   -12,    92,   108,    59,  -181,  -181,  -181,  -181,
1533
     147,  -181,    82,   114,  -181,  -181,  -181,   191,  -181,  -181,
1534
    -181,   157,    63,   191,   159,  -181,    96,   218,   169,   173,
1535
    -181,   175,    59,  -181,    63,   180,   177,  -181,  -181,   -45,
1536
    -181,  -181,   -39,   149,  -181,    63,  -181,  -181,    67,  -181,
1537
     179,     9,    72,  -181,  -181,  -181,   191,  -181,   185,  -181,
1538
     229,   187,   192,   189,    86,    87,   194,  -181,  -181,  -181,
1539
    -181,   182,    95,  -181,   197,    63,   199,   129,  -181,  -181,
1540
     191,  -181,  -181,     2,   200,  -181,   191,   202,  -181,  -181,
1541
    -181,  -181,   124,  -181,   150,    -4,   191,  -181,  -181,    63,
1542
     203,  -181,  -181,   204,    63,  -181,  -181,  -181,  -181,     2,
1543
      64,    64,    64,  -181,   196,   188,   195,    42,   -14,    22,
1544
    -181,  -181,   218,  -181,    63,  -181,   240,   191,    63,  -181,
1545
    -181,  -181,  -181,  -181,  -181,  -181,  -181,  -181,  -181,  -181,
1546
      23,  -181,    59,    59,    63,  -181,  -181,   136,  -181,   207,
1547
     205,  -181,  -181,  -181,     2,     2,     2,     2,     2,     2,
1548
       2,     2,     2,     2,   210,    59,    63,  -181,   150,  -181,
1549
      17,    19,   212,   209,   213,     2,  -181,   188,   195,    42,
1550
     -14,   -14,    22,    22,  -181,  -181,  -181,  -181,    29,  -181,
1551
     211,  -181,  -181,  -181,  -181,   214,  -181,   215,  -181,   219,
1552
     216,    68,   220,   217,  -181,  -181,  -181,   222,    68,   221,
1553
     223,  -181,  -181,  -181,  -181,   224,   242,   214,    -6,  -181,
1554
     225,   242,   216,   191,   226,   228,  -181,  -181,   242,   242,
1555
    -181,  -181,   191,   230,  -181,   280,    59,  -181,   234,   235,
1556
      63,  -181,  -181,    63,    66,   218,  -181,  -181,  -181,  -181,
1557
      59,  -181,   218
1558
};
1559
1560
  /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
1561
     Performed when YYTABLE does not specify something else to do.  Zero
1562
     means the default is an error.  */
1563
static const yytype_uint8 yydefact[] =
1564
{
1565
       3,   178,     1,     0,   177,     2,     4,     5,     6,     7,
1566
       8,     9,    10,    11,    12,    13,    14,    15,    16,   106,
1567
     174,   175,   176,   173,    17,   105,     0,     0,     0,     0,
1568
       0,     0,     0,     0,     0,     0,     3,    64,    19,    97,
1569
      97,    84,     0,    97,     0,   166,   153,   154,   163,   162,
1570
     161,   159,   157,     0,   155,   164,   165,     0,   152,     0,
1571
     168,   172,   178,     0,     0,     0,    32,    96,   104,    37,
1572
       0,    69,     0,     0,    28,    26,   171,     0,   160,   158,
1573
     156,     0,     0,     0,     0,    67,   178,    98,     0,     0,
1574
      87,    72,     0,    94,     0,     0,     0,    63,   170,     0,
1575
     151,    18,   178,     0,    23,     0,    35,    40,   178,    74,
1576
       0,     0,     0,    31,    35,   167,     0,   169,     0,    66,
1577
       0,     0,   178,    24,   178,   178,     0,    86,    88,    89,
1578
      90,   108,   178,    70,     0,     0,     0,   178,   150,    65,
1579
       0,    20,    22,     0,     0,    34,     0,     0,    39,    41,
1580
      42,    43,   108,    85,     0,     0,   107,    71,    73,     0,
1581
       0,    30,    35,     0,     0,   145,   146,   147,   148,     0,
1582
       0,     0,     0,    25,   123,   125,   127,   129,   132,   135,
1583
     139,   143,   149,    33,     0,    38,     0,   107,     0,   112,
1584
     113,   114,   115,   116,   117,   118,   119,   120,   121,   122,
1585
       0,   111,     0,     0,     0,    75,    95,   178,    27,     0,
1586
       0,   140,   141,   142,     0,     0,     0,     0,     0,     0,
1587
       0,     0,     0,     0,     0,     0,     0,    53,     0,   109,
1588
       0,     0,     0,     0,     0,     0,   144,   124,   126,   128,
1589
     130,   131,   133,   134,   136,   137,   138,    36,     0,    45,
1590
       0,   110,    92,    91,    93,    78,    29,     0,    44,    48,
1591
      56,     0,     0,    77,    80,    68,    50,     0,     0,     0,
1592
      55,    58,    60,    62,    61,     0,   100,     0,     0,    46,
1593
       0,   100,     0,     0,     0,     0,    99,    79,     0,     0,
1594
      47,    49,     0,     0,    57,    83,     0,    76,     0,     0,
1595
       0,    54,    82,     0,     0,   103,    51,    52,    59,    81,
1596
       0,   101,   102
1597
};
1598
1599
  /* YYPGOTO[NTERM-NUM].  */
1600
static const yytype_int16 yypgoto[] =
1601
{
1602
    -181,   251,  -181,  -181,  -181,  -181,  -181,  -181,   172,  -181,
1603
    -181,  -181,  -181,  -181,  -181,  -181,  -102,  -181,  -181,  -181,
1604
    -181,  -181,  -181,  -181,  -181,  -181,  -181,  -181,  -181,  -181,
1605
    -181,  -181,    13,    28,  -181,  -181,  -181,  -181,  -181,  -181,
1606
    -181,  -181,  -181,  -181,  -181,  -181,  -181,    21,  -181,  -181,
1607
    -181,  -181,  -181,  -181,  -181,  -181,  -181,  -181,   151,   116,
1608
      18,  -180,  -181,  -181,  -181,   152,   153,  -181,    73,  -166,
1609
    -181,    88,    91,    93,   -41,    -9,   -24,    49,  -181,   -76,
1610
     -33,    -3,     4
1611
};
1612
1613
  /* YYDEFGOTO[NTERM-NUM].  */
1614
static const yytype_int16 yydefgoto[] =
1615
{
1616
      -1,     1,     5,     6,    27,     7,    64,   103,   104,     8,
1617
      95,     9,    94,   112,    10,    88,   124,   145,    11,    89,
1618
     125,   148,   149,   150,   259,   267,   278,   291,   151,   250,
1619
     269,   270,   271,   275,    12,    13,    63,   102,   119,    14,
1620
      91,   110,   132,   158,   233,   262,   263,   264,   303,    15,
1621
      70,   108,   127,   128,   129,   130,    16,    17,    66,    67,
1622
     285,   286,   304,    18,    26,   155,   156,   200,   201,   173,
1623
     174,   175,   176,   177,   178,   179,   180,   181,    99,    59,
1624
     182,    61,   146
1625
};
1626
1627
  /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
1628
     positive, shift that token.  If negative, reduce the rule whose
1629
     number is the opposite.  If YYTABLE_NINF, syntax error.  */
1630
static const yytype_int16 yytable[] =
1631
{
1632
      24,    96,    60,   210,    82,    19,    44,   100,     2,   165,
1633
     166,    68,   137,    82,   116,     4,   288,   117,   118,     3,
1634
      65,    82,   202,    82,    20,    37,    38,    39,    40,    41,
1635
      42,    43,    87,    82,    25,   289,   203,    21,    72,     3,
1636
     138,    76,     4,    22,    60,    84,    74,   217,   218,    65,
1637
      60,   290,    65,    23,   167,   168,    81,   219,   220,   111,
1638
     207,    83,     4,    44,   164,   169,    19,   134,    44,   257,
1639
     184,   165,   166,   170,   171,   252,   188,   253,   172,    98,
1640
     204,    20,   228,    60,    78,    20,    20,   258,    79,   229,
1641
     105,   113,   272,   273,    21,   221,   222,   223,    21,    21,
1642
      22,   274,   123,    80,    22,    22,   120,    60,   298,   299,
1643
      23,   226,   131,    60,    23,    23,   167,   168,    36,    60,
1644
      65,     4,    92,    60,   126,   310,   105,   169,    44,   152,
1645
     311,   135,   161,    45,   136,    46,   159,    47,    48,    77,
1646
       4,     4,    49,   144,   147,    50,    20,    51,    85,     4,
1647
       4,    52,   157,   -21,    60,   -21,   205,    71,    73,    21,
1648
     189,   209,   190,    53,    86,    22,    54,   191,    55,   230,
1649
     231,    56,    93,    57,    58,    23,   240,   241,   192,   193,
1650
     194,   224,   195,     4,   196,   227,   163,   197,   198,   154,
1651
       4,    69,   248,   234,    75,    44,   199,   244,   245,   246,
1652
      45,   232,    46,    90,    47,    48,   121,   295,   122,    49,
1653
     242,   243,    50,    20,    51,    97,   300,   101,    52,   211,
1654
     212,   213,    82,   249,    28,   106,    21,    29,    30,   107,
1655
      53,   109,    22,    54,    31,    55,   114,   133,    56,   115,
1656
      57,    58,    23,   139,   140,   141,     4,   154,    32,   143,
1657
      60,    33,   153,    34,   160,   162,    35,   215,   183,    60,
1658
     185,   206,   208,   305,   214,   216,   225,   235,   247,   236,
1659
     254,   256,   255,   265,   260,   266,   277,   312,   284,   261,
1660
     279,   268,   282,   302,   276,   281,   297,    62,   301,   296,
1661
     283,   292,   306,   307,   142,   294,   280,   308,   287,   293,
1662
     309,   251,   237,     0,   186,   187,   238,     0,     0,   239
1663
};
1664
1665
static const yytype_int16 yycheck[] =
1666
{
1667
       3,    77,    35,   169,     4,     1,     4,    83,     0,     7,
1668
       8,    58,   114,     4,    59,    54,    22,    62,    57,    31,
1669
      67,     4,    26,     4,    22,    28,    29,    30,    31,    32,
1670
      33,    34,    65,     4,    35,    41,    40,    35,    56,    31,
1671
     116,    44,    54,    41,    77,    57,    61,     5,     6,    67,
1672
      83,    57,    67,    51,    52,    53,    59,    71,    72,    92,
1673
     162,    61,    54,     4,   140,    63,    62,    58,     4,   235,
1674
     146,     7,     8,    71,    72,    58,   152,    58,    76,    82,
1675
     156,    22,    59,   116,    23,    22,    22,    58,    27,    66,
1676
      86,    94,    24,    25,    35,    73,    74,    75,    35,    35,
1677
      41,    33,   105,    42,    41,    41,   102,   140,   288,   289,
1678
      51,   187,   108,   146,    51,    51,    52,    53,    56,   152,
1679
      67,    54,    40,   156,    57,    59,   122,    63,     4,   125,
1680
      64,    59,   135,     9,    62,    11,   132,    13,    14,    61,
1681
      54,    54,    18,    57,    57,    21,    22,    23,    56,    54,
1682
      54,    27,    57,    57,   187,    59,   159,    41,    42,    35,
1683
      10,   164,    12,    39,    56,    41,    42,    17,    44,   202,
1684
     203,    47,    58,    49,    50,    51,   217,   218,    28,    29,
1685
      30,   184,    32,    54,    34,   188,    57,    37,    38,    65,
1686
      54,    40,   225,    57,    43,     4,    46,   221,   222,   223,
1687
       9,   204,    11,    56,    13,    14,    57,   283,    59,    18,
1688
     219,   220,    21,    22,    23,    58,   292,    58,    27,   170,
1689
     171,   172,     4,   226,    16,    56,    35,    19,    20,    56,
1690
      39,    56,    41,    42,    26,    44,    56,    58,    47,    62,
1691
      49,    50,    51,    58,    15,    58,    54,    65,    40,    60,
1692
     283,    43,    58,    45,    57,    56,    48,    69,    58,   292,
1693
      58,    58,    58,   296,    68,    70,    26,    60,    58,    64,
1694
      58,    58,    63,    58,    63,    56,    59,   310,    36,    65,
1695
      58,    65,    59,     3,    64,    64,    58,    36,    58,    63,
1696
      66,    66,    58,    58,   122,   282,   268,   300,   277,   281,
1697
     303,   228,   214,    -1,   152,   152,   215,    -1,    -1,   216
1698
};
1699
1700
  /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
1701
     symbol of state STATE-NUM.  */
1702
static const yytype_uint8 yystos[] =
1703
{
1704
       0,    78,     0,    31,    54,    79,    80,    82,    86,    88,
1705
      91,    95,   111,   112,   116,   126,   133,   134,   140,   159,
1706
      22,    35,    41,    51,   158,    35,   141,    81,    16,    19,
1707
      20,    26,    40,    43,    45,    48,    56,   158,   158,   158,
1708
     158,   158,   158,   158,     4,     9,    11,    13,    14,    18,
1709
      21,    23,    27,    39,    42,    44,    47,    49,    50,   156,
1710
     157,   158,    78,   113,    83,    67,   135,   136,    58,   135,
1711
     127,   136,    56,   136,    61,   135,   158,    61,    23,    27,
1712
      42,   158,     4,    61,    57,    56,    56,   157,    92,    96,
1713
      56,   117,    40,    58,    89,    87,   156,    58,   158,   155,
1714
     156,    58,   114,    84,    85,   159,    56,    56,   128,    56,
1715
     118,   157,    90,   158,    56,    62,    59,    62,    57,   115,
1716
     159,    57,    59,   158,    93,    97,    57,   129,   130,   131,
1717
     132,   159,   119,    58,    58,    59,    62,    93,   156,    58,
1718
      15,    58,    85,    60,    57,    94,   159,    57,    98,    99,
1719
     100,   105,   159,    58,    65,   142,   143,    57,   120,   159,
1720
      57,   158,    56,    57,   156,     7,     8,    52,    53,    63,
1721
      71,    72,    76,   146,   147,   148,   149,   150,   151,   152,
1722
     153,   154,   157,    58,   156,    58,   142,   143,   156,    10,
1723
      12,    17,    28,    29,    30,    32,    34,    37,    38,    46,
1724
     144,   145,    26,    40,   156,   158,    58,    93,    58,   158,
1725
     146,   154,   154,   154,    68,    69,    70,     5,     6,    71,
1726
      72,    73,    74,    75,   158,    26,   156,   158,    59,    66,
1727
     157,   157,   158,   121,    57,    60,    64,   148,   149,   150,
1728
     151,   151,   152,   152,   153,   153,   153,    58,   157,   158,
1729
     106,   145,    58,    58,    58,    63,    58,   146,    58,   101,
1730
      63,    65,   122,   123,   124,    58,    56,   102,    65,   107,
1731
     108,   109,    24,    25,    33,   110,    64,    59,   103,    58,
1732
     110,    64,    59,    66,    36,   137,   138,   124,    22,    41,
1733
      57,   104,    66,   137,   109,   156,    63,    58,   138,   138,
1734
     156,    58,     3,   125,   139,   157,    58,    58,   158,   158,
1735
      59,    64,   157
1736
};
1737
1738
  /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
1739
static const yytype_uint8 yyr1[] =
1740
{
1741
       0,    77,    78,    78,    79,    79,    79,    79,    79,    79,
1742
      79,    79,    79,    79,    79,    79,    79,    81,    80,    83,
1743
      82,    84,    84,    84,    85,    85,    87,    86,    89,    88,
1744
      90,    90,    92,    91,    93,    93,    94,    96,    95,    97,
1745
      97,    98,    98,    98,    99,   101,   100,   102,   102,   103,
1746
     103,   104,   104,   106,   105,   107,   107,   108,   108,   109,
1747
     110,   110,   110,   111,   113,   112,   114,   114,   115,   117,
1748
     116,   118,   118,   119,   119,   121,   120,   122,   122,   123,
1749
     123,   124,   125,   125,   127,   126,   128,   128,   129,   129,
1750
     129,   130,   131,   132,   133,   134,   135,   135,   136,   137,
1751
     137,   138,   139,   139,   140,   141,   141,   142,   142,   143,
1752
     144,   144,   145,   145,   145,   145,   145,   145,   145,   145,
1753
     145,   145,   145,   146,   147,   147,   148,   148,   149,   149,
1754
     150,   150,   150,   151,   151,   151,   152,   152,   152,   152,
1755
     153,   153,   153,   153,   154,   154,   154,   154,   154,   154,
1756
     155,   155,   156,   156,   156,   156,   156,   156,   156,   156,
1757
     156,   156,   156,   156,   156,   156,   156,   156,   156,   156,
1758
     157,   157,   157,   158,   158,   158,   158,   159,   159
1759
};
1760
1761
  /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
1762
static const yytype_int8 yyr2[] =
1763
{
1764
       0,     2,     2,     0,     1,     1,     1,     1,     1,     1,
1765
       1,     1,     1,     1,     1,     1,     1,     0,     7,     0,
1766
       9,     0,     3,     1,     2,     4,     0,    10,     0,    12,
1767
       3,     1,     0,    10,     2,     0,     4,     0,    10,     2,
1768
       0,     1,     1,     1,     5,     0,     7,     3,     0,     2,
1769
       0,     3,     3,     0,     9,     1,     0,     3,     1,     5,
1770
       1,     1,     1,     6,     0,     9,     2,     0,     7,     0,
1771
       8,     3,     0,     2,     0,     0,     8,     1,     0,     3,
1772
       1,     6,     1,     0,     0,     9,     2,     0,     1,     1,
1773
       1,     5,     5,     5,     6,    10,     1,     0,     2,     1,
1774
       0,     4,     3,     1,     5,     1,     0,     1,     0,     3,
1775
       3,     1,     1,     1,     1,     1,     1,     1,     1,     1,
1776
       1,     1,     1,     1,     3,     1,     3,     1,     3,     1,
1777
       3,     3,     1,     3,     3,     1,     3,     3,     3,     1,
1778
       2,     2,     2,     1,     3,     1,     1,     1,     1,     1,
1779
       3,     1,     1,     1,     1,     1,     2,     1,     2,     1,
1780
       2,     1,     1,     1,     1,     1,     1,     4,     1,     4,
1781
       3,     2,     1,     1,     1,     1,     1,     1,     0
1782
};
1783
1784
1785
#define yyerrok         (yyerrstatus = 0)
1786
#define yyclearin       (yychar = YYEMPTY)
1787
0
#define YYEMPTY         (-2)
1788
0
#define YYEOF           0
1789
1790
0
#define YYACCEPT        goto yyacceptlab
1791
0
#define YYABORT         goto yyabortlab
1792
0
#define YYERROR         goto yyerrorlab
1793
1794
1795
#define YYRECOVERING()  (!!yyerrstatus)
1796
1797
#define YYBACKUP(Token, Value)                                    \
1798
  do                                                              \
1799
    if (yychar == YYEMPTY)                                        \
1800
      {                                                           \
1801
        yychar = (Token);                                         \
1802
        yylval = (Value);                                         \
1803
        YYPOPSTACK (yylen);                                       \
1804
        yystate = *yyssp;                                         \
1805
        goto yybackup;                                            \
1806
      }                                                           \
1807
    else                                                          \
1808
      {                                                           \
1809
        yyerror (&yylloc, yyscanner, YY_("syntax error: cannot back up")); \
1810
        YYERROR;                                                  \
1811
      }                                                           \
1812
  while (0)
1813
1814
/* Error token number */
1815
0
#define YYTERROR        1
1816
#define YYERRCODE       256
1817
1818
1819
/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
1820
   If N is 0, then set CURRENT to the empty location which ends
1821
   the previous symbol: RHS[0] (always defined).  */
1822
1823
#ifndef YYLLOC_DEFAULT
1824
# define YYLLOC_DEFAULT(Current, Rhs, N)                                \
1825
    do                                                                  \
1826
      if (N)                                                            \
1827
        {                                                               \
1828
          (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;        \
1829
          (Current).first_column = YYRHSLOC (Rhs, 1).first_column;      \
1830
          (Current).last_line    = YYRHSLOC (Rhs, N).last_line;         \
1831
          (Current).last_column  = YYRHSLOC (Rhs, N).last_column;       \
1832
        }                                                               \
1833
      else                                                              \
1834
        {                                                               \
1835
          (Current).first_line   = (Current).last_line   =              \
1836
            YYRHSLOC (Rhs, 0).last_line;                                \
1837
          (Current).first_column = (Current).last_column =              \
1838
            YYRHSLOC (Rhs, 0).last_column;                              \
1839
        }                                                               \
1840
    while (0)
1841
#endif
1842
1843
0
#define YYRHSLOC(Rhs, K) ((Rhs)[K])
1844
1845
1846
/* Enable debugging if requested.  */
1847
#if YYDEBUG
1848
1849
# ifndef YYFPRINTF
1850
#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1851
#  define YYFPRINTF fprintf
1852
# endif
1853
1854
# define YYDPRINTF(Args)                        \
1855
do {                                            \
1856
  if (yydebug)                                  \
1857
    YYFPRINTF Args;                             \
1858
} while (0)
1859
1860
1861
/* YY_LOCATION_PRINT -- Print the location on the stream.
1862
   This macro was not mandated originally: define only if we know
1863
   we won't break user code: when these are the locations we know.  */
1864
1865
#ifndef YY_LOCATION_PRINT
1866
# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
1867
1868
/* Print *YYLOCP on YYO.  Private, do not rely on its existence. */
1869
1870
YY_ATTRIBUTE_UNUSED
1871
static int
1872
yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
1873
{
1874
  int res = 0;
1875
  int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
1876
  if (0 <= yylocp->first_line)
1877
    {
1878
      res += YYFPRINTF (yyo, "%d", yylocp->first_line);
1879
      if (0 <= yylocp->first_column)
1880
        res += YYFPRINTF (yyo, ".%d", yylocp->first_column);
1881
    }
1882
  if (0 <= yylocp->last_line)
1883
    {
1884
      if (yylocp->first_line < yylocp->last_line)
1885
        {
1886
          res += YYFPRINTF (yyo, "-%d", yylocp->last_line);
1887
          if (0 <= end_col)
1888
            res += YYFPRINTF (yyo, ".%d", end_col);
1889
        }
1890
      else if (0 <= end_col && yylocp->first_column < end_col)
1891
        res += YYFPRINTF (yyo, "-%d", end_col);
1892
    }
1893
  return res;
1894
 }
1895
1896
#  define YY_LOCATION_PRINT(File, Loc)          \
1897
  yy_location_print_ (File, &(Loc))
1898
1899
# else
1900
#  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1901
# endif
1902
#endif
1903
1904
1905
# define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
1906
do {                                                                      \
1907
  if (yydebug)                                                            \
1908
    {                                                                     \
1909
      YYFPRINTF (stderr, "%s ", Title);                                   \
1910
      yy_symbol_print (stderr,                                            \
1911
                  Type, Value, Location, yyscanner); \
1912
      YYFPRINTF (stderr, "\n");                                           \
1913
    }                                                                     \
1914
} while (0)
1915
1916
1917
/*-----------------------------------.
1918
| Print this symbol's value on YYO.  |
1919
`-----------------------------------*/
1920
1921
static void
1922
yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, yyscan_t yyscanner)
1923
{
1924
  FILE *yyoutput = yyo;
1925
  YYUSE (yyoutput);
1926
  YYUSE (yylocationp);
1927
  YYUSE (yyscanner);
1928
  if (!yyvaluep)
1929
    return;
1930
# ifdef YYPRINT
1931
  if (yytype < YYNTOKENS)
1932
    YYPRINT (yyo, yytoknum[yytype], *yyvaluep);
1933
# endif
1934
  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1935
  YYUSE (yytype);
1936
  YY_IGNORE_MAYBE_UNINITIALIZED_END
1937
}
1938
1939
1940
/*---------------------------.
1941
| Print this symbol on YYO.  |
1942
`---------------------------*/
1943
1944
static void
1945
yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, yyscan_t yyscanner)
1946
{
1947
  YYFPRINTF (yyo, "%s %s (",
1948
             yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
1949
1950
  YY_LOCATION_PRINT (yyo, *yylocationp);
1951
  YYFPRINTF (yyo, ": ");
1952
  yy_symbol_value_print (yyo, yytype, yyvaluep, yylocationp, yyscanner);
1953
  YYFPRINTF (yyo, ")");
1954
}
1955
1956
/*------------------------------------------------------------------.
1957
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
1958
| TOP (included).                                                   |
1959
`------------------------------------------------------------------*/
1960
1961
static void
1962
yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
1963
{
1964
  YYFPRINTF (stderr, "Stack now");
1965
  for (; yybottom <= yytop; yybottom++)
1966
    {
1967
      int yybot = *yybottom;
1968
      YYFPRINTF (stderr, " %d", yybot);
1969
    }
1970
  YYFPRINTF (stderr, "\n");
1971
}
1972
1973
# define YY_STACK_PRINT(Bottom, Top)                            \
1974
do {                                                            \
1975
  if (yydebug)                                                  \
1976
    yy_stack_print ((Bottom), (Top));                           \
1977
} while (0)
1978
1979
1980
/*------------------------------------------------.
1981
| Report that the YYRULE is going to be reduced.  |
1982
`------------------------------------------------*/
1983
1984
static void
1985
yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, yyscan_t yyscanner)
1986
{
1987
  int yylno = yyrline[yyrule];
1988
  int yynrhs = yyr2[yyrule];
1989
  int yyi;
1990
  YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
1991
             yyrule - 1, yylno);
1992
  /* The symbols being reduced.  */
1993
  for (yyi = 0; yyi < yynrhs; yyi++)
1994
    {
1995
      YYFPRINTF (stderr, "   $%d = ", yyi + 1);
1996
      yy_symbol_print (stderr,
1997
                       yystos[+yyssp[yyi + 1 - yynrhs]],
1998
                       &yyvsp[(yyi + 1) - (yynrhs)]
1999
                       , &(yylsp[(yyi + 1) - (yynrhs)])                       , yyscanner);
2000
      YYFPRINTF (stderr, "\n");
2001
    }
2002
}
2003
2004
# define YY_REDUCE_PRINT(Rule)          \
2005
do {                                    \
2006
  if (yydebug)                          \
2007
    yy_reduce_print (yyssp, yyvsp, yylsp, Rule, yyscanner); \
2008
} while (0)
2009
2010
/* Nonzero means print parse trace.  It is left uninitialized so that
2011
   multiple parsers can coexist.  */
2012
int yydebug;
2013
#else /* !YYDEBUG */
2014
# define YYDPRINTF(Args)
2015
# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2016
# define YY_STACK_PRINT(Bottom, Top)
2017
# define YY_REDUCE_PRINT(Rule)
2018
#endif /* !YYDEBUG */
2019
2020
2021
/* YYINITDEPTH -- initial size of the parser's stacks.  */
2022
#ifndef YYINITDEPTH
2023
0
# define YYINITDEPTH 200
2024
#endif
2025
2026
/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2027
   if the built-in stack extension method is used).
2028
2029
   Do not make this value too large; the results are undefined if
2030
   YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2031
   evaluated with infinite-precision integer arithmetic.  */
2032
2033
#ifndef YYMAXDEPTH
2034
# define YYMAXDEPTH 10000
2035
#endif
2036
2037
2038
#if YYERROR_VERBOSE
2039
2040
# ifndef yystrlen
2041
#  if defined __GLIBC__ && defined _STRING_H
2042
#   define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S)))
2043
#  else
2044
/* Return the length of YYSTR.  */
2045
static YYPTRDIFF_T
2046
yystrlen (const char *yystr)
2047
{
2048
  YYPTRDIFF_T yylen;
2049
  for (yylen = 0; yystr[yylen]; yylen++)
2050
    continue;
2051
  return yylen;
2052
}
2053
#  endif
2054
# endif
2055
2056
# ifndef yystpcpy
2057
#  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
2058
#   define yystpcpy stpcpy
2059
#  else
2060
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2061
   YYDEST.  */
2062
static char *
2063
yystpcpy (char *yydest, const char *yysrc)
2064
{
2065
  char *yyd = yydest;
2066
  const char *yys = yysrc;
2067
2068
  while ((*yyd++ = *yys++) != '\0')
2069
    continue;
2070
2071
  return yyd - 1;
2072
}
2073
#  endif
2074
# endif
2075
2076
# ifndef yytnamerr
2077
/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
2078
   quotes and backslashes, so that it's suitable for yyerror.  The
2079
   heuristic is that double-quoting is unnecessary unless the string
2080
   contains an apostrophe, a comma, or backslash (other than
2081
   backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
2082
   null, do not copy; instead, return the length of what the result
2083
   would have been.  */
2084
static YYPTRDIFF_T
2085
yytnamerr (char *yyres, const char *yystr)
2086
{
2087
  if (*yystr == '"')
2088
    {
2089
      YYPTRDIFF_T yyn = 0;
2090
      char const *yyp = yystr;
2091
2092
      for (;;)
2093
        switch (*++yyp)
2094
          {
2095
          case '\'':
2096
          case ',':
2097
            goto do_not_strip_quotes;
2098
2099
          case '\\':
2100
            if (*++yyp != '\\')
2101
              goto do_not_strip_quotes;
2102
            else
2103
              goto append;
2104
2105
          append:
2106
          default:
2107
            if (yyres)
2108
              yyres[yyn] = *yyp;
2109
            yyn++;
2110
            break;
2111
2112
          case '"':
2113
            if (yyres)
2114
              yyres[yyn] = '\0';
2115
            return yyn;
2116
          }
2117
    do_not_strip_quotes: ;
2118
    }
2119
2120
  if (yyres)
2121
    return yystpcpy (yyres, yystr) - yyres;
2122
  else
2123
    return yystrlen (yystr);
2124
}
2125
# endif
2126
2127
/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
2128
   about the unexpected token YYTOKEN for the state stack whose top is
2129
   YYSSP.
2130
2131
   Return 0 if *YYMSG was successfully written.  Return 1 if *YYMSG is
2132
   not large enough to hold the message.  In that case, also set
2133
   *YYMSG_ALLOC to the required number of bytes.  Return 2 if the
2134
   required number of bytes is too large to store.  */
2135
static int
2136
yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
2137
                yy_state_t *yyssp, int yytoken)
2138
{
2139
  enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
2140
  /* Internationalized format string. */
2141
  const char *yyformat = YY_NULLPTR;
2142
  /* Arguments of yyformat: reported tokens (one for the "unexpected",
2143
     one per "expected"). */
2144
  char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
2145
  /* Actual size of YYARG. */
2146
  int yycount = 0;
2147
  /* Cumulated lengths of YYARG.  */
2148
  YYPTRDIFF_T yysize = 0;
2149
2150
  /* There are many possibilities here to consider:
2151
     - If this state is a consistent state with a default action, then
2152
       the only way this function was invoked is if the default action
2153
       is an error action.  In that case, don't check for expected
2154
       tokens because there are none.
2155
     - The only way there can be no lookahead present (in yychar) is if
2156
       this state is a consistent state with a default action.  Thus,
2157
       detecting the absence of a lookahead is sufficient to determine
2158
       that there is no unexpected or expected token to report.  In that
2159
       case, just report a simple "syntax error".
2160
     - Don't assume there isn't a lookahead just because this state is a
2161
       consistent state with a default action.  There might have been a
2162
       previous inconsistent state, consistent state with a non-default
2163
       action, or user semantic action that manipulated yychar.
2164
     - Of course, the expected token list depends on states to have
2165
       correct lookahead information, and it depends on the parser not
2166
       to perform extra reductions after fetching a lookahead from the
2167
       scanner and before detecting a syntax error.  Thus, state merging
2168
       (from LALR or IELR) and default reductions corrupt the expected
2169
       token list.  However, the list is correct for canonical LR with
2170
       one exception: it will still contain any token that will not be
2171
       accepted due to an error action in a later state.
2172
  */
2173
  if (yytoken != YYEMPTY)
2174
    {
2175
      int yyn = yypact[+*yyssp];
2176
      YYPTRDIFF_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
2177
      yysize = yysize0;
2178
      yyarg[yycount++] = yytname[yytoken];
2179
      if (!yypact_value_is_default (yyn))
2180
        {
2181
          /* Start YYX at -YYN if negative to avoid negative indexes in
2182
             YYCHECK.  In other words, skip the first -YYN actions for
2183
             this state because they are default actions.  */
2184
          int yyxbegin = yyn < 0 ? -yyn : 0;
2185
          /* Stay within bounds of both yycheck and yytname.  */
2186
          int yychecklim = YYLAST - yyn + 1;
2187
          int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
2188
          int yyx;
2189
2190
          for (yyx = yyxbegin; yyx < yyxend; ++yyx)
2191
            if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
2192
                && !yytable_value_is_error (yytable[yyx + yyn]))
2193
              {
2194
                if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
2195
                  {
2196
                    yycount = 1;
2197
                    yysize = yysize0;
2198
                    break;
2199
                  }
2200
                yyarg[yycount++] = yytname[yyx];
2201
                {
2202
                  YYPTRDIFF_T yysize1
2203
                    = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
2204
                  if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
2205
                    yysize = yysize1;
2206
                  else
2207
                    return 2;
2208
                }
2209
              }
2210
        }
2211
    }
2212
2213
  switch (yycount)
2214
    {
2215
# define YYCASE_(N, S)                      \
2216
      case N:                               \
2217
        yyformat = S;                       \
2218
      break
2219
    default: /* Avoid compiler warnings. */
2220
      YYCASE_(0, YY_("syntax error"));
2221
      YYCASE_(1, YY_("syntax error, unexpected %s"));
2222
      YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
2223
      YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
2224
      YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
2225
      YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
2226
# undef YYCASE_
2227
    }
2228
2229
  {
2230
    /* Don't count the "%s"s in the final size, but reserve room for
2231
       the terminator.  */
2232
    YYPTRDIFF_T yysize1 = yysize + (yystrlen (yyformat) - 2 * yycount) + 1;
2233
    if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
2234
      yysize = yysize1;
2235
    else
2236
      return 2;
2237
  }
2238
2239
  if (*yymsg_alloc < yysize)
2240
    {
2241
      *yymsg_alloc = 2 * yysize;
2242
      if (! (yysize <= *yymsg_alloc
2243
             && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
2244
        *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
2245
      return 1;
2246
    }
2247
2248
  /* Avoid sprintf, as that infringes on the user's name space.
2249
     Don't have undefined behavior even if the translation
2250
     produced a string with the wrong number of "%s"s.  */
2251
  {
2252
    char *yyp = *yymsg;
2253
    int yyi = 0;
2254
    while ((*yyp = *yyformat) != '\0')
2255
      if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
2256
        {
2257
          yyp += yytnamerr (yyp, yyarg[yyi++]);
2258
          yyformat += 2;
2259
        }
2260
      else
2261
        {
2262
          ++yyp;
2263
          ++yyformat;
2264
        }
2265
  }
2266
  return 0;
2267
}
2268
#endif /* YYERROR_VERBOSE */
2269
2270
/*-----------------------------------------------.
2271
| Release the memory associated to this symbol.  |
2272
`-----------------------------------------------*/
2273
2274
static void
2275
yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, yyscan_t yyscanner)
2276
0
{
2277
0
  YYUSE (yyvaluep);
2278
0
  YYUSE (yylocationp);
2279
0
  YYUSE (yyscanner);
2280
0
  if (!yymsg)
2281
0
    yymsg = "Deleting";
2282
0
  YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
2283
2284
0
  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2285
0
  YYUSE (yytype);
2286
0
  YY_IGNORE_MAYBE_UNINITIALIZED_END
2287
0
}
2288
2289
2290
2291
2292
/*----------.
2293
| yyparse.  |
2294
`----------*/
2295
2296
int
2297
yyparse (yyscan_t yyscanner)
2298
0
{
2299
/* The lookahead symbol.  */
2300
0
int yychar;
2301
2302
2303
/* The semantic value of the lookahead symbol.  */
2304
/* Default value used for initialization, for pacifying older GCCs
2305
   or non-GCC compilers.  */
2306
0
YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
2307
0
YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
2308
2309
/* Location data for the lookahead symbol.  */
2310
0
static YYLTYPE yyloc_default
2311
# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
2312
  = { 1, 1, 1, 1 }
2313
# endif
2314
0
;
2315
0
YYLTYPE yylloc = yyloc_default;
2316
2317
    /* Number of syntax errors so far.  */
2318
0
    int yynerrs;
2319
2320
0
    yy_state_fast_t yystate;
2321
    /* Number of tokens to shift before error messages enabled.  */
2322
0
    int yyerrstatus;
2323
2324
    /* The stacks and their tools:
2325
       'yyss': related to states.
2326
       'yyvs': related to semantic values.
2327
       'yyls': related to locations.
2328
2329
       Refer to the stacks through separate pointers, to allow yyoverflow
2330
       to reallocate them elsewhere.  */
2331
2332
    /* The state stack.  */
2333
0
    yy_state_t yyssa[YYINITDEPTH];
2334
0
    yy_state_t *yyss;
2335
0
    yy_state_t *yyssp;
2336
2337
    /* The semantic value stack.  */
2338
0
    YYSTYPE yyvsa[YYINITDEPTH];
2339
0
    YYSTYPE *yyvs;
2340
0
    YYSTYPE *yyvsp;
2341
2342
    /* The location stack.  */
2343
0
    YYLTYPE yylsa[YYINITDEPTH];
2344
0
    YYLTYPE *yyls;
2345
0
    YYLTYPE *yylsp;
2346
2347
    /* The locations where the error started and ended.  */
2348
0
    YYLTYPE yyerror_range[3];
2349
2350
0
    YYPTRDIFF_T yystacksize;
2351
2352
0
  int yyn;
2353
0
  int yyresult;
2354
  /* Lookahead token as an internal (translated) token number.  */
2355
0
  int yytoken = 0;
2356
  /* The variables used to return semantic value and location from the
2357
     action routines.  */
2358
0
  YYSTYPE yyval;
2359
0
  YYLTYPE yyloc;
2360
2361
#if YYERROR_VERBOSE
2362
  /* Buffer for error messages, and its allocated size.  */
2363
  char yymsgbuf[128];
2364
  char *yymsg = yymsgbuf;
2365
  YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf;
2366
#endif
2367
2368
0
#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
2369
2370
  /* The number of symbols on the RHS of the reduced rule.
2371
     Keep to zero when no symbol should be popped.  */
2372
0
  int yylen = 0;
2373
2374
0
  yyssp = yyss = yyssa;
2375
0
  yyvsp = yyvs = yyvsa;
2376
0
  yylsp = yyls = yylsa;
2377
0
  yystacksize = YYINITDEPTH;
2378
2379
0
  YYDPRINTF ((stderr, "Starting parse\n"));
2380
2381
0
  yystate = 0;
2382
0
  yyerrstatus = 0;
2383
0
  yynerrs = 0;
2384
0
  yychar = YYEMPTY; /* Cause a token to be read.  */
2385
2386
/* User initialization code.  */
2387
0
#line 946 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
2388
0
{ yylloc = 1; }
2389
2390
0
#line 2391 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
2391
2392
0
  yylsp[0] = yylloc;
2393
0
  goto yysetstate;
2394
2395
2396
/*------------------------------------------------------------.
2397
| yynewstate -- push a new state, which is found in yystate.  |
2398
`------------------------------------------------------------*/
2399
0
yynewstate:
2400
  /* In all cases, when you get here, the value and location stacks
2401
     have just been pushed.  So pushing a state here evens the stacks.  */
2402
0
  yyssp++;
2403
2404
2405
/*--------------------------------------------------------------------.
2406
| yysetstate -- set current state (the top of the stack) to yystate.  |
2407
`--------------------------------------------------------------------*/
2408
0
yysetstate:
2409
0
  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
2410
0
  YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
2411
0
  YY_IGNORE_USELESS_CAST_BEGIN
2412
0
  *yyssp = YY_CAST (yy_state_t, yystate);
2413
0
  YY_IGNORE_USELESS_CAST_END
2414
2415
0
  if (yyss + yystacksize - 1 <= yyssp)
2416
0
#if !defined yyoverflow && !defined YYSTACK_RELOCATE
2417
0
    goto yyexhaustedlab;
2418
#else
2419
    {
2420
      /* Get the current used size of the three stacks, in elements.  */
2421
      YYPTRDIFF_T yysize = yyssp - yyss + 1;
2422
2423
# if defined yyoverflow
2424
      {
2425
        /* Give user a chance to reallocate the stack.  Use copies of
2426
           these so that the &'s don't force the real ones into
2427
           memory.  */
2428
        yy_state_t *yyss1 = yyss;
2429
        YYSTYPE *yyvs1 = yyvs;
2430
        YYLTYPE *yyls1 = yyls;
2431
2432
        /* Each stack pointer address is followed by the size of the
2433
           data in use in that stack, in bytes.  This used to be a
2434
           conditional around just the two extra args, but that might
2435
           be undefined if yyoverflow is a macro.  */
2436
        yyoverflow (YY_("memory exhausted"),
2437
                    &yyss1, yysize * YYSIZEOF (*yyssp),
2438
                    &yyvs1, yysize * YYSIZEOF (*yyvsp),
2439
                    &yyls1, yysize * YYSIZEOF (*yylsp),
2440
                    &yystacksize);
2441
        yyss = yyss1;
2442
        yyvs = yyvs1;
2443
        yyls = yyls1;
2444
      }
2445
# else /* defined YYSTACK_RELOCATE */
2446
      /* Extend the stack our own way.  */
2447
      if (YYMAXDEPTH <= yystacksize)
2448
        goto yyexhaustedlab;
2449
      yystacksize *= 2;
2450
      if (YYMAXDEPTH < yystacksize)
2451
        yystacksize = YYMAXDEPTH;
2452
2453
      {
2454
        yy_state_t *yyss1 = yyss;
2455
        union yyalloc *yyptr =
2456
          YY_CAST (union yyalloc *,
2457
                   YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
2458
        if (! yyptr)
2459
          goto yyexhaustedlab;
2460
        YYSTACK_RELOCATE (yyss_alloc, yyss);
2461
        YYSTACK_RELOCATE (yyvs_alloc, yyvs);
2462
        YYSTACK_RELOCATE (yyls_alloc, yyls);
2463
# undef YYSTACK_RELOCATE
2464
        if (yyss1 != yyssa)
2465
          YYSTACK_FREE (yyss1);
2466
      }
2467
# endif
2468
2469
      yyssp = yyss + yysize - 1;
2470
      yyvsp = yyvs + yysize - 1;
2471
      yylsp = yyls + yysize - 1;
2472
2473
      YY_IGNORE_USELESS_CAST_BEGIN
2474
      YYDPRINTF ((stderr, "Stack size increased to %ld\n",
2475
                  YY_CAST (long, yystacksize)));
2476
      YY_IGNORE_USELESS_CAST_END
2477
2478
      if (yyss + yystacksize - 1 <= yyssp)
2479
        YYABORT;
2480
    }
2481
#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
2482
2483
0
  if (yystate == YYFINAL)
2484
0
    YYACCEPT;
2485
2486
0
  goto yybackup;
2487
2488
2489
/*-----------.
2490
| yybackup.  |
2491
`-----------*/
2492
0
yybackup:
2493
  /* Do appropriate processing given the current state.  Read a
2494
     lookahead token if we need one and don't already have one.  */
2495
2496
  /* First try to decide what to do without reference to lookahead token.  */
2497
0
  yyn = yypact[yystate];
2498
0
  if (yypact_value_is_default (yyn))
2499
0
    goto yydefault;
2500
2501
  /* Not known => get a lookahead token if don't already have one.  */
2502
2503
  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
2504
0
  if (yychar == YYEMPTY)
2505
0
    {
2506
0
      YYDPRINTF ((stderr, "Reading a token: "));
2507
0
      yychar = yylex (&yylval, &yylloc, yyscanner);
2508
0
    }
2509
2510
0
  if (yychar <= YYEOF)
2511
0
    {
2512
0
      yychar = yytoken = YYEOF;
2513
0
      YYDPRINTF ((stderr, "Now at end of input.\n"));
2514
0
    }
2515
0
  else
2516
0
    {
2517
0
      yytoken = YYTRANSLATE (yychar);
2518
0
      YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
2519
0
    }
2520
2521
  /* If the proper action on seeing token YYTOKEN is to reduce or to
2522
     detect an error, take that action.  */
2523
0
  yyn += yytoken;
2524
0
  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
2525
0
    goto yydefault;
2526
0
  yyn = yytable[yyn];
2527
0
  if (yyn <= 0)
2528
0
    {
2529
0
      if (yytable_value_is_error (yyn))
2530
0
        goto yyerrlab;
2531
0
      yyn = -yyn;
2532
0
      goto yyreduce;
2533
0
    }
2534
2535
  /* Count tokens shifted since error; after three, turn off error
2536
     status.  */
2537
0
  if (yyerrstatus)
2538
0
    yyerrstatus--;
2539
2540
  /* Shift the lookahead token.  */
2541
0
  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
2542
0
  yystate = yyn;
2543
0
  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2544
0
  *++yyvsp = yylval;
2545
0
  YY_IGNORE_MAYBE_UNINITIALIZED_END
2546
0
  *++yylsp = yylloc;
2547
2548
  /* Discard the shifted token.  */
2549
0
  yychar = YYEMPTY;
2550
0
  goto yynewstate;
2551
2552
2553
/*-----------------------------------------------------------.
2554
| yydefault -- do the default action for the current state.  |
2555
`-----------------------------------------------------------*/
2556
0
yydefault:
2557
0
  yyn = yydefact[yystate];
2558
0
  if (yyn == 0)
2559
0
    goto yyerrlab;
2560
0
  goto yyreduce;
2561
2562
2563
/*-----------------------------.
2564
| yyreduce -- do a reduction.  |
2565
`-----------------------------*/
2566
0
yyreduce:
2567
  /* yyn is the number of a rule to reduce with.  */
2568
0
  yylen = yyr2[yyn];
2569
2570
  /* If YYLEN is nonzero, implement the default value of the action:
2571
     '$$ = $1'.
2572
2573
     Otherwise, the following line sets YYVAL to garbage.
2574
     This behavior is undocumented and Bison
2575
     users should not rely upon it.  Assigning to YYVAL
2576
     unconditionally makes the parser a bit smaller, and it avoids a
2577
     GCC warning that YYVAL may be used uninitialized.  */
2578
0
  yyval = yyvsp[1-yylen];
2579
2580
  /* Default location. */
2581
0
  YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
2582
0
  yyerror_range[1] = yyloc;
2583
0
  YY_REDUCE_PRINT (yyn);
2584
0
  switch (yyn)
2585
0
    {
2586
0
  case 17:
2587
0
#line 973 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
2588
0
  {
2589
0
      unoidl::detail::SourceProviderScannerData * data = yyget_extra(yyscanner);
2590
0
      OUString name(convertToFullName(data, (yyvsp[0].sval)));
2591
0
      data->modules.push_back(name);
2592
0
      std::pair<std::map<OUString, unoidl::detail::SourceProviderEntity>::iterator, bool> p(
2593
0
          data->entities.emplace(
2594
0
                  name,
2595
0
                  unoidl::detail::SourceProviderEntity(
2596
0
                      unoidl::detail::SourceProviderEntity::KIND_MODULE)));
2597
0
      if (!p.second
2598
0
          && (p.first->second.kind
2599
0
              != unoidl::detail::SourceProviderEntity::KIND_MODULE))
2600
0
      {
2601
0
          error((yylsp[0]), yyscanner, "multiple entities named " + name);
2602
0
          YYERROR;
2603
0
      }
2604
0
  }
2605
0
#line 2606 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
2606
0
    break;
2607
2608
0
  case 18:
2609
0
#line 990 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
2610
0
                          { yyget_extra(yyscanner)->modules.pop_back(); }
2611
0
#line 2612 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
2612
0
    break;
2613
2614
0
  case 19:
2615
0
#line 995 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
2616
0
  {
2617
0
      unoidl::detail::SourceProviderScannerData * data = yyget_extra(yyscanner);
2618
0
      data->publishedContext = (yyvsp[-2].bval);
2619
0
      convertToCurrentName(data, (yyvsp[0].sval));
2620
0
      if (!data->entities.emplace(
2621
0
                  data->currentName,
2622
0
                  unoidl::detail::SourceProviderEntity(
2623
0
                      new unoidl::detail::SourceProviderEnumTypeEntityPad(
2624
0
                          (yyvsp[-2].bval)))).
2625
0
          second)
2626
0
      {
2627
0
          error((yylsp[0]), yyscanner, "multiple entities named " + data->currentName);
2628
0
          YYERROR;
2629
0
      }
2630
0
  }
2631
0
#line 2632 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
2632
0
    break;
2633
2634
0
  case 20:
2635
0
#line 1011 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
2636
0
  {
2637
0
      unoidl::detail::SourceProviderScannerData * data = yyget_extra(yyscanner);
2638
0
      unoidl::detail::SourceProviderEntity * ent = getCurrentEntity(data);
2639
0
      unoidl::detail::SourceProviderEnumTypeEntityPad * pad =
2640
0
          dynamic_cast<unoidl::detail::SourceProviderEnumTypeEntityPad *>(
2641
0
              ent->pad.get());
2642
0
      assert(pad != nullptr);
2643
0
      ent->entity = new unoidl::EnumTypeEntity(
2644
0
          pad->isPublished(), std::move(pad->members), annotations((yyvsp[-8].bval)));
2645
0
      ent->pad.clear();
2646
0
      clearCurrentState(data);
2647
0
  }
2648
0
#line 2649 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
2649
0
    break;
2650
2651
0
  case 24:
2652
0
#line 1032 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
2653
0
  {
2654
0
      OUString id(convertName((yyvsp[0].sval)));
2655
0
      unoidl::detail::SourceProviderScannerData * data = yyget_extra(yyscanner);
2656
0
      rtl::Reference<unoidl::detail::SourceProviderEnumTypeEntityPad> pad(
2657
0
          getCurrentPad<unoidl::detail::SourceProviderEnumTypeEntityPad>(data));
2658
0
      sal_Int32 v;
2659
0
      if (pad->members.empty()) {
2660
0
          v = 0;
2661
0
      } else {
2662
0
          v = pad->members.back().value;
2663
0
          if (v == SAL_MAX_INT32) {
2664
0
              error(
2665
0
                  (yylsp[0]), yyscanner,
2666
0
                  ("enum " + data->currentName + " member " + id
2667
0
                   + " would have out-of-range value 2^31"));
2668
0
              YYERROR;
2669
0
          }
2670
0
          ++v;
2671
0
      }
2672
0
      pad->members.emplace_back(id, v, annotations((yyvsp[-1].bval)));
2673
0
  }
2674
0
#line 2675 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
2675
0
    break;
2676
2677
0
  case 25:
2678
0
#line 1054 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
2679
0
  {
2680
0
      OUString id(convertName((yyvsp[-2].sval)));
2681
0
      unoidl::detail::SourceProviderScannerData * data = yyget_extra(yyscanner);
2682
0
      rtl::Reference<unoidl::detail::SourceProviderEnumTypeEntityPad> pad(
2683
0
          getCurrentPad<unoidl::detail::SourceProviderEnumTypeEntityPad>(data));
2684
0
      sal_Int32 v;
2685
0
      switch ((yyvsp[0].expr).type) {
2686
0
      case unoidl::detail::SourceProviderExpr::TYPE_INT:
2687
0
          if ((yyvsp[0].expr).ival < SAL_MIN_INT32 || (yyvsp[0].expr).ival > SAL_MAX_INT32) {
2688
0
              error(
2689
0
                  (yylsp[0]), yyscanner,
2690
0
                  ("out-of-range enum " + data->currentName + " member " + id
2691
0
                   + " value " + OUString::number((yyvsp[0].expr).ival)));
2692
0
              YYERROR;
2693
0
          }
2694
0
          v = static_cast<sal_Int32>((yyvsp[0].expr).ival);
2695
0
          break;
2696
0
      case unoidl::detail::SourceProviderExpr::TYPE_UINT:
2697
0
          if ((yyvsp[0].expr).uval > SAL_MAX_INT32) {
2698
0
              error(
2699
0
                  (yylsp[0]), yyscanner,
2700
0
                  ("out-of-range enum " + data->currentName + " member " + id
2701
0
                   + " value " + OUString::number((yyvsp[0].expr).uval)));
2702
0
              YYERROR;
2703
0
          }
2704
0
          v = static_cast<sal_Int32>((yyvsp[0].expr).uval);
2705
0
          break;
2706
0
      default:
2707
0
          error(
2708
0
              (yylsp[0]), yyscanner,
2709
0
              ("non-integer enum " + data->currentName + " member " + id
2710
0
               + " value"));
2711
0
          YYERROR;
2712
0
          break;
2713
0
      }
2714
0
      pad->members.emplace_back(id, v, annotations((yyvsp[-3].bval)));
2715
0
  }
2716
0
#line 2717 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
2717
0
    break;
2718
2719
0
  case 26:
2720
0
#line 1095 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
2721
0
  {
2722
0
      unoidl::detail::SourceProviderScannerData * data = yyget_extra(yyscanner);
2723
0
      data->publishedContext = (yyvsp[-3].bval);
2724
0
      convertToCurrentName(data, (yyvsp[-1].sval));
2725
0
      OUString baseName;
2726
0
      rtl::Reference<unoidl::PlainStructTypeEntity> baseEnt;
2727
0
      if ((yyvsp[0].sval) != nullptr) {
2728
0
          baseName = convertName((yyvsp[0].sval));
2729
0
          unoidl::detail::SourceProviderEntity const * p;
2730
0
          if (findEntity(
2731
0
                  (yylsp[0]), yyscanner, data, false, &baseName, &p, nullptr, nullptr)
2732
0
              == FOUND_ERROR)
2733
0
          {
2734
0
              YYERROR;
2735
0
          }
2736
0
          if (p == nullptr || !p->entity.is()
2737
0
              || p->entity->getSort() != unoidl::Entity::SORT_PLAIN_STRUCT_TYPE)
2738
0
          {
2739
0
              error(
2740
0
                  (yylsp[0]), yyscanner,
2741
0
                  ("plain struct type " + data->currentName + " base "
2742
0
                   + baseName
2743
0
                   + " does not resolve to an existing plain struct type"));
2744
0
              YYERROR;
2745
0
          }
2746
0
          baseEnt = static_cast<unoidl::PlainStructTypeEntity *>(
2747
0
              p->entity.get());
2748
0
          if ((yyvsp[-3].bval) && !baseEnt->isPublished()) {
2749
0
              error(
2750
0
                  (yylsp[0]), yyscanner,
2751
0
                  ("published plain struct type " + data->currentName + " base "
2752
0
                   + baseName + " is unpublished"));
2753
0
              YYERROR;
2754
0
          }
2755
0
      }
2756
0
      if (!data->entities.emplace(
2757
0
                  data->currentName,
2758
0
                  unoidl::detail::SourceProviderEntity(
2759
0
                      new unoidl::detail::SourceProviderPlainStructTypeEntityPad(
2760
0
                          (yyvsp[-3].bval), baseName, baseEnt))).
2761
0
          second)
2762
0
      {
2763
0
          error((yylsp[-1]), yyscanner, "multiple entities named " + data->currentName);
2764
0
          YYERROR;
2765
0
      }
2766
0
  }
2767
0
#line 2768 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
2768
0
    break;
2769
2770
0
  case 27:
2771
0
#line 1142 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
2772
0
  {
2773
0
      unoidl::detail::SourceProviderScannerData * data = yyget_extra(yyscanner);
2774
0
      unoidl::detail::SourceProviderEntity * ent = getCurrentEntity(data);
2775
0
      unoidl::detail::SourceProviderPlainStructTypeEntityPad * pad =
2776
0
          dynamic_cast<
2777
0
              unoidl::detail::SourceProviderPlainStructTypeEntityPad *>(
2778
0
                  ent->pad.get());
2779
0
      assert(pad != nullptr);
2780
0
      ent->entity = new unoidl::PlainStructTypeEntity(
2781
0
          pad->isPublished(), pad->baseName, std::move(pad->members), annotations((yyvsp[-9].bval)));
2782
0
      ent->pad.clear();
2783
0
      clearCurrentState(data);
2784
0
  }
2785
0
#line 2786 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
2786
0
    break;
2787
2788
0
  case 28:
2789
0
#line 1159 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
2790
0
  {
2791
0
      unoidl::detail::SourceProviderScannerData * data = yyget_extra(yyscanner);
2792
0
      data->publishedContext = (yyvsp[-3].bval);
2793
0
      convertToCurrentName(data, (yyvsp[-1].sval));
2794
0
      if (!data->entities.emplace(
2795
0
                  data->currentName,
2796
0
                  unoidl::detail::SourceProviderEntity(
2797
0
                      new unoidl::detail::SourceProviderPolymorphicStructTypeTemplateEntityPad(
2798
0
                          (yyvsp[-3].bval)))).
2799
0
          second)
2800
0
      {
2801
0
          error((yylsp[-1]), yyscanner, "multiple entities named " + data->currentName);
2802
0
          YYERROR;
2803
0
      }
2804
0
  }
2805
0
#line 2806 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
2806
0
    break;
2807
2808
0
  case 29:
2809
0
#line 1175 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
2810
0
  {
2811
0
      unoidl::detail::SourceProviderScannerData * data = yyget_extra(yyscanner);
2812
0
      unoidl::detail::SourceProviderEntity * ent = getCurrentEntity(data);
2813
0
      unoidl::detail::SourceProviderPolymorphicStructTypeTemplateEntityPad *
2814
0
          pad = dynamic_cast<
2815
0
              unoidl::detail::SourceProviderPolymorphicStructTypeTemplateEntityPad *>(
2816
0
                  ent->pad.get());
2817
0
      assert(pad != nullptr);
2818
0
      ent->entity = new unoidl::PolymorphicStructTypeTemplateEntity(
2819
0
          pad->isPublished(), std::move(pad->typeParameters), std::move(pad->members),
2820
0
          annotations((yyvsp[-11].bval)));
2821
0
      ent->pad.clear();
2822
0
      clearCurrentState(data);
2823
0
  }
2824
0
#line 2825 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
2825
0
    break;
2826
2827
0
  case 30:
2828
0
#line 1193 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
2829
0
  {
2830
0
      unoidl::detail::SourceProviderScannerData * data = yyget_extra(yyscanner);
2831
0
      rtl::Reference<unoidl::detail::SourceProviderPolymorphicStructTypeTemplateEntityPad>
2832
0
          pad(getCurrentPad<unoidl::detail::SourceProviderPolymorphicStructTypeTemplateEntityPad>(
2833
0
                  data));
2834
0
      OUString id(convertName((yyvsp[0].sval)));
2835
0
      if (std::find(pad->typeParameters.begin(), pad->typeParameters.end(), id)
2836
0
          != pad->typeParameters.end())
2837
0
      {
2838
0
          error(
2839
0
              (yylsp[0]), yyscanner,
2840
0
              ("polymorphic struct type template " + data->currentName
2841
0
               + " type parameter " + id
2842
0
               + " has same identifier as another type parameter"));
2843
0
          YYERROR;
2844
0
      }
2845
0
      pad->typeParameters.push_back(id);
2846
0
  }
2847
0
#line 2848 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
2848
0
    break;
2849
2850
0
  case 31:
2851
0
#line 1212 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
2852
0
  {
2853
0
      unoidl::detail::SourceProviderScannerData * data = yyget_extra(yyscanner);
2854
0
      rtl::Reference<unoidl::detail::SourceProviderPolymorphicStructTypeTemplateEntityPad>
2855
0
          pad(getCurrentPad<unoidl::detail::SourceProviderPolymorphicStructTypeTemplateEntityPad>(
2856
0
                  data));
2857
0
      OUString id(convertName((yyvsp[0].sval)));
2858
0
      assert(pad->typeParameters.empty());
2859
0
      pad->typeParameters.push_back(id);
2860
0
  }
2861
0
#line 2862 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
2862
0
    break;
2863
2864
0
  case 32:
2865
0
#line 1225 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
2866
0
  {
2867
0
      unoidl::detail::SourceProviderScannerData * data = yyget_extra(yyscanner);
2868
0
      data->publishedContext = (yyvsp[-3].bval);
2869
0
      convertToCurrentName(data, (yyvsp[-1].sval));
2870
0
      OUString baseName;
2871
0
      rtl::Reference<unoidl::ExceptionTypeEntity> baseEnt;
2872
0
      if ((yyvsp[0].sval) != nullptr) {
2873
0
          baseName = convertName((yyvsp[0].sval));
2874
0
          unoidl::detail::SourceProviderEntity const * p;
2875
0
          if (findEntity(
2876
0
                  (yylsp[0]), yyscanner, data, false, &baseName, &p, nullptr, nullptr)
2877
0
              == FOUND_ERROR)
2878
0
          {
2879
0
              YYERROR;
2880
0
          }
2881
0
          if (p == nullptr || !p->entity.is()
2882
0
              || p->entity->getSort() != unoidl::Entity::SORT_EXCEPTION_TYPE)
2883
0
          {
2884
0
              error(
2885
0
                  (yylsp[0]), yyscanner,
2886
0
                  ("exception type " + data->currentName + " base " + baseName
2887
0
                   + " does not resolve to an existing exception type"));
2888
0
              YYERROR;
2889
0
          }
2890
0
          baseEnt = static_cast<unoidl::ExceptionTypeEntity *>(
2891
0
              p->entity.get());
2892
0
          if ((yyvsp[-3].bval) && !baseEnt->isPublished()) {
2893
0
              error(
2894
0
                  (yylsp[0]), yyscanner,
2895
0
                  ("published exception type " + data->currentName + " base "
2896
0
                   + baseName + " is unpublished"));
2897
0
              YYERROR;
2898
0
          }
2899
0
      }
2900
0
      if (!data->entities.emplace(
2901
0
                  data->currentName,
2902
0
                  unoidl::detail::SourceProviderEntity(
2903
0
                      new unoidl::detail::SourceProviderExceptionTypeEntityPad(
2904
0
                          (yyvsp[-3].bval), baseName, baseEnt))).
2905
0
          second)
2906
0
      {
2907
0
          error((yylsp[-1]), yyscanner, "multiple entities named " + data->currentName);
2908
0
          YYERROR;
2909
0
      }
2910
0
  }
2911
0
#line 2912 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
2912
0
    break;
2913
2914
0
  case 33:
2915
0
#line 1271 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
2916
0
  {
2917
0
      unoidl::detail::SourceProviderScannerData * data = yyget_extra(yyscanner);
2918
0
      unoidl::detail::SourceProviderEntity * ent = getCurrentEntity(data);
2919
0
      unoidl::detail::SourceProviderExceptionTypeEntityPad * pad =
2920
0
          dynamic_cast<unoidl::detail::SourceProviderExceptionTypeEntityPad *>(
2921
0
              ent->pad.get());
2922
0
      assert(pad != nullptr);
2923
0
      ent->entity = new unoidl::ExceptionTypeEntity(
2924
0
          pad->isPublished(), pad->baseName, std::move(pad->members), annotations((yyvsp[-9].bval)));
2925
0
      ent->pad.clear();
2926
0
      clearCurrentState(data);
2927
0
  }
2928
0
#line 2929 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
2929
0
    break;
2930
2931
0
  case 36:
2932
0
#line 1292 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
2933
0
  {
2934
0
      unoidl::detail::SourceProviderScannerData * data = yyget_extra(yyscanner);
2935
0
      unoidl::detail::SourceProviderType t(*(yyvsp[-2].type));
2936
0
      delete (yyvsp[-2].type);
2937
0
      OUString id(convertName((yyvsp[-1].sval)));
2938
0
      switch (t.type) {
2939
0
      case unoidl::detail::SourceProviderType::TYPE_VOID:
2940
0
      case unoidl::detail::SourceProviderType::TYPE_EXCEPTION:
2941
0
          error(
2942
0
              (yylsp[-2]), yyscanner,
2943
0
              ("illegal struct/exception type " + data->currentName
2944
0
               + " direct member " + id + " type"));
2945
0
          YYERROR;
2946
0
          break;
2947
0
      default:
2948
0
          break;
2949
0
      }
2950
0
      if (t.type != unoidl::detail::SourceProviderType::TYPE_PARAMETER
2951
0
          && t.getName() == data->currentName) // no need to worry about typedef
2952
0
      {
2953
0
          error(
2954
0
              (yylsp[-2]), yyscanner,
2955
0
              ("struct/exception type " + data->currentName + " direct member "
2956
0
               + id + " has same type as the type itself"));
2957
0
          YYERROR;
2958
0
      }
2959
0
      if (checkInstantiatedPolymorphicStructTypeArgument(t, data->currentName))
2960
0
      {
2961
0
          error(
2962
0
              (yylsp[-2]), yyscanner,
2963
0
              ("struct/exception type " + data->currentName + " direct member "
2964
0
               + id
2965
0
               + (" has instantiated polymorphic struct type that uses the type"
2966
0
                  " itself as an argument")));
2967
0
          YYERROR;
2968
0
      }
2969
0
      if (nameHasSameIdentifierAs(data->currentName, id)) {
2970
0
          error(
2971
0
              (yylsp[-1]), yyscanner,
2972
0
              ("struct/exception type " + data->currentName + " direct member "
2973
0
               + id + " has same unqualified identifier as the type itself"));
2974
0
          YYERROR;
2975
0
      }
2976
0
      unoidl::detail::SourceProviderEntity * ent = getCurrentEntity(data);
2977
0
      unoidl::detail::SourceProviderPlainStructTypeEntityPad * p1 =
2978
0
          dynamic_cast<unoidl::detail::SourceProviderPlainStructTypeEntityPad *>(
2979
0
              ent->pad.get());
2980
0
      if (p1 != nullptr) {
2981
0
          for (const auto & i: p1->members) {
2982
0
              if (id == i.name) {
2983
0
                  error(
2984
0
                      (yylsp[-1]), yyscanner,
2985
0
                      ("plain struct type " + data->currentName
2986
0
                       + " direct member " + id
2987
0
                       + " has same identifier as another direct member"));
2988
0
                  YYERROR;
2989
0
              }
2990
0
          }
2991
0
          if (p1->baseEntity.is()) {
2992
0
              OUString baseName(p1->baseName);
2993
0
              for (auto baseEnt(p1->baseEntity);;) {
2994
0
                  if (nameHasSameIdentifierAs(baseName, id)) {
2995
0
                      error(
2996
0
                          (yylsp[-1]), yyscanner,
2997
0
                          ("plain struct type " + data->currentName
2998
0
                           + " direct member " + id
2999
0
                           + " has same unqalified identifier as base "
3000
0
                           + baseName));
3001
0
                      YYERROR;
3002
0
                  }
3003
0
                  for (auto & i: baseEnt->getDirectMembers()) {
3004
0
                      if (id == i.name) {
3005
0
                          error(
3006
0
                              (yylsp[-1]), yyscanner,
3007
0
                              ("plain struct type " + data->currentName
3008
0
                               + " direct member " + id
3009
0
                               + " has same identifier as a member of base "
3010
0
                               + baseName));
3011
0
                          YYERROR;
3012
0
                      }
3013
0
                  }
3014
0
                  baseName = baseEnt->getDirectBase();
3015
0
                  if (baseName.isEmpty()) {
3016
0
                      break;
3017
0
                  }
3018
0
                  unoidl::detail::SourceProviderEntity const * p;
3019
0
                  if (findEntity(
3020
0
                          (yylsp[-2]), yyscanner, data, false, &baseName, &p, nullptr,
3021
0
                          nullptr)
3022
0
                      == FOUND_ERROR)
3023
0
                  {
3024
0
                      YYERROR;
3025
0
                  }
3026
0
                  if (p == nullptr || !p->entity.is()
3027
0
                      || (p->entity->getSort()
3028
0
                          != unoidl::Entity::SORT_PLAIN_STRUCT_TYPE))
3029
0
                  {
3030
0
                      error(
3031
0
                          (yylsp[-2]), yyscanner,
3032
0
                          ("inconsistent type manager: plain struct type "
3033
0
                           + data->currentName + " base " + baseName
3034
0
                           + (" does not resolve to an existing plain struct"
3035
0
                              " type")));
3036
0
                      YYERROR;
3037
0
                  }
3038
0
                  baseEnt = static_cast<unoidl::PlainStructTypeEntity *>(
3039
0
                      p->entity.get());
3040
0
              }
3041
0
          }
3042
0
          p1->members.emplace_back(id, t.getName(), annotations((yyvsp[-3].bval)));
3043
0
      } else {
3044
0
          unoidl::detail::SourceProviderPolymorphicStructTypeTemplateEntityPad *
3045
0
              p2 = dynamic_cast<unoidl::detail::SourceProviderPolymorphicStructTypeTemplateEntityPad *>(
3046
0
                  ent->pad.get());
3047
0
          if (p2 != nullptr) {
3048
0
              for (const auto & i: p2->members) {
3049
0
                  if (id == i.name) {
3050
0
                      error(
3051
0
                          (yylsp[-1]), yyscanner,
3052
0
                          ("polymorphic struct type template "
3053
0
                           + data->currentName + " direct member " + id
3054
0
                           + " has same identifier as another direct member"));
3055
0
                      YYERROR;
3056
0
                  }
3057
0
              }
3058
0
              p2->members.emplace_back(
3059
0
                  id, t.getName(),
3060
0
                  t.type == unoidl::detail::SourceProviderType::TYPE_PARAMETER,
3061
0
                  annotations((yyvsp[-3].bval)));
3062
0
          } else {
3063
0
              unoidl::detail::SourceProviderExceptionTypeEntityPad * p3
3064
0
                  = dynamic_cast<unoidl::detail::SourceProviderExceptionTypeEntityPad *>(
3065
0
                      ent->pad.get());
3066
0
              assert(p3 != nullptr);
3067
0
              for (const auto & i: p3->members) {
3068
0
                  if (id == i.name) {
3069
0
                      error(
3070
0
                          (yylsp[-1]), yyscanner,
3071
0
                          ("exception type " + data->currentName
3072
0
                           + " direct member " + id
3073
0
                           + " has same identifier as another direct member"));
3074
0
                      YYERROR;
3075
0
                  }
3076
0
              }
3077
0
              if (p3->baseEntity.is()) {
3078
0
                  OUString baseName(p3->baseName);
3079
0
                  for (auto baseEnt(p3->baseEntity);;) {
3080
0
                      if (nameHasSameIdentifierAs(baseName, id)) {
3081
0
                          error(
3082
0
                              (yylsp[-1]), yyscanner,
3083
0
                              ("exception type " + data->currentName
3084
0
                               + " direct member " + id
3085
0
                               + " has same unqalified identifier as base "
3086
0
                               + baseName));
3087
0
                          YYERROR;
3088
0
                      }
3089
0
                      for (auto & i: baseEnt->getDirectMembers()) {
3090
0
                          if (id == i.name) {
3091
0
                              error(
3092
0
                                  (yylsp[-1]), yyscanner,
3093
0
                                  ("exception type " + data->currentName
3094
0
                                   + " direct member " + id
3095
0
                                   + " has same identifier as a member of base "
3096
0
                                   + baseName));
3097
0
                              YYERROR;
3098
0
                          }
3099
0
                      }
3100
0
                      baseName = baseEnt->getDirectBase();
3101
0
                      if (baseName.isEmpty()) {
3102
0
                          break;
3103
0
                      }
3104
0
                      unoidl::detail::SourceProviderEntity const * p;
3105
0
                      if (findEntity(
3106
0
                              (yylsp[-2]), yyscanner, data, false, &baseName, &p,
3107
0
                              nullptr, nullptr)
3108
0
                          == FOUND_ERROR)
3109
0
                      {
3110
0
                          YYERROR;
3111
0
                      }
3112
0
                      if (p == nullptr || !p->entity.is()
3113
0
                          || (p->entity->getSort()
3114
0
                              != unoidl::Entity::SORT_EXCEPTION_TYPE))
3115
0
                      {
3116
0
                          error(
3117
0
                              (yylsp[-2]), yyscanner,
3118
0
                              ("inconsistent type manager: exception type "
3119
0
                               + data->currentName + " base " + baseName
3120
0
                               + (" does not resolve to an existing exception"
3121
0
                                  " type")));
3122
0
                          YYERROR;
3123
0
                      }
3124
0
                      baseEnt = static_cast<unoidl::ExceptionTypeEntity *>(
3125
0
                          p->entity.get());
3126
0
                  }
3127
0
              }
3128
0
              p3->members.emplace_back(id, t.getName(), annotations((yyvsp[-3].bval)));
3129
0
          }
3130
0
      }
3131
0
  }
3132
0
#line 3133 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
3133
0
    break;
3134
3135
0
  case 37:
3136
0
#line 1495 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
3137
0
  {
3138
0
      unoidl::detail::SourceProviderScannerData * data = yyget_extra(yyscanner);
3139
0
      data->publishedContext = (yyvsp[-3].bval);
3140
0
      convertToCurrentName(data, (yyvsp[-1].sval));
3141
0
      OUString baseName;
3142
0
      rtl::Reference<unoidl::InterfaceTypeEntity> baseEnt;
3143
0
      if ((yyvsp[0].sval) != nullptr) {
3144
0
          baseName = convertName((yyvsp[0].sval));
3145
0
          unoidl::detail::SourceProviderEntity const * p;
3146
0
          if (findEntity(
3147
0
                  (yylsp[0]), yyscanner, data, true, &baseName, &p, nullptr, nullptr)
3148
0
              == FOUND_ERROR)
3149
0
          {
3150
0
              YYERROR;
3151
0
          }
3152
0
          if (p == nullptr || !p->entity.is()
3153
0
              || p->entity->getSort() != unoidl::Entity::SORT_INTERFACE_TYPE)
3154
0
          {
3155
0
              error(
3156
0
                  (yylsp[0]), yyscanner,
3157
0
                  ("interface type " + data->currentName + " direct base "
3158
0
                   + baseName
3159
0
                   + " does not resolve to an existing interface type"));
3160
0
              YYERROR;
3161
0
          }
3162
0
          baseEnt = static_cast<unoidl::InterfaceTypeEntity *>(p->entity.get());
3163
0
          if ((yyvsp[-3].bval) && !baseEnt->isPublished()) {
3164
0
              error(
3165
0
                  (yylsp[0]), yyscanner,
3166
0
                  ("published interface type " + data->currentName
3167
0
                   + " direct base " + baseName + " is unpublished"));
3168
0
              YYERROR;
3169
0
          }
3170
0
      }
3171
0
      std::map<OUString, unoidl::detail::SourceProviderEntity>::iterator i(
3172
0
          data->entities.find(data->currentName));
3173
0
      if (i != data->entities.end()) {
3174
0
          switch (i->second.kind) {
3175
0
          case unoidl::detail::SourceProviderEntity::KIND_INTERFACE_DECL:
3176
0
              break;
3177
0
          case unoidl::detail::SourceProviderEntity::KIND_PUBLISHED_INTERFACE_DECL:
3178
0
              if (!(yyvsp[-3].bval)) {
3179
0
                  error(
3180
0
                      (yylsp[-1]), yyscanner,
3181
0
                      ("unpublished interface type " + data->currentName
3182
0
                       + " has been declared published"));
3183
0
                  YYERROR;
3184
0
              }
3185
0
              break;
3186
0
          default:
3187
0
              error(
3188
0
                  (yylsp[-1]), yyscanner,
3189
0
                  "multiple entities named " + data->currentName);
3190
0
              YYERROR;
3191
0
              break;
3192
0
          }
3193
0
      }
3194
0
      rtl::Reference<unoidl::detail::SourceProviderInterfaceTypeEntityPad> pad(
3195
0
          new unoidl::detail::SourceProviderInterfaceTypeEntityPad(
3196
0
              (yyvsp[-3].bval), baseEnt.is()));
3197
0
      if (baseEnt.is()
3198
0
          && !pad->addDirectBase(
3199
0
              (yylsp[-1]), yyscanner, data,
3200
0
              unoidl::detail::SourceProviderInterfaceTypeEntityPad::DirectBase(
3201
0
                  baseName, baseEnt, std::vector<OUString>()),
3202
0
              false))
3203
0
      {
3204
0
          YYERROR;
3205
0
      }
3206
0
      data->entities[data->currentName] = unoidl::detail::SourceProviderEntity(
3207
0
          pad);
3208
0
  }
3209
0
#line 3210 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
3210
0
    break;
3211
3212
0
  case 38:
3213
0
#line 1568 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
3214
0
  {
3215
0
      unoidl::detail::SourceProviderScannerData * data = yyget_extra(yyscanner);
3216
0
      unoidl::detail::SourceProviderEntity * ent = getCurrentEntity(data);
3217
0
      unoidl::detail::SourceProviderInterfaceTypeEntityPad * pad =
3218
0
          dynamic_cast<unoidl::detail::SourceProviderInterfaceTypeEntityPad *>(
3219
0
              ent->pad.get());
3220
0
      assert(pad != nullptr);
3221
0
      if (pad->directMandatoryBases.empty()
3222
0
          && data->currentName != "com.sun.star.uno.XInterface")
3223
0
      {
3224
0
          OUString base(u".com.sun.star.uno.XInterface"_ustr);
3225
0
          unoidl::detail::SourceProviderEntity const * p;
3226
0
          if (findEntity((yylsp[-6]), yyscanner, data, true, &base, &p, nullptr, nullptr)
3227
0
              == FOUND_ERROR)
3228
0
          {
3229
0
              YYERROR;
3230
0
          }
3231
0
          if (p == nullptr || !p->entity.is()
3232
0
              || p->entity->getSort() != unoidl::Entity::SORT_INTERFACE_TYPE)
3233
0
          {
3234
0
              error(
3235
0
                  (yylsp[-7]), yyscanner,
3236
0
                  ("interface type " + data->currentName
3237
0
                   + " implicit direct base " + base
3238
0
                   + " does not resolve to an existing interface type"));
3239
0
              YYERROR;
3240
0
          }
3241
0
          if (!pad->addDirectBase(
3242
0
                  (yylsp[-7]), yyscanner, data,
3243
0
                  unoidl::detail::SourceProviderInterfaceTypeEntityPad::DirectBase(
3244
0
                      base,
3245
0
                      static_cast<unoidl::InterfaceTypeEntity *>(
3246
0
                          p->entity.get()),
3247
0
                      std::vector<OUString>()),
3248
0
                  false))
3249
0
          {
3250
0
              YYERROR;
3251
0
          }
3252
0
      }
3253
0
      std::vector<unoidl::AnnotatedReference> mbases;
3254
0
      for (auto & i: pad->directMandatoryBases) {
3255
0
          mbases.emplace_back(i.name, std::move(i.annotations));
3256
0
      }
3257
0
      std::vector<unoidl::AnnotatedReference> obases;
3258
0
      for (auto & i: pad->directOptionalBases) {
3259
0
          obases.emplace_back(i.name, std::move(i.annotations));
3260
0
      }
3261
0
      ent->entity = new unoidl::InterfaceTypeEntity(
3262
0
          pad->isPublished(), std::move(mbases), std::move(obases), std::move(pad->directAttributes),
3263
0
          std::move(pad->directMethods), annotations((yyvsp[-9].bval)));
3264
0
      ent->pad.clear();
3265
0
      clearCurrentState(data);
3266
0
  }
3267
0
#line 3268 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
3268
0
    break;
3269
3270
0
  case 44:
3271
0
#line 1636 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
3272
0
  {
3273
0
      unoidl::detail::SourceProviderScannerData * data = yyget_extra(yyscanner);
3274
0
      OUString name(convertName((yyvsp[-1].sval)));
3275
0
      rtl::Reference<unoidl::detail::SourceProviderInterfaceTypeEntityPad> pad(
3276
0
          getCurrentPad<unoidl::detail::SourceProviderInterfaceTypeEntityPad>(
3277
0
              data));
3278
0
      if (pad->singleBase) {
3279
0
          error(
3280
0
              (yylsp[-2]), yyscanner,
3281
0
              u"single-inheritance interface cannot have additional bases"_ustr);
3282
0
          YYERROR;
3283
0
      }
3284
0
      if (((yyvsp[-3].flags) & ~unoidl::detail::FLAG_OPTIONAL) != 0) {
3285
0
          error(
3286
0
              (yylsp[-3]), yyscanner,
3287
0
              u"interface base can only be flagged as [optional]"_ustr);
3288
0
          YYERROR;
3289
0
      }
3290
0
      bool opt = ((yyvsp[-3].flags) & unoidl::detail::FLAG_OPTIONAL) != 0;
3291
0
      OUString orgName(name);
3292
0
      unoidl::detail::SourceProviderEntity const * p;
3293
0
      bool typedefed = false;
3294
0
      if (findEntity((yylsp[-1]), yyscanner, data, true, &name, &p, &typedefed, nullptr)
3295
0
          == FOUND_ERROR)
3296
0
      {
3297
0
          YYERROR;
3298
0
      }
3299
0
      if (p == nullptr || !p->entity.is()
3300
0
          || p->entity->getSort() != unoidl::Entity::SORT_INTERFACE_TYPE)
3301
0
      {
3302
0
          error(
3303
0
              (yylsp[-1]), yyscanner,
3304
0
              ("interface type " + data->currentName + " direct base " + name
3305
0
               + " does not resolve to an existing interface type"));
3306
0
          YYERROR;
3307
0
      }
3308
0
      if (typedefed) {
3309
0
          error(
3310
0
              (yylsp[-1]), yyscanner,
3311
0
              ("interface type " + data->currentName + " direct base " + orgName
3312
0
               + " is a typedef"));
3313
0
          YYERROR;
3314
0
      }
3315
0
      rtl::Reference<unoidl::InterfaceTypeEntity> ent(
3316
0
          static_cast<unoidl::InterfaceTypeEntity *>(p->entity.get()));
3317
0
      if (data->publishedContext && !ent->isPublished()) {
3318
0
          error(
3319
0
              (yylsp[-1]), yyscanner,
3320
0
              ("published interface type " + data->currentName + " direct base "
3321
0
               + name + " is unpublished"));
3322
0
          YYERROR;
3323
0
      }
3324
0
      if (!pad->addDirectBase(
3325
0
              (yylsp[-1]), yyscanner, data,
3326
0
              unoidl::detail::SourceProviderInterfaceTypeEntityPad::DirectBase(
3327
0
                  name, ent, annotations((yyvsp[-4].bval))),
3328
0
              opt))
3329
0
      {
3330
0
          YYERROR;
3331
0
      }
3332
0
  }
3333
0
#line 3334 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
3334
0
    break;
3335
3336
0
  case 45:
3337
0
#line 1701 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
3338
0
  {
3339
0
      unoidl::detail::SourceProviderScannerData * data = yyget_extra(yyscanner);
3340
0
      unoidl::detail::SourceProviderType t(*(yyvsp[-1].type));
3341
0
      delete (yyvsp[-1].type);
3342
0
      OUString id(convertName((yyvsp[0].sval)));
3343
0
      if (((yyvsp[-2].flags) & unoidl::detail::FLAG_ATTRIBUTE) == 0) {
3344
0
          error(
3345
0
              (yylsp[-2]), yyscanner,
3346
0
              u"interface attribute must be flagged as [attribute]"_ustr);
3347
0
          YYERROR;
3348
0
      }
3349
0
      if (((yyvsp[-2].flags)
3350
0
           & ~(unoidl::detail::FLAG_ATTRIBUTE | unoidl::detail::FLAG_BOUND
3351
0
               | unoidl::detail::FLAG_READONLY))
3352
0
          != 0)
3353
0
      {
3354
0
          error(
3355
0
              (yylsp[-2]), yyscanner,
3356
0
              (u"interface attribute can only be flagged as [attribute,"
3357
0
               " bound, readonly]"_ustr));
3358
0
          YYERROR;
3359
0
      }
3360
0
      switch (t.type) {
3361
0
      case unoidl::detail::SourceProviderType::TYPE_VOID:
3362
0
      case unoidl::detail::SourceProviderType::TYPE_EXCEPTION:
3363
0
          error(
3364
0
              (yylsp[-1]), yyscanner,
3365
0
              ("illegal interface type " + data->currentName
3366
0
               + " direct attribute " + id + " type"));
3367
0
          YYERROR;
3368
0
          break;
3369
0
      default:
3370
0
          break;
3371
0
      }
3372
0
      rtl::Reference<unoidl::detail::SourceProviderInterfaceTypeEntityPad> pad(
3373
0
          getCurrentPad<unoidl::detail::SourceProviderInterfaceTypeEntityPad>(
3374
0
              data));
3375
0
      if (!pad->addDirectMember((yylsp[0]), yyscanner, data, id)) {
3376
0
          YYERROR;
3377
0
      }
3378
0
      pad->directAttributes.emplace_back(
3379
0
          id, t.getName(), ((yyvsp[-2].flags) & unoidl::detail::FLAG_BOUND) != 0,
3380
0
          ((yyvsp[-2].flags) & unoidl::detail::FLAG_READONLY) != 0,
3381
0
          std::vector<OUString>(), std::vector<OUString>(), annotations((yyvsp[-3].bval)));
3382
0
  }
3383
0
#line 3384 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
3384
0
    break;
3385
3386
0
  case 49:
3387
0
#line 1756 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
3388
0
  {
3389
0
      if (((yyvsp[-1].decls) & (yyvsp[0].decls)) != 0) {
3390
0
          error(
3391
0
              (yylsp[0]), yyscanner, u"duplicate get/set attribute access declaration"_ustr);
3392
0
          YYERROR;
3393
0
      }
3394
0
      (yyval.decls) = unoidl::detail::SourceProviderAccessDecls((yyvsp[-1].decls) | (yyvsp[0].decls));
3395
0
  }
3396
0
#line 3397 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
3397
0
    break;
3398
3399
0
  case 50:
3400
0
#line 1764 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
3401
0
              { (yyval.decls) = unoidl::detail::SourceProviderAccessDecls(0); }
3402
0
#line 3403 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
3403
0
    break;
3404
3405
0
  case 51:
3406
0
#line 1769 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
3407
0
  {
3408
0
      unoidl::detail::SourceProviderScannerData * data = yyget_extra(yyscanner);
3409
0
      rtl::Reference<unoidl::detail::SourceProviderInterfaceTypeEntityPad>
3410
0
          pad(getCurrentPad<unoidl::detail::SourceProviderInterfaceTypeEntityPad>(
3411
0
              data));
3412
0
      assert(!pad->directAttributes.empty());
3413
0
      pad->directAttributes.back().getExceptions = *(yyvsp[-1].excns);
3414
0
      delete (yyvsp[-1].excns);
3415
0
      (yyval.decls) = unoidl::detail::ACCESS_DECL_GET;
3416
0
  }
3417
0
#line 3418 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
3418
0
    break;
3419
3420
0
  case 52:
3421
0
#line 1780 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
3422
0
  {
3423
0
      unoidl::detail::SourceProviderScannerData * data = yyget_extra(yyscanner);
3424
0
      rtl::Reference<unoidl::detail::SourceProviderInterfaceTypeEntityPad>
3425
0
          pad(getCurrentPad<unoidl::detail::SourceProviderInterfaceTypeEntityPad>(
3426
0
              data));
3427
0
      assert(!pad->directAttributes.empty());
3428
0
      pad->directAttributes.back().setExceptions = *(yyvsp[-1].excns);
3429
0
      delete (yyvsp[-1].excns);
3430
0
      if (pad->directAttributes.back().readOnly) {
3431
0
          error(
3432
0
              (yylsp[-2]), yyscanner,
3433
0
              ("interface type " + data->currentName
3434
0
               + " direct read-only attribute "
3435
0
               + pad->directAttributes.back().name
3436
0
               + " cannot have set access declaration"));
3437
0
          YYERROR;
3438
0
      }
3439
0
      (yyval.decls) = unoidl::detail::ACCESS_DECL_SET;
3440
0
  }
3441
0
#line 3442 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
3442
0
    break;
3443
3444
0
  case 53:
3445
0
#line 1803 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
3446
0
  {
3447
0
      unoidl::detail::SourceProviderScannerData * data = yyget_extra(yyscanner);
3448
0
      unoidl::detail::SourceProviderType t(*(yyvsp[-1].type));
3449
0
      delete (yyvsp[-1].type);
3450
0
      OUString id(convertName((yyvsp[0].sval)));
3451
0
      if (t.type == unoidl::detail::SourceProviderType::TYPE_EXCEPTION) {
3452
0
          error(
3453
0
              (yylsp[0]), yyscanner,
3454
0
              ("illegal interface type " + data->currentName
3455
0
               + " direct method " + id + " return type"));
3456
0
          YYERROR;
3457
0
      }
3458
0
      rtl::Reference<unoidl::detail::SourceProviderInterfaceTypeEntityPad> pad(
3459
0
          getCurrentPad<unoidl::detail::SourceProviderInterfaceTypeEntityPad>(
3460
0
              data));
3461
0
      if (!pad->addDirectMember((yylsp[0]), yyscanner, data, id)) {
3462
0
          YYERROR;
3463
0
      }
3464
0
      pad->directMethods.emplace_back(
3465
0
          id, t.getName(),
3466
0
          std::vector<unoidl::InterfaceTypeEntity::Method::Parameter>(),
3467
0
          std::vector<OUString>(), annotations((yyvsp[-2].bval)));
3468
0
  }
3469
0
#line 3470 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
3470
0
    break;
3471
3472
0
  case 54:
3473
0
#line 1827 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
3474
0
  {
3475
0
      if ((yyvsp[-1].excns) != nullptr) {
3476
0
          unoidl::detail::SourceProviderScannerData * data
3477
0
              = yyget_extra(yyscanner);
3478
0
          rtl::Reference<unoidl::detail::SourceProviderInterfaceTypeEntityPad>
3479
0
              pad(getCurrentPad<unoidl::detail::SourceProviderInterfaceTypeEntityPad>(
3480
0
                  data));
3481
0
          assert(!pad->directMethods.empty());
3482
0
          pad->directMethods.back().exceptions = *(yyvsp[-1].excns);
3483
0
          delete (yyvsp[-1].excns);
3484
0
      }
3485
0
  }
3486
0
#line 3487 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
3487
0
    break;
3488
3489
0
  case 59:
3490
0
#line 1853 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
3491
0
  {
3492
0
      unoidl::detail::SourceProviderScannerData * data = yyget_extra(yyscanner);
3493
0
      unoidl::detail::SourceProviderType t(*(yyvsp[-1].type));
3494
0
      delete (yyvsp[-1].type);
3495
0
      OUString id(convertName((yyvsp[0].sval)));
3496
0
      rtl::Reference<unoidl::detail::SourceProviderInterfaceTypeEntityPad>
3497
0
          pad(getCurrentPad<unoidl::detail::SourceProviderInterfaceTypeEntityPad>(
3498
0
              data));
3499
0
      assert(!pad->directMethods.empty());
3500
0
      switch (t.type) {
3501
0
      case unoidl::detail::SourceProviderType::TYPE_VOID:
3502
0
      case unoidl::detail::SourceProviderType::TYPE_EXCEPTION:
3503
0
          error(
3504
0
              (yylsp[-1]), yyscanner,
3505
0
              ("illegal interface type " + data->currentName
3506
0
               + " direct method " + pad->directMethods.back().name
3507
0
               + " parameter " + id + " type"));
3508
0
          YYERROR;
3509
0
          break;
3510
0
      default:
3511
0
          break;
3512
0
      }
3513
0
      for (const auto & i: pad->directMethods.back().parameters) {
3514
0
          if (id == i.name) {
3515
0
              error(
3516
0
                  (yylsp[0]), yyscanner,
3517
0
                  ("interface type " + data->currentName + " direct method "
3518
0
                   + pad->directMethods.back().name + " parameter " + id
3519
0
                   + " has same identifier as another parameter"));
3520
0
              YYERROR;
3521
0
          }
3522
0
      }
3523
0
      pad->directMethods.back().parameters.emplace_back(id, t.getName(), (yyvsp[-3].dir));
3524
0
  }
3525
0
#line 3526 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
3526
0
    break;
3527
3528
0
  case 60:
3529
0
#line 1890 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
3530
0
         { (yyval.dir) = unoidl::InterfaceTypeEntity::Method::Parameter::DIRECTION_IN; }
3531
0
#line 3532 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
3532
0
    break;
3533
3534
0
  case 61:
3535
0
#line 1892 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
3536
0
  { (yyval.dir) = unoidl::InterfaceTypeEntity::Method::Parameter::DIRECTION_OUT; }
3537
0
#line 3538 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
3538
0
    break;
3539
3540
0
  case 62:
3541
0
#line 1894 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
3542
0
  { (yyval.dir) = unoidl::InterfaceTypeEntity::Method::Parameter::DIRECTION_IN_OUT; }
3543
0
#line 3544 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
3544
0
    break;
3545
3546
0
  case 63:
3547
0
#line 1899 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
3548
0
  {
3549
0
      unoidl::detail::SourceProviderScannerData * data = yyget_extra(yyscanner);
3550
0
      data->publishedContext = (yyvsp[-4].bval);
3551
0
      unoidl::detail::SourceProviderType t(*(yyvsp[-2].type));
3552
0
      delete (yyvsp[-2].type);
3553
0
      OUString name(convertToFullName(data, (yyvsp[-1].sval)));
3554
      // There is no good reason to forbid typedefs to VOID, to instantiated
3555
      // polymorphic struct types, and to exception types, but some old client
3556
      // code of registry data expects this typedef restriction (like the
3557
      // assert(false) default in handleTypedef in
3558
      // codemaker/source/javamaker/javatype.cxx), so forbid them for now:
3559
0
      switch (t.type) {
3560
0
      case unoidl::detail::SourceProviderType::TYPE_VOID:
3561
0
      case unoidl::detail::SourceProviderType::TYPE_EXCEPTION:
3562
0
      case unoidl::detail::SourceProviderType::TYPE_INSTANTIATED_POLYMORPHIC_STRUCT:
3563
0
          error((yylsp[-2]), yyscanner, u"bad typedef type"_ustr);
3564
0
          YYERROR;
3565
0
          break;
3566
0
      case unoidl::detail::SourceProviderType::TYPE_ENUM:
3567
0
      case unoidl::detail::SourceProviderType::TYPE_PLAIN_STRUCT:
3568
0
      case unoidl::detail::SourceProviderType::TYPE_INTERFACE:
3569
0
          if ((yyvsp[-4].bval)) {
3570
0
              bool unpub = false;
3571
0
              switch (t.entity->kind) {
3572
0
              case unoidl::detail::SourceProviderEntity::KIND_INTERFACE_DECL:
3573
0
                  unpub = true;
3574
0
                  break;
3575
0
              case unoidl::detail::SourceProviderEntity::KIND_PUBLISHED_INTERFACE_DECL:
3576
0
                  break;
3577
0
              case unoidl::detail::SourceProviderEntity::KIND_MODULE:
3578
0
                  O3TL_UNREACHABLE;
3579
0
              default:
3580
0
                  assert(t.entity->entity.is() || t.entity->pad.is());
3581
0
                  unpub
3582
0
                      = !(t.entity->entity.is()
3583
0
                          ? static_cast<unoidl::PublishableEntity *>(
3584
0
                              t.entity->entity.get())->isPublished()
3585
0
                          : t.entity->pad->isPublished());
3586
0
                  break;
3587
0
              }
3588
0
              if (unpub) {
3589
0
                  error(
3590
0
                      (yylsp[-2]), yyscanner,
3591
0
                      "published typedef " + name + " type is unpublished");
3592
0
                  YYERROR;
3593
0
              }
3594
0
          }
3595
0
          break;
3596
0
      case unoidl::detail::SourceProviderType::TYPE_PARAMETER:
3597
0
          O3TL_UNREACHABLE;
3598
0
      default:
3599
0
          break;
3600
0
      }
3601
0
      if (!data->entities.emplace(
3602
0
                  name,
3603
0
                  unoidl::detail::SourceProviderEntity(
3604
0
                      unoidl::detail::SourceProviderEntity::KIND_LOCAL,
3605
0
                      new unoidl::TypedefEntity(
3606
0
                          (yyvsp[-4].bval), t.getName(), annotations((yyvsp[-5].bval))))).
3607
0
          second)
3608
0
      {
3609
0
          error((yylsp[-1]), yyscanner, "multiple entities named " + name);
3610
0
          YYERROR;
3611
0
      }
3612
0
      clearCurrentState(data);
3613
0
  }
3614
0
#line 3615 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
3615
0
    break;
3616
3617
0
  case 64:
3618
0
#line 1969 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
3619
0
  {
3620
0
      unoidl::detail::SourceProviderScannerData * data = yyget_extra(yyscanner);
3621
0
      data->publishedContext = (yyvsp[-2].bval);
3622
0
      convertToCurrentName(data, (yyvsp[0].sval));
3623
0
      if (!data->entities.emplace(
3624
0
                  data->currentName,
3625
0
                  unoidl::detail::SourceProviderEntity(
3626
0
                      new unoidl::detail::SourceProviderConstantGroupEntityPad(
3627
0
                          (yyvsp[-2].bval)))).
3628
0
          second)
3629
0
      {
3630
0
          error((yylsp[0]), yyscanner, "multiple entities named " + data->currentName);
3631
0
          YYERROR;
3632
0
      }
3633
0
  }
3634
0
#line 3635 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
3635
0
    break;
3636
3637
0
  case 65:
3638
0
#line 1985 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
3639
0
  {
3640
0
      unoidl::detail::SourceProviderScannerData * data = yyget_extra(yyscanner);
3641
0
      unoidl::detail::SourceProviderEntity * ent = getCurrentEntity(data);
3642
0
      unoidl::detail::SourceProviderConstantGroupEntityPad * pad =
3643
0
          dynamic_cast<unoidl::detail::SourceProviderConstantGroupEntityPad *>(
3644
0
              ent->pad.get());
3645
0
      assert(pad != nullptr);
3646
0
      ent->entity = new unoidl::ConstantGroupEntity(
3647
0
          pad->isPublished(), std::move(pad->members), annotations((yyvsp[-8].bval)));
3648
0
      ent->pad.clear();
3649
0
      clearCurrentState(data);
3650
0
  }
3651
0
#line 3652 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
3652
0
    break;
3653
3654
0
  case 68:
3655
0
#line 2006 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
3656
0
  {
3657
0
      OUString id(convertName((yyvsp[-3].sval)));
3658
0
      unoidl::detail::SourceProviderScannerData * data = yyget_extra(yyscanner);
3659
0
      rtl::Reference<unoidl::detail::SourceProviderConstantGroupEntityPad> pad(
3660
0
          getCurrentPad<unoidl::detail::SourceProviderConstantGroupEntityPad>(
3661
0
              data));
3662
0
      unoidl::detail::SourceProviderType t(*(yyvsp[-4].type));
3663
0
      delete (yyvsp[-4].type);
3664
0
      unoidl::ConstantValue v(false); // dummy value
3665
0
      switch (t.type) {
3666
0
      case unoidl::detail::SourceProviderType::TYPE_BOOLEAN:
3667
0
          if ((yyvsp[-1].expr).type != unoidl::detail::SourceProviderExpr::TYPE_BOOL) {
3668
0
              error(
3669
0
                  (yylsp[-1]), yyscanner,
3670
0
                  ("bad value of boolean-typed constant " + data->currentName
3671
0
                   + "." + id));
3672
0
              YYERROR;
3673
0
          }
3674
0
          v = unoidl::ConstantValue((yyvsp[-1].expr).bval);
3675
0
          break;
3676
0
      case unoidl::detail::SourceProviderType::TYPE_BYTE:
3677
0
          switch ((yyvsp[-1].expr).type) {
3678
0
          case unoidl::detail::SourceProviderExpr::TYPE_INT:
3679
0
              if ((yyvsp[-1].expr).ival < SAL_MIN_INT8 || (yyvsp[-1].expr).ival > SAL_MAX_INT8) {
3680
0
                  error(
3681
0
                      (yylsp[-1]), yyscanner,
3682
0
                      ("out-of-range byte-typed constant " + data->currentName
3683
0
                       + "." + id + " value " + OUString::number((yyvsp[-1].expr).ival)));
3684
0
                  YYERROR;
3685
0
              }
3686
0
              v = unoidl::ConstantValue(static_cast<sal_Int8>((yyvsp[-1].expr).ival));
3687
0
              break;
3688
0
          case unoidl::detail::SourceProviderExpr::TYPE_UINT:
3689
0
              if ((yyvsp[-1].expr).uval > SAL_MAX_INT8) {
3690
0
                  error(
3691
0
                      (yylsp[-1]), yyscanner,
3692
0
                      ("out-of-range byte-typed constant " + data->currentName
3693
0
                       + "." + id + " value " + OUString::number((yyvsp[-1].expr).uval)));
3694
0
                  YYERROR;
3695
0
              }
3696
0
              v = unoidl::ConstantValue(static_cast<sal_Int8>((yyvsp[-1].expr).uval));
3697
0
              break;
3698
0
          default:
3699
0
              error(
3700
0
                  (yylsp[-1]), yyscanner,
3701
0
                  ("bad value of byte-typed constant " + data->currentName + "."
3702
0
                   + id));
3703
0
              YYERROR;
3704
0
              break;
3705
0
          }
3706
0
          break;
3707
0
      case unoidl::detail::SourceProviderType::TYPE_SHORT:
3708
0
          switch ((yyvsp[-1].expr).type) {
3709
0
          case unoidl::detail::SourceProviderExpr::TYPE_INT:
3710
0
              if ((yyvsp[-1].expr).ival < SAL_MIN_INT16 || (yyvsp[-1].expr).ival > SAL_MAX_INT16) {
3711
0
                  error(
3712
0
                      (yylsp[-1]), yyscanner,
3713
0
                      ("out-of-range short-typed constant " + data->currentName
3714
0
                       + "." + id + " value " + OUString::number((yyvsp[-1].expr).ival)));
3715
0
                  YYERROR;
3716
0
              }
3717
0
              v = unoidl::ConstantValue(static_cast<sal_Int16>((yyvsp[-1].expr).ival));
3718
0
              break;
3719
0
          case unoidl::detail::SourceProviderExpr::TYPE_UINT:
3720
0
              if ((yyvsp[-1].expr).uval > SAL_MAX_INT16) {
3721
0
                  error(
3722
0
                      (yylsp[-1]), yyscanner,
3723
0
                      ("out-of-range short-typed constant " + data->currentName
3724
0
                       + "." + id + " value " + OUString::number((yyvsp[-1].expr).uval)));
3725
0
                  YYERROR;
3726
0
              }
3727
0
              v = unoidl::ConstantValue(static_cast<sal_Int16>((yyvsp[-1].expr).uval));
3728
0
              break;
3729
0
          default:
3730
0
              error(
3731
0
                  (yylsp[-1]), yyscanner,
3732
0
                  ("bad value of short-typed constant " + data->currentName
3733
0
                   + "." + id));
3734
0
              YYERROR;
3735
0
              break;
3736
0
          }
3737
0
          break;
3738
0
      case unoidl::detail::SourceProviderType::TYPE_UNSIGNED_SHORT:
3739
0
          switch ((yyvsp[-1].expr).type) {
3740
0
          case unoidl::detail::SourceProviderExpr::TYPE_INT:
3741
0
              if ((yyvsp[-1].expr).ival < 0 || (yyvsp[-1].expr).ival > SAL_MAX_UINT16) {
3742
0
                  error(
3743
0
                      (yylsp[-1]), yyscanner,
3744
0
                      ("out-of-range unsigned-short-typed constant "
3745
0
                       + data->currentName + "." + id + " value "
3746
0
                       + OUString::number((yyvsp[-1].expr).ival)));
3747
0
                  YYERROR;
3748
0
              }
3749
0
              v = unoidl::ConstantValue(static_cast<sal_uInt16>((yyvsp[-1].expr).ival));
3750
0
              break;
3751
0
          case unoidl::detail::SourceProviderExpr::TYPE_UINT:
3752
0
              if ((yyvsp[-1].expr).uval > SAL_MAX_UINT16) {
3753
0
                  error(
3754
0
                      (yylsp[-1]), yyscanner,
3755
0
                      ("out-of-range unsigned-short-typed constant "
3756
0
                       + data->currentName + "." + id + " value "
3757
0
                       + OUString::number((yyvsp[-1].expr).uval)));
3758
0
                  YYERROR;
3759
0
              }
3760
0
              v = unoidl::ConstantValue(static_cast<sal_uInt16>((yyvsp[-1].expr).uval));
3761
0
              break;
3762
0
          default:
3763
0
              error(
3764
0
                  (yylsp[-1]), yyscanner,
3765
0
                  ("bad value of unsigned-short-typed constant "
3766
0
                   + data->currentName + "." + id));
3767
0
              YYERROR;
3768
0
              break;
3769
0
          }
3770
0
          break;
3771
0
      case unoidl::detail::SourceProviderType::TYPE_LONG:
3772
0
          switch ((yyvsp[-1].expr).type) {
3773
0
          case unoidl::detail::SourceProviderExpr::TYPE_INT:
3774
0
              if ((yyvsp[-1].expr).ival < SAL_MIN_INT32 || (yyvsp[-1].expr).ival > SAL_MAX_INT32) {
3775
0
                  error(
3776
0
                      (yylsp[-1]), yyscanner,
3777
0
                      ("out-of-range long-typed constant " + data->currentName
3778
0
                       + "." + id + " value " + OUString::number((yyvsp[-1].expr).ival)));
3779
0
                  YYERROR;
3780
0
              }
3781
0
              v = unoidl::ConstantValue(static_cast<sal_Int32>((yyvsp[-1].expr).ival));
3782
0
              break;
3783
0
          case unoidl::detail::SourceProviderExpr::TYPE_UINT:
3784
0
              if ((yyvsp[-1].expr).uval > SAL_MAX_INT32) {
3785
0
                  error(
3786
0
                      (yylsp[-1]), yyscanner,
3787
0
                      ("out-of-range long-typed constant " + data->currentName
3788
0
                       + "." + id + " value " + OUString::number((yyvsp[-1].expr).uval)));
3789
0
                  YYERROR;
3790
0
              }
3791
0
              v = unoidl::ConstantValue(static_cast<sal_Int32>((yyvsp[-1].expr).uval));
3792
0
              break;
3793
0
          default:
3794
0
              error(
3795
0
                  (yylsp[-1]), yyscanner,
3796
0
                  ("bad value of long-typed constant " + data->currentName
3797
0
                   + "." + id));
3798
0
              YYERROR;
3799
0
              break;
3800
0
          }
3801
0
          break;
3802
0
      case unoidl::detail::SourceProviderType::TYPE_UNSIGNED_LONG:
3803
0
          switch ((yyvsp[-1].expr).type) {
3804
0
          case unoidl::detail::SourceProviderExpr::TYPE_INT:
3805
0
              if ((yyvsp[-1].expr).ival < 0 || (yyvsp[-1].expr).ival > SAL_MAX_UINT32) {
3806
0
                  error(
3807
0
                      (yylsp[-1]), yyscanner,
3808
0
                      ("out-of-range unsigned-long-typed constant "
3809
0
                       + data->currentName + "." + id + " value "
3810
0
                       + OUString::number((yyvsp[-1].expr).ival)));
3811
0
                  YYERROR;
3812
0
              }
3813
0
              v = unoidl::ConstantValue(static_cast<sal_uInt32>((yyvsp[-1].expr).ival));
3814
0
              break;
3815
0
          case unoidl::detail::SourceProviderExpr::TYPE_UINT:
3816
0
              if ((yyvsp[-1].expr).uval > SAL_MAX_UINT32) {
3817
0
                  error(
3818
0
                      (yylsp[-1]), yyscanner,
3819
0
                      ("out-of-range unsigned-long-typed constant "
3820
0
                       + data->currentName + "." + id + " value "
3821
0
                       + OUString::number((yyvsp[-1].expr).uval)));
3822
0
                  YYERROR;
3823
0
              }
3824
0
              v = unoidl::ConstantValue(static_cast<sal_uInt32>((yyvsp[-1].expr).uval));
3825
0
              break;
3826
0
          default:
3827
0
              error(
3828
0
                  (yylsp[-1]), yyscanner,
3829
0
                  ("bad value of unsigned-long-typed constant "
3830
0
                   + data->currentName + "." + id));
3831
0
              YYERROR;
3832
0
              break;
3833
0
          }
3834
0
          break;
3835
0
      case unoidl::detail::SourceProviderType::TYPE_HYPER:
3836
0
          switch ((yyvsp[-1].expr).type) {
3837
0
          case unoidl::detail::SourceProviderExpr::TYPE_INT:
3838
0
              v = unoidl::ConstantValue((yyvsp[-1].expr).ival);
3839
0
              break;
3840
0
          case unoidl::detail::SourceProviderExpr::TYPE_UINT:
3841
0
              if ((yyvsp[-1].expr).uval > SAL_MAX_INT64) {
3842
0
                  error(
3843
0
                      (yylsp[-1]), yyscanner,
3844
0
                      ("out-of-range hyper-typed constant " + data->currentName
3845
0
                       + "." + id + " value " + OUString::number((yyvsp[-1].expr).uval)));
3846
0
                  YYERROR;
3847
0
              }
3848
0
              v = unoidl::ConstantValue(static_cast<sal_Int64>((yyvsp[-1].expr).uval));
3849
0
              break;
3850
0
          default:
3851
0
              error(
3852
0
                  (yylsp[-1]), yyscanner,
3853
0
                  ("bad value of hyper-typed constant " + data->currentName
3854
0
                   + "." + id));
3855
0
              YYERROR;
3856
0
              break;
3857
0
          }
3858
0
          break;
3859
0
      case unoidl::detail::SourceProviderType::TYPE_UNSIGNED_HYPER:
3860
0
          switch ((yyvsp[-1].expr).type) {
3861
0
          case unoidl::detail::SourceProviderExpr::TYPE_INT:
3862
0
              if ((yyvsp[-1].expr).ival < 0) {
3863
0
                  error(
3864
0
                      (yylsp[-1]), yyscanner,
3865
0
                      ("out-of-range unsigned-hyper-typed constant "
3866
0
                       + data->currentName + "." + id + " value "
3867
0
                       + OUString::number((yyvsp[-1].expr).ival)));
3868
0
                  YYERROR;
3869
0
              }
3870
0
              v = unoidl::ConstantValue(static_cast<sal_uInt64>((yyvsp[-1].expr).ival));
3871
0
              break;
3872
0
          case unoidl::detail::SourceProviderExpr::TYPE_UINT:
3873
0
              v = unoidl::ConstantValue((yyvsp[-1].expr).uval);
3874
0
              break;
3875
0
          default:
3876
0
              error(
3877
0
                  (yylsp[-1]), yyscanner,
3878
0
                  ("bad value of unsigned-hyper-typed constant "
3879
0
                   + data->currentName + "." + id));
3880
0
              YYERROR;
3881
0
              break;
3882
0
          }
3883
0
          break;
3884
0
      case unoidl::detail::SourceProviderType::TYPE_FLOAT:
3885
0
          switch ((yyvsp[-1].expr).type) {
3886
0
          case unoidl::detail::SourceProviderExpr::TYPE_BOOL:
3887
0
              error(
3888
0
                  (yylsp[-1]), yyscanner,
3889
0
                  ("bad boolean value of float-typed constant "
3890
0
                   + data->currentName + "." + id));
3891
0
              YYERROR;
3892
0
              break;
3893
0
          case unoidl::detail::SourceProviderExpr::TYPE_INT:
3894
0
              v = unoidl::ConstantValue(static_cast<float>((yyvsp[-1].expr).ival));
3895
0
              break;
3896
0
          case unoidl::detail::SourceProviderExpr::TYPE_UINT:
3897
0
              v = unoidl::ConstantValue(static_cast<float>((yyvsp[-1].expr).uval));
3898
0
              break;
3899
0
          case unoidl::detail::SourceProviderExpr::TYPE_FLOAT:
3900
0
              v = unoidl::ConstantValue(static_cast<float>((yyvsp[-1].expr).fval));
3901
0
              break;
3902
0
          }
3903
0
          break;
3904
0
      case unoidl::detail::SourceProviderType::TYPE_DOUBLE:
3905
0
          switch ((yyvsp[-1].expr).type) {
3906
0
          case unoidl::detail::SourceProviderExpr::TYPE_BOOL:
3907
0
              error(
3908
0
                  (yylsp[-1]), yyscanner,
3909
0
                  ("bad boolean value of double-typed constant "
3910
0
                   + data->currentName + "." + id));
3911
0
              YYERROR;
3912
0
              break;
3913
0
          case unoidl::detail::SourceProviderExpr::TYPE_INT:
3914
0
              v = unoidl::ConstantValue(static_cast<double>((yyvsp[-1].expr).ival));
3915
0
              break;
3916
0
          case unoidl::detail::SourceProviderExpr::TYPE_UINT:
3917
0
              v = unoidl::ConstantValue(static_cast<double>((yyvsp[-1].expr).uval));
3918
0
              break;
3919
0
          case unoidl::detail::SourceProviderExpr::TYPE_FLOAT:
3920
0
              v = unoidl::ConstantValue((yyvsp[-1].expr).fval);
3921
0
              break;
3922
0
          }
3923
0
          break;
3924
0
      default:
3925
0
          error(
3926
0
              (yylsp[-4]), yyscanner,
3927
0
              "bad type for constant " + data->currentName + "." + id);
3928
0
          YYERROR;
3929
0
          break;
3930
0
      }
3931
0
      pad->members.emplace_back(id, v, annotations((yyvsp[-6].bval)));
3932
0
  }
3933
0
#line 3934 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
3934
0
    break;
3935
3936
0
  case 69:
3937
0
#line 2287 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
3938
0
  {
3939
0
      unoidl::detail::SourceProviderScannerData * data = yyget_extra(yyscanner);
3940
0
      data->publishedContext = (yyvsp[-3].bval);
3941
0
      convertToCurrentName(data, (yyvsp[-1].sval));
3942
0
      OUString base(convertName((yyvsp[0].sval)));
3943
0
      unoidl::detail::SourceProviderEntity const * p;
3944
0
      if (findEntity((yylsp[0]), yyscanner, data, false, &base, &p, nullptr, nullptr)
3945
0
          == FOUND_ERROR)
3946
0
      {
3947
0
          YYERROR;
3948
0
      }
3949
0
      bool ifcBase = false;
3950
0
      bool pubBase = false;
3951
0
      if (p != nullptr) {
3952
0
          switch (p->kind) {
3953
0
          case unoidl::detail::SourceProviderEntity::KIND_INTERFACE_DECL:
3954
0
              ifcBase = true;
3955
0
              pubBase = false;
3956
0
              break;
3957
0
          case unoidl::detail::SourceProviderEntity::KIND_PUBLISHED_INTERFACE_DECL:
3958
0
              ifcBase = true;
3959
0
              pubBase = true;
3960
0
              break;
3961
0
          default:
3962
0
              if (p->entity.is()
3963
0
                  && (p->entity->getSort()
3964
0
                      == unoidl::Entity::SORT_INTERFACE_TYPE))
3965
0
              {
3966
0
                  ifcBase = true;
3967
0
                  pubBase = static_cast<unoidl::InterfaceTypeEntity *>(
3968
0
                      p->entity.get())->isPublished();
3969
0
              }
3970
0
              break;
3971
0
          }
3972
0
      }
3973
0
      if (!ifcBase) {
3974
0
          error(
3975
0
              (yylsp[0]), yyscanner,
3976
0
              ("single-interface--based service " + data->currentName + " base "
3977
0
               + base + " does not resolve to an interface type"));
3978
0
          YYERROR;
3979
0
      }
3980
0
      if ((yyvsp[-3].bval) && !pubBase) {
3981
0
          error(
3982
0
              (yylsp[0]), yyscanner,
3983
0
              ("published single-interface--based service " + data->currentName
3984
0
               + " base " + base + " is unpublished"));
3985
0
          YYERROR;
3986
0
      }
3987
0
      if (!data->entities.emplace(
3988
0
                  data->currentName,
3989
0
                  unoidl::detail::SourceProviderEntity(
3990
0
                      new unoidl::detail::SourceProviderSingleInterfaceBasedServiceEntityPad(
3991
0
                          (yyvsp[-3].bval), base))).
3992
0
          second)
3993
0
      {
3994
0
          error((yylsp[-1]), yyscanner, "multiple entities named " + data->currentName);
3995
0
          YYERROR;
3996
0
      }
3997
0
  }
3998
0
#line 3999 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
3999
0
    break;
4000
4001
0
  case 70:
4002
0
#line 2348 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
4003
0
  {
4004
0
      unoidl::detail::SourceProviderScannerData * data = yyget_extra(yyscanner);
4005
0
      unoidl::detail::SourceProviderEntity * ent = getCurrentEntity(data);
4006
0
      unoidl::detail::SourceProviderSingleInterfaceBasedServiceEntityPad * pad =
4007
0
          dynamic_cast<unoidl::detail::SourceProviderSingleInterfaceBasedServiceEntityPad *>(
4008
0
              ent->pad.get());
4009
0
      assert(pad != nullptr);
4010
0
      std::vector<unoidl::SingleInterfaceBasedServiceEntity::Constructor> ctors;
4011
0
      if ((yyvsp[-1].bval)) {
4012
0
          for (const auto & i: pad->constructors) {
4013
0
              std::vector<unoidl::SingleInterfaceBasedServiceEntity::Constructor::Parameter> parms;
4014
0
              for (auto & j: i.parameters) {
4015
0
                  parms.emplace_back(j.name, j.type.getName(), j.rest);
4016
0
              }
4017
0
              ctors.push_back(
4018
0
                  unoidl::SingleInterfaceBasedServiceEntity::Constructor(
4019
0
                      i.name, std::move(parms), std::vector(i.exceptions), std::vector(i.annotations)));
4020
0
          }
4021
0
      } else {
4022
0
          assert(pad->constructors.empty());
4023
0
          ctors.push_back(
4024
0
              unoidl::SingleInterfaceBasedServiceEntity::Constructor());
4025
0
      }
4026
0
      ent->entity = new unoidl::SingleInterfaceBasedServiceEntity(
4027
0
          pad->isPublished(), pad->base, std::move(ctors), annotations((yyvsp[-7].bval)));
4028
0
      ent->pad.clear();
4029
0
      clearCurrentState(data);
4030
0
  }
4031
0
#line 4032 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
4032
0
    break;
4033
4034
0
  case 71:
4035
0
#line 2379 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
4036
0
                { (yyval.bval) = true; }
4037
0
#line 4038 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
4038
0
    break;
4039
4040
0
  case 72:
4041
0
#line 2380 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
4042
0
              { (yyval.bval) = false; }
4043
0
#line 4044 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
4044
0
    break;
4045
4046
0
  case 75:
4047
0
#line 2390 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
4048
0
  {
4049
0
      unoidl::detail::SourceProviderScannerData * data = yyget_extra(yyscanner);
4050
0
      OUString id(convertName((yyvsp[0].sval)));
4051
0
      rtl::Reference<unoidl::detail::SourceProviderSingleInterfaceBasedServiceEntityPad>
4052
0
          pad(getCurrentPad<unoidl::detail::SourceProviderSingleInterfaceBasedServiceEntityPad>(
4053
0
                  data));
4054
0
      for (const auto & i: pad->constructors) {
4055
0
          if (id == i.name) {
4056
0
              error(
4057
0
                  (yylsp[0]), yyscanner,
4058
0
                  ("single-interface--based service " + data->currentName
4059
0
                   + " constructor " + id
4060
0
                   + " has same identifier as another constructor"));
4061
0
              YYERROR;
4062
0
          }
4063
0
      }
4064
0
      pad->constructors.push_back(
4065
0
          unoidl::detail::SourceProviderSingleInterfaceBasedServiceEntityPad::Constructor(
4066
0
              id, annotations((yyvsp[-1].bval))));
4067
0
  }
4068
0
#line 4069 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
4069
0
    break;
4070
4071
0
  case 76:
4072
0
#line 2411 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
4073
0
  {
4074
0
      unoidl::detail::SourceProviderScannerData * data = yyget_extra(yyscanner);
4075
0
      rtl::Reference<unoidl::detail::SourceProviderSingleInterfaceBasedServiceEntityPad>
4076
0
          pad(getCurrentPad<unoidl::detail::SourceProviderSingleInterfaceBasedServiceEntityPad>(
4077
0
                  data));
4078
0
      assert(!pad->constructors.empty());
4079
0
      if ((yyvsp[-1].excns) != nullptr) {
4080
0
          pad->constructors.back().exceptions = *(yyvsp[-1].excns);
4081
0
          delete (yyvsp[-1].excns);
4082
0
      }
4083
0
      for (auto i(pad->constructors.begin()); i != pad->constructors.end() - 1;
4084
0
           ++i)
4085
0
      {
4086
0
          if (i->parameters.size()
4087
0
              == pad->constructors.back().parameters.size())
4088
0
          {
4089
0
              bool same = true;
4090
0
              for (auto
4091
0
                       j(i->parameters.begin()),
4092
0
                       k(pad->constructors.back().parameters.begin());
4093
0
                   j != i->parameters.end(); ++j, ++k)
4094
0
              {
4095
0
                  if (!j->type.equals(k->type) || j->rest != k->rest) {
4096
0
                      same = false;
4097
0
                      break;
4098
0
                  }
4099
0
              }
4100
0
              if (same) {
4101
0
                  error(
4102
0
                      (yylsp[-6]), yyscanner,
4103
0
                      ("single-interface--based service " + data->currentName
4104
0
                       + " constructor " + pad->constructors.back().name
4105
0
                       + " has similar parameter list to constructor "
4106
0
                       + i->name));
4107
0
                  YYERROR;
4108
0
              }
4109
0
          }
4110
0
      }
4111
0
  }
4112
0
#line 4113 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
4113
0
    break;
4114
4115
0
  case 81:
4116
0
#line 2464 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
4117
0
  {
4118
0
      unoidl::detail::SourceProviderScannerData * data = yyget_extra(yyscanner);
4119
0
      unoidl::detail::SourceProviderType t(*(yyvsp[-2].type));
4120
0
      delete (yyvsp[-2].type);
4121
0
      OUString id(convertName((yyvsp[0].sval)));
4122
0
      rtl::Reference<unoidl::detail::SourceProviderSingleInterfaceBasedServiceEntityPad>
4123
0
          pad(getCurrentPad<unoidl::detail::SourceProviderSingleInterfaceBasedServiceEntityPad>(
4124
0
              data));
4125
0
      assert(!pad->constructors.empty());
4126
0
      if ((yyvsp[-4].dir) != unoidl::InterfaceTypeEntity::Method::Parameter::DIRECTION_IN) {
4127
0
          error(
4128
0
              (yylsp[-2]), yyscanner,
4129
0
              ("single-interface--based service " + data->currentName
4130
0
               + " constructor " + pad->constructors.back().name + " parameter "
4131
0
               + id + " direction must be [in]"));
4132
0
          YYERROR;
4133
0
      }
4134
0
      switch (t.type) {
4135
0
      case unoidl::detail::SourceProviderType::TYPE_VOID:
4136
0
      case unoidl::detail::SourceProviderType::TYPE_EXCEPTION:
4137
0
          error(
4138
0
              (yylsp[-2]), yyscanner,
4139
0
              ("illegal single-interface--based service " + data->currentName
4140
0
               + " constructor " + pad->constructors.back().name + " parameter "
4141
0
               + id + " type"));
4142
0
          YYERROR;
4143
0
          break;
4144
0
      default:
4145
0
          break;
4146
0
      }
4147
0
      if ((yyvsp[-1].bval)) {
4148
0
          if (t.type != unoidl::detail::SourceProviderType::TYPE_ANY) {
4149
0
              error(
4150
0
                  (yylsp[-2]), yyscanner,
4151
0
                  ("illegal single-interface--based service "
4152
0
                   + data->currentName + " constructor "
4153
0
                   + pad->constructors.back().name + " rest parameter " + id
4154
0
                   + " non-any type"));
4155
0
              YYERROR;
4156
0
          }
4157
0
          if (!pad->constructors.back().parameters.empty()) {
4158
0
              error(
4159
0
                  (yylsp[-1]), yyscanner,
4160
0
                  ("single-interface--based service " + data->currentName
4161
0
                   + " constructor " + pad->constructors.back().name
4162
0
                   + " rest parameter " + id + " must be first parameter"));
4163
0
              YYERROR;
4164
0
          }
4165
0
      } else if (!pad->constructors.back().parameters.empty()
4166
0
                 && pad->constructors.back().parameters.back().rest)
4167
0
      {
4168
0
          error(
4169
0
              (yylsp[-5]), yyscanner,
4170
0
              ("single-interface--based service " + data->currentName
4171
0
               + " constructor " + pad->constructors.back().name
4172
0
               + " rest parameter must be last parameter"));
4173
0
          YYERROR;
4174
0
      }
4175
0
      for (const auto & i: pad->constructors.back().parameters) {
4176
0
          if (id == i.name) {
4177
0
              error(
4178
0
                  (yylsp[0]), yyscanner,
4179
0
                  ("single-interface--based service " + data->currentName
4180
0
                   + " constructor " + pad->constructors.back().name
4181
0
                   + " parameter " + id
4182
0
                   + " has same identifier as another parameter"));
4183
0
              YYERROR;
4184
0
          }
4185
0
      }
4186
0
      pad->constructors.back().parameters.push_back(
4187
0
          unoidl::detail::SourceProviderSingleInterfaceBasedServiceEntityPad::Constructor::Parameter(
4188
0
              id, std::move(t), (yyvsp[-1].bval)));
4189
0
  }
4190
0
#line 4191 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
4191
0
    break;
4192
4193
0
  case 82:
4194
0
#line 2540 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
4195
0
               { (yyval.bval) = true; }
4196
0
#line 4197 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
4197
0
    break;
4198
4199
0
  case 83:
4200
0
#line 2541 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
4201
0
              { (yyval.bval) = false; }
4202
0
#line 4203 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
4203
0
    break;
4204
4205
0
  case 84:
4206
0
#line 2545 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
4207
0
  {
4208
0
      unoidl::detail::SourceProviderScannerData * data = yyget_extra(yyscanner);
4209
0
      data->publishedContext = (yyvsp[-2].bval);
4210
0
      convertToCurrentName(data, (yyvsp[0].sval));
4211
0
      if (!data->entities.emplace(
4212
0
                  data->currentName,
4213
0
                  unoidl::detail::SourceProviderEntity(
4214
0
                      new unoidl::detail::SourceProviderAccumulationBasedServiceEntityPad(
4215
0
                          (yyvsp[-2].bval)))).
4216
0
          second)
4217
0
      {
4218
0
          error((yylsp[0]), yyscanner, "multiple entities named " + data->currentName);
4219
0
          YYERROR;
4220
0
      }
4221
0
  }
4222
0
#line 4223 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
4223
0
    break;
4224
4225
0
  case 85:
4226
0
#line 2561 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
4227
0
  {
4228
0
      unoidl::detail::SourceProviderScannerData * data = yyget_extra(yyscanner);
4229
0
      unoidl::detail::SourceProviderEntity * ent = getCurrentEntity(data);
4230
0
      unoidl::detail::SourceProviderAccumulationBasedServiceEntityPad * pad =
4231
0
          dynamic_cast<unoidl::detail::SourceProviderAccumulationBasedServiceEntityPad *>(
4232
0
              ent->pad.get());
4233
0
      assert(pad != nullptr);
4234
0
      ent->entity = new unoidl::AccumulationBasedServiceEntity(
4235
0
          pad->isPublished(), std::move(pad->directMandatoryBaseServices),
4236
0
          std::move(pad->directOptionalBaseServices), std::move(pad->directMandatoryBaseInterfaces),
4237
0
          std::move(pad->directOptionalBaseInterfaces), std::move(pad->directProperties),
4238
0
          annotations((yyvsp[-8].bval)));
4239
0
      ent->pad.clear();
4240
0
      clearCurrentState(data);
4241
0
  }
4242
0
#line 4243 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
4243
0
    break;
4244
4245
0
  case 91:
4246
0
#line 2591 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
4247
0
  {
4248
0
      unoidl::detail::SourceProviderScannerData * data = yyget_extra(yyscanner);
4249
0
      OUString name(convertName((yyvsp[-1].sval)));
4250
0
      rtl::Reference<unoidl::detail::SourceProviderAccumulationBasedServiceEntityPad> pad(
4251
0
          getCurrentPad<unoidl::detail::SourceProviderAccumulationBasedServiceEntityPad>(
4252
0
              data));
4253
0
      if (((yyvsp[-3].flags) & ~unoidl::detail::FLAG_OPTIONAL) != 0) {
4254
0
          error(
4255
0
              (yylsp[-3]), yyscanner,
4256
0
              u"service base can only be flagged as [optional]"_ustr);
4257
0
          YYERROR;
4258
0
      }
4259
0
      bool opt = ((yyvsp[-3].flags) & unoidl::detail::FLAG_OPTIONAL) != 0;
4260
0
      unoidl::detail::SourceProviderEntity const * p;
4261
0
      if (findEntity((yylsp[-1]), yyscanner, data, false, &name, &p, nullptr, nullptr)
4262
0
          == FOUND_ERROR)
4263
0
      {
4264
0
          YYERROR;
4265
0
      }
4266
0
      if (p == nullptr || !p->entity.is()
4267
0
          || (p->entity->getSort()
4268
0
              != unoidl::Entity::SORT_ACCUMULATION_BASED_SERVICE))
4269
0
      {
4270
0
          error(
4271
0
              (yylsp[-1]), yyscanner,
4272
0
              ("accumulation-based service " + data->currentName
4273
0
               + " direct base service " + name
4274
0
               + " does not resolve to an accumulation-based service"));
4275
0
          YYERROR;
4276
0
      }
4277
0
      if (data->publishedContext
4278
0
          && !static_cast<unoidl::AccumulationBasedServiceEntity *>(
4279
0
              p->entity.get())->isPublished())
4280
0
      {
4281
0
          error(
4282
0
              (yylsp[-1]), yyscanner,
4283
0
              ("published accumulation-based service " + data->currentName
4284
0
               + " direct base service " + name + " is unpublished"));
4285
0
          YYERROR;
4286
0
      }
4287
0
      std::vector<unoidl::AnnotatedReference> & v(
4288
0
          opt
4289
0
          ? pad->directOptionalBaseServices : pad->directMandatoryBaseServices);
4290
0
      for (const auto & i: v) {
4291
0
          if (name == i.name) {
4292
0
              error(
4293
0
                  (yylsp[-1]), yyscanner,
4294
0
                  ("accumulation-based service " + data->currentName
4295
0
                   + " duplicate direct base service " + name));
4296
0
              YYERROR;
4297
0
          }
4298
0
      }
4299
0
      v.emplace_back(name, annotations((yyvsp[-4].bval)));
4300
0
  }
4301
0
#line 4302 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
4302
0
    break;
4303
4304
0
  case 92:
4305
0
#line 2649 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
4306
0
  {
4307
0
      unoidl::detail::SourceProviderScannerData * data = yyget_extra(yyscanner);
4308
0
      OUString name(convertName((yyvsp[-1].sval)));
4309
0
      rtl::Reference<unoidl::detail::SourceProviderAccumulationBasedServiceEntityPad> pad(
4310
0
          getCurrentPad<unoidl::detail::SourceProviderAccumulationBasedServiceEntityPad>(
4311
0
              data));
4312
0
      if (((yyvsp[-3].flags) & ~unoidl::detail::FLAG_OPTIONAL) != 0) {
4313
0
          error(
4314
0
              (yylsp[-3]), yyscanner,
4315
0
              u"interface base can only be flagged as [optional]"_ustr);
4316
0
          YYERROR;
4317
0
      }
4318
0
      bool opt = ((yyvsp[-3].flags) & unoidl::detail::FLAG_OPTIONAL) != 0;
4319
0
      unoidl::detail::SourceProviderEntity const * p;
4320
0
      if (findEntity((yylsp[-1]), yyscanner, data, false, &name, &p, nullptr, nullptr)
4321
0
          == FOUND_ERROR)
4322
0
      {
4323
0
          YYERROR;
4324
0
      }
4325
0
      bool ifcBase = false;
4326
0
      bool pubBase = false;
4327
0
      if (p != nullptr) {
4328
0
          switch (p->kind) {
4329
0
          case unoidl::detail::SourceProviderEntity::KIND_INTERFACE_DECL:
4330
0
              ifcBase = true;
4331
0
              pubBase = false;
4332
0
              break;
4333
0
          case unoidl::detail::SourceProviderEntity::KIND_PUBLISHED_INTERFACE_DECL:
4334
0
              ifcBase = true;
4335
0
              pubBase = true;
4336
0
              break;
4337
0
          default:
4338
0
              if (p->entity.is()
4339
0
                  && (p->entity->getSort()
4340
0
                      == unoidl::Entity::SORT_INTERFACE_TYPE))
4341
0
              {
4342
0
                  ifcBase = true;
4343
0
                  pubBase = static_cast<unoidl::InterfaceTypeEntity *>(
4344
0
                      p->entity.get())->isPublished();
4345
0
              }
4346
0
              break;
4347
0
          }
4348
0
      }
4349
0
      if (!ifcBase) {
4350
0
          error(
4351
0
              (yylsp[-1]), yyscanner,
4352
0
              ("accumulation-based service " + data->currentName
4353
0
               + " direct base interface " + name
4354
0
               + " does not resolve to an interface type"));
4355
0
          YYERROR;
4356
0
      }
4357
0
      if (data->publishedContext && !opt && !pubBase) {
4358
0
          error(
4359
0
              (yylsp[-1]), yyscanner,
4360
0
              ("published accumulation-based service " + data->currentName
4361
0
               + " direct base interface " + name + " is unpublished"));
4362
0
          YYERROR;
4363
0
      }
4364
0
      std::vector<unoidl::AnnotatedReference> & v(
4365
0
          opt
4366
0
          ? pad->directOptionalBaseInterfaces
4367
0
          : pad->directMandatoryBaseInterfaces);
4368
0
      for (const auto & i: v) {
4369
0
          if (name == i.name) {
4370
0
              error(
4371
0
                  (yylsp[-1]), yyscanner,
4372
0
                  ("accumulation-based service " + data->currentName
4373
0
                   + " duplicate direct base interface " + name));
4374
0
              YYERROR;
4375
0
          }
4376
0
      }
4377
0
      v.emplace_back(name, annotations((yyvsp[-4].bval)));
4378
0
  }
4379
0
#line 4380 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
4380
0
    break;
4381
4382
0
  case 93:
4383
0
#line 2726 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
4384
0
  {
4385
0
      unoidl::detail::SourceProviderScannerData * data = yyget_extra(yyscanner);
4386
0
      unoidl::detail::SourceProviderType t(*(yyvsp[-2].type));
4387
0
      delete (yyvsp[-2].type);
4388
0
      OUString id(convertName((yyvsp[-1].sval)));
4389
0
      if (((yyvsp[-3].flags) & unoidl::detail::FLAG_PROPERTY) == 0) {
4390
0
          error(
4391
0
              (yylsp[-3]), yyscanner,
4392
0
              (u"accumulation-based service property must be flagged as"
4393
0
               " [property]"_ustr));
4394
0
          YYERROR;
4395
0
      }
4396
0
      if (((yyvsp[-3].flags)
4397
0
           & ~(unoidl::detail::FLAG_BOUND | unoidl::detail::FLAG_CONSTRAINED
4398
0
               | unoidl::detail::FLAG_MAYBEAMBIGUOUS
4399
0
               | unoidl::detail::FLAG_MAYBEDEFAULT
4400
0
               | unoidl::detail::FLAG_MAYBEVOID | unoidl::detail::FLAG_OPTIONAL
4401
0
               | unoidl::detail::FLAG_PROPERTY | unoidl::detail::FLAG_READONLY
4402
0
               | unoidl::detail::FLAG_REMOVABLE
4403
0
               | unoidl::detail::FLAG_TRANSIENT))
4404
0
          != 0)
4405
0
      {
4406
0
          error(
4407
0
              (yylsp[-3]), yyscanner,
4408
0
              (u"accumulation-based service property can only be flagged as"
4409
0
               " [property, bound, constrained, maybeambiguous, maybedefault,"
4410
0
               " maybevoid, optional, readonly, removable, transient]"_ustr));
4411
0
          YYERROR;
4412
0
      }
4413
0
      int att = 0;
4414
0
      if (((yyvsp[-3].flags) & unoidl::detail::FLAG_BOUND) != 0) {
4415
0
          att |= unoidl::AccumulationBasedServiceEntity::Property::ATTRIBUTE_BOUND;
4416
0
      }
4417
0
      if (((yyvsp[-3].flags) & unoidl::detail::FLAG_CONSTRAINED) != 0) {
4418
0
          att |= unoidl::AccumulationBasedServiceEntity::Property::ATTRIBUTE_CONSTRAINED;
4419
0
      }
4420
0
      if (((yyvsp[-3].flags) & unoidl::detail::FLAG_MAYBEAMBIGUOUS) != 0) {
4421
0
          att |= unoidl::AccumulationBasedServiceEntity::Property::ATTRIBUTE_MAYBE_AMBIGUOUS;
4422
0
      }
4423
0
      if (((yyvsp[-3].flags) & unoidl::detail::FLAG_MAYBEDEFAULT) != 0) {
4424
0
          att |= unoidl::AccumulationBasedServiceEntity::Property::ATTRIBUTE_MAYBE_DEFAULT;
4425
0
      }
4426
0
      if (((yyvsp[-3].flags) & unoidl::detail::FLAG_MAYBEVOID) != 0) {
4427
0
          att |= unoidl::AccumulationBasedServiceEntity::Property::ATTRIBUTE_MAYBE_VOID;
4428
0
      }
4429
0
      if (((yyvsp[-3].flags) & unoidl::detail::FLAG_OPTIONAL) != 0) {
4430
0
          att |= unoidl::AccumulationBasedServiceEntity::Property::ATTRIBUTE_OPTIONAL;
4431
0
      }
4432
0
      if (((yyvsp[-3].flags) & unoidl::detail::FLAG_READONLY) != 0) {
4433
0
          att |= unoidl::AccumulationBasedServiceEntity::Property::ATTRIBUTE_READ_ONLY;
4434
0
      }
4435
0
      if (((yyvsp[-3].flags) & unoidl::detail::FLAG_REMOVABLE) != 0) {
4436
0
          att |= unoidl::AccumulationBasedServiceEntity::Property::ATTRIBUTE_REMOVABLE;
4437
0
      }
4438
0
      if (((yyvsp[-3].flags) & unoidl::detail::FLAG_TRANSIENT) != 0) {
4439
0
          att |= unoidl::AccumulationBasedServiceEntity::Property::ATTRIBUTE_TRANSIENT;
4440
0
      }
4441
0
      switch (t.type) {
4442
0
      case unoidl::detail::SourceProviderType::TYPE_VOID:
4443
0
      case unoidl::detail::SourceProviderType::TYPE_EXCEPTION:
4444
0
          error(
4445
0
              (yylsp[-2]), yyscanner,
4446
0
              ("illegal accumulation-based service " + data->currentName
4447
0
               + " direct property " + id + " type"));
4448
0
          YYERROR;
4449
0
          break;
4450
0
      default:
4451
0
          break;
4452
0
      }
4453
0
      rtl::Reference<unoidl::detail::SourceProviderAccumulationBasedServiceEntityPad>
4454
0
          pad(getCurrentPad<unoidl::detail::SourceProviderAccumulationBasedServiceEntityPad>(
4455
0
                  data));
4456
0
      for (const auto & i: pad->directProperties) {
4457
0
          if (id == i.name) {
4458
0
              error(
4459
0
                  (yylsp[-1]), yyscanner,
4460
0
                  ("accumulation-based service " + data->currentName
4461
0
                   + " duplicate direct property " + id));
4462
0
              YYERROR;
4463
0
          }
4464
0
      }
4465
0
      pad->directProperties.emplace_back(
4466
0
          id, t.getName(),
4467
0
          unoidl::AccumulationBasedServiceEntity::Property::Attributes(att),
4468
0
          annotations((yyvsp[-4].bval)));
4469
0
  }
4470
0
#line 4471 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
4471
0
    break;
4472
4473
0
  case 94:
4474
0
#line 2816 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
4475
0
  {
4476
0
      unoidl::detail::SourceProviderScannerData * data = yyget_extra(yyscanner);
4477
0
      data->publishedContext = (yyvsp[-4].bval);
4478
0
      OUString name(convertToFullName(data, (yyvsp[-2].sval)));
4479
0
      OUString base(convertName((yyvsp[-1].sval)));
4480
0
      unoidl::detail::SourceProviderEntity const * p;
4481
0
      if (findEntity((yylsp[-1]), yyscanner, data, false, &base, &p, nullptr, nullptr)
4482
0
          == FOUND_ERROR)
4483
0
      {
4484
0
          YYERROR;
4485
0
      }
4486
0
      bool ifcBase = false;
4487
0
      bool pubBase = false;
4488
0
      if (p != nullptr) {
4489
0
          switch (p->kind) {
4490
0
          case unoidl::detail::SourceProviderEntity::KIND_INTERFACE_DECL:
4491
0
              ifcBase = true;
4492
0
              pubBase = false;
4493
0
              break;
4494
0
          case unoidl::detail::SourceProviderEntity::KIND_PUBLISHED_INTERFACE_DECL:
4495
0
              ifcBase = true;
4496
0
              pubBase = true;
4497
0
              break;
4498
0
          default:
4499
0
              if (p->entity.is()
4500
0
                  && (p->entity->getSort()
4501
0
                      == unoidl::Entity::SORT_INTERFACE_TYPE))
4502
0
              {
4503
0
                  ifcBase = true;
4504
0
                  pubBase = static_cast<unoidl::InterfaceTypeEntity *>(
4505
0
                      p->entity.get())->isPublished();
4506
0
              }
4507
0
              break;
4508
0
          }
4509
0
      }
4510
0
      if (!ifcBase) {
4511
0
          error(
4512
0
              (yylsp[-1]), yyscanner,
4513
0
              ("interface-based singleton " + name + " base " + base
4514
0
               + " does not resolve to an interface type"));
4515
0
          YYERROR;
4516
0
      }
4517
0
      if ((yyvsp[-4].bval) && !pubBase) {
4518
0
          error(
4519
0
              (yylsp[-1]), yyscanner,
4520
0
              ("published interface-based singleton " + name + " base " + base
4521
0
               + " is unpublished"));
4522
0
          YYERROR;
4523
0
      }
4524
0
      if (!data->entities.emplace(
4525
0
                  name,
4526
0
                  unoidl::detail::SourceProviderEntity(
4527
0
                      unoidl::detail::SourceProviderEntity::KIND_LOCAL,
4528
0
                      new unoidl::InterfaceBasedSingletonEntity(
4529
0
                          (yyvsp[-4].bval), base, annotations((yyvsp[-5].bval))))).
4530
0
          second)
4531
0
      {
4532
0
          error((yylsp[-2]), yyscanner, "multiple entities named " + name);
4533
0
          YYERROR;
4534
0
      }
4535
0
      clearCurrentState(data);
4536
0
  }
4537
0
#line 4538 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
4538
0
    break;
4539
4540
0
  case 95:
4541
0
#line 2883 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
4542
0
  {
4543
0
      unoidl::detail::SourceProviderScannerData * data = yyget_extra(yyscanner);
4544
0
      data->publishedContext = (yyvsp[-8].bval);
4545
0
      OUString name(convertToFullName(data, (yyvsp[-6].sval)));
4546
0
      OUString base(convertName((yyvsp[-3].sval)));
4547
0
      unoidl::detail::SourceProviderEntity const * p;
4548
0
      if (findEntity((yylsp[-3]), yyscanner, data, false, &base, &p, nullptr, nullptr)
4549
0
          == FOUND_ERROR)
4550
0
      {
4551
0
          YYERROR;
4552
0
      }
4553
0
      if (p == nullptr
4554
0
          || !p->entity.is()
4555
0
          || (p->entity->getSort()
4556
0
              != unoidl::Entity::SORT_ACCUMULATION_BASED_SERVICE))
4557
0
      {
4558
0
          error(
4559
0
              (yylsp[-3]), yyscanner,
4560
0
              ("service-based singleton " + name + " base " + base
4561
0
               + " does not resolve to an accumulation-based service"));
4562
0
          YYERROR;
4563
0
      }
4564
0
      if ((yyvsp[-8].bval)
4565
0
          && !static_cast<unoidl::AccumulationBasedServiceEntity *>(
4566
0
              p->entity.get())->isPublished())
4567
0
      {
4568
0
          error(
4569
0
              (yylsp[-3]), yyscanner,
4570
0
              ("published service-based singleton " + name + " base " + base
4571
0
               + " is unpublished"));
4572
0
          YYERROR;
4573
0
      }
4574
0
      if (!data->entities.emplace(
4575
0
                  name,
4576
0
                  unoidl::detail::SourceProviderEntity(
4577
0
                      unoidl::detail::SourceProviderEntity::KIND_LOCAL,
4578
0
                      new unoidl::ServiceBasedSingletonEntity(
4579
0
                          (yyvsp[-8].bval), base, annotations((yyvsp[-9].bval))))).
4580
0
          second)
4581
0
      {
4582
0
          error((yylsp[-6]), yyscanner, "multiple entities named " + name);
4583
0
          YYERROR;
4584
0
      }
4585
0
      clearCurrentState(data);
4586
0
  }
4587
0
#line 4588 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
4588
0
    break;
4589
4590
0
  case 97:
4591
0
#line 2932 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
4592
0
              { (yyval.sval) = nullptr; }
4593
0
#line 4594 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
4594
0
    break;
4595
4596
0
  case 98:
4597
0
#line 2935 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
4598
0
                            { (yyval.sval) = (yyvsp[0].sval); }
4599
0
#line 4600 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
4600
0
    break;
4601
4602
0
  case 100:
4603
0
#line 2940 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
4604
0
              { (yyval.excns) = nullptr; }
4605
0
#line 4606 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
4606
0
    break;
4607
4608
0
  case 101:
4609
0
#line 2943 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
4610
0
                                             { (yyval.excns) = (yyvsp[-1].excns); }
4611
0
#line 4612 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
4612
0
    break;
4613
4614
0
  case 102:
4615
0
#line 2948 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
4616
0
  {
4617
0
      unoidl::detail::SourceProviderScannerData * data = yyget_extra(yyscanner);
4618
0
      OUString name(convertName((yyvsp[0].sval)));
4619
0
      unoidl::detail::SourceProviderEntity const * p;
4620
0
      if (findEntity((yylsp[0]), yyscanner, data, false, &name, &p, nullptr, nullptr)
4621
0
          == FOUND_ERROR)
4622
0
      {
4623
0
          delete (yyvsp[-2].excns); /* see commented-out %destructor above */
4624
0
          YYERROR;
4625
0
      }
4626
0
      if (p == nullptr
4627
0
          || !p->entity.is()
4628
0
          || (p->entity->getSort() != unoidl::Entity::SORT_EXCEPTION_TYPE))
4629
0
      {
4630
0
          delete (yyvsp[-2].excns); /* see commented-out %destructor above */
4631
0
          error(
4632
0
              (yylsp[0]), yyscanner,
4633
0
              ("exception " + name + " does not resolve to an exception type"));
4634
0
          YYERROR;
4635
0
      }
4636
0
      if (data->publishedContext
4637
0
          && !(static_cast<unoidl::ExceptionTypeEntity *>(p->entity.get())
4638
0
               ->isPublished()))
4639
0
      {
4640
0
          delete (yyvsp[-2].excns); /* see commented-out %destructor above */
4641
0
          error(
4642
0
              (yylsp[0]), yyscanner,
4643
0
              ("unpublished exception " + name + " used in published context"));
4644
0
          YYERROR;
4645
0
      }
4646
0
      if (std::find((yyvsp[-2].excns)->begin(), (yyvsp[-2].excns)->end(), name) != (yyvsp[-2].excns)->end()) {
4647
0
          delete (yyvsp[-2].excns); /* see commented-out %destructor above */
4648
0
          error(
4649
0
              (yylsp[0]), yyscanner, ("exception " + name + " listed more than once"));
4650
0
          YYERROR;
4651
0
      }
4652
0
      (yyvsp[-2].excns)->push_back(name);
4653
0
      (yyval.excns) = (yyvsp[-2].excns);
4654
0
  }
4655
0
#line 4656 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
4656
0
    break;
4657
4658
0
  case 103:
4659
0
#line 2988 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
4660
0
  {
4661
0
      unoidl::detail::SourceProviderScannerData * data = yyget_extra(yyscanner);
4662
0
      OUString name(convertName((yyvsp[0].sval)));
4663
0
      unoidl::detail::SourceProviderEntity const * p;
4664
0
      if (findEntity((yylsp[0]), yyscanner, data, false, &name, &p, nullptr, nullptr)
4665
0
          == FOUND_ERROR)
4666
0
      {
4667
0
          YYERROR;
4668
0
      }
4669
0
      if (p == nullptr
4670
0
          || !p->entity.is()
4671
0
          || (p->entity->getSort() != unoidl::Entity::SORT_EXCEPTION_TYPE))
4672
0
      {
4673
0
          error(
4674
0
              (yylsp[0]), yyscanner,
4675
0
              ("exception " + name + " does not resolve to an exception type"));
4676
0
          YYERROR;
4677
0
      }
4678
0
      if (data->publishedContext
4679
0
          && !(static_cast<unoidl::ExceptionTypeEntity *>(p->entity.get())
4680
0
               ->isPublished()))
4681
0
      {
4682
0
          error(
4683
0
              (yylsp[0]), yyscanner,
4684
0
              ("unpublished exception " + name + " used in published context"));
4685
0
          YYERROR;
4686
0
      }
4687
0
      (yyval.excns) = new std::vector<OUString>; (yyval.excns)->push_back(name);
4688
0
  }
4689
0
#line 4690 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
4690
0
    break;
4691
4692
0
  case 104:
4693
0
#line 3021 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
4694
0
  {
4695
0
      unoidl::detail::SourceProviderScannerData * data = yyget_extra(yyscanner);
4696
0
      data->publishedContext = (yyvsp[-3].bval);
4697
0
      OUString name(convertToFullName(data, (yyvsp[-1].sval)));
4698
0
      std::pair<std::map<OUString, unoidl::detail::SourceProviderEntity>::iterator, bool> p(
4699
0
          data->entities.emplace(
4700
0
                  name,
4701
0
                  unoidl::detail::SourceProviderEntity(
4702
0
                      (yyvsp[-3].bval)
4703
0
                      ? unoidl::detail::SourceProviderEntity::KIND_PUBLISHED_INTERFACE_DECL
4704
0
                      : unoidl::detail::SourceProviderEntity::KIND_INTERFACE_DECL)));
4705
0
      if (!p.second) {
4706
0
          switch (p.first->second.kind) {
4707
0
          case unoidl::detail::SourceProviderEntity::KIND_INTERFACE_DECL:
4708
0
              if ((yyvsp[-3].bval)) {
4709
0
                  p.first->second.kind
4710
0
                      = unoidl::detail::SourceProviderEntity::KIND_PUBLISHED_INTERFACE_DECL;
4711
0
              }
4712
0
              break;
4713
0
          case unoidl::detail::SourceProviderEntity::KIND_PUBLISHED_INTERFACE_DECL:
4714
0
              break;
4715
0
          default:
4716
0
              assert(p.first->second.entity.is());
4717
0
              if (p.first->second.entity->getSort()
4718
0
                  != unoidl::Entity::SORT_INTERFACE_TYPE)
4719
0
              {
4720
0
                  error(
4721
0
                      (yylsp[-1]), yyscanner,
4722
0
                      "multiple entities named " + data->currentName);
4723
0
                  YYERROR;
4724
0
              }
4725
0
              if ((yyvsp[-3].bval)
4726
0
                  && !static_cast<unoidl::InterfaceTypeEntity *>(
4727
0
                      p.first->second.entity.get())->isPublished())
4728
0
              {
4729
0
                  error(
4730
0
                      (yylsp[-1]), yyscanner,
4731
0
                      ("published interface type declaration "
4732
0
                       + data->currentName + " has been defined unpublished"));
4733
0
                  YYERROR;
4734
0
              }
4735
0
          }
4736
0
      }
4737
0
      clearCurrentState(data);
4738
0
  }
4739
0
#line 4740 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
4740
0
    break;
4741
4742
0
  case 105:
4743
0
#line 3069 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
4744
0
                { (yyval.bval) = true; }
4745
0
#line 4746 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
4746
0
    break;
4747
4748
0
  case 106:
4749
0
#line 3070 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
4750
0
              { (yyval.bval) = false; }
4751
0
#line 4752 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
4752
0
    break;
4753
4754
0
  case 108:
4755
0
#line 3075 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
4756
0
              { (yyval.flags) = unoidl::detail::SourceProviderFlags(0); }
4757
0
#line 4758 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
4758
0
    break;
4759
4760
0
  case 109:
4761
0
#line 3078 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
4762
0
                           { (yyval.flags) = (yyvsp[-1].flags); }
4763
0
#line 4764 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
4764
0
    break;
4765
4766
0
  case 110:
4767
0
#line 3083 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
4768
0
  {
4769
0
      if (((yyvsp[-2].flags) & (yyvsp[0].flags)) != 0) {
4770
0
          error((yylsp[0]), yyscanner, "duplicate flag " + flagName((yyvsp[0].flags)));
4771
0
          YYERROR;
4772
0
      }
4773
0
      (yyval.flags) = unoidl::detail::SourceProviderFlags((yyvsp[-2].flags) | (yyvsp[0].flags));
4774
0
  }
4775
0
#line 4776 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
4776
0
    break;
4777
4778
0
  case 112:
4779
0
#line 3094 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
4780
0
                { (yyval.flags) = unoidl::detail::FLAG_ATTRIBUTE; }
4781
0
#line 4782 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
4782
0
    break;
4783
4784
0
  case 113:
4785
0
#line 3095 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
4786
0
            { (yyval.flags) = unoidl::detail::FLAG_BOUND; }
4787
0
#line 4788 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
4788
0
    break;
4789
4790
0
  case 114:
4791
0
#line 3096 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
4792
0
                  { (yyval.flags) = unoidl::detail::FLAG_CONSTRAINED; }
4793
0
#line 4794 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
4794
0
    break;
4795
4796
0
  case 115:
4797
0
#line 3097 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
4798
0
                     { (yyval.flags) = unoidl::detail::FLAG_MAYBEAMBIGUOUS; }
4799
0
#line 4800 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
4800
0
    break;
4801
4802
0
  case 116:
4803
0
#line 3098 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
4804
0
                   { (yyval.flags) = unoidl::detail::FLAG_MAYBEDEFAULT; }
4805
0
#line 4806 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
4806
0
    break;
4807
4808
0
  case 117:
4809
0
#line 3099 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
4810
0
                { (yyval.flags) = unoidl::detail::FLAG_MAYBEVOID; }
4811
0
#line 4812 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
4812
0
    break;
4813
4814
0
  case 118:
4815
0
#line 3100 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
4816
0
               { (yyval.flags) = unoidl::detail::FLAG_OPTIONAL; }
4817
0
#line 4818 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
4818
0
    break;
4819
4820
0
  case 119:
4821
0
#line 3101 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
4822
0
               { (yyval.flags) = unoidl::detail::FLAG_PROPERTY; }
4823
0
#line 4824 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
4824
0
    break;
4825
4826
0
  case 120:
4827
0
#line 3102 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
4828
0
               { (yyval.flags) = unoidl::detail::FLAG_READONLY; }
4829
0
#line 4830 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
4830
0
    break;
4831
4832
0
  case 121:
4833
0
#line 3103 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
4834
0
                { (yyval.flags) = unoidl::detail::FLAG_REMOVABLE; }
4835
0
#line 4836 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
4836
0
    break;
4837
4838
0
  case 122:
4839
0
#line 3104 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
4840
0
                { (yyval.flags) = unoidl::detail::FLAG_TRANSIENT; }
4841
0
#line 4842 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
4842
0
    break;
4843
4844
0
  case 124:
4845
0
#line 3112 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
4846
0
  {
4847
0
      if (!coerce((yylsp[-2]), yyscanner, &(yyvsp[-2].expr), &(yyvsp[0].expr))) {
4848
0
          YYERROR;
4849
0
      }
4850
0
      switch ((yyvsp[-2].expr).type) {
4851
0
      case unoidl::detail::SourceProviderExpr::TYPE_INT:
4852
0
          (yyval.expr) = unoidl::detail::SourceProviderExpr::Int((yyvsp[-2].expr).ival | (yyvsp[0].expr).ival);
4853
0
          break;
4854
0
      case unoidl::detail::SourceProviderExpr::TYPE_UINT:
4855
0
          (yyval.expr) = unoidl::detail::SourceProviderExpr::Uint((yyvsp[-2].expr).uval | (yyvsp[0].expr).uval);
4856
0
          break;
4857
0
      default:
4858
0
          error((yylsp[-2]), yyscanner, u"arguments of non-integer type to \"|\""_ustr);
4859
0
          YYERROR;
4860
0
          break;
4861
0
      }
4862
0
  }
4863
0
#line 4864 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
4864
0
    break;
4865
4866
0
  case 126:
4867
0
#line 3134 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
4868
0
  {
4869
0
      if (!coerce((yylsp[-2]), yyscanner, &(yyvsp[-2].expr), &(yyvsp[0].expr))) {
4870
0
          YYERROR;
4871
0
      }
4872
0
      switch ((yyvsp[-2].expr).type) {
4873
0
      case unoidl::detail::SourceProviderExpr::TYPE_INT:
4874
0
          (yyval.expr) = unoidl::detail::SourceProviderExpr::Int((yyvsp[-2].expr).ival ^ (yyvsp[0].expr).ival);
4875
0
          break;
4876
0
      case unoidl::detail::SourceProviderExpr::TYPE_UINT:
4877
0
          (yyval.expr) = unoidl::detail::SourceProviderExpr::Uint((yyvsp[-2].expr).uval ^ (yyvsp[0].expr).uval);
4878
0
          break;
4879
0
      default:
4880
0
          error((yylsp[-2]), yyscanner, u"arguments of non-integer type to \"^\""_ustr);
4881
0
          YYERROR;
4882
0
          break;
4883
0
      }
4884
0
  }
4885
0
#line 4886 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
4886
0
    break;
4887
4888
0
  case 128:
4889
0
#line 3156 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
4890
0
  {
4891
0
      if (!coerce((yylsp[-2]), yyscanner, &(yyvsp[-2].expr), &(yyvsp[0].expr))) {
4892
0
          YYERROR;
4893
0
      }
4894
0
      switch ((yyvsp[-2].expr).type) {
4895
0
      case unoidl::detail::SourceProviderExpr::TYPE_INT:
4896
0
          (yyval.expr) = unoidl::detail::SourceProviderExpr::Int((yyvsp[-2].expr).ival & (yyvsp[0].expr).ival);
4897
0
          break;
4898
0
      case unoidl::detail::SourceProviderExpr::TYPE_UINT:
4899
0
          (yyval.expr) = unoidl::detail::SourceProviderExpr::Uint((yyvsp[-2].expr).uval & (yyvsp[0].expr).uval);
4900
0
          break;
4901
0
      default:
4902
0
          error((yylsp[-2]), yyscanner, u"arguments of non-integer type to \"&\""_ustr);
4903
0
          YYERROR;
4904
0
          break;
4905
0
      }
4906
0
  }
4907
0
#line 4908 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
4908
0
    break;
4909
4910
0
  case 130:
4911
0
#line 3178 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
4912
0
  {
4913
0
      int n;
4914
0
      switch ((yyvsp[0].expr).type) {
4915
0
      case unoidl::detail::SourceProviderExpr::TYPE_INT:
4916
0
          if ((yyvsp[0].expr).ival < 0 || (yyvsp[0].expr).ival > 63) {
4917
0
              error(
4918
0
                  (yylsp[0]), yyscanner,
4919
0
                  ("out-of-range shift argument " + OUString::number((yyvsp[0].expr).ival)
4920
0
                   + " to \"<<\" "));
4921
0
              YYERROR;
4922
0
          }
4923
0
          n = static_cast<int>((yyvsp[0].expr).ival);
4924
0
          break;
4925
0
      case unoidl::detail::SourceProviderExpr::TYPE_UINT:
4926
0
          if ((yyvsp[0].expr).uval > 63) {
4927
0
              error(
4928
0
                  (yylsp[0]), yyscanner,
4929
0
                  ("out-of-range shift argument " + OUString::number((yyvsp[0].expr).uval)
4930
0
                   + " to \"<<\" "));
4931
0
              YYERROR;
4932
0
          }
4933
0
          n = static_cast<int>((yyvsp[0].expr).uval);
4934
0
          break;
4935
0
      default:
4936
0
          error((yylsp[0]), yyscanner, u"right argument of non-integer type to \"<<\""_ustr);
4937
0
          YYERROR;
4938
0
      }
4939
0
      switch ((yyvsp[-2].expr).type) {
4940
0
      case unoidl::detail::SourceProviderExpr::TYPE_INT:
4941
0
          if ((yyvsp[-2].expr).ival < 0) {
4942
0
              error(
4943
0
                  (yylsp[-2]), yyscanner,
4944
0
                  ("cannot left-shift negative argument "
4945
0
                   + OUString::number((yyvsp[-2].expr).ival)));
4946
0
              YYERROR;
4947
0
          }
4948
0
          (yyval.expr) = unoidl::detail::SourceProviderExpr::Int((yyvsp[-2].expr).ival << n);
4949
0
          break;
4950
0
      case unoidl::detail::SourceProviderExpr::TYPE_UINT:
4951
0
          (yyval.expr) = unoidl::detail::SourceProviderExpr::Uint((yyvsp[-2].expr).uval << n);
4952
0
          break;
4953
0
      default:
4954
0
          error((yylsp[-2]), yyscanner, u"left argument of non-integer type to \"<<\""_ustr);
4955
0
          YYERROR;
4956
0
          break;
4957
0
      }
4958
0
  }
4959
0
#line 4960 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
4960
0
    break;
4961
4962
0
  case 131:
4963
0
#line 3226 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
4964
0
  {
4965
0
      int n;
4966
0
      switch ((yyvsp[0].expr).type) {
4967
0
      case unoidl::detail::SourceProviderExpr::TYPE_INT:
4968
0
          if ((yyvsp[0].expr).ival < 0 || (yyvsp[0].expr).ival > 63) {
4969
0
              error(
4970
0
                  (yylsp[0]), yyscanner,
4971
0
                  ("out-of-range shift argument " + OUString::number((yyvsp[0].expr).ival)
4972
0
                   + " to \">>\" "));
4973
0
              YYERROR;
4974
0
          }
4975
0
          n = static_cast<int>((yyvsp[0].expr).ival);
4976
0
          break;
4977
0
      case unoidl::detail::SourceProviderExpr::TYPE_UINT:
4978
0
          if ((yyvsp[0].expr).uval > 63) {
4979
0
              error(
4980
0
                  (yylsp[0]), yyscanner,
4981
0
                  ("out-of-range shift argument " + OUString::number((yyvsp[0].expr).uval)
4982
0
                   + " to \">>\" "));
4983
0
              YYERROR;
4984
0
          }
4985
0
          n = static_cast<int>((yyvsp[0].expr).uval);
4986
0
          break;
4987
0
      default:
4988
0
          error((yylsp[0]), yyscanner, u"right argument of non-integer type to \">>\""_ustr);
4989
0
          YYERROR;
4990
0
          break;
4991
0
      }
4992
0
      switch ((yyvsp[-2].expr).type) {
4993
0
      case unoidl::detail::SourceProviderExpr::TYPE_INT:
4994
0
          (yyval.expr) = unoidl::detail::SourceProviderExpr::Int((yyvsp[-2].expr).ival >> n);
4995
0
          break;
4996
0
      case unoidl::detail::SourceProviderExpr::TYPE_UINT:
4997
0
          (yyval.expr) = unoidl::detail::SourceProviderExpr::Uint((yyvsp[-2].expr).uval >> n);
4998
0
          break;
4999
0
      default:
5000
0
          error((yylsp[-2]), yyscanner, u"left argument of non-integer type to \">>\""_ustr);
5001
0
          YYERROR;
5002
0
          break;
5003
0
      }
5004
0
  }
5005
0
#line 5006 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
5006
0
    break;
5007
5008
0
  case 133:
5009
0
#line 3272 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
5010
0
  {
5011
0
      if (!coerce((yylsp[-2]), yyscanner, &(yyvsp[-2].expr), &(yyvsp[0].expr))) {
5012
0
          YYERROR;
5013
0
      }
5014
0
      switch ((yyvsp[-2].expr).type) {
5015
0
      case unoidl::detail::SourceProviderExpr::TYPE_BOOL:
5016
0
          error((yylsp[-2]), yyscanner, u"arguments of boolean type to binary \"+\""_ustr);
5017
0
          YYERROR;
5018
0
          break;
5019
0
      case unoidl::detail::SourceProviderExpr::TYPE_INT:
5020
0
          (yyval.expr) = unoidl::detail::SourceProviderExpr::Int((yyvsp[-2].expr).ival + (yyvsp[0].expr).ival); //TODO: overflow
5021
0
          break;
5022
0
      case unoidl::detail::SourceProviderExpr::TYPE_UINT:
5023
0
          (yyval.expr) = unoidl::detail::SourceProviderExpr::Uint((yyvsp[-2].expr).uval + (yyvsp[0].expr).uval); //TODO: overflow
5024
0
          break;
5025
0
      case unoidl::detail::SourceProviderExpr::TYPE_FLOAT:
5026
0
          (yyval.expr) = unoidl::detail::SourceProviderExpr::Float((yyvsp[-2].expr).fval + (yyvsp[0].expr).fval);
5027
0
          break;
5028
0
      }
5029
0
  }
5030
0
#line 5031 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
5031
0
    break;
5032
5033
0
  case 134:
5034
0
#line 3293 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
5035
0
  {
5036
0
      if (!coerce((yylsp[-2]), yyscanner, &(yyvsp[-2].expr), &(yyvsp[0].expr))) {
5037
0
          YYERROR;
5038
0
      }
5039
0
      switch ((yyvsp[-2].expr).type) {
5040
0
      case unoidl::detail::SourceProviderExpr::TYPE_BOOL:
5041
0
          error((yylsp[-2]), yyscanner, u"arguments of boolean type to binary \"-\""_ustr);
5042
0
          YYERROR;
5043
0
          break;
5044
0
      case unoidl::detail::SourceProviderExpr::TYPE_INT:
5045
0
          (yyval.expr) = unoidl::detail::SourceProviderExpr::Int((yyvsp[-2].expr).ival - (yyvsp[0].expr).ival); //TODO: overflow
5046
0
          break;
5047
0
      case unoidl::detail::SourceProviderExpr::TYPE_UINT:
5048
0
          (yyval.expr) = unoidl::detail::SourceProviderExpr::Uint((yyvsp[-2].expr).uval - (yyvsp[0].expr).uval); //TODO: overflow
5049
0
          break;
5050
0
      case unoidl::detail::SourceProviderExpr::TYPE_FLOAT:
5051
0
          (yyval.expr) = unoidl::detail::SourceProviderExpr::Float((yyvsp[-2].expr).fval - (yyvsp[0].expr).fval);
5052
0
          break;
5053
0
      }
5054
0
  }
5055
0
#line 5056 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
5056
0
    break;
5057
5058
0
  case 136:
5059
0
#line 3318 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
5060
0
  {
5061
0
      if (!coerce((yylsp[-2]), yyscanner, &(yyvsp[-2].expr), &(yyvsp[0].expr))) {
5062
0
          YYERROR;
5063
0
      }
5064
0
      switch ((yyvsp[-2].expr).type) {
5065
0
      case unoidl::detail::SourceProviderExpr::TYPE_BOOL:
5066
0
          error((yylsp[-2]), yyscanner, u"arguments of boolean type to \"*\""_ustr);
5067
0
          YYERROR;
5068
0
          break;
5069
0
      case unoidl::detail::SourceProviderExpr::TYPE_INT:
5070
0
          (yyval.expr) = unoidl::detail::SourceProviderExpr::Int((yyvsp[-2].expr).ival * (yyvsp[0].expr).ival); //TODO: overflow
5071
0
          break;
5072
0
      case unoidl::detail::SourceProviderExpr::TYPE_UINT:
5073
0
          (yyval.expr) = unoidl::detail::SourceProviderExpr::Uint((yyvsp[-2].expr).uval * (yyvsp[0].expr).uval); //TODO: overflow
5074
0
          break;
5075
0
      case unoidl::detail::SourceProviderExpr::TYPE_FLOAT:
5076
0
          (yyval.expr) = unoidl::detail::SourceProviderExpr::Float((yyvsp[-2].expr).fval * (yyvsp[0].expr).fval);
5077
0
          break;
5078
0
      }
5079
0
  }
5080
0
#line 5081 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
5081
0
    break;
5082
5083
0
  case 137:
5084
0
#line 3339 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
5085
0
  {
5086
0
      if (!coerce((yylsp[-2]), yyscanner, &(yyvsp[-2].expr), &(yyvsp[0].expr))) {
5087
0
          YYERROR;
5088
0
      }
5089
0
      switch ((yyvsp[-2].expr).type) {
5090
0
      case unoidl::detail::SourceProviderExpr::TYPE_BOOL:
5091
0
          error((yylsp[-2]), yyscanner, u"arguments of boolean type to \"/\""_ustr);
5092
0
          YYERROR;
5093
0
          break;
5094
0
      case unoidl::detail::SourceProviderExpr::TYPE_INT:
5095
0
          if ((yyvsp[0].expr).ival == 0) {
5096
0
              error((yylsp[0]), yyscanner, u"cannot divide by zero"_ustr);
5097
0
              YYERROR;
5098
0
          }
5099
0
          (yyval.expr) = unoidl::detail::SourceProviderExpr::Int((yyvsp[-2].expr).ival / (yyvsp[0].expr).ival);
5100
0
          break;
5101
0
      case unoidl::detail::SourceProviderExpr::TYPE_UINT:
5102
0
          if ((yyvsp[0].expr).uval == 0) {
5103
0
              error((yylsp[0]), yyscanner, u"cannot divide by zero"_ustr);
5104
0
              YYERROR;
5105
0
          }
5106
0
          (yyval.expr) = unoidl::detail::SourceProviderExpr::Uint((yyvsp[-2].expr).uval / (yyvsp[0].expr).uval);
5107
0
          break;
5108
0
      case unoidl::detail::SourceProviderExpr::TYPE_FLOAT:
5109
0
          if ((yyvsp[0].expr).fval == 0) {
5110
0
              error((yylsp[0]), yyscanner, u"cannot divide by zero"_ustr);
5111
0
              YYERROR;
5112
0
          }
5113
0
          (yyval.expr) = unoidl::detail::SourceProviderExpr::Float((yyvsp[-2].expr).fval - (yyvsp[0].expr).fval);
5114
0
          break;
5115
0
      }
5116
0
  }
5117
0
#line 5118 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
5118
0
    break;
5119
5120
0
  case 138:
5121
0
#line 3372 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
5122
0
  {
5123
0
      if (!coerce((yylsp[-2]), yyscanner, &(yyvsp[-2].expr), &(yyvsp[0].expr))) {
5124
0
          YYERROR;
5125
0
      }
5126
0
      switch ((yyvsp[-2].expr).type) {
5127
0
      case unoidl::detail::SourceProviderExpr::TYPE_INT:
5128
0
          if ((yyvsp[0].expr).ival == 0) {
5129
0
              error((yylsp[0]), yyscanner, u"cannot divide by zero"_ustr);
5130
0
              YYERROR;
5131
0
          }
5132
0
          (yyval.expr) = unoidl::detail::SourceProviderExpr::Int((yyvsp[-2].expr).ival % (yyvsp[0].expr).ival);
5133
0
          break;
5134
0
      case unoidl::detail::SourceProviderExpr::TYPE_UINT:
5135
0
          if ((yyvsp[0].expr).uval == 0) {
5136
0
              error((yylsp[0]), yyscanner, u"cannot divide by zero"_ustr);
5137
0
              YYERROR;
5138
0
          }
5139
0
          (yyval.expr) = unoidl::detail::SourceProviderExpr::Uint((yyvsp[-2].expr).uval % (yyvsp[0].expr).uval);
5140
0
          break;
5141
0
      default:
5142
0
          error((yylsp[-2]), yyscanner, u"arguments of non-integer type to \"%\""_ustr);
5143
0
          YYERROR;
5144
0
          break;
5145
0
      }
5146
0
  }
5147
0
#line 5148 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
5148
0
    break;
5149
5150
0
  case 140:
5151
0
#line 3402 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
5152
0
  {
5153
0
      if ((yyvsp[0].expr).type == unoidl::detail::SourceProviderExpr::TYPE_BOOL) {
5154
0
          error((yylsp[0]), yyscanner, u"argument of boolean type to unary \"+\""_ustr);
5155
0
          YYERROR;
5156
0
      }
5157
0
      (yyval.expr) = (yyvsp[0].expr);
5158
0
  }
5159
0
#line 5160 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
5160
0
    break;
5161
5162
0
  case 141:
5163
0
#line 3410 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
5164
0
  {
5165
0
      switch ((yyvsp[0].expr).type) {
5166
0
      case unoidl::detail::SourceProviderExpr::TYPE_BOOL:
5167
0
          error((yylsp[0]), yyscanner, u"argument of boolean type to unary \"-\""_ustr);
5168
0
          YYERROR;
5169
0
          break;
5170
0
      case unoidl::detail::SourceProviderExpr::TYPE_INT:
5171
0
          if ((yyvsp[0].expr).ival == SAL_MIN_INT64) {
5172
0
              error((yylsp[0]), yyscanner, u"cannot negate -2^63"_ustr);
5173
0
              YYERROR;
5174
0
          }
5175
0
          (yyval.expr) = unoidl::detail::SourceProviderExpr::Int(-(yyvsp[0].expr).ival);
5176
0
          break;
5177
0
      case unoidl::detail::SourceProviderExpr::TYPE_UINT:
5178
0
          if ((yyvsp[0].expr).uval == SAL_CONST_UINT64(0x8000000000000000)) {
5179
0
              (yyval.expr) = unoidl::detail::SourceProviderExpr::Int(SAL_MIN_INT64);
5180
0
          } else {
5181
0
              if ((yyvsp[0].expr).uval > SAL_MAX_INT64) {
5182
0
                  error(
5183
0
                      (yylsp[0]), yyscanner,
5184
0
                      ("cannot negate out-of-range value "
5185
0
                       + OUString::number((yyvsp[0].expr).uval)));
5186
0
                  YYERROR;
5187
0
              }
5188
0
              (yyval.expr) = unoidl::detail::SourceProviderExpr::Int(
5189
0
                  -static_cast<sal_Int64>((yyvsp[0].expr).uval));
5190
0
          }
5191
0
          break;
5192
0
      case unoidl::detail::SourceProviderExpr::TYPE_FLOAT:
5193
0
          (yyval.expr) = unoidl::detail::SourceProviderExpr::Float(-(yyvsp[0].expr).fval);
5194
0
          break;
5195
0
      }
5196
0
  }
5197
0
#line 5198 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
5198
0
    break;
5199
5200
0
  case 142:
5201
0
#line 3444 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
5202
0
  {
5203
0
      switch ((yyvsp[0].expr).type) {
5204
0
      case unoidl::detail::SourceProviderExpr::TYPE_INT:
5205
0
          (yyval.expr) = unoidl::detail::SourceProviderExpr::Int(~(yyvsp[0].expr).ival);
5206
0
          break;
5207
0
      case unoidl::detail::SourceProviderExpr::TYPE_UINT:
5208
0
          (yyval.expr) = unoidl::detail::SourceProviderExpr::Uint(~(yyvsp[0].expr).uval);
5209
0
          break;
5210
0
      default:
5211
0
          error((yylsp[0]), yyscanner, u"argument of non-integer type to \"~\""_ustr);
5212
0
          YYERROR;
5213
0
          break;
5214
0
      }
5215
0
  }
5216
0
#line 5217 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
5217
0
    break;
5218
5219
0
  case 144:
5220
0
#line 3462 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
5221
0
               { (yyval.expr) = (yyvsp[-1].expr); }
5222
0
#line 5223 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
5223
0
    break;
5224
5225
0
  case 145:
5226
0
#line 3463 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
5227
0
            { (yyval.expr) = unoidl::detail::SourceProviderExpr::Bool(false); }
5228
0
#line 5229 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
5229
0
    break;
5230
5231
0
  case 146:
5232
0
#line 3464 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
5233
0
           { (yyval.expr) = unoidl::detail::SourceProviderExpr::Bool(true); }
5234
0
#line 5235 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
5235
0
    break;
5236
5237
0
  case 147:
5238
0
#line 3465 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
5239
0
              { (yyval.expr) = unoidl::detail::SourceProviderExpr::Uint((yyvsp[0].ival)); }
5240
0
#line 5241 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
5241
0
    break;
5242
5243
0
  case 148:
5244
0
#line 3466 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
5245
0
               { (yyval.expr) = unoidl::detail::SourceProviderExpr::Float((yyvsp[0].fval)); }
5246
0
#line 5247 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
5247
0
    break;
5248
5249
0
  case 149:
5250
0
#line 3468 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
5251
0
  {
5252
0
      OUString name(convertName((yyvsp[0].sval)));
5253
0
      unoidl::detail::SourceProviderScannerData * data = yyget_extra(yyscanner);
5254
0
      unoidl::ConstantValue v(false); // dummy value
5255
0
      bool found = false;
5256
0
      bool unpub = false;
5257
0
      sal_Int32 i = name.lastIndexOf('.');
5258
0
      if (i == -1) {
5259
0
          rtl::Reference<unoidl::detail::SourceProviderEntityPad> pad(
5260
0
              getCurrentEntity(data)->pad);
5261
0
          unoidl::detail::SourceProviderEnumTypeEntityPad * p1 = dynamic_cast<
5262
0
              unoidl::detail::SourceProviderEnumTypeEntityPad *>(pad.get());
5263
0
          if (p1 != nullptr) {
5264
0
              for (const auto & j: p1->members) {
5265
0
                  if (j.name == name) {
5266
0
                      v = unoidl::ConstantValue(j.value);
5267
0
                      found = true;
5268
0
                      break;
5269
0
                  }
5270
0
              }
5271
0
          } else {
5272
0
              unoidl::detail::SourceProviderConstantGroupEntityPad * p2
5273
0
                  = dynamic_cast<
5274
0
                      unoidl::detail::SourceProviderConstantGroupEntityPad *>(
5275
0
                          pad.get());
5276
0
              if (p2 != nullptr) {
5277
0
                  for (const auto & j: p2->members) {
5278
0
                      if (j.name == name) {
5279
0
                          v = j.value;
5280
0
                          found = true;
5281
0
                          break;
5282
0
                      }
5283
0
                  }
5284
0
              }
5285
0
          }
5286
0
      } else {
5287
0
          OUString scope(name.copy(0, i));
5288
0
          unoidl::detail::SourceProviderEntity const * ent;
5289
0
          if (findEntity(
5290
0
                  (yylsp[0]), yyscanner, data, false, &scope, &ent, nullptr, nullptr)
5291
0
              == FOUND_ERROR)
5292
0
          {
5293
0
              YYERROR;
5294
0
          }
5295
0
          if (ent != nullptr) {
5296
0
              std::u16string_view id(name.subView(i + 1));
5297
              // No need to check for enum members here, as they cannot be
5298
              // referenced in expressions by qualified name (TODO: is that true?):
5299
0
              if (ent->entity.is()) {
5300
0
                  if (ent->entity->getSort()
5301
0
                      == unoidl::Entity::SORT_CONSTANT_GROUP)
5302
0
                  {
5303
0
                      std::vector<unoidl::ConstantGroupEntity::Member> const &
5304
0
                          mems(
5305
0
                              static_cast<unoidl::ConstantGroupEntity *>(
5306
0
                                  ent->entity.get())->
5307
0
                              getMembers());
5308
0
                      for (auto & j: mems) {
5309
0
                          if (j.name == id) {
5310
0
                              v = j.value;
5311
0
                              found = true;
5312
0
                              unpub
5313
0
                                  = !static_cast<unoidl::ConstantGroupEntity *>(
5314
0
                                      ent->entity.get())->isPublished();
5315
0
                              break;
5316
0
                          }
5317
0
                      }
5318
0
                  }
5319
0
              } else if (ent->pad.is()) {
5320
0
                  unoidl::detail::SourceProviderConstantGroupEntityPad * pad
5321
0
                      = dynamic_cast<
5322
0
                          unoidl::detail::SourceProviderConstantGroupEntityPad *>(
5323
0
                              ent->pad.get());
5324
0
                  if (pad != nullptr) {
5325
0
                      for (const auto & j: pad->members) {
5326
0
                          if (j.name == id) {
5327
0
                              v = j.value;
5328
0
                              found = true;
5329
0
                              unpub = !ent->pad->isPublished();
5330
0
                              break;
5331
0
                          }
5332
0
                      }
5333
0
                  }
5334
0
              }
5335
0
          }
5336
0
      }
5337
0
      if (!found) {
5338
0
          error(
5339
0
              (yylsp[0]), yyscanner,
5340
0
              (name
5341
0
               + (" does not resolve to neither a constant nor an unqualified"
5342
0
                  " enum member")));
5343
0
          YYERROR;
5344
0
      }
5345
0
      if (data->publishedContext && unpub) {
5346
0
          error(
5347
0
              (yylsp[0]), yyscanner,
5348
0
              "unpublished value " + name + " used in published context");
5349
0
          YYERROR;
5350
0
      }
5351
0
      switch (v.type) {
5352
0
      case unoidl::ConstantValue::TYPE_BOOLEAN:
5353
0
          (yyval.expr) = unoidl::detail::SourceProviderExpr::Bool(v.booleanValue);
5354
0
          break;
5355
0
      case unoidl::ConstantValue::TYPE_BYTE:
5356
0
          (yyval.expr) = unoidl::detail::SourceProviderExpr::Int(v.byteValue);
5357
0
          break;
5358
0
      case unoidl::ConstantValue::TYPE_SHORT:
5359
0
          (yyval.expr) = unoidl::detail::SourceProviderExpr::Int(v.shortValue);
5360
0
          break;
5361
0
      case unoidl::ConstantValue::TYPE_UNSIGNED_SHORT:
5362
0
          (yyval.expr) = unoidl::detail::SourceProviderExpr::Uint(v.unsignedShortValue);
5363
0
          break;
5364
0
      case unoidl::ConstantValue::TYPE_LONG:
5365
0
          (yyval.expr) = unoidl::detail::SourceProviderExpr::Int(v.longValue);
5366
0
          break;
5367
0
      case unoidl::ConstantValue::TYPE_UNSIGNED_LONG:
5368
0
          (yyval.expr) = unoidl::detail::SourceProviderExpr::Uint(v.unsignedLongValue);
5369
0
          break;
5370
0
      case unoidl::ConstantValue::TYPE_HYPER:
5371
0
          (yyval.expr) = unoidl::detail::SourceProviderExpr::Int(v.hyperValue);
5372
0
          break;
5373
0
      case unoidl::ConstantValue::TYPE_UNSIGNED_HYPER:
5374
0
          (yyval.expr) = unoidl::detail::SourceProviderExpr::Uint(v.unsignedHyperValue);
5375
0
          break;
5376
0
      case unoidl::ConstantValue::TYPE_FLOAT:
5377
0
          (yyval.expr) = unoidl::detail::SourceProviderExpr::Float(v.floatValue);
5378
0
          break;
5379
0
      case unoidl::ConstantValue::TYPE_DOUBLE:
5380
0
          (yyval.expr) = unoidl::detail::SourceProviderExpr::Float(v.doubleValue);
5381
0
          break;
5382
0
      }
5383
0
  }
5384
0
#line 5385 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
5385
0
    break;
5386
5387
0
  case 150:
5388
0
#line 3605 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
5389
0
  {
5390
0
      unoidl::detail::SourceProviderType t(*(yyvsp[0].type));
5391
0
      delete (yyvsp[0].type);
5392
0
      if (!checkTypeArgument((yylsp[0]), yyscanner, t)) {
5393
0
          delete (yyvsp[-2].types); /* see commented-out %destructor above */
5394
0
          YYERROR;
5395
0
      }
5396
0
      (yyvsp[-2].types)->push_back(t);
5397
0
      (yyval.types) = (yyvsp[-2].types);
5398
0
  }
5399
0
#line 5400 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
5400
0
    break;
5401
5402
0
  case 151:
5403
0
#line 3616 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
5404
0
  {
5405
0
      unoidl::detail::SourceProviderType t(*(yyvsp[0].type));
5406
0
      delete (yyvsp[0].type);
5407
0
      if (!checkTypeArgument((yylsp[0]), yyscanner, t)) {
5408
0
          YYERROR;
5409
0
      }
5410
0
      (yyval.types) = new std::vector<unoidl::detail::SourceProviderType>;
5411
0
      (yyval.types)->push_back(t);
5412
0
  }
5413
0
#line 5414 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
5414
0
    break;
5415
5416
0
  case 152:
5417
0
#line 3629 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
5418
0
  {
5419
0
      (yyval.type) = new unoidl::detail::SourceProviderType(
5420
0
          unoidl::detail::SourceProviderType::TYPE_VOID);
5421
0
  }
5422
0
#line 5423 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
5423
0
    break;
5424
5425
0
  case 153:
5426
0
#line 3634 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
5427
0
  {
5428
0
      (yyval.type) = new unoidl::detail::SourceProviderType(
5429
0
          unoidl::detail::SourceProviderType::TYPE_BOOLEAN);
5430
0
  }
5431
0
#line 5432 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
5432
0
    break;
5433
5434
0
  case 154:
5435
0
#line 3639 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
5436
0
  {
5437
0
      (yyval.type) = new unoidl::detail::SourceProviderType(
5438
0
          unoidl::detail::SourceProviderType::TYPE_BYTE);
5439
0
  }
5440
0
#line 5441 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
5441
0
    break;
5442
5443
0
  case 155:
5444
0
#line 3644 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
5445
0
  {
5446
0
      (yyval.type) = new unoidl::detail::SourceProviderType(
5447
0
          unoidl::detail::SourceProviderType::TYPE_SHORT);
5448
0
  }
5449
0
#line 5450 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
5450
0
    break;
5451
5452
0
  case 156:
5453
0
#line 3649 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
5454
0
  {
5455
0
      (yyval.type) = new unoidl::detail::SourceProviderType(
5456
0
          unoidl::detail::SourceProviderType::TYPE_UNSIGNED_SHORT);
5457
0
  }
5458
0
#line 5459 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
5459
0
    break;
5460
5461
0
  case 157:
5462
0
#line 3654 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
5463
0
  {
5464
0
      (yyval.type) = new unoidl::detail::SourceProviderType(
5465
0
          unoidl::detail::SourceProviderType::TYPE_LONG);
5466
0
  }
5467
0
#line 5468 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
5468
0
    break;
5469
5470
0
  case 158:
5471
0
#line 3659 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
5472
0
  {
5473
0
      (yyval.type) = new unoidl::detail::SourceProviderType(
5474
0
          unoidl::detail::SourceProviderType::TYPE_UNSIGNED_LONG);
5475
0
  }
5476
0
#line 5477 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
5477
0
    break;
5478
5479
0
  case 159:
5480
0
#line 3664 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
5481
0
  {
5482
0
      (yyval.type) = new unoidl::detail::SourceProviderType(
5483
0
          unoidl::detail::SourceProviderType::TYPE_HYPER);
5484
0
  }
5485
0
#line 5486 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
5486
0
    break;
5487
5488
0
  case 160:
5489
0
#line 3669 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
5490
0
  {
5491
0
      (yyval.type) = new unoidl::detail::SourceProviderType(
5492
0
          unoidl::detail::SourceProviderType::TYPE_UNSIGNED_HYPER);
5493
0
  }
5494
0
#line 5495 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
5495
0
    break;
5496
5497
0
  case 161:
5498
0
#line 3674 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
5499
0
  {
5500
0
      (yyval.type) = new unoidl::detail::SourceProviderType(
5501
0
          unoidl::detail::SourceProviderType::TYPE_FLOAT);
5502
0
  }
5503
0
#line 5504 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
5504
0
    break;
5505
5506
0
  case 162:
5507
0
#line 3679 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
5508
0
  {
5509
0
      (yyval.type) = new unoidl::detail::SourceProviderType(
5510
0
          unoidl::detail::SourceProviderType::TYPE_DOUBLE);
5511
0
  }
5512
0
#line 5513 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
5513
0
    break;
5514
5515
0
  case 163:
5516
0
#line 3684 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
5517
0
  {
5518
0
      (yyval.type) = new unoidl::detail::SourceProviderType(
5519
0
          unoidl::detail::SourceProviderType::TYPE_CHAR);
5520
0
  }
5521
0
#line 5522 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
5522
0
    break;
5523
5524
0
  case 164:
5525
0
#line 3689 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
5526
0
  {
5527
0
      (yyval.type) = new unoidl::detail::SourceProviderType(
5528
0
          unoidl::detail::SourceProviderType::TYPE_STRING);
5529
0
  }
5530
0
#line 5531 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
5531
0
    break;
5532
5533
0
  case 165:
5534
0
#line 3694 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
5535
0
  {
5536
0
      (yyval.type) = new unoidl::detail::SourceProviderType(
5537
0
          unoidl::detail::SourceProviderType::TYPE_TYPE);
5538
0
  }
5539
0
#line 5540 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
5540
0
    break;
5541
5542
0
  case 166:
5543
0
#line 3699 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
5544
0
  {
5545
0
      (yyval.type) = new unoidl::detail::SourceProviderType(
5546
0
          unoidl::detail::SourceProviderType::TYPE_ANY);
5547
0
  }
5548
0
#line 5549 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
5549
0
    break;
5550
5551
0
  case 167:
5552
0
#line 3704 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
5553
0
  {
5554
0
      switch ((yyvsp[-1].type)->type) {
5555
0
      case unoidl::detail::SourceProviderType::TYPE_VOID:
5556
0
      case unoidl::detail::SourceProviderType::TYPE_EXCEPTION:
5557
0
      case unoidl::detail::SourceProviderType::TYPE_PARAMETER: //TODO?
5558
0
          error((yylsp[-1]), yyscanner, u"illegal sequence type component type"_ustr);
5559
0
          YYERROR;
5560
0
          break;
5561
0
      default:
5562
0
          break;
5563
0
      }
5564
0
      (yyval.type) = new unoidl::detail::SourceProviderType((yyvsp[-1].type));
5565
0
      delete (yyvsp[-1].type);
5566
0
  }
5567
0
#line 5568 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
5568
0
    break;
5569
5570
0
  case 168:
5571
0
#line 3719 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
5572
0
  {
5573
0
      unoidl::detail::SourceProviderScannerData * data = yyget_extra(yyscanner);
5574
0
      OUString name(convertName((yyvsp[0].sval)));
5575
0
      bool done = false;
5576
0
      if (name.indexOf('.') == -1 && !data->currentName.isEmpty()) {
5577
0
          unoidl::detail::SourceProviderEntity * ent = getCurrentEntity(data);
5578
0
          unoidl::detail::SourceProviderPolymorphicStructTypeTemplateEntityPad *
5579
0
              pad = dynamic_cast<
5580
0
                  unoidl::detail::SourceProviderPolymorphicStructTypeTemplateEntityPad *>(
5581
0
                      ent->pad.get());
5582
0
          if (pad != nullptr
5583
0
              && (std::find(
5584
0
                      pad->typeParameters.begin(), pad->typeParameters.end(),
5585
0
                      name)
5586
0
                  != pad->typeParameters.end()))
5587
0
          {
5588
0
              (yyval.type) = new unoidl::detail::SourceProviderType(name);
5589
0
              done = true;
5590
0
          }
5591
0
      }
5592
0
      if (!done) {
5593
0
          unoidl::detail::SourceProviderEntity const * ent;
5594
0
          unoidl::detail::SourceProviderType t;
5595
0
          switch (findEntity(
5596
0
                      (yylsp[0]), yyscanner, data, false, &name, &ent, nullptr, &t))
5597
0
          {
5598
0
          case FOUND_ERROR:
5599
0
              YYERROR;
5600
0
              break;
5601
0
          case FOUND_TYPE:
5602
0
              (yyval.type) = new unoidl::detail::SourceProviderType(t);
5603
0
              break;
5604
0
          case FOUND_ENTITY:
5605
0
              if (ent == nullptr) {
5606
0
                  error((yylsp[0]), yyscanner, "unknown entity " + name);
5607
0
                  YYERROR;
5608
0
              }
5609
0
              bool ok = false;
5610
0
              switch (ent->kind) {
5611
0
              case unoidl::detail::SourceProviderEntity::KIND_LOCAL:
5612
0
                  if (ent->pad.is()) {
5613
0
                      if (data->publishedContext && !ent->pad->isPublished()) {
5614
0
                          error(
5615
0
                              (yylsp[0]), yyscanner,
5616
0
                              ("unpublished entity " + name
5617
0
                               + " used in published context"));
5618
0
                          YYERROR;
5619
0
                      }
5620
0
                      if (dynamic_cast<unoidl::detail::SourceProviderEnumTypeEntityPad *>(
5621
0
                              ent->pad.get())
5622
0
                          != nullptr)
5623
0
                      {
5624
0
                          (yyval.type) = new unoidl::detail::SourceProviderType(
5625
0
                              unoidl::detail::SourceProviderType::TYPE_ENUM,
5626
0
                              name, ent);
5627
0
                          ok = true;
5628
0
                      } else if (dynamic_cast<unoidl::detail::SourceProviderPlainStructTypeEntityPad *>(
5629
0
                                     ent->pad.get())
5630
0
                                 != nullptr)
5631
0
                      {
5632
0
                          (yyval.type) = new unoidl::detail::SourceProviderType(
5633
0
                              unoidl::detail::SourceProviderType::TYPE_PLAIN_STRUCT,
5634
0
                              name, ent);
5635
0
                          ok = true;
5636
0
                      } else if (dynamic_cast<unoidl::detail::SourceProviderPolymorphicStructTypeTemplateEntityPad *>(
5637
0
                                     ent->pad.get())
5638
0
                                 != nullptr)
5639
0
                      {
5640
0
                          error(
5641
0
                              (yylsp[0]), yyscanner,
5642
0
                              (("recursive reference to polymorphic struct type"
5643
0
                                " template ")
5644
0
                               + name));
5645
0
                          YYERROR;
5646
0
                      } else if (dynamic_cast<unoidl::detail::SourceProviderExceptionTypeEntityPad *>(
5647
0
                                     ent->pad.get())
5648
0
                                 != nullptr)
5649
0
                      {
5650
0
                          (yyval.type) = new unoidl::detail::SourceProviderType(
5651
0
                              unoidl::detail::SourceProviderType::TYPE_EXCEPTION,
5652
0
                              name, ent);
5653
0
                          ok = true;
5654
0
                      } else if (dynamic_cast<unoidl::detail::SourceProviderInterfaceTypeEntityPad *>(
5655
0
                                     ent->pad.get())
5656
0
                                 != nullptr)
5657
0
                      {
5658
0
                          (yyval.type) = new unoidl::detail::SourceProviderType(
5659
0
                              unoidl::detail::SourceProviderType::TYPE_INTERFACE,
5660
0
                              name, ent);
5661
0
                          ok = true;
5662
0
                      }
5663
0
                      break;
5664
0
                  }
5665
0
                  assert(ent->entity.is());
5666
0
                  [[fallthrough]];
5667
0
              case unoidl::detail::SourceProviderEntity::KIND_EXTERNAL:
5668
0
                  if (data->publishedContext
5669
0
                      && ent->entity->getSort() != unoidl::Entity::SORT_MODULE
5670
0
                      && !static_cast<unoidl::PublishableEntity *>(
5671
0
                          ent->entity.get())->isPublished())
5672
0
                  {
5673
0
                      error(
5674
0
                          (yylsp[0]), yyscanner,
5675
0
                          ("unpublished entity " + name
5676
0
                           + " used in published context"));
5677
0
                      YYERROR;
5678
0
                  }
5679
0
                  switch (ent->entity->getSort()) {
5680
0
                  case unoidl::Entity::SORT_ENUM_TYPE:
5681
0
                      (yyval.type) = new unoidl::detail::SourceProviderType(
5682
0
                          unoidl::detail::SourceProviderType::TYPE_ENUM, name,
5683
0
                          ent);
5684
0
                      ok = true;
5685
0
                      break;
5686
0
                  case unoidl::Entity::SORT_PLAIN_STRUCT_TYPE:
5687
0
                      (yyval.type) = new unoidl::detail::SourceProviderType(
5688
0
                          unoidl::detail::SourceProviderType::TYPE_PLAIN_STRUCT,
5689
0
                          name, ent);
5690
0
                      ok = true;
5691
0
                      break;
5692
0
                  case unoidl::Entity::SORT_POLYMORPHIC_STRUCT_TYPE_TEMPLATE:
5693
0
                      error(
5694
0
                          (yylsp[0]), yyscanner,
5695
0
                          ("polymorphic struct type template " + name
5696
0
                           + " without type arguments"));
5697
0
                      YYERROR;
5698
0
                      break;
5699
0
                  case unoidl::Entity::SORT_EXCEPTION_TYPE:
5700
0
                      (yyval.type) = new unoidl::detail::SourceProviderType(
5701
0
                          unoidl::detail::SourceProviderType::TYPE_EXCEPTION,
5702
0
                          name, ent);
5703
0
                      ok = true;
5704
0
                      break;
5705
0
                  case unoidl::Entity::SORT_INTERFACE_TYPE:
5706
0
                      (yyval.type) = new unoidl::detail::SourceProviderType(
5707
0
                          unoidl::detail::SourceProviderType::TYPE_INTERFACE,
5708
0
                          name, ent);
5709
0
                      ok = true;
5710
0
                      break;
5711
0
                  case unoidl::Entity::SORT_TYPEDEF:
5712
0
                      O3TL_UNREACHABLE;
5713
0
                  default:
5714
0
                      break;
5715
0
                  }
5716
0
                  break;
5717
0
              case unoidl::detail::SourceProviderEntity::KIND_INTERFACE_DECL:
5718
0
                  if (data->publishedContext) {
5719
0
                      error(
5720
0
                          (yylsp[0]), yyscanner,
5721
0
                          ("unpublished entity " + name
5722
0
                           + " used in published context"));
5723
0
                      YYERROR;
5724
0
                  }
5725
0
                  [[fallthrough]];
5726
0
              case unoidl::detail::SourceProviderEntity::KIND_PUBLISHED_INTERFACE_DECL:
5727
0
                  (yyval.type) = new unoidl::detail::SourceProviderType(
5728
0
                      unoidl::detail::SourceProviderType::TYPE_INTERFACE, name,
5729
0
                      ent);
5730
0
                  ok = true;
5731
0
                  break;
5732
0
              case unoidl::detail::SourceProviderEntity::KIND_MODULE:
5733
0
                  assert(false && "this cannot happen");
5734
0
              }
5735
0
              if (!ok) {
5736
0
                  error((yylsp[0]), yyscanner, "non-type entity " + name);
5737
0
                  YYERROR;
5738
0
              }
5739
0
              break;
5740
0
          }
5741
0
      }
5742
0
  }
5743
0
#line 5744 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
5744
0
    break;
5745
5746
0
  case 169:
5747
0
#line 3891 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
5748
0
  {
5749
0
      unoidl::detail::SourceProviderScannerData * data = yyget_extra(yyscanner);
5750
0
      OUString name(convertName((yyvsp[-3].sval)));
5751
0
      std::vector<unoidl::detail::SourceProviderType> args(*(yyvsp[-1].types));
5752
0
      delete (yyvsp[-1].types);
5753
0
      unoidl::detail::SourceProviderEntity const * ent;
5754
0
      if (findEntity((yylsp[-3]), yyscanner, data, false, &name, &ent, nullptr, nullptr)
5755
0
          == FOUND_ERROR)
5756
0
      {
5757
0
          YYERROR;
5758
0
      }
5759
0
      if (ent == nullptr) {
5760
0
          error((yylsp[-3]), yyscanner, "unknown entity " + name);
5761
0
          YYERROR;
5762
0
      }
5763
0
      bool ok = false;
5764
0
      switch (ent->kind) {
5765
0
      case unoidl::detail::SourceProviderEntity::KIND_LOCAL:
5766
0
          if (ent->pad.is()) {
5767
0
              if (dynamic_cast<unoidl::detail::SourceProviderPolymorphicStructTypeTemplateEntityPad *>(
5768
0
                      ent->pad.get())
5769
0
                  != nullptr)
5770
0
              {
5771
0
                  error(
5772
0
                      (yylsp[-3]), yyscanner,
5773
0
                      (("recursive reference to polymorphic struct type"
5774
0
                        " template ")
5775
0
                       + name));
5776
0
                  YYERROR;
5777
0
              }
5778
0
              break;
5779
0
          }
5780
0
          assert(ent->entity.is());
5781
0
          [[fallthrough]];
5782
0
      case unoidl::detail::SourceProviderEntity::KIND_EXTERNAL:
5783
0
          if (ent->entity->getSort()
5784
0
              == unoidl::Entity::SORT_POLYMORPHIC_STRUCT_TYPE_TEMPLATE)
5785
0
          {
5786
0
              rtl::Reference<unoidl::PolymorphicStructTypeTemplateEntity> e(
5787
0
                  static_cast<unoidl::PolymorphicStructTypeTemplateEntity *>(
5788
0
                      ent->entity.get()));
5789
0
              if (args.size() != e->getTypeParameters().size()) {
5790
0
                  error(
5791
0
                      (yylsp[-3]), yyscanner,
5792
0
                      ("bad number of polymorphic struct type template " + name
5793
0
                       + " type arguments"));
5794
0
                  YYERROR;
5795
0
              }
5796
0
              if (data->publishedContext && !e->isPublished()) {
5797
0
                  error(
5798
0
                      (yylsp[-3]), yyscanner,
5799
0
                      ("unpublished polymorphic struct type template " + name
5800
0
                       + " used in published context"));
5801
0
                  YYERROR;
5802
0
              }
5803
0
              (yyval.type) = new unoidl::detail::SourceProviderType(name, ent, std::move(args));
5804
0
              ok = true;
5805
0
          }
5806
0
          break;
5807
0
      case unoidl::detail::SourceProviderEntity::KIND_INTERFACE_DECL:
5808
0
      case unoidl::detail::SourceProviderEntity::KIND_PUBLISHED_INTERFACE_DECL:
5809
0
          break;
5810
0
      case unoidl::detail::SourceProviderEntity::KIND_MODULE:
5811
0
          assert(false && "this cannot happen");
5812
0
      }
5813
0
      if (!ok) {
5814
0
          error((yylsp[-3]), yyscanner, "non-type entity " + name);
5815
0
          YYERROR;
5816
0
      }
5817
0
  }
5818
0
#line 5819 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
5819
0
    break;
5820
5821
0
  case 170:
5822
0
#line 3964 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
5823
0
                             { *(yyvsp[-2].sval) += "." + *(yyvsp[0].sval); delete (yyvsp[0].sval); (yyval.sval) = (yyvsp[-2].sval); }
5824
0
#line 5825 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
5825
0
    break;
5826
5827
0
  case 171:
5828
0
#line 3965 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
5829
0
                        { *(yyvsp[0].sval) = "." + *(yyvsp[0].sval); (yyval.sval) = (yyvsp[0].sval); }
5830
0
#line 5831 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
5831
0
    break;
5832
5833
0
  case 174:
5834
0
#line 3971 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
5835
0
          { (yyval.sval) = new OString("get"_ostr); }
5836
0
#line 5837 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
5837
0
    break;
5838
5839
0
  case 175:
5840
0
#line 3972 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
5841
0
                { (yyval.sval) = new OString("published"_ostr); }
5842
0
#line 5843 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
5843
0
    break;
5844
5845
0
  case 176:
5846
0
#line 3973 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
5847
0
          { (yyval.sval) = new OString("set"_ostr); }
5848
0
#line 5849 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
5849
0
    break;
5850
5851
0
  case 177:
5852
0
#line 3977 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
5853
0
                 { (yyval.bval) = true; }
5854
0
#line 5855 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
5855
0
    break;
5856
5857
0
  case 178:
5858
0
#line 3978 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
5859
0
              { (yyval.bval) = false; }
5860
0
#line 5861 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
5861
0
    break;
5862
5863
5864
0
#line 5865 "/work/workdir/YaccTarget/unoidl/source/sourceprovider-parser.cxx"
5865
5866
0
      default: break;
5867
0
    }
5868
  /* User semantic actions sometimes alter yychar, and that requires
5869
     that yytoken be updated with the new translation.  We take the
5870
     approach of translating immediately before every use of yytoken.
5871
     One alternative is translating here after every semantic action,
5872
     but that translation would be missed if the semantic action invokes
5873
     YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
5874
     if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
5875
     incorrect destructor might then be invoked immediately.  In the
5876
     case of YYERROR or YYBACKUP, subsequent parser actions might lead
5877
     to an incorrect destructor call or verbose syntax error message
5878
     before the lookahead is translated.  */
5879
0
  YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
5880
5881
0
  YYPOPSTACK (yylen);
5882
0
  yylen = 0;
5883
0
  YY_STACK_PRINT (yyss, yyssp);
5884
5885
0
  *++yyvsp = yyval;
5886
0
  *++yylsp = yyloc;
5887
5888
  /* Now 'shift' the result of the reduction.  Determine what state
5889
     that goes to, based on the state we popped back to and the rule
5890
     number reduced by.  */
5891
0
  {
5892
0
    const int yylhs = yyr1[yyn] - YYNTOKENS;
5893
0
    const int yyi = yypgoto[yylhs] + *yyssp;
5894
0
    yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
5895
0
               ? yytable[yyi]
5896
0
               : yydefgoto[yylhs]);
5897
0
  }
5898
5899
0
  goto yynewstate;
5900
5901
5902
/*--------------------------------------.
5903
| yyerrlab -- here on detecting error.  |
5904
`--------------------------------------*/
5905
0
yyerrlab:
5906
  /* Make sure we have latest lookahead translation.  See comments at
5907
     user semantic actions for why this is necessary.  */
5908
0
  yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
5909
5910
  /* If not already recovering from an error, report this error.  */
5911
0
  if (!yyerrstatus)
5912
0
    {
5913
0
      ++yynerrs;
5914
0
#if ! YYERROR_VERBOSE
5915
0
      yyerror (&yylloc, yyscanner, YY_("syntax error"));
5916
#else
5917
# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
5918
                                        yyssp, yytoken)
5919
      {
5920
        char const *yymsgp = YY_("syntax error");
5921
        int yysyntax_error_status;
5922
        yysyntax_error_status = YYSYNTAX_ERROR;
5923
        if (yysyntax_error_status == 0)
5924
          yymsgp = yymsg;
5925
        else if (yysyntax_error_status == 1)
5926
          {
5927
            if (yymsg != yymsgbuf)
5928
              YYSTACK_FREE (yymsg);
5929
            yymsg = YY_CAST (char *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc)));
5930
            if (!yymsg)
5931
              {
5932
                yymsg = yymsgbuf;
5933
                yymsg_alloc = sizeof yymsgbuf;
5934
                yysyntax_error_status = 2;
5935
              }
5936
            else
5937
              {
5938
                yysyntax_error_status = YYSYNTAX_ERROR;
5939
                yymsgp = yymsg;
5940
              }
5941
          }
5942
        yyerror (&yylloc, yyscanner, yymsgp);
5943
        if (yysyntax_error_status == 2)
5944
          goto yyexhaustedlab;
5945
      }
5946
# undef YYSYNTAX_ERROR
5947
#endif
5948
0
    }
5949
5950
0
  yyerror_range[1] = yylloc;
5951
5952
0
  if (yyerrstatus == 3)
5953
0
    {
5954
      /* If just tried and failed to reuse lookahead token after an
5955
         error, discard it.  */
5956
5957
0
      if (yychar <= YYEOF)
5958
0
        {
5959
          /* Return failure if at end of input.  */
5960
0
          if (yychar == YYEOF)
5961
0
            YYABORT;
5962
0
        }
5963
0
      else
5964
0
        {
5965
0
          yydestruct ("Error: discarding",
5966
0
                      yytoken, &yylval, &yylloc, yyscanner);
5967
0
          yychar = YYEMPTY;
5968
0
        }
5969
0
    }
5970
5971
  /* Else will try to reuse lookahead token after shifting the error
5972
     token.  */
5973
0
  goto yyerrlab1;
5974
5975
5976
/*---------------------------------------------------.
5977
| yyerrorlab -- error raised explicitly by YYERROR.  |
5978
`---------------------------------------------------*/
5979
0
yyerrorlab:
5980
  /* Pacify compilers when the user code never invokes YYERROR and the
5981
     label yyerrorlab therefore never appears in user code.  */
5982
0
  if (0)
5983
0
    YYERROR;
5984
5985
  /* Do not reclaim the symbols of the rule whose action triggered
5986
     this YYERROR.  */
5987
0
  YYPOPSTACK (yylen);
5988
0
  yylen = 0;
5989
0
  YY_STACK_PRINT (yyss, yyssp);
5990
0
  yystate = *yyssp;
5991
0
  goto yyerrlab1;
5992
5993
5994
/*-------------------------------------------------------------.
5995
| yyerrlab1 -- common code for both syntax error and YYERROR.  |
5996
`-------------------------------------------------------------*/
5997
0
yyerrlab1:
5998
0
  yyerrstatus = 3;      /* Each real token shifted decrements this.  */
5999
6000
0
  for (;;)
6001
0
    {
6002
0
      yyn = yypact[yystate];
6003
0
      if (!yypact_value_is_default (yyn))
6004
0
        {
6005
0
          yyn += YYTERROR;
6006
0
          if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
6007
0
            {
6008
0
              yyn = yytable[yyn];
6009
0
              if (0 < yyn)
6010
0
                break;
6011
0
            }
6012
0
        }
6013
6014
      /* Pop the current state because it cannot handle the error token.  */
6015
0
      if (yyssp == yyss)
6016
0
        YYABORT;
6017
6018
0
      yyerror_range[1] = *yylsp;
6019
0
      yydestruct ("Error: popping",
6020
0
                  yystos[yystate], yyvsp, yylsp, yyscanner);
6021
0
      YYPOPSTACK (1);
6022
0
      yystate = *yyssp;
6023
0
      YY_STACK_PRINT (yyss, yyssp);
6024
0
    }
6025
6026
0
  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
6027
0
  *++yyvsp = yylval;
6028
0
  YY_IGNORE_MAYBE_UNINITIALIZED_END
6029
6030
0
  yyerror_range[2] = yylloc;
6031
  /* Using YYLLOC is tempting, but would change the location of
6032
     the lookahead.  YYLOC is available though.  */
6033
0
  YYLLOC_DEFAULT (yyloc, yyerror_range, 2);
6034
0
  *++yylsp = yyloc;
6035
6036
  /* Shift the error token.  */
6037
0
  YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
6038
6039
0
  yystate = yyn;
6040
0
  goto yynewstate;
6041
6042
6043
/*-------------------------------------.
6044
| yyacceptlab -- YYACCEPT comes here.  |
6045
`-------------------------------------*/
6046
0
yyacceptlab:
6047
0
  yyresult = 0;
6048
0
  goto yyreturn;
6049
6050
6051
/*-----------------------------------.
6052
| yyabortlab -- YYABORT comes here.  |
6053
`-----------------------------------*/
6054
0
yyabortlab:
6055
0
  yyresult = 1;
6056
0
  goto yyreturn;
6057
6058
6059
0
#if !defined yyoverflow || YYERROR_VERBOSE
6060
/*-------------------------------------------------.
6061
| yyexhaustedlab -- memory exhaustion comes here.  |
6062
`-------------------------------------------------*/
6063
0
yyexhaustedlab:
6064
0
  yyerror (&yylloc, yyscanner, YY_("memory exhausted"));
6065
0
  yyresult = 2;
6066
  /* Fall through.  */
6067
0
#endif
6068
6069
6070
/*-----------------------------------------------------.
6071
| yyreturn -- parsing is finished, return the result.  |
6072
`-----------------------------------------------------*/
6073
0
yyreturn:
6074
0
  if (yychar != YYEMPTY)
6075
0
    {
6076
      /* Make sure we have latest lookahead translation.  See comments at
6077
         user semantic actions for why this is necessary.  */
6078
0
      yytoken = YYTRANSLATE (yychar);
6079
0
      yydestruct ("Cleanup: discarding lookahead",
6080
0
                  yytoken, &yylval, &yylloc, yyscanner);
6081
0
    }
6082
  /* Do not reclaim the symbols of the rule whose action triggered
6083
     this YYABORT or YYACCEPT.  */
6084
0
  YYPOPSTACK (yylen);
6085
0
  YY_STACK_PRINT (yyss, yyssp);
6086
0
  while (yyssp != yyss)
6087
0
    {
6088
0
      yydestruct ("Cleanup: popping",
6089
0
                  yystos[+*yyssp], yyvsp, yylsp, yyscanner);
6090
0
      YYPOPSTACK (1);
6091
0
    }
6092
0
#ifndef yyoverflow
6093
0
  if (yyss != yyssa)
6094
0
    YYSTACK_FREE (yyss);
6095
0
#endif
6096
#if YYERROR_VERBOSE
6097
  if (yymsg != yymsgbuf)
6098
    YYSTACK_FREE (yymsg);
6099
#endif
6100
0
  return yyresult;
6101
0
}
6102
#line 3981 "/src/libreoffice/unoidl/source/sourceprovider-parser.y"
6103
6104
6105
namespace unoidl::detail {
6106
6107
0
OUString SourceProviderType::getName() const {
6108
0
    if (!typedefName.isEmpty()) {
6109
0
        return typedefName;
6110
0
    }
6111
0
    switch (type) {
6112
0
    case unoidl::detail::SourceProviderType::TYPE_VOID:
6113
0
        return u"void"_ustr;
6114
0
    case unoidl::detail::SourceProviderType::TYPE_BOOLEAN:
6115
0
        return u"boolean"_ustr;
6116
0
    case unoidl::detail::SourceProviderType::TYPE_BYTE:
6117
0
        return u"byte"_ustr;
6118
0
    case unoidl::detail::SourceProviderType::TYPE_SHORT:
6119
0
        return u"short"_ustr;
6120
0
    case unoidl::detail::SourceProviderType::TYPE_UNSIGNED_SHORT:
6121
0
        return u"unsigned short"_ustr;
6122
0
    case unoidl::detail::SourceProviderType::TYPE_LONG:
6123
0
        return u"long"_ustr;
6124
0
    case unoidl::detail::SourceProviderType::TYPE_UNSIGNED_LONG:
6125
0
        return u"unsigned long"_ustr;
6126
0
    case unoidl::detail::SourceProviderType::TYPE_HYPER:
6127
0
        return u"hyper"_ustr;
6128
0
    case unoidl::detail::SourceProviderType::TYPE_UNSIGNED_HYPER:
6129
0
        return u"unsigned hyper"_ustr;
6130
0
    case unoidl::detail::SourceProviderType::TYPE_FLOAT:
6131
0
        return u"float"_ustr;
6132
0
    case unoidl::detail::SourceProviderType::TYPE_DOUBLE:
6133
0
        return u"double"_ustr;
6134
0
    case unoidl::detail::SourceProviderType::TYPE_CHAR:
6135
0
        return u"char"_ustr;
6136
0
    case unoidl::detail::SourceProviderType::TYPE_STRING:
6137
0
        return u"string"_ustr;
6138
0
    case unoidl::detail::SourceProviderType::TYPE_TYPE:
6139
0
        return u"type"_ustr;
6140
0
    case unoidl::detail::SourceProviderType::TYPE_ANY:
6141
0
        return u"any"_ustr;
6142
0
    case unoidl::detail::SourceProviderType::TYPE_SEQUENCE:
6143
0
        assert(subtypes.size() == 1);
6144
0
        return "[]" + subtypes.front().getName();
6145
0
    case unoidl::detail::SourceProviderType::TYPE_ENUM:
6146
0
    case unoidl::detail::SourceProviderType::TYPE_PLAIN_STRUCT:
6147
0
    case unoidl::detail::SourceProviderType::TYPE_EXCEPTION:
6148
0
    case unoidl::detail::SourceProviderType::TYPE_INTERFACE:
6149
0
    case unoidl::detail::SourceProviderType::TYPE_PARAMETER:
6150
0
        return name;
6151
0
    case unoidl::detail::SourceProviderType::TYPE_INSTANTIATED_POLYMORPHIC_STRUCT:
6152
0
        {
6153
0
            OUStringBuffer n(512);
6154
0
            n.append(name + "<");
6155
0
            for (auto i(subtypes.begin()); i != subtypes.end(); ++i) {
6156
0
                if (i != subtypes.begin()) {
6157
0
                    n.append(",");
6158
0
                }
6159
0
                n.append(i->getName());
6160
0
            }
6161
0
            return n.append(">").makeStringAndClear();
6162
0
        }
6163
0
    default:
6164
0
        assert(false && "this cannot happen"); for (;;) { std::abort(); }
6165
0
    }
6166
0
}
6167
6168
0
bool SourceProviderType::equals(SourceProviderType const & other) const {
6169
0
    if (type != other.type || name != other.name
6170
0
        || subtypes.size() != other.subtypes.size())
6171
0
    {
6172
0
        return false;
6173
0
    }
6174
0
    for (auto i(subtypes.begin()), j(other.subtypes.begin());
6175
0
         i != subtypes.end(); ++i, ++j)
6176
0
    {
6177
0
        if (!i->equals(*j)) {
6178
0
            return false;
6179
0
        }
6180
0
    }
6181
0
    return true;
6182
0
}
6183
6184
bool SourceProviderInterfaceTypeEntityPad::addDirectBase(
6185
    YYLTYPE location, yyscan_t yyscanner, SourceProviderScannerData * data,
6186
    DirectBase const & base, bool optional)
6187
0
{
6188
0
    std::set<OUString> seen;
6189
0
    if (!(checkBaseClashes(
6190
0
              location, yyscanner, data, base.name, base.entity, true, optional,
6191
0
              optional, &seen)
6192
0
          && addBase(
6193
0
              location, yyscanner, data, base.name, base.name, base.entity,
6194
0
              true, optional)))
6195
0
    {
6196
0
        return false;
6197
0
    }
6198
0
    if (optional) {
6199
0
        addOptionalBaseMembers(
6200
0
            location, yyscanner, data, base.name, base.entity);
6201
0
    }
6202
0
    (optional ? directOptionalBases : directMandatoryBases).push_back(base);
6203
0
    return true;
6204
0
}
6205
6206
bool SourceProviderInterfaceTypeEntityPad::addDirectMember(
6207
    YYLTYPE location, yyscan_t yyscanner, SourceProviderScannerData * data,
6208
    OUString const & name)
6209
0
{
6210
0
    assert(data != nullptr);
6211
0
    if (!checkMemberClashes(location, yyscanner, data, u"", name, true)) {
6212
0
        return false;
6213
0
    }
6214
0
    allMembers.emplace(name, Member(data->currentName));
6215
0
    return true;
6216
0
}
6217
6218
bool SourceProviderInterfaceTypeEntityPad::checkBaseClashes(
6219
    YYLTYPE location, yyscan_t yyscanner, SourceProviderScannerData * data,
6220
    OUString const & name,
6221
    rtl::Reference<unoidl::InterfaceTypeEntity> const & entity, bool direct,
6222
    bool optional, bool outerOptional, std::set<OUString> * seen) const
6223
0
{
6224
0
    assert(data != nullptr);
6225
0
    assert(entity.is());
6226
0
    assert(seen != nullptr);
6227
0
    if (direct || optional || seen->insert(name).second) {
6228
0
        std::map<OUString, BaseKind>::const_iterator i(allBases.find(name));
6229
0
        if (i != allBases.end()) {
6230
0
            switch (i->second) {
6231
0
            case BASE_INDIRECT_OPTIONAL:
6232
0
                if (direct && optional) {
6233
0
                    error(
6234
0
                        location, yyscanner,
6235
0
                        ("interface type " + data->currentName
6236
0
                         + " duplicate base " + name));
6237
0
                    return false;
6238
0
                }
6239
0
                break;
6240
0
            case BASE_DIRECT_OPTIONAL:
6241
0
                if (direct || !outerOptional) {
6242
0
                    error(
6243
0
                        location, yyscanner,
6244
0
                        ("interface type " + data->currentName
6245
0
                         + " duplicate base " + name));
6246
0
                    return false;
6247
0
                }
6248
0
                return true;
6249
0
            case BASE_INDIRECT_MANDATORY:
6250
0
                if (direct) {
6251
0
                    error(
6252
0
                        location, yyscanner,
6253
0
                        ("interface type " + data->currentName
6254
0
                         + " duplicate base " + name));
6255
0
                    return false;
6256
0
                }
6257
0
                return true;
6258
0
            case BASE_DIRECT_MANDATORY:
6259
0
                if (direct || (!optional && !outerOptional)) {
6260
0
                    error(
6261
0
                        location, yyscanner,
6262
0
                        ("interface type " + data->currentName
6263
0
                         + " duplicate base " + name));
6264
0
                    return false;
6265
0
                }
6266
0
                return true;
6267
0
            }
6268
0
        }
6269
0
        if (direct || !optional) {
6270
0
            for (auto & j: entity->getDirectMandatoryBases()) {
6271
0
                OUString n("." + j.name);
6272
0
                unoidl::detail::SourceProviderEntity const * p;
6273
0
                if (findEntity(
6274
0
                        location, yyscanner, data, true, &n, &p, nullptr,
6275
0
                        nullptr)
6276
0
                    == FOUND_ERROR)
6277
0
                {
6278
0
                    return false;
6279
0
                }
6280
0
                if (p == nullptr || !p->entity.is()
6281
0
                    || (p->entity->getSort()
6282
0
                        != unoidl::Entity::SORT_INTERFACE_TYPE))
6283
0
                {
6284
0
                    error(
6285
0
                        location, yyscanner,
6286
0
                        ("inconsistent type manager: interface type "
6287
0
                         + data->currentName + " base " + n
6288
0
                         + " does not resolve to an existing interface type"));
6289
0
                    return false;
6290
0
                }
6291
0
                if (!checkBaseClashes(
6292
0
                        location, yyscanner, data, n,
6293
0
                        static_cast<unoidl::InterfaceTypeEntity *>(
6294
0
                            p->entity.get()),
6295
0
                        false, false, outerOptional, seen))
6296
0
                {
6297
0
                    return false;
6298
0
                }
6299
0
            }
6300
0
            for (auto & j: entity->getDirectOptionalBases()) {
6301
0
                OUString n("." + j.name);
6302
0
                unoidl::detail::SourceProviderEntity const * p;
6303
0
                if (findEntity(
6304
0
                        location, yyscanner, data, true, &n, &p, nullptr,
6305
0
                        nullptr)
6306
0
                    == FOUND_ERROR)
6307
0
                {
6308
0
                    return false;
6309
0
                }
6310
0
                if (p == nullptr || !p->entity.is()
6311
0
                    || (p->entity->getSort()
6312
0
                        != unoidl::Entity::SORT_INTERFACE_TYPE))
6313
0
                {
6314
0
                    error(
6315
0
                        location, yyscanner,
6316
0
                        ("inconsistent type manager: interface type "
6317
0
                         + data->currentName + " base " + n
6318
0
                         + " does not resolve to an existing interface type"));
6319
0
                    return false;
6320
0
                }
6321
0
                if (!checkBaseClashes(
6322
0
                        location, yyscanner, data, n,
6323
0
                        static_cast<unoidl::InterfaceTypeEntity *>(
6324
0
                            p->entity.get()),
6325
0
                        false, true, outerOptional, seen))
6326
0
                {
6327
0
                    return false;
6328
0
                }
6329
0
            }
6330
0
            for (auto & j: entity->getDirectAttributes()) {
6331
0
                if (!checkMemberClashes(
6332
0
                        location, yyscanner, data, name, j.name,
6333
0
                        !outerOptional))
6334
0
                {
6335
0
                    return false;
6336
0
                }
6337
0
            }
6338
0
            for (auto & j: entity->getDirectMethods()) {
6339
0
                if (!checkMemberClashes(
6340
0
                        location, yyscanner, data, name, j.name,
6341
0
                        !outerOptional))
6342
0
                {
6343
0
                    return false;
6344
0
                }
6345
0
            }
6346
0
        }
6347
0
    }
6348
0
    return true;
6349
0
}
6350
6351
bool SourceProviderInterfaceTypeEntityPad::checkMemberClashes(
6352
    YYLTYPE location, yyscan_t yyscanner, SourceProviderScannerData * data,
6353
    std::u16string_view interfaceName, OUString const & memberName,
6354
    bool checkOptional) const
6355
0
{
6356
0
    std::map<OUString, Member>::const_iterator i(allMembers.find(memberName));
6357
0
    if (i != allMembers.end()) {
6358
0
        if (!i->second.mandatory.isEmpty()) {
6359
            // For a direct member, interfaceName will be empty, so this will
6360
            // catch two direct members with the same name:
6361
0
            if (i->second.mandatory != interfaceName) {
6362
0
                error(
6363
0
                    location, yyscanner,
6364
0
                    ("interface type " + data->currentName
6365
0
                     + " duplicate member " + memberName));
6366
0
                return false;
6367
0
            }
6368
0
        } else if (checkOptional) {
6369
0
            for (auto & j: i->second.optional) {
6370
0
                if (j != interfaceName) {
6371
0
                    error(
6372
0
                        location, yyscanner,
6373
0
                        ("interface type " + data->currentName
6374
0
                         + " duplicate member " + memberName));
6375
0
                    return false;
6376
0
                }
6377
0
            }
6378
0
        }
6379
0
    }
6380
0
    return true;
6381
0
}
6382
6383
bool SourceProviderInterfaceTypeEntityPad::addBase(
6384
    YYLTYPE location, yyscan_t yyscanner, SourceProviderScannerData * data,
6385
    OUString const & directBaseName, OUString const & name,
6386
    rtl::Reference<unoidl::InterfaceTypeEntity> const & entity, bool direct,
6387
    bool optional)
6388
0
{
6389
0
    assert(data != nullptr);
6390
0
    assert(entity.is());
6391
0
    BaseKind kind = optional
6392
0
        ? direct ? BASE_DIRECT_OPTIONAL : BASE_INDIRECT_OPTIONAL
6393
0
        : direct ? BASE_DIRECT_MANDATORY : BASE_INDIRECT_MANDATORY;
6394
0
    std::pair<std::map<OUString, BaseKind>::iterator, bool> p(
6395
0
        allBases.emplace(name, kind));
6396
0
    bool seen = !p.second && p.first->second >= BASE_INDIRECT_MANDATORY;
6397
0
    if (!p.second && kind > p.first->second) {
6398
0
        p.first->second = kind;
6399
0
    }
6400
0
    if (!optional && !seen) {
6401
0
        for (auto & i: entity->getDirectMandatoryBases()) {
6402
0
            OUString n("." + i.name);
6403
0
            unoidl::detail::SourceProviderEntity const * q;
6404
0
            if (findEntity(
6405
0
                    location, yyscanner, data, true, &n, &q, nullptr, nullptr)
6406
0
                == FOUND_ERROR)
6407
0
            {
6408
0
                return false;
6409
0
            }
6410
0
            if (q == nullptr || !q->entity.is()
6411
0
                || q->entity->getSort() != unoidl::Entity::SORT_INTERFACE_TYPE)
6412
0
            {
6413
0
                error(
6414
0
                    location, yyscanner,
6415
0
                    ("inconsistent type manager: interface type "
6416
0
                     + data->currentName + " base " + n
6417
0
                     + " does not resolve to an existing interface type"));
6418
0
                return false;
6419
0
            }
6420
0
            if (!addBase(
6421
0
                    location, yyscanner, data, directBaseName, n,
6422
0
                    static_cast<unoidl::InterfaceTypeEntity *>(q->entity.get()),
6423
0
                    false, false))
6424
0
            {
6425
0
                return false;
6426
0
            }
6427
0
        }
6428
0
        for (auto & i: entity->getDirectOptionalBases())
6429
0
        {
6430
0
            OUString n("." + i.name);
6431
0
            unoidl::detail::SourceProviderEntity const * q;
6432
0
            if (findEntity(
6433
0
                    location, yyscanner, data, true, &n, &q, nullptr, nullptr)
6434
0
                == FOUND_ERROR)
6435
0
            {
6436
0
                return false;
6437
0
            }
6438
0
            if (q == nullptr || !q->entity.is()
6439
0
                || q->entity->getSort() != unoidl::Entity::SORT_INTERFACE_TYPE)
6440
0
            {
6441
0
                error(
6442
0
                    location, yyscanner,
6443
0
                    ("inconsistent type manager: interface type "
6444
0
                     + data->currentName + " base " + n
6445
0
                     + " does not resolve to an existing interface type"));
6446
0
                return false;
6447
0
            }
6448
0
            if (!addBase(
6449
0
                    location, yyscanner, data, directBaseName, n,
6450
0
                    static_cast<unoidl::InterfaceTypeEntity *>(q->entity.get()),
6451
0
                    false, true))
6452
0
            {
6453
0
                return false;
6454
0
            }
6455
0
        }
6456
0
        for (auto & i: entity->getDirectAttributes()) {
6457
0
            allMembers.emplace(i.name, Member(name));
6458
0
        }
6459
0
        for (auto & i: entity->getDirectMethods()) {
6460
0
            allMembers.emplace(i.name, Member(name));
6461
0
        }
6462
0
    }
6463
0
    return true;
6464
0
}
6465
6466
bool SourceProviderInterfaceTypeEntityPad::addOptionalBaseMembers(
6467
    YYLTYPE location, yyscan_t yyscanner, SourceProviderScannerData * data,
6468
    OUString const & name,
6469
    rtl::Reference<unoidl::InterfaceTypeEntity> const & entity)
6470
0
{
6471
0
    assert(entity.is());
6472
0
    for (auto & i: entity->getDirectMandatoryBases()) {
6473
0
        OUString n("." + i.name);
6474
0
        unoidl::detail::SourceProviderEntity const * p;
6475
0
        if (findEntity(
6476
0
                location, yyscanner, data, true, &n, &p, nullptr, nullptr)
6477
0
            == FOUND_ERROR)
6478
0
        {
6479
0
            return false;
6480
0
        }
6481
0
        if (p == nullptr || !p->entity.is()
6482
0
            || p->entity->getSort() != unoidl::Entity::SORT_INTERFACE_TYPE)
6483
0
        {
6484
0
            error(
6485
0
                location, yyscanner,
6486
0
                ("inconsistent type manager: interface type "
6487
0
                 + data->currentName + " base " + n
6488
0
                 + " does not resolve to an existing interface type"));
6489
0
            return false;
6490
0
        }
6491
0
        if (!addOptionalBaseMembers(
6492
0
                location, yyscanner, data, n,
6493
0
                static_cast<unoidl::InterfaceTypeEntity *>(p->entity.get())))
6494
0
        {
6495
0
            return false;
6496
0
        }
6497
0
    }
6498
0
    for (auto & i: entity->getDirectAttributes()) {
6499
0
        Member & m(
6500
0
            allMembers.emplace(i.name, Member(u""_ustr))
6501
0
            .first->second);
6502
0
        if (m.mandatory.isEmpty()) {
6503
0
            m.optional.insert(name);
6504
0
        }
6505
0
    }
6506
0
    for (auto & i: entity->getDirectMethods()) {
6507
0
        Member & m(
6508
0
            allMembers.emplace(i.name, Member(u""_ustr))
6509
0
            .first->second);
6510
0
        if (m.mandatory.isEmpty()) {
6511
0
            m.optional.insert(name);
6512
0
        }
6513
0
    }
6514
0
    return true;
6515
0
}
6516
6517
0
bool parse(OUString const & uri, SourceProviderScannerData * data) {
6518
0
    assert(data != nullptr);
6519
0
    oslFileHandle handle;
6520
0
    oslFileError e = osl_openFile(uri.pData, &handle, osl_File_OpenFlag_Read);
6521
0
    switch (e) {
6522
0
    case osl_File_E_None:
6523
0
        break;
6524
0
    case osl_File_E_NOENT:
6525
0
        return false;
6526
0
    default:
6527
0
        throw FileFormatException(uri, "cannot open: " + OUString::number(e));
6528
0
    }
6529
0
    sal_uInt64 size;
6530
0
    e = osl_getFileSize(handle, &size);
6531
0
    if (e != osl_File_E_None) {
6532
0
        oslFileError e2 = osl_closeFile(handle);
6533
0
        SAL_WARN_IF(
6534
0
            e2 != osl_File_E_None, "unoidl",
6535
0
            "cannot close " << uri << ": " << +e2);
6536
0
        throw FileFormatException(
6537
0
            uri, "cannot get size: " + OUString::number(e));
6538
0
    }
6539
0
    void * address;
6540
0
    e = osl_mapFile(handle, &address, size, 0, osl_File_MapFlag_RandomAccess);
6541
0
    if (e != osl_File_E_None) {
6542
0
        oslFileError e2 = osl_closeFile(handle);
6543
0
        SAL_WARN_IF(
6544
0
            e2 != osl_File_E_None, "unoidl",
6545
0
            "cannot close " << uri << ": " << +e2);
6546
0
        throw FileFormatException(uri, "cannot mmap: " + OUString::number(e));
6547
0
    }
6548
0
    try {
6549
0
        data->setSource(address, size);
6550
0
        yyscan_t yyscanner;
6551
0
        if (yylex_init_extra(data, &yyscanner) != 0) {
6552
            // Checking errno for the specific EINVAL, ENOMEM documented for
6553
            // yylex_init_extra would not work as those values are not defined
6554
            // by the C++ Standard:
6555
0
            int e2 = errno;
6556
0
            throw FileFormatException(
6557
0
                uri,
6558
0
                "yylex_init_extra failed with errno " + OUString::number(e2));
6559
0
        }
6560
0
        int e2 = yyparse(yyscanner);
6561
0
        yylex_destroy(yyscanner);
6562
0
        switch (e2) {
6563
0
        case 0:
6564
0
            break;
6565
0
        default:
6566
0
            O3TL_UNREACHABLE;
6567
0
        case 1:
6568
0
            throw FileFormatException(
6569
0
                uri,
6570
0
                ("cannot parse"
6571
0
                 + (data->errorLine == 0
6572
0
                    ? OUString() : " line " + OUString::number(data->errorLine))
6573
0
                 + (data->parserError.isEmpty()
6574
0
                    ? OUString()
6575
0
                    : (", "
6576
0
                       + OStringToOUString(
6577
0
                           data->parserError, osl_getThreadTextEncoding())))
6578
0
                 + (data->errorMessage.isEmpty()
6579
0
                    ? OUString() : ": \"" + data->errorMessage + "\"")));
6580
0
        case 2:
6581
0
            throw std::bad_alloc();
6582
0
        }
6583
0
    } catch (...) {
6584
0
        e = osl_unmapMappedFile(handle, address, size);
6585
0
        SAL_WARN_IF(e != osl_File_E_None, "unoidl", "cannot unmap: " << +e);
6586
0
        e = osl_closeFile(handle);
6587
0
        SAL_WARN_IF(e != osl_File_E_None, "unoidl", "cannot close: " << +e);
6588
0
        throw;
6589
0
    }
6590
0
    e = osl_unmapMappedFile(handle, address, size);
6591
0
    SAL_WARN_IF(e != osl_File_E_None, "unoidl", "cannot unmap: " << +e);
6592
0
    e = osl_closeFile(handle);
6593
0
    SAL_WARN_IF(e != osl_File_E_None, "unoidl", "cannot close: " << +e);
6594
0
    return true;
6595
0
}
6596
6597
}
6598
6599
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */