1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 /*TODO: check Exception, RuntimeException, XInterface defns */
17 #include "sal/config.h"
29 #include <sourceprovider-parser-requires.hxx>
39 std
::vector
<OUString
> * excns
;
40 unoidl
::detail
::SourceProviderAccessDecls decls
;
41 unoidl
::InterfaceTypeEntity
::Method
::Parameter
::Direction dir
;
42 unoidl
::detail
::SourceProviderFlags flags
;
43 unoidl
::detail
::SourceProviderExpr expr
;
44 unoidl
::detail
::SourceProviderType
* type
;
45 std
::vector
<unoidl
::detail
::SourceProviderType
> * types
;
48 /* TODO: %destructor { delete $$; } <sval> <excns> <type> <types> */
50 %lex
-param
{yyscan_t yyscanner
}
51 %parse
-param
{yyscan_t yyscanner
}
56 #include "osl/thread.h"
57 #include "sal/log.hxx"
59 #include "sourceprovider-scanner.hxx"
61 #define YYLLOC_DEFAULT(Current, Rhs, N) \
62 do
{ (Current
) = YYRHSLOC
((Rhs
), (N
) ?
1 : 0); } while
(0)
64 void yyerror(YYLTYPE * locp
, yyscan_t yyscanner
, char const * msg
) {
66 unoidl
::detail
::SourceProviderScannerData
* data
= yyget_extra
(yyscanner
);
67 data
->errorLine
= *locp
;
68 data
->parserError
= OString
(msg
);
73 void error(YYLTYPE location
, yyscan_t yyscanner
, OUString
const & message
) {
74 unoidl
::detail
::SourceProviderScannerData
* data
= yyget_extra
(yyscanner
);
75 data
->errorLine
= location
;
76 data
->errorMessage
= message
;
79 OUString flagName
(unoidl
::detail
::SourceProviderFlags flag
) {
81 case unoidl
::detail
::FLAG_ATTRIBUTE
:
82 return OUString
("attribute");
83 case unoidl
::detail
::FLAG_BOUND
:
84 return OUString
("bound");
85 case unoidl
::detail
::FLAG_CONSTRAINED
:
86 return OUString
("constrained");
87 case unoidl
::detail
::FLAG_MAYBEAMBIGUOUS
:
88 return OUString
("maybeambiguous");
89 case unoidl
::detail
::FLAG_MAYBEDEFAULT
:
90 return OUString
("maybedefault");
91 case unoidl
::detail
::FLAG_MAYBEVOID
:
92 return OUString
("maybevoid");
93 case unoidl
::detail
::FLAG_OPTIONAL
:
94 return OUString
("optional");
95 case unoidl
::detail
::FLAG_PROPERTY
:
96 return OUString
("property");
97 case unoidl
::detail
::FLAG_READONLY
:
98 return OUString
("readonly");
99 case unoidl
::detail
::FLAG_REMOVABLE
:
100 return OUString
("removable");
101 case unoidl
::detail
::FLAG_TRANSIENT
:
102 return OUString
("transient");
104 assert
(false
&& "this cannot happen"); for
(;;) { std
::abort
(); }
108 OUString convertName
(OString
const * name
) {
110 OUString s
(OStringToOUString
(*name
, RTL_TEXTENCODING_ASCII_US
));
115 OUString convertToFullName
(
116 unoidl
::detail
::SourceProviderScannerData
const * data
,
117 OString
const * identifier
)
121 if
(!data
->modules.empty
()) {
122 pref
= data
->modules.back
() + ".";
124 return pref
+ convertName
(identifier
);
127 void convertToCurrentName
(
128 unoidl
::detail
::SourceProviderScannerData
* data
,
129 OString
const * identifier
)
132 assert
(data
->currentName.isEmpty
());
133 data
->currentName
= convertToFullName
(data
, identifier
);
134 assert
(!data
->currentName.isEmpty
());
137 void clearCurrentState
(unoidl
::detail
::SourceProviderScannerData
* data
) {
139 data
->currentName.clear
();
140 data
->publishedContext
= false
;
143 unoidl::detail
::SourceProviderEntity
* getCurrentEntity
(
144 unoidl
::detail
::SourceProviderScannerData
* data
)
147 assert
(!data
->currentName.isEmpty
());
148 std
::map
<OUString
, unoidl
::detail
::SourceProviderEntity
>::iterator i
(
149 data
->entities.find
(data
->currentName
));
150 assert
(i
!= data
->entities.end
());
151 assert
(i
->second.kind
== unoidl
::detail
::SourceProviderEntity
::KIND_LOCAL
);
152 assert
(i
->second.pad.is
());
156 template
<typename T
> rtl
::Reference
<T
> getCurrentPad
(
157 unoidl
::detail
::SourceProviderScannerData
* data
)
159 rtl
::Reference
<T
> pad
(dynamic_cast
<T
*>(getCurrentEntity
(data
)->pad.get
()));
164 bool nameHasSameIdentifierAs
(OUString
const & name
, OUString
const & identifier
)
166 sal_Int32 i
= name.lastIndexOf
('.') + 1;
167 return identifier.getLength
() == name.getLength
() - i
168 && name.match
(identifier
, i
);
172 YYLTYPE location
, yyscan_t yyscanner
,
173 unoidl
::detail
::SourceProviderExpr
* lhs
,
174 unoidl
::detail
::SourceProviderExpr
* rhs
)
178 bool ok
= bool(); // avoid warnings
180 case unoidl
::detail
::SourceProviderExpr
::TYPE_BOOL
:
181 ok
= rhs
->type
!= unoidl
::detail
::SourceProviderExpr
::TYPE_BOOL
;
183 case unoidl
::detail
::SourceProviderExpr
::TYPE_INT
:
185 case unoidl
::detail
::SourceProviderExpr
::TYPE_BOOL
:
188 case unoidl
::detail
::SourceProviderExpr
::TYPE_INT
:
191 case unoidl
::detail
::SourceProviderExpr
::TYPE_UINT
:
192 if
(lhs
->ival
>= 0) {
193 lhs
->type
= unoidl
::detail
::SourceProviderExpr
::TYPE_UINT
;
195 } else if
(rhs
->uval
<= SAL_MAX_INT64
) {
196 rhs
->type
= unoidl
::detail
::SourceProviderExpr
::TYPE_INT
;
202 case unoidl
::detail
::SourceProviderExpr
::TYPE_FLOAT
:
203 lhs
->fval
= lhs
->ival
;
208 case unoidl
::detail
::SourceProviderExpr
::TYPE_UINT
:
210 case unoidl
::detail
::SourceProviderExpr
::TYPE_BOOL
:
213 case unoidl
::detail
::SourceProviderExpr
::TYPE_INT
:
214 if
(rhs
->ival
>= 0) {
215 rhs
->type
= unoidl
::detail
::SourceProviderExpr
::TYPE_UINT
;
217 } else if
(lhs
->uval
<= SAL_MAX_INT64
) {
218 lhs
->type
= unoidl
::detail
::SourceProviderExpr
::TYPE_INT
;
224 case unoidl
::detail
::SourceProviderExpr
::TYPE_UINT
:
227 case unoidl
::detail
::SourceProviderExpr
::TYPE_FLOAT
:
228 lhs
->fval
= lhs
->uval
;
233 case unoidl
::detail
::SourceProviderExpr
::TYPE_FLOAT
:
235 case unoidl
::detail
::SourceProviderExpr
::TYPE_BOOL
:
238 case unoidl
::detail
::SourceProviderExpr
::TYPE_INT
:
239 rhs
->fval
= rhs
->ival
;
242 case unoidl
::detail
::SourceProviderExpr
::TYPE_UINT
:
243 rhs
->fval
= rhs
->uval
;
246 case unoidl
::detail
::SourceProviderExpr
::TYPE_FLOAT
:
253 error(location
, yyscanner
, "cannot coerce binary expression arguments");
258 unoidl::detail
::SourceProviderEntity
* findEntity_
(
259 unoidl
::detail
::SourceProviderScannerData
* data
, OUString
* name
)
264 if
(!name
->startsWith
(".", &n
)) {
265 for
(std
::vector
<OUString
>::reverse_iterator i
(data
->modules.rbegin
());
266 i
!= data
->modules.rend
(); ++i
)
268 n
= *i
+ "." + *name
;
269 std
::map
<OUString
, unoidl
::detail
::SourceProviderEntity
>::iterator j
(
270 data
->entities.find
(n
));
271 if
(j
!= data
->entities.end
()) {
275 rtl
::Reference
<unoidl
::Entity
> ent
(data
->manager
->findEntity
(n
));
277 std
::map
<OUString
, unoidl
::detail
::SourceProviderEntity
>::iterator
278 k
(data
->entities.insert
(
279 std
::map
<OUString
, unoidl
::detail
::SourceProviderEntity
>::value_type
(
281 unoidl
::detail
::SourceProviderEntity
(
282 unoidl
::detail
::SourceProviderEntity
::KIND_EXTERNAL
,
291 std
::map
<OUString
, unoidl
::detail
::SourceProviderEntity
>::iterator i
(
292 data
->entities.find
(n
));
293 if
(i
!= data
->entities.end
()) {
297 rtl
::Reference
<unoidl
::Entity
> ent
(data
->manager
->findEntity
(n
));
299 std
::map
<OUString
, unoidl
::detail
::SourceProviderEntity
>::iterator
300 j
(data
->entities.insert
(
301 std
::map
<OUString
, unoidl
::detail
::SourceProviderEntity
>::value_type
(
303 unoidl
::detail
::SourceProviderEntity
(
304 unoidl
::detail
::SourceProviderEntity
::KIND_EXTERNAL
,
313 enum Found
{ FOUND_ERROR
, FOUND_TYPE
, FOUND_ENTITY
};
316 YYLTYPE location
, yyscan_t yyscanner
,
317 unoidl
::detail
::SourceProviderScannerData
* data
,
318 bool resolveInterfaceDefinitions
, OUString
* name
,
319 unoidl
::detail
::SourceProviderEntity
const ** entity
, bool * typedefed
,
320 unoidl
::detail
::SourceProviderType
* typedefedType
)
322 //TODO: avoid recursion
326 unoidl
::detail
::SourceProviderEntity
* e
= findEntity_
(data
, name
);
328 OUString typeNucleus
;
329 std
::size_t rank
= 0;
330 std
::vector
<unoidl
::detail
::SourceProviderType
> args
;
334 case unoidl
::detail
::SourceProviderEntity
::KIND_LOCAL
:
338 assert
(e
->entity.is
());
340 case unoidl
::detail
::SourceProviderEntity
::KIND_EXTERNAL
:
341 if
(e
->entity
->getSort
() == unoidl
::Entity
::SORT_TYPEDEF
) {
342 if
(typedefed
!= 0) {
345 if
(data
->publishedContext
346 && !static_cast
<unoidl
::TypedefEntity
*>(
347 e
->entity.get
())->isPublished
())
351 ("type " + *name
+ " based on unpublished typedef "
352 + n
+ " used in published context"));
356 static_cast
<unoidl
::TypedefEntity
*>(e
->entity.get
())
359 while
(typeNucleus.startsWith
("[]", &typeNucleus
)) {
363 ("inconsistent type manager: bad type " + *name
364 + (" based on instantiated polymorphic struct"
365 " type based on sequence type named ")
369 if
(rank
== std
::numeric_limits
<std
::size_t>::max
()) {
373 + " based on sequence type of too high rank"));
378 sal_Int32 i
= typeNucleus.indexOf
('<');
383 ("inconsistent type manager: bad type " + *name
384 + (" based on instantiated polymorphic struct"
385 " type based on instantiated polymorphic"
386 " struct type named ")
390 OUString tmpl
(typeNucleus.copy
(0, i
));
392 ++i
; // skip '<' or ','
394 for
(sal_Int32 level
= 0;
395 j
!= typeNucleus.getLength
(); ++j
)
397 sal_Unicode c
= typeNucleus
[j
];
402 } else if
(c
== '<') {
404 } else if
(c
== '>') {
411 if
(j
!= typeNucleus.getLength
()) {
412 OUString argName
(typeNucleus.copy
(i
, j
- i
));
413 unoidl
::detail
::SourceProviderEntity
const *
415 unoidl
::detail
::SourceProviderType argType
;
418 location
, yyscanner
, data
, false
,
419 &argName
, &argEnt
, 0, &argType
))
429 (("inconsistent type manager: bad"
430 " instantiated polymorphic struct"
431 " type template type argument ")
435 unoidl
::detail
::SourceProviderType
::Type
437 = unoidl
::detail
::SourceProviderType
::Type
();
439 switch
(argEnt
->kind
) {
440 case unoidl
::detail
::SourceProviderEntity
::KIND_LOCAL
:
444 (("inconsistent type"
447 " polymorphic struct type"
453 assert
(e
->entity.is
());
455 case unoidl
::detail
::SourceProviderEntity
::KIND_EXTERNAL
:
456 switch
(e
->entity
->getSort
()) {
457 case unoidl
::Entity
::SORT_ENUM_TYPE
:
458 argT
= unoidl
::detail
::SourceProviderType
::TYPE_ENUM
;
460 case unoidl
::Entity
::SORT_PLAIN_STRUCT_TYPE
:
461 argT
= unoidl
::detail
::SourceProviderType
::TYPE_PLAIN_STRUCT
;
463 case unoidl
::Entity
::SORT_INTERFACE_TYPE
:
464 argT
= unoidl
::detail
::SourceProviderType
::TYPE_INTERFACE
;
469 (("inconsistent type"
472 " polymorphic struct type"
479 case unoidl
::detail
::SourceProviderEntity
::KIND_INTERFACE_DECL
:
480 case unoidl
::detail
::SourceProviderEntity
::KIND_PUBLISHED_INTERFACE_DECL
:
481 argT
= unoidl
::detail
::SourceProviderType
::TYPE_INTERFACE
;
483 case unoidl
::detail
::SourceProviderEntity
::KIND_MODULE
:
484 assert
(false
&& "this cannot happen");
487 = unoidl
::detail
::SourceProviderType
(
488 argT
, argName
, argEnt
);
492 args.push_back
(argType
);
495 } while
(i
!= typeNucleus.getLength
()
496 && typeNucleus
[i
] != '>');
497 if
(i
!= typeNucleus.getLength
() - 1
498 || typeNucleus
[i
] != '>')
502 ("inconsistent type manager: bad type name \""
506 assert
(!args.empty
());
509 if
(typeNucleus.isEmpty
()) {
512 ("inconsistent type manager: bad type name \"" + t
516 if
(typeNucleus
== "void") {
519 ("inconsistent type manager: bad type " + *name
520 + " based on void"));
523 if
(typeNucleus
== "boolean" || typeNucleus
== "byte"
524 || typeNucleus
== "short"
525 || typeNucleus
== "unsigned short"
526 || typeNucleus
== "long"
527 || typeNucleus
== "unsigned long"
528 || typeNucleus
== "hyper"
529 || typeNucleus
== "unsigned hyper"
530 || typeNucleus
== "float" || typeNucleus
== "double"
531 || typeNucleus
== "char" || typeNucleus
== "string"
532 || typeNucleus
== "type" || typeNucleus
== "any")
537 ("inconsistent type manager: bad type " + *name
538 + (" based on instantiated polymorphic struct"
545 n
= "." + typeNucleus
;
547 e
= findEntity_
(data
, &n
);
551 case unoidl
::detail
::SourceProviderEntity
::KIND_INTERFACE_DECL
:
552 case unoidl
::detail
::SourceProviderEntity
::KIND_PUBLISHED_INTERFACE_DECL
:
553 if
(resolveInterfaceDefinitions
) {
554 rtl
::Reference
<unoidl
::Entity
> ent
(
555 data
->manager
->findEntity
(n
));
556 // Do not allow ent to be of SORT_TYPEDEF:
559 != unoidl
::Entity
::SORT_INTERFACE_TYPE
))
563 (*name
+ " is based on interface declaration " + n
564 + " that is not an interface type entity"));
568 = unoidl
::detail
::SourceProviderEntity
::KIND_EXTERNAL
;
572 case unoidl
::detail
::SourceProviderEntity
::KIND_MODULE
:
575 *name
+ " is based on module entity " + n
);
579 if
(!typeNucleus.isEmpty
() || rank
!= 0 ||
!args.empty
()) {
580 if
(typeNucleus.isEmpty
() && e
== 0) {
581 // Found a type name based on an unknown entity:
585 unoidl
::detail
::SourceProviderType t
;
587 if
(typeNucleus
== "boolean") {
588 t
= unoidl
::detail
::SourceProviderType
(
589 unoidl
::detail
::SourceProviderType
::TYPE_BOOLEAN
);
590 } else if
(typeNucleus
== "byte") {
591 t
= unoidl
::detail
::SourceProviderType
(
592 unoidl
::detail
::SourceProviderType
::TYPE_BYTE
);
593 } else if
(typeNucleus
== "short") {
594 t
= unoidl
::detail
::SourceProviderType
(
595 unoidl
::detail
::SourceProviderType
::TYPE_SHORT
);
596 } else if
(typeNucleus
== "unsigned short") {
597 t
= unoidl
::detail
::SourceProviderType
(
598 unoidl
::detail
::SourceProviderType
::TYPE_UNSIGNED_SHORT
);
599 } else if
(typeNucleus
== "long") {
600 t
= unoidl
::detail
::SourceProviderType
(
601 unoidl
::detail
::SourceProviderType
::TYPE_LONG
);
602 } else if
(typeNucleus
== "unsigned long") {
603 t
= unoidl
::detail
::SourceProviderType
(
604 unoidl
::detail
::SourceProviderType
::TYPE_UNSIGNED_LONG
);
605 } else if
(typeNucleus
== "hyper") {
606 t
= unoidl
::detail
::SourceProviderType
(
607 unoidl
::detail
::SourceProviderType
::TYPE_HYPER
);
608 } else if
(typeNucleus
== "unsigned hyper") {
609 t
= unoidl
::detail
::SourceProviderType
(
610 unoidl
::detail
::SourceProviderType
::TYPE_UNSIGNED_HYPER
);
611 } else if
(typeNucleus
== "float") {
612 t
= unoidl
::detail
::SourceProviderType
(
613 unoidl
::detail
::SourceProviderType
::TYPE_FLOAT
);
614 } else if
(typeNucleus
== "double") {
615 t
= unoidl
::detail
::SourceProviderType
(
616 unoidl
::detail
::SourceProviderType
::TYPE_DOUBLE
);
617 } else if
(typeNucleus
== "char") {
618 t
= unoidl
::detail
::SourceProviderType
(
619 unoidl
::detail
::SourceProviderType
::TYPE_CHAR
);
620 } else if
(typeNucleus
== "string") {
621 t
= unoidl
::detail
::SourceProviderType
(
622 unoidl
::detail
::SourceProviderType
::TYPE_STRING
);
623 } else if
(typeNucleus
== "type") {
624 t
= unoidl
::detail
::SourceProviderType
(
625 unoidl
::detail
::SourceProviderType
::TYPE_TYPE
);
626 } else if
(typeNucleus
== "any") {
627 t
= unoidl
::detail
::SourceProviderType
(
628 unoidl
::detail
::SourceProviderType
::TYPE_ANY
);
630 assert
(typeNucleus.isEmpty
());
633 case unoidl
::detail
::SourceProviderEntity
::KIND_LOCAL
:
635 if
(dynamic_cast
<unoidl
::detail
::SourceProviderEnumTypeEntityPad
*>(
639 t
= unoidl
::detail
::SourceProviderType
(
640 unoidl
::detail
::SourceProviderType
::TYPE_ENUM
,
642 } else if
(dynamic_cast
<unoidl
::detail
::SourceProviderPlainStructTypeEntityPad
*>(
646 t
= unoidl
::detail
::SourceProviderType
(
647 unoidl
::detail
::SourceProviderType
::TYPE_PLAIN_STRUCT
,
649 } else if
(dynamic_cast
<unoidl
::detail
::SourceProviderPolymorphicStructTypeTemplateEntityPad
*>(
656 + (" based on recursive reference to"
657 " polymorphic struct type template ")
660 } else if
(dynamic_cast
<unoidl
::detail
::SourceProviderExceptionTypeEntityPad
*>(
664 t
= unoidl
::detail
::SourceProviderType
(
665 unoidl
::detail
::SourceProviderType
::TYPE_EXCEPTION
,
667 } else if
(dynamic_cast
<unoidl
::detail
::SourceProviderInterfaceTypeEntityPad
*>(
671 t
= unoidl
::detail
::SourceProviderType
(
672 unoidl
::detail
::SourceProviderType
::TYPE_INTERFACE
,
678 + " based on non-type entity " + n
));
683 assert
(e
->entity.is
());
685 case unoidl
::detail
::SourceProviderEntity
::KIND_EXTERNAL
:
686 switch
(e
->entity
->getSort
()) {
687 case unoidl
::Entity
::SORT_ENUM_TYPE
:
688 t
= unoidl
::detail
::SourceProviderType
(
689 unoidl
::detail
::SourceProviderType
::TYPE_ENUM
,
692 case unoidl
::Entity
::SORT_PLAIN_STRUCT_TYPE
:
693 t
= unoidl
::detail
::SourceProviderType
(
694 unoidl
::detail
::SourceProviderType
::TYPE_PLAIN_STRUCT
,
697 case unoidl
::Entity
::SORT_POLYMORPHIC_STRUCT_TYPE_TEMPLATE
:
701 + " based on polymorphic struct type template "
702 + n
+ " without type arguments"));
704 case unoidl
::Entity
::SORT_EXCEPTION_TYPE
:
705 t
= unoidl
::detail
::SourceProviderType
(
706 unoidl
::detail
::SourceProviderType
::TYPE_EXCEPTION
,
709 case unoidl
::Entity
::SORT_INTERFACE_TYPE
:
710 t
= unoidl
::detail
::SourceProviderType
(
711 unoidl
::detail
::SourceProviderType
::TYPE_INTERFACE
,
718 + " based on non-type entity " + n
));
722 case unoidl
::detail
::SourceProviderEntity
::KIND_INTERFACE_DECL
:
723 case unoidl
::detail
::SourceProviderEntity
::KIND_PUBLISHED_INTERFACE_DECL
:
724 t
= unoidl
::detail
::SourceProviderType
(
725 unoidl
::detail
::SourceProviderType
::TYPE_INTERFACE
,
728 case unoidl
::detail
::SourceProviderEntity
::KIND_MODULE
:
729 assert
(false
&& "this cannot happen");
733 assert
(typeNucleus.isEmpty
());
736 case unoidl
::detail
::SourceProviderEntity
::KIND_LOCAL
:
741 + (" based on instantiated polymorphic struct type"
744 + (" that is either not a polymorphic struct type"
745 " template or a recursive reference to a"
746 " polymorphic struct type template")));
749 assert
(e
->entity.is
());
751 case unoidl
::detail
::SourceProviderEntity
::KIND_EXTERNAL
:
752 if
(e
->entity
->getSort
()
753 == unoidl
::Entity
::SORT_POLYMORPHIC_STRUCT_TYPE_TEMPLATE
)
757 unoidl
::PolymorphicStructTypeTemplateEntity
*>(
759 ->getTypeParameters
().size
()))
764 + (" based on instantiated polymorphic struct"
766 + OUString
::number
(args.size
())
767 + (" type arguments based on polymorphic"
768 " struct type template ")
772 unoidl
::PolymorphicStructTypeTemplateEntity
*>(
774 ->getTypeParameters
().size
())
775 + " type paramters"));
778 t
= unoidl
::detail
::SourceProviderType
(n
, e
, args
);
782 case unoidl
::detail
::SourceProviderEntity
::KIND_INTERFACE_DECL
:
783 case unoidl
::detail
::SourceProviderEntity
::KIND_PUBLISHED_INTERFACE_DECL
:
787 + (" based on instantiated polymorphic struct type"
790 + " that is not a polymorphic struct type template"));
792 case unoidl
::detail
::SourceProviderEntity
::KIND_MODULE
:
793 assert
(false
&& "this cannot happen");
796 if
(typedefedType
!= 0) {
797 for
(std
::size_t i
= 0; i
!= rank
; ++i
) {
798 t
= unoidl
::detail
::SourceProviderType
(&t
);
801 typedefedType
->typedefName
= *name
;
812 bool checkTypeArgument
(
813 YYLTYPE location
, yyscan_t yyscanner
,
814 unoidl
::detail
::SourceProviderType
const & type
)
817 case unoidl
::detail
::SourceProviderType
::TYPE_VOID
:
818 case unoidl
::detail
::SourceProviderType
::TYPE_UNSIGNED_SHORT
:
819 case unoidl
::detail
::SourceProviderType
::TYPE_UNSIGNED_LONG
:
820 case unoidl
::detail
::SourceProviderType
::TYPE_UNSIGNED_HYPER
:
821 case unoidl
::detail
::SourceProviderType
::TYPE_EXCEPTION
:
822 case unoidl
::detail
::SourceProviderType
::TYPE_PARAMETER
: //TODO?
825 "bad instantiated polymorphic struct type argument");
827 case unoidl
::detail
::SourceProviderType
::TYPE_SEQUENCE
:
828 return checkTypeArgument
(location
, yyscanner
, type.subtypes.front
());
834 bool checkInstantiatedPolymorphicStructTypeArgument
(
835 unoidl
::detail
::SourceProviderType
const & type
, OUString
const & name
)
838 == unoidl
::detail
::SourceProviderType
::TYPE_INSTANTIATED_POLYMORPHIC_STRUCT
)
840 for
(std
::vector
<unoidl
::detail
::SourceProviderType
>::const_iterator i
(
841 type.subtypes.begin
());
842 i
!= type.subtypes.end
(); ++i
)
844 if
(checkInstantiatedPolymorphicStructTypeArgument
(*i
, name
)
845 || i
->getName
() == name
) // no need to worry about typedef
854 std::vector
<OUString
> annotations
(bool deprecated
) {
855 std
::vector
<OUString
> ann
;
857 ann.push_back
("deprecated");
869 %token TOK_RIGHTSHIFT
881 %token TOK_CONSTRAINED
892 %token TOK_MAYBEAMBIGUOUS
893 %token TOK_MAYBEDEFAULT
916 %token
<sval
> TOK_IDENTIFIER
917 %token
<ival
> TOK_INTEGER
918 %token
<fval
> TOK_FLOATING
920 %token TOK_DEPRECATED
924 %type
<sval
> identifier name singleInheritance singleInheritance_opt
925 %type
<bval
> ctors_opt deprecated_opt ellipsis_opt published_opt
926 %type
<decls
> attributeAccessDecl attributeAccessDecls
928 %type
<excns
> exceptionSpec exceptionSpec_opt exceptions
929 %type
<flags
> flag flagSection flagSection_opt flags
930 %type
<expr
> addExpr andExpr expr multExpr orExpr primaryExpr shiftExpr unaryExpr
933 %type
<types
> typeArguments
935 %initial
-action
{ yylloc = 1; }
940 definitions definition
948 | polymorphicStructTemplateDefn
953 | singleInterfaceBasedServiceDefn
954 | accumulationBasedServiceDefn
955 | interfaceBasedSingletonDefn
956 | serviceBasedSingletonDefn
961 TOK_MODULE identifier
963 unoidl
::detail
::SourceProviderScannerData
* data
= yyget_extra
(yyscanner
);
964 OUString name
(convertToFullName
(data
, $2));
965 data
->modules.push_back
(name
);
966 std
::pair
<std
::map
<OUString
, unoidl
::detail
::SourceProviderEntity
>::iterator
, bool> p
(
967 data
->entities.insert
(
968 std
::map
<OUString
, unoidl
::detail
::SourceProviderEntity
>::value_type
(
970 unoidl
::detail
::SourceProviderEntity
(
971 unoidl
::detail
::SourceProviderEntity
::KIND_MODULE
))));
973 && (p.first
->second.kind
974 != unoidl
::detail
::SourceProviderEntity
::KIND_MODULE
))
976 error(@
2, yyscanner
, "multiple entities named " + name
);
980 '{' definitions
'}' ';' { yyget_extra
(yyscanner
)->modules.pop_back
(); }
984 deprecated_opt published_opt TOK_ENUM identifier
986 unoidl
::detail
::SourceProviderScannerData
* data
= yyget_extra
(yyscanner
);
987 data
->publishedContext
= $2;
988 convertToCurrentName
(data
, $4);
989 if
(!data
->entities.insert
(
990 std
::map
<OUString
, unoidl
::detail
::SourceProviderEntity
>::value_type
(
992 unoidl
::detail
::SourceProviderEntity
(
993 new unoidl
::detail
::SourceProviderEnumTypeEntityPad
(
997 error(@
4, yyscanner
, "multiple entities named " + data
->currentName
);
1001 '{' enumMembers
'}' ';'
1003 unoidl
::detail
::SourceProviderScannerData
* data
= yyget_extra
(yyscanner
);
1004 unoidl
::detail
::SourceProviderEntity
* ent
= getCurrentEntity
(data
);
1005 unoidl
::detail
::SourceProviderEnumTypeEntityPad
* pad
=
1006 dynamic_cast
<unoidl
::detail
::SourceProviderEnumTypeEntityPad
*>(
1009 ent
->entity
= new unoidl
::EnumTypeEntity
(
1010 pad
->isPublished
(), pad
->members
, annotations
($1));
1012 clearCurrentState
(data
);
1017 | enumMembers
',' enumMember
1022 deprecated_opt identifier
1024 OUString id
(convertName
($2));
1025 unoidl
::detail
::SourceProviderScannerData
* data
= yyget_extra
(yyscanner
);
1026 rtl
::Reference
<unoidl
::detail
::SourceProviderEnumTypeEntityPad
> pad
(
1027 getCurrentPad
<unoidl
::detail
::SourceProviderEnumTypeEntityPad
>(data
));
1029 if
(pad
->members.empty
()) {
1032 v
= pad
->members.back
().value
;
1033 if
(v
== SAL_MAX_INT32
) {
1036 ("enum " + data
->currentName
+ " member " + id
1037 + " would have out-of-range value 2^31"));
1042 pad
->members.push_back
(
1043 unoidl
::EnumTypeEntity
::Member
(id
, v
, annotations
($1)));
1045 | deprecated_opt identifier
'=' expr
1047 OUString id
(convertName
($2));
1048 unoidl
::detail
::SourceProviderScannerData
* data
= yyget_extra
(yyscanner
);
1049 rtl
::Reference
<unoidl
::detail
::SourceProviderEnumTypeEntityPad
> pad
(
1050 getCurrentPad
<unoidl
::detail
::SourceProviderEnumTypeEntityPad
>(data
));
1053 case unoidl
::detail
::SourceProviderExpr
::TYPE_INT
:
1054 if
($4.ival
< SAL_MIN_INT32 ||
$4.ival
> SAL_MAX_INT32
) {
1057 ("out-of-range enum " + data
->currentName
+ " member " + id
1058 + " value " + OUString
::number
($4.ival
)));
1061 v
= static_cast
<sal_Int32
>($4.ival
);
1063 case unoidl
::detail
::SourceProviderExpr
::TYPE_UINT
:
1064 if
($4.uval
> SAL_MAX_INT32
) {
1067 ("out-of-range enum " + data
->currentName
+ " member " + id
1068 + " value " + OUString
::number
($4.uval
)));
1071 v
= static_cast
<sal_Int32
>($4.uval
);
1076 ("non-integer enum " + data
->currentName
+ " member " + id
1081 pad
->members.push_back
(
1082 unoidl
::EnumTypeEntity
::Member
(id
, v
, annotations
($1)));
1087 deprecated_opt published_opt TOK_STRUCT identifier singleInheritance_opt
1089 unoidl
::detail
::SourceProviderScannerData
* data
= yyget_extra
(yyscanner
);
1090 data
->publishedContext
= $2;
1091 convertToCurrentName
(data
, $4);
1093 rtl
::Reference
<unoidl
::PlainStructTypeEntity
> baseEnt
;
1095 baseName
= convertName
($5);
1096 unoidl
::detail
::SourceProviderEntity
const * p
;
1097 if
(findEntity
(@
5, yyscanner
, data
, false
, &baseName
, &p
, 0, 0)
1102 if
(p
== 0 ||
!p
->entity.is
()
1103 || p
->entity
->getSort
() != unoidl
::Entity
::SORT_PLAIN_STRUCT_TYPE
)
1107 ("plain struct type " + data
->currentName
+ " base "
1109 + " does not resolve to an existing plain struct type"));
1112 baseEnt
= static_cast
<unoidl
::PlainStructTypeEntity
*>(
1114 if
($2 && !baseEnt
->isPublished
()) {
1117 ("published plain struct type " + data
->currentName
+ " base "
1118 + baseName
+ " is unpublished"));
1122 if
(!data
->entities.insert
(
1123 std
::map
<OUString
, unoidl
::detail
::SourceProviderEntity
>::value_type
(
1125 unoidl
::detail
::SourceProviderEntity
(
1126 new unoidl
::detail
::SourceProviderPlainStructTypeEntityPad
(
1127 $2, baseName
, baseEnt
)))).
1130 error(@
4, yyscanner
, "multiple entities named " + data
->currentName
);
1134 '{' structMembers
'}' ';'
1136 unoidl
::detail
::SourceProviderScannerData
* data
= yyget_extra
(yyscanner
);
1137 unoidl
::detail
::SourceProviderEntity
* ent
= getCurrentEntity
(data
);
1138 unoidl
::detail
::SourceProviderPlainStructTypeEntityPad
* pad
=
1140 unoidl
::detail
::SourceProviderPlainStructTypeEntityPad
*>(
1143 ent
->entity
= new unoidl
::PlainStructTypeEntity
(
1144 pad
->isPublished
(), pad
->baseName
, pad
->members
, annotations
($1));
1146 clearCurrentState
(data
);
1150 polymorphicStructTemplateDefn:
1151 deprecated_opt published_opt TOK_STRUCT identifier
'<'
1153 unoidl
::detail
::SourceProviderScannerData
* data
= yyget_extra
(yyscanner
);
1154 data
->publishedContext
= $2;
1155 convertToCurrentName
(data
, $4);
1156 if
(!data
->entities.insert
(
1157 std
::map
<OUString
, unoidl
::detail
::SourceProviderEntity
>::value_type
(
1159 unoidl
::detail
::SourceProviderEntity
(
1160 new unoidl
::detail
::SourceProviderPolymorphicStructTypeTemplateEntityPad
(
1164 error(@
4, yyscanner
, "multiple entities named " + data
->currentName
);
1168 typeParameters
'>' '{' structMembers
'}' ';'
1170 unoidl
::detail
::SourceProviderScannerData
* data
= yyget_extra
(yyscanner
);
1171 unoidl
::detail
::SourceProviderEntity
* ent
= getCurrentEntity
(data
);
1172 unoidl
::detail
::SourceProviderPolymorphicStructTypeTemplateEntityPad
*
1174 unoidl
::detail
::SourceProviderPolymorphicStructTypeTemplateEntityPad
*>(
1177 ent
->entity
= new unoidl
::PolymorphicStructTypeTemplateEntity
(
1178 pad
->isPublished
(), pad
->typeParameters
, pad
->members
,
1181 clearCurrentState
(data
);
1186 typeParameters
',' identifier
1188 unoidl
::detail
::SourceProviderScannerData
* data
= yyget_extra
(yyscanner
);
1189 rtl
::Reference
<unoidl
::detail
::SourceProviderPolymorphicStructTypeTemplateEntityPad
>
1190 pad
(getCurrentPad
<unoidl
::detail
::SourceProviderPolymorphicStructTypeTemplateEntityPad
>(
1192 OUString id
(convertName
($3));
1193 if
(std
::find
(pad
->typeParameters.begin
(), pad
->typeParameters.end
(), id
)
1194 != pad
->typeParameters.end
())
1198 ("polymorphic struct type template " + data
->currentName
1199 + " type parameter " + id
1200 + " has same identifier as another type parameter"));
1203 pad
->typeParameters.push_back
(id
);
1207 unoidl
::detail
::SourceProviderScannerData
* data
= yyget_extra
(yyscanner
);
1208 rtl
::Reference
<unoidl
::detail
::SourceProviderPolymorphicStructTypeTemplateEntityPad
>
1209 pad
(getCurrentPad
<unoidl
::detail
::SourceProviderPolymorphicStructTypeTemplateEntityPad
>(
1211 OUString id
(convertName
($1));
1212 assert
(pad
->typeParameters.empty
());
1213 pad
->typeParameters.push_back
(id
);
1218 deprecated_opt published_opt TOK_EXCEPTION identifier singleInheritance_opt
1220 unoidl
::detail
::SourceProviderScannerData
* data
= yyget_extra
(yyscanner
);
1221 data
->publishedContext
= $2;
1222 convertToCurrentName
(data
, $4);
1224 rtl
::Reference
<unoidl
::ExceptionTypeEntity
> baseEnt
;
1226 baseName
= convertName
($5);
1227 unoidl
::detail
::SourceProviderEntity
const * p
;
1228 if
(findEntity
(@
5, yyscanner
, data
, false
, &baseName
, &p
, 0, 0)
1233 if
(p
== 0 ||
!p
->entity.is
()
1234 || p
->entity
->getSort
() != unoidl
::Entity
::SORT_EXCEPTION_TYPE
)
1238 ("exception type " + data
->currentName
+ " base " + baseName
1239 + " does not resolve to an existing exception type"));
1242 baseEnt
= static_cast
<unoidl
::ExceptionTypeEntity
*>(
1244 if
($2 && !baseEnt
->isPublished
()) {
1247 ("published exception type " + data
->currentName
+ " base "
1248 + baseName
+ " is unpublished"));
1252 if
(!data
->entities.insert
(
1253 std
::map
<OUString
, unoidl
::detail
::SourceProviderEntity
>::value_type
(
1255 unoidl
::detail
::SourceProviderEntity
(
1256 new unoidl
::detail
::SourceProviderExceptionTypeEntityPad
(
1257 $2, baseName
, baseEnt
)))).
1260 error(@
4, yyscanner
, "multiple entities named " + data
->currentName
);
1264 '{' structMembers
'}' ';'
1266 unoidl
::detail
::SourceProviderScannerData
* data
= yyget_extra
(yyscanner
);
1267 unoidl
::detail
::SourceProviderEntity
* ent
= getCurrentEntity
(data
);
1268 unoidl
::detail
::SourceProviderExceptionTypeEntityPad
* pad
=
1269 dynamic_cast
<unoidl
::detail
::SourceProviderExceptionTypeEntityPad
*>(
1272 ent
->entity
= new unoidl
::ExceptionTypeEntity
(
1273 pad
->isPublished
(), pad
->baseName
, pad
->members
, annotations
($1));
1275 clearCurrentState
(data
);
1280 structMembers structMember
1285 deprecated_opt type identifier
';'
1287 unoidl
::detail
::SourceProviderScannerData
* data
= yyget_extra
(yyscanner
);
1288 unoidl
::detail
::SourceProviderType t
(*$2);
1290 OUString id
(convertName
($3));
1292 case unoidl
::detail
::SourceProviderType
::TYPE_VOID
:
1293 case unoidl
::detail
::SourceProviderType
::TYPE_EXCEPTION
:
1296 ("illegal struct/exception type " + data
->currentName
1297 + " direct member " + id
+ " type"));
1303 if
(t.type
!= unoidl
::detail
::SourceProviderType
::TYPE_PARAMETER
1304 && t.getName
() == data
->currentName
) // no need to worry about typedef
1308 ("struct/exception type " + data
->currentName
+ " direct member "
1309 + id
+ " has same type as the type itself"));
1312 if
(checkInstantiatedPolymorphicStructTypeArgument
(t
, data
->currentName
))
1316 ("struct/exception type " + data
->currentName
+ " direct member "
1318 + (" has instantiated polymorphic struct type that uses the type"
1319 " itself as an argument")));
1322 if
(nameHasSameIdentifierAs
(data
->currentName
, id
)) {
1325 ("struct/exception type " + data
->currentName
+ " direct member "
1326 + id
+ " has same unqualified identifer as the type itself"));
1329 unoidl
::detail
::SourceProviderEntity
* ent
= getCurrentEntity
(data
);
1330 unoidl
::detail
::SourceProviderPlainStructTypeEntityPad
* p1
=
1331 dynamic_cast
<unoidl
::detail
::SourceProviderPlainStructTypeEntityPad
*>(
1334 for
(std
::vector
<unoidl
::PlainStructTypeEntity
::Member
>::iterator i
(
1335 p1
->members.begin
());
1336 i
!= p1
->members.end
(); ++i
)
1338 if
(id
== i
->name
) {
1341 ("plain struct type " + data
->currentName
1342 + " direct member " + id
1343 + " has same identifier as another direct member"));
1347 if
(p1
->baseEntity.is
()) {
1348 OUString baseName
(p1
->baseName
);
1349 for
(rtl
::Reference
<unoidl
::PlainStructTypeEntity
> baseEnt
(
1352 if
(nameHasSameIdentifierAs
(baseName
, id
)) {
1355 ("plain struct type " + data
->currentName
1356 + " direct member " + id
1357 + " has same unqalified identifier as base "
1361 for
(std
::vector
<unoidl
::PlainStructTypeEntity
::Member
>::const_iterator i
(
1362 baseEnt
->getDirectMembers
().begin
());
1363 i
!= baseEnt
->getDirectMembers
().end
(); ++i
)
1365 if
(id
== i
->name
) {
1368 ("plain struct type " + data
->currentName
1369 + " direct member " + id
1370 + " has same identifier as a member of base "
1375 baseName
= baseEnt
->getDirectBase
();
1376 if
(baseName.isEmpty
()) {
1379 unoidl
::detail
::SourceProviderEntity
const * p
;
1381 @
2, yyscanner
, data
, false
, &baseName
, &p
, 0, 0)
1386 if
(p
== 0 ||
!p
->entity.is
()
1387 ||
(p
->entity
->getSort
()
1388 != unoidl
::Entity
::SORT_PLAIN_STRUCT_TYPE
))
1392 ("inconsistent type manager: plain struct type "
1393 + data
->currentName
+ " base " + baseName
1394 + (" does not resolve to an existing plain struct"
1398 baseEnt
= static_cast
<unoidl
::PlainStructTypeEntity
*>(
1402 p1
->members.push_back
(
1403 unoidl
::PlainStructTypeEntity
::Member
(
1404 id
, t.getName
(), annotations
($1)));
1406 unoidl
::detail
::SourceProviderPolymorphicStructTypeTemplateEntityPad
*
1407 p2
= dynamic_cast
<unoidl
::detail
::SourceProviderPolymorphicStructTypeTemplateEntityPad
*>(
1410 for
(std
::vector
<unoidl
::PolymorphicStructTypeTemplateEntity
::Member
>::iterator i
(
1411 p2
->members.begin
());
1412 i
!= p2
->members.end
(); ++i
)
1414 if
(id
== i
->name
) {
1417 ("polymorphic struct type template "
1418 + data
->currentName
+ " direct member " + id
1419 + " has same identifier as another direct member"));
1423 p2
->members.push_back
(
1424 unoidl
::PolymorphicStructTypeTemplateEntity
::Member
(
1427 == unoidl
::detail
::SourceProviderType
::TYPE_PARAMETER
),
1430 unoidl
::detail
::SourceProviderExceptionTypeEntityPad
* p3
1431 = dynamic_cast
<unoidl
::detail
::SourceProviderExceptionTypeEntityPad
*>(
1434 for
(std
::vector
<unoidl
::ExceptionTypeEntity
::Member
>::iterator i
(
1435 p3
->members.begin
());
1436 i
!= p3
->members.end
(); ++i
)
1438 if
(id
== i
->name
) {
1441 ("exception type " + data
->currentName
1442 + " direct member " + id
1443 + " has same identifier as another direct member"));
1447 if
(p3
->baseEntity.is
()) {
1448 OUString baseName
(p3
->baseName
);
1449 for
(rtl
::Reference
<unoidl
::ExceptionTypeEntity
> baseEnt
(
1452 if
(nameHasSameIdentifierAs
(baseName
, id
)) {
1455 ("exception type " + data
->currentName
1456 + " direct member " + id
1457 + " has same unqalified identifier as base "
1461 for
(std
::vector
<unoidl
::ExceptionTypeEntity
::Member
>::const_iterator i
(
1462 baseEnt
->getDirectMembers
().begin
());
1463 i
!= baseEnt
->getDirectMembers
().end
(); ++i
)
1465 if
(id
== i
->name
) {
1468 ("exception type " + data
->currentName
1469 + " direct member " + id
1470 + " has same identifier as a member of base "
1475 baseName
= baseEnt
->getDirectBase
();
1476 if
(baseName.isEmpty
()) {
1479 unoidl
::detail
::SourceProviderEntity
const * p
;
1481 @
2, yyscanner
, data
, false
, &baseName
, &p
, 0, 0)
1486 if
(p
== 0 ||
!p
->entity.is
()
1487 ||
(p
->entity
->getSort
()
1488 != unoidl
::Entity
::SORT_EXCEPTION_TYPE
))
1492 ("inconsistent type manager: exception type "
1493 + data
->currentName
+ " base " + baseName
1494 + (" does not resolve to an existing exception"
1498 baseEnt
= static_cast
<unoidl
::ExceptionTypeEntity
*>(
1502 p3
->members.push_back
(
1503 unoidl
::ExceptionTypeEntity
::Member
(
1504 id
, t.getName
(), annotations
($1)));
1511 deprecated_opt published_opt TOK_INTERFACE identifier singleInheritance_opt
1513 unoidl
::detail
::SourceProviderScannerData
* data
= yyget_extra
(yyscanner
);
1514 data
->publishedContext
= $2;
1515 convertToCurrentName
(data
, $4);
1517 rtl
::Reference
<unoidl
::InterfaceTypeEntity
> baseEnt
;
1519 baseName
= convertName
($5);
1520 unoidl
::detail
::SourceProviderEntity
const * p
;
1521 if
(findEntity
(@
5, yyscanner
, data
, true
, &baseName
, &p
, 0, 0)
1526 if
(p
== 0 ||
!p
->entity.is
()
1527 || p
->entity
->getSort
() != unoidl
::Entity
::SORT_INTERFACE_TYPE
)
1531 ("interface type " + data
->currentName
+ " direct base "
1533 + " does not resolve to an existing interface type"));
1536 baseEnt
= static_cast
<unoidl
::InterfaceTypeEntity
*>(p
->entity.get
());
1537 if
($2 && !baseEnt
->isPublished
()) {
1540 ("published interface type " + data
->currentName
1541 + " direct base " + baseName
+ " is unpublished"));
1545 std
::map
<OUString
, unoidl
::detail
::SourceProviderEntity
>::iterator i
(
1546 data
->entities.find
(data
->currentName
));
1547 if
(i
!= data
->entities.end
()) {
1548 switch
(i
->second.kind
) {
1549 case unoidl
::detail
::SourceProviderEntity
::KIND_INTERFACE_DECL
:
1551 case unoidl
::detail
::SourceProviderEntity
::KIND_PUBLISHED_INTERFACE_DECL
:
1555 ("unpublished interface type " + data
->currentName
1556 + " has been declared published"));
1563 "multiple entities named " + data
->currentName
);
1568 rtl
::Reference
<unoidl
::detail
::SourceProviderInterfaceTypeEntityPad
> pad
(
1569 new unoidl
::detail
::SourceProviderInterfaceTypeEntityPad
(
1572 && !pad
->addDirectBase
(
1573 @
4, yyscanner
, data
,
1574 unoidl
::detail
::SourceProviderInterfaceTypeEntityPad
::DirectBase
(
1575 baseName
, baseEnt
, std
::vector
<OUString
>()),
1580 data
->entities
[data
->currentName
] = unoidl
::detail
::SourceProviderEntity
(
1583 '{' interfaceMembers
'}' ';'
1585 unoidl
::detail
::SourceProviderScannerData
* data
= yyget_extra
(yyscanner
);
1586 unoidl
::detail
::SourceProviderEntity
* ent
= getCurrentEntity
(data
);
1587 unoidl
::detail
::SourceProviderInterfaceTypeEntityPad
* pad
=
1588 dynamic_cast
<unoidl
::detail
::SourceProviderInterfaceTypeEntityPad
*>(
1591 if
(pad
->directMandatoryBases.empty
()
1592 && data
->currentName
!= "com.sun.star.uno.XInterface")
1594 OUString base
(".com.sun.star.uno.XInterface");
1595 unoidl
::detail
::SourceProviderEntity
const * p
;
1596 if
(findEntity
(@
4, yyscanner
, data
, true
, &base
, &p
, 0, 0)
1601 if
(p
== 0 ||
!p
->entity.is
()
1602 || p
->entity
->getSort
() != unoidl
::Entity
::SORT_INTERFACE_TYPE
)
1606 ("interface type " + data
->currentName
1607 + " implicit direct base " + base
1608 + " does not resolve to an existing interface type"));
1611 if
(!pad
->addDirectBase
(
1612 @
3, yyscanner
, data
,
1613 unoidl
::detail
::SourceProviderInterfaceTypeEntityPad
::DirectBase
(
1615 static_cast
<unoidl
::InterfaceTypeEntity
*>(
1617 std
::vector
<OUString
>()),
1623 std
::vector
<unoidl
::AnnotatedReference
> mbases
;
1624 for
(std
::vector
<unoidl
::detail
::SourceProviderInterfaceTypeEntityPad
::DirectBase
>::const_iterator
1625 i
(pad
->directMandatoryBases.begin
());
1626 i
!= pad
->directMandatoryBases.end
(); ++i
)
1628 mbases.push_back
(unoidl
::AnnotatedReference
(i
->name
, i
->annotations
));
1630 std
::vector
<unoidl
::AnnotatedReference
> obases
;
1631 for
(std
::vector
<unoidl
::detail
::SourceProviderInterfaceTypeEntityPad
::DirectBase
>::const_iterator
1632 i
(pad
->directOptionalBases.begin
());
1633 i
!= pad
->directOptionalBases.end
(); ++i
)
1635 obases.push_back
(unoidl
::AnnotatedReference
(i
->name
, i
->annotations
));
1637 ent
->entity
= new unoidl
::InterfaceTypeEntity
(
1638 pad
->isPublished
(), mbases
, obases
, pad
->directAttributes
,
1639 pad
->directMethods
, annotations
($1));
1641 clearCurrentState
(data
);
1646 interfaceMembers interfaceMember
1652 | interfaceAttribute
1657 deprecated_opt flagSection_opt TOK_INTERFACE name
';'
1659 unoidl
::detail
::SourceProviderScannerData
* data
= yyget_extra
(yyscanner
);
1660 OUString name
(convertName
($4));
1661 rtl
::Reference
<unoidl
::detail
::SourceProviderInterfaceTypeEntityPad
> pad
(
1662 getCurrentPad
<unoidl
::detail
::SourceProviderInterfaceTypeEntityPad
>(
1664 if
(pad
->singleBase
) {
1667 "single-inheritance interface cannot have additional bases");
1670 if
(($2 & ~unoidl
::detail
::FLAG_OPTIONAL
) != 0) {
1673 "interface base can only be flagged as [optional]");
1676 bool opt
= ($2 & unoidl
::detail
::FLAG_OPTIONAL
) != 0;
1677 OUString orgName
(name
);
1678 unoidl
::detail
::SourceProviderEntity
const * p
;
1679 bool typedefed
= false
;
1680 if
(findEntity
(@
4, yyscanner
, data
, true
, &name
, &p
, &typedefed
, 0)
1685 if
(p
== 0 ||
!p
->entity.is
()
1686 || p
->entity
->getSort
() != unoidl
::Entity
::SORT_INTERFACE_TYPE
)
1690 ("interface type " + data
->currentName
+ " direct base " + name
1691 + " does not resolve to an existing interface type"));
1697 ("interface type " + data
->currentName
+ " direct base " + orgName
1698 + " is a typedef"));
1701 rtl
::Reference
<unoidl
::InterfaceTypeEntity
> ent
(
1702 static_cast
<unoidl
::InterfaceTypeEntity
*>(p
->entity.get
()));
1703 if
(data
->publishedContext
&& !ent
->isPublished
()) {
1706 ("published interface type " + data
->currentName
+ " direct base "
1707 + name
+ " is unpublished"));
1710 if
(!pad
->addDirectBase
(
1711 @
4, yyscanner
, data
,
1712 unoidl
::detail
::SourceProviderInterfaceTypeEntityPad
::DirectBase
(
1713 name
, ent
, annotations
($1)),
1722 deprecated_opt flagSection type identifier
1724 unoidl
::detail
::SourceProviderScannerData
* data
= yyget_extra
(yyscanner
);
1725 unoidl
::detail
::SourceProviderType t
(*$3);
1727 OUString id
(convertName
($4));
1728 if
(($2 & unoidl
::detail
::FLAG_ATTRIBUTE
) == 0) {
1731 "interface attribute must be flagged as [attribute]");
1735 & ~
(unoidl
::detail
::FLAG_ATTRIBUTE | unoidl
::detail
::FLAG_BOUND
1736 | unoidl
::detail
::FLAG_READONLY
))
1741 ("interface attribute can only be flagged as [attribute,"
1746 case unoidl
::detail
::SourceProviderType
::TYPE_VOID
:
1747 case unoidl
::detail
::SourceProviderType
::TYPE_EXCEPTION
:
1750 ("illegal interface type " + data
->currentName
1751 + " direct attribute " + id
+ " type"));
1757 rtl
::Reference
<unoidl
::detail
::SourceProviderInterfaceTypeEntityPad
> pad
(
1758 getCurrentPad
<unoidl
::detail
::SourceProviderInterfaceTypeEntityPad
>(
1760 if
(!pad
->addDirectMember
(@
4, yyscanner
, data
, id
)) {
1763 pad
->directAttributes.push_back
(
1764 unoidl
::InterfaceTypeEntity
::Attribute
(
1765 id
, t.getName
(), ($2 & unoidl
::detail
::FLAG_BOUND
) != 0,
1766 ($2 & unoidl
::detail
::FLAG_READONLY
) != 0,
1767 std
::vector
<OUString
>(), std
::vector
<OUString
>(),
1770 attributeAccessDecls_opt
';'
1773 attributeAccessDecls_opt:
1774 '{' attributeAccessDecls
'}'
1778 attributeAccessDecls:
1779 attributeAccessDecls attributeAccessDecl
1781 if
(($1 & $2) != 0) {
1783 @
2, yyscanner
, "duplicate get/set attribute access declaration");
1786 $$
= unoidl
::detail
::SourceProviderAccessDecls
($1 |
$2);
1788 |
/* empty */ { $$
= unoidl
::detail
::SourceProviderAccessDecls
(0); }
1791 attributeAccessDecl:
1792 TOK_GET exceptionSpec
';'
1794 unoidl
::detail
::SourceProviderScannerData
* data
= yyget_extra
(yyscanner
);
1795 rtl
::Reference
<unoidl
::detail
::SourceProviderInterfaceTypeEntityPad
>
1796 pad
(getCurrentPad
<unoidl
::detail
::SourceProviderInterfaceTypeEntityPad
>(
1798 assert
(!pad
->directAttributes.empty
());
1799 pad
->directAttributes.back
().getExceptions
= *$2;
1801 $$
= unoidl
::detail
::ACCESS_DECL_GET
;
1803 | TOK_SET exceptionSpec
';'
1805 unoidl
::detail
::SourceProviderScannerData
* data
= yyget_extra
(yyscanner
);
1806 rtl
::Reference
<unoidl
::detail
::SourceProviderInterfaceTypeEntityPad
>
1807 pad
(getCurrentPad
<unoidl
::detail
::SourceProviderInterfaceTypeEntityPad
>(
1809 assert
(!pad
->directAttributes.empty
());
1810 pad
->directAttributes.back
().setExceptions
= *$2;
1812 if
(pad
->directAttributes.back
().readOnly
) {
1815 ("interface type " + data
->currentName
1816 + " direct read-only attribute "
1817 + pad
->directAttributes.back
().name
1818 + " cannot have set access declaration"));
1821 $$
= unoidl
::detail
::ACCESS_DECL_SET
;
1826 deprecated_opt type identifier
1828 unoidl
::detail
::SourceProviderScannerData
* data
= yyget_extra
(yyscanner
);
1829 unoidl
::detail
::SourceProviderType t
(*$2);
1831 OUString id
(convertName
($3));
1832 if
(t.type
== unoidl
::detail
::SourceProviderType
::TYPE_EXCEPTION
) {
1835 ("illegal interface type " + data
->currentName
1836 + " direct method " + id
+ " return type"));
1839 rtl
::Reference
<unoidl
::detail
::SourceProviderInterfaceTypeEntityPad
> pad
(
1840 getCurrentPad
<unoidl
::detail
::SourceProviderInterfaceTypeEntityPad
>(
1842 if
(!pad
->addDirectMember
(@
3, yyscanner
, data
, id
)) {
1845 pad
->directMethods.push_back
(
1846 unoidl
::InterfaceTypeEntity
::Method
(
1848 std
::vector
<unoidl
::InterfaceTypeEntity
::Method
::Parameter
>(),
1849 std
::vector
<OUString
>(), annotations
($1)));
1851 '(' methodParams_opt
')' exceptionSpec_opt
';'
1854 unoidl
::detail
::SourceProviderScannerData
* data
1855 = yyget_extra
(yyscanner
);
1856 rtl
::Reference
<unoidl
::detail
::SourceProviderInterfaceTypeEntityPad
>
1857 pad
(getCurrentPad
<unoidl
::detail
::SourceProviderInterfaceTypeEntityPad
>(
1859 assert
(!pad
->directMethods.empty
());
1860 pad
->directMethods.back
().exceptions
= *$8;
1872 methodParams
',' methodParam
1877 '[' direction
']' type identifier
1879 unoidl
::detail
::SourceProviderScannerData
* data
= yyget_extra
(yyscanner
);
1880 unoidl
::detail
::SourceProviderType t
(*$4);
1882 OUString id
(convertName
($5));
1883 rtl
::Reference
<unoidl
::detail
::SourceProviderInterfaceTypeEntityPad
>
1884 pad
(getCurrentPad
<unoidl
::detail
::SourceProviderInterfaceTypeEntityPad
>(
1886 assert
(!pad
->directMethods.empty
());
1888 case unoidl
::detail
::SourceProviderType
::TYPE_VOID
:
1889 case unoidl
::detail
::SourceProviderType
::TYPE_EXCEPTION
:
1892 ("illegal interface type " + data
->currentName
1893 + " direct method " + pad
->directMethods.back
().name
1894 + " parameter " + id
+ " type"));
1900 for
(std
::vector
<unoidl
::InterfaceTypeEntity
::Method
::Parameter
>::iterator
1901 i
(pad
->directMethods.back
().parameters.begin
());
1902 i
!= pad
->directMethods.back
().parameters.end
(); ++i
)
1904 if
(id
== i
->name
) {
1907 ("interface type " + data
->currentName
+ " direct method "
1908 + pad
->directMethods.back
().name
+ " parameter " + id
1909 + " has same identifier as another parameter"));
1913 pad
->directMethods.back
().parameters.push_back
(
1914 unoidl
::InterfaceTypeEntity
::Method
::Parameter
(id
, t.getName
(), $2));
1919 TOK_IN
{ $$
= unoidl
::InterfaceTypeEntity
::Method
::Parameter
::DIRECTION_IN
; }
1921 { $$
= unoidl
::InterfaceTypeEntity
::Method
::Parameter
::DIRECTION_OUT
; }
1923 { $$
= unoidl
::InterfaceTypeEntity
::Method
::Parameter
::DIRECTION_IN_OUT
; }
1927 deprecated_opt published_opt TOK_TYPEDEF type identifier
';'
1929 unoidl
::detail
::SourceProviderScannerData
* data
= yyget_extra
(yyscanner
);
1930 data
->publishedContext
= $2;
1931 unoidl
::detail
::SourceProviderType t
(*$4);
1933 OUString name
(convertToFullName
(data
, $5));
1934 // There is no good reason to forbid typedefs to VOID, to instantiated
1935 // polymorphic struct types, and to exception types, but some old client
1936 // code of registry data expects this typedef restriction (like the
1937 // assert(false) default in handleTypedef in
1938 // codemaker/source/javamaker/javatype.cxx), so forbid them for now:
1940 case unoidl
::detail
::SourceProviderType
::TYPE_VOID
:
1941 case unoidl
::detail
::SourceProviderType
::TYPE_EXCEPTION
:
1942 case unoidl
::detail
::SourceProviderType
::TYPE_INSTANTIATED_POLYMORPHIC_STRUCT
:
1943 error(@
4, yyscanner
, "bad typedef type");
1946 case unoidl
::detail
::SourceProviderType
::TYPE_ENUM
:
1947 case unoidl
::detail
::SourceProviderType
::TYPE_PLAIN_STRUCT
:
1948 case unoidl
::detail
::SourceProviderType
::TYPE_INTERFACE
:
1951 switch
(t.entity
->kind
) {
1952 case unoidl
::detail
::SourceProviderEntity
::KIND_INTERFACE_DECL
:
1955 case unoidl
::detail
::SourceProviderEntity
::KIND_PUBLISHED_INTERFACE_DECL
:
1957 case unoidl
::detail
::SourceProviderEntity
::KIND_MODULE
:
1958 assert
(false
&& "this cannot happen");
1960 assert
(t.entity
->entity.is
() || t.entity
->pad.is
());
1962 = !(t.entity
->entity.is
()
1963 ? static_cast
<unoidl
::PublishableEntity
*>(
1964 t.entity
->entity.get
())->isPublished
()
1965 : t.entity
->pad
->isPublished
());
1971 "published typedef " + name
+ " type is unpublished");
1976 case unoidl
::detail
::SourceProviderType
::TYPE_PARAMETER
:
1977 assert
(false
&& "this cannot happen");
1981 if
(!data
->entities.insert
(
1982 std
::map
<OUString
, unoidl
::detail
::SourceProviderEntity
>::value_type
(
1984 unoidl
::detail
::SourceProviderEntity
(
1985 unoidl
::detail
::SourceProviderEntity
::KIND_LOCAL
,
1986 new unoidl
::TypedefEntity
(
1987 $2, t.getName
(), annotations
($1))))).
1990 error(@
5, yyscanner
, "multiple entities named " + name
);
1993 clearCurrentState
(data
);
1998 deprecated_opt published_opt TOK_CONSTANTS identifier
2000 unoidl
::detail
::SourceProviderScannerData
* data
= yyget_extra
(yyscanner
);
2001 data
->publishedContext
= $2;
2002 convertToCurrentName
(data
, $4);
2003 if
(!data
->entities.insert
(
2004 std
::map
<OUString
, unoidl
::detail
::SourceProviderEntity
>::value_type
(
2006 unoidl
::detail
::SourceProviderEntity
(
2007 new unoidl
::detail
::SourceProviderConstantGroupEntityPad
(
2011 error(@
4, yyscanner
, "multiple entities named " + data
->currentName
);
2015 '{' constants
'}' ';'
2017 unoidl
::detail
::SourceProviderScannerData
* data
= yyget_extra
(yyscanner
);
2018 unoidl
::detail
::SourceProviderEntity
* ent
= getCurrentEntity
(data
);
2019 unoidl
::detail
::SourceProviderConstantGroupEntityPad
* pad
=
2020 dynamic_cast
<unoidl
::detail
::SourceProviderConstantGroupEntityPad
*>(
2023 ent
->entity
= new unoidl
::ConstantGroupEntity
(
2024 pad
->isPublished
(), pad
->members
, annotations
($1));
2026 clearCurrentState
(data
);
2036 deprecated_opt TOK_CONST type identifier
'=' expr
';'
2038 OUString id
(convertName
($4));
2039 unoidl
::detail
::SourceProviderScannerData
* data
= yyget_extra
(yyscanner
);
2040 rtl
::Reference
<unoidl
::detail
::SourceProviderConstantGroupEntityPad
> pad
(
2041 getCurrentPad
<unoidl
::detail
::SourceProviderConstantGroupEntityPad
>(
2043 unoidl
::detail
::SourceProviderType t
(*$3);
2045 unoidl
::ConstantValue v
(false
); // dummy value
2047 case unoidl
::detail
::SourceProviderType
::TYPE_BOOLEAN
:
2048 if
($6.type
!= unoidl
::detail
::SourceProviderExpr
::TYPE_BOOL
) {
2051 ("bad value of boolean-typed constant " + data
->currentName
2055 v
= unoidl
::ConstantValue
($6.bval
);
2057 case unoidl
::detail
::SourceProviderType
::TYPE_BYTE
:
2059 case unoidl
::detail
::SourceProviderExpr
::TYPE_INT
:
2060 if
($6.ival
< SAL_MIN_INT8 ||
$6.ival
> SAL_MAX_INT8
) {
2063 ("out-of-range byte-typed constant " + data
->currentName
2064 + "." + id
+ " value " + OUString
::number
($6.ival
)));
2067 v
= unoidl
::ConstantValue
(static_cast
<sal_Int8
>($6.ival
));
2069 case unoidl
::detail
::SourceProviderExpr
::TYPE_UINT
:
2070 if
($6.uval
> SAL_MAX_INT8
) {
2073 ("out-of-range byte-typed constant " + data
->currentName
2074 + "." + id
+ " value " + OUString
::number
($6.uval
)));
2077 v
= unoidl
::ConstantValue
(static_cast
<sal_Int8
>($6.uval
));
2082 ("bad value of byte-typed constant " + data
->currentName
+ "."
2088 case unoidl
::detail
::SourceProviderType
::TYPE_SHORT
:
2090 case unoidl
::detail
::SourceProviderExpr
::TYPE_INT
:
2091 if
($6.ival
< SAL_MIN_INT16 ||
$6.ival
> SAL_MAX_INT16
) {
2094 ("out-of-range short-typed constant " + data
->currentName
2095 + "." + id
+ " value " + OUString
::number
($6.ival
)));
2098 v
= unoidl
::ConstantValue
(static_cast
<sal_Int16
>($6.ival
));
2100 case unoidl
::detail
::SourceProviderExpr
::TYPE_UINT
:
2101 if
($6.uval
> SAL_MAX_INT16
) {
2104 ("out-of-range short-typed constant " + data
->currentName
2105 + "." + id
+ " value " + OUString
::number
($6.uval
)));
2108 v
= unoidl
::ConstantValue
(static_cast
<sal_Int16
>($6.uval
));
2113 ("bad value of short-typed constant " + data
->currentName
2119 case unoidl
::detail
::SourceProviderType
::TYPE_UNSIGNED_SHORT
:
2121 case unoidl
::detail
::SourceProviderExpr
::TYPE_INT
:
2122 if
($6.ival
< 0 ||
$6.ival
> SAL_MAX_UINT16
) {
2125 ("out-of-range unsigned-short-typed constant "
2126 + data
->currentName
+ "." + id
+ " value "
2127 + OUString
::number
($6.ival
)));
2130 v
= unoidl
::ConstantValue
(static_cast
<sal_uInt16
>($6.ival
));
2132 case unoidl
::detail
::SourceProviderExpr
::TYPE_UINT
:
2133 if
($6.uval
> SAL_MAX_UINT16
) {
2136 ("out-of-range unsigned-short-typed constant "
2137 + data
->currentName
+ "." + id
+ " value "
2138 + OUString
::number
($6.uval
)));
2141 v
= unoidl
::ConstantValue
(static_cast
<sal_uInt16
>($6.uval
));
2146 ("bad value of unsigned-short-typed constant "
2147 + data
->currentName
+ "." + id
));
2152 case unoidl
::detail
::SourceProviderType
::TYPE_LONG
:
2154 case unoidl
::detail
::SourceProviderExpr
::TYPE_INT
:
2155 if
($6.ival
< SAL_MIN_INT32 ||
$6.ival
> SAL_MAX_INT32
) {
2158 ("out-of-range long-typed constant " + data
->currentName
2159 + "." + id
+ " value " + OUString
::number
($6.ival
)));
2162 v
= unoidl
::ConstantValue
(static_cast
<sal_Int32
>($6.ival
));
2164 case unoidl
::detail
::SourceProviderExpr
::TYPE_UINT
:
2165 if
($6.uval
> SAL_MAX_INT32
) {
2168 ("out-of-range long-typed constant " + data
->currentName
2169 + "." + id
+ " value " + OUString
::number
($6.uval
)));
2172 v
= unoidl
::ConstantValue
(static_cast
<sal_Int32
>($6.uval
));
2177 ("bad value of long-typed constant " + data
->currentName
2183 case unoidl
::detail
::SourceProviderType
::TYPE_UNSIGNED_LONG
:
2185 case unoidl
::detail
::SourceProviderExpr
::TYPE_INT
:
2186 if
($6.ival
< 0 ||
$6.ival
> SAL_MAX_UINT32
) {
2189 ("out-of-range unsigned-long-typed constant "
2190 + data
->currentName
+ "." + id
+ " value "
2191 + OUString
::number
($6.ival
)));
2194 v
= unoidl
::ConstantValue
(static_cast
<sal_uInt32
>($6.ival
));
2196 case unoidl
::detail
::SourceProviderExpr
::TYPE_UINT
:
2197 if
($6.uval
> SAL_MAX_UINT32
) {
2200 ("out-of-range unsigned-long-typed constant "
2201 + data
->currentName
+ "." + id
+ " value "
2202 + OUString
::number
($6.uval
)));
2205 v
= unoidl
::ConstantValue
(static_cast
<sal_uInt32
>($6.uval
));
2210 ("bad value of unsigned-long-typed constant "
2211 + data
->currentName
+ "." + id
));
2216 case unoidl
::detail
::SourceProviderType
::TYPE_HYPER
:
2218 case unoidl
::detail
::SourceProviderExpr
::TYPE_INT
:
2219 v
= unoidl
::ConstantValue
($6.ival
);
2221 case unoidl
::detail
::SourceProviderExpr
::TYPE_UINT
:
2222 if
($6.uval
> SAL_MAX_INT64
) {
2225 ("out-of-range hyper-typed constant " + data
->currentName
2226 + "." + id
+ " value " + OUString
::number
($6.uval
)));
2229 v
= unoidl
::ConstantValue
(static_cast
<sal_Int64
>($6.uval
));
2234 ("bad value of hyper-typed constant " + data
->currentName
2240 case unoidl
::detail
::SourceProviderType
::TYPE_UNSIGNED_HYPER
:
2242 case unoidl
::detail
::SourceProviderExpr
::TYPE_INT
:
2246 ("out-of-range unsigned-hyper-typed constant "
2247 + data
->currentName
+ "." + id
+ " value "
2248 + OUString
::number
($6.ival
)));
2251 v
= unoidl
::ConstantValue
(static_cast
<sal_uInt64
>($6.ival
));
2253 case unoidl
::detail
::SourceProviderExpr
::TYPE_UINT
:
2254 v
= unoidl
::ConstantValue
($6.uval
);
2259 ("bad value of unsigned-hyper-typed constant "
2260 + data
->currentName
+ "." + id
));
2265 case unoidl
::detail
::SourceProviderType
::TYPE_FLOAT
:
2267 case unoidl
::detail
::SourceProviderExpr
::TYPE_BOOL
:
2270 ("bad boolean value of float-typed constant "
2271 + data
->currentName
+ "." + id
));
2274 case unoidl
::detail
::SourceProviderExpr
::TYPE_INT
:
2275 v
= unoidl
::ConstantValue
(static_cast
<float>($6.ival
));
2277 case unoidl
::detail
::SourceProviderExpr
::TYPE_UINT
:
2278 v
= unoidl
::ConstantValue
(static_cast
<float>($6.uval
));
2280 case unoidl
::detail
::SourceProviderExpr
::TYPE_FLOAT
:
2281 v
= unoidl
::ConstantValue
(static_cast
<float>($6.fval
));
2285 case unoidl
::detail
::SourceProviderType
::TYPE_DOUBLE
:
2287 case unoidl
::detail
::SourceProviderExpr
::TYPE_BOOL
:
2290 ("bad boolean value of double-typed constant "
2291 + data
->currentName
+ "." + id
));
2294 case unoidl
::detail
::SourceProviderExpr
::TYPE_INT
:
2295 v
= unoidl
::ConstantValue
(static_cast
<double>($6.ival
));
2297 case unoidl
::detail
::SourceProviderExpr
::TYPE_UINT
:
2298 v
= unoidl
::ConstantValue
(static_cast
<double>($6.uval
));
2300 case unoidl
::detail
::SourceProviderExpr
::TYPE_FLOAT
:
2301 v
= unoidl
::ConstantValue
($6.fval
);
2308 "bad type for constant " + data
->currentName
+ "." + id
);
2312 pad
->members.push_back
(
2313 unoidl
::ConstantGroupEntity
::Member
(id
, v
, annotations
($1)));
2317 singleInterfaceBasedServiceDefn:
2318 deprecated_opt published_opt TOK_SERVICE identifier singleInheritance
2320 unoidl
::detail
::SourceProviderScannerData
* data
= yyget_extra
(yyscanner
);
2321 data
->publishedContext
= $2;
2322 convertToCurrentName
(data
, $4);
2323 OUString base
(convertName
($5));
2324 unoidl
::detail
::SourceProviderEntity
const * p
;
2325 if
(findEntity
(@
5, yyscanner
, data
, false
, &base
, &p
, 0, 0)
2330 bool ifcBase
= false
;
2331 bool pubBase
= false
;
2334 case unoidl
::detail
::SourceProviderEntity
::KIND_INTERFACE_DECL
:
2338 case unoidl
::detail
::SourceProviderEntity
::KIND_PUBLISHED_INTERFACE_DECL
:
2344 && (p
->entity
->getSort
()
2345 == unoidl
::Entity
::SORT_INTERFACE_TYPE
))
2348 pubBase
= static_cast
<unoidl
::InterfaceTypeEntity
*>(
2349 p
->entity.get
())->isPublished
();
2357 ("single-interface--based service " + data
->currentName
+ " base "
2358 + base
+ " does not resolve to an interface type"));
2361 if
($2 && !pubBase
) {
2364 ("published single-interface--based service " + data
->currentName
2365 + " base " + base
+ " is unpublished"));
2368 if
(!data
->entities.insert
(
2369 std
::map
<OUString
, unoidl
::detail
::SourceProviderEntity
>::value_type
(
2371 unoidl
::detail
::SourceProviderEntity
(
2372 new unoidl
::detail
::SourceProviderSingleInterfaceBasedServiceEntityPad
(
2376 error(@
4, yyscanner
, "multiple entities named " + data
->currentName
);
2382 unoidl
::detail
::SourceProviderScannerData
* data
= yyget_extra
(yyscanner
);
2383 unoidl
::detail
::SourceProviderEntity
* ent
= getCurrentEntity
(data
);
2384 unoidl
::detail
::SourceProviderSingleInterfaceBasedServiceEntityPad
* pad
=
2385 dynamic_cast
<unoidl
::detail
::SourceProviderSingleInterfaceBasedServiceEntityPad
*>(
2388 std
::vector
<unoidl
::SingleInterfaceBasedServiceEntity
::Constructor
> ctors
;
2390 for
(std
::vector
<unoidl
::detail
::SourceProviderSingleInterfaceBasedServiceEntityPad
::Constructor
>::iterator
2391 i
(pad
->constructors.begin
());
2392 i
!= pad
->constructors.end
(); ++i
)
2394 std
::vector
<unoidl
::SingleInterfaceBasedServiceEntity
::Constructor
::Parameter
> parms
;
2395 for
(std
::vector
<unoidl
::detail
::SourceProviderSingleInterfaceBasedServiceEntityPad
::Constructor
::Parameter
>::iterator
2396 j
(i
->parameters.begin
());
2397 j
!= i
->parameters.end
(); ++j
)
2400 unoidl
::SingleInterfaceBasedServiceEntity
::Constructor
::Parameter
(
2401 j
->name
, j
->type.getName
(), j
->rest
));
2404 unoidl
::SingleInterfaceBasedServiceEntity
::Constructor
(
2405 i
->name
, parms
, i
->exceptions
, i
->annotations
));
2408 assert
(pad
->constructors.empty
());
2410 unoidl
::SingleInterfaceBasedServiceEntity
::Constructor
());
2412 ent
->entity
= new unoidl
::SingleInterfaceBasedServiceEntity
(
2413 pad
->isPublished
(), pad
->base
, ctors
, annotations
($1));
2415 clearCurrentState
(data
);
2420 '{' ctors
'}' { $$
= true
; }
2421 |
/* empty */ { $$
= false
; }
2430 deprecated_opt identifier
2432 unoidl
::detail
::SourceProviderScannerData
* data
= yyget_extra
(yyscanner
);
2433 OUString id
(convertName
($2));
2434 rtl
::Reference
<unoidl
::detail
::SourceProviderSingleInterfaceBasedServiceEntityPad
>
2435 pad
(getCurrentPad
<unoidl
::detail
::SourceProviderSingleInterfaceBasedServiceEntityPad
>(
2437 for
(std
::vector
<unoidl
::detail
::SourceProviderSingleInterfaceBasedServiceEntityPad
::Constructor
>::iterator
2438 i
(pad
->constructors.begin
());
2439 i
!= pad
->constructors.end
(); ++i
)
2441 if
(id
== i
->name
) {
2444 ("single-interface--based service " + data
->currentName
2445 + " constructor " + id
2446 + " has same identifier as another constructor"));
2450 pad
->constructors.push_back
(
2451 unoidl
::detail
::SourceProviderSingleInterfaceBasedServiceEntityPad
::Constructor
(
2452 id
, annotations
($1)));
2454 '(' ctorParams_opt
')' exceptionSpec_opt
';'
2456 unoidl
::detail
::SourceProviderScannerData
* data
= yyget_extra
(yyscanner
);
2457 rtl
::Reference
<unoidl
::detail
::SourceProviderSingleInterfaceBasedServiceEntityPad
>
2458 pad
(getCurrentPad
<unoidl
::detail
::SourceProviderSingleInterfaceBasedServiceEntityPad
>(
2460 assert
(!pad
->constructors.empty
());
2462 pad
->constructors.back
().exceptions
= *$7;
2465 for
(std
::vector
<unoidl
::detail
::SourceProviderSingleInterfaceBasedServiceEntityPad
::Constructor
>::iterator
2466 i
(pad
->constructors.begin
());
2467 i
!= pad
->constructors.end
() - 1; ++i
)
2469 if
(i
->parameters.size
()
2470 == pad
->constructors.back
().parameters.size
())
2473 for
(std
::vector
<unoidl
::detail
::SourceProviderSingleInterfaceBasedServiceEntityPad
::Constructor
::Parameter
>::iterator
2474 j
(i
->parameters.begin
()),
2475 k
(pad
->constructors.back
().parameters.begin
());
2476 j
!= i
->parameters.end
(); ++j
, ++k
)
2478 if
(!j
->type.equals
(k
->type
) || j
->rest
!= k
->rest
) {
2486 ("single-interface--based service " + data
->currentName
2487 + " constructor " + pad
->constructors.back
().name
2488 + " has similar paramete list to constructor "
2503 ctorParams
',' ctorParam
2508 '[' direction
']' type ellipsis_opt identifier
2510 unoidl
::detail
::SourceProviderScannerData
* data
= yyget_extra
(yyscanner
);
2511 unoidl
::detail
::SourceProviderType t
(*$4);
2513 OUString id
(convertName
($6));
2514 rtl
::Reference
<unoidl
::detail
::SourceProviderSingleInterfaceBasedServiceEntityPad
>
2515 pad
(getCurrentPad
<unoidl
::detail
::SourceProviderSingleInterfaceBasedServiceEntityPad
>(
2517 assert
(!pad
->constructors.empty
());
2518 if
($2 != unoidl
::InterfaceTypeEntity
::Method
::Parameter
::DIRECTION_IN
) {
2521 ("single-interface--based service " + data
->currentName
2522 + " constructor " + pad
->constructors.back
().name
+ " parameter "
2523 + id
+ " direction must be [in]"));
2527 case unoidl
::detail
::SourceProviderType
::TYPE_VOID
:
2528 case unoidl
::detail
::SourceProviderType
::TYPE_EXCEPTION
:
2531 ("illegal single-interface--based service " + data
->currentName
2532 + " constructor " + pad
->constructors.back
().name
+ " parameter "
2540 if
(t.type
!= unoidl
::detail
::SourceProviderType
::TYPE_ANY
) {
2543 ("illegal single-interface--based service "
2544 + data
->currentName
+ " constructor "
2545 + pad
->constructors.back
().name
+ " rest parameter " + id
2546 + " non-any type"));
2549 if
(!pad
->constructors.back
().parameters.empty
()) {
2552 ("single-interface--based service " + data
->currentName
2553 + " constructor " + pad
->constructors.back
().name
2554 + " rest parameter " + id
+ " must be first parameter"));
2557 } else if
(!pad
->constructors.back
().parameters.empty
()
2558 && pad
->constructors.back
().parameters.back
().rest
)
2562 ("single-interface--based service " + data
->currentName
2563 + " constructor " + pad
->constructors.back
().name
2564 + " rest parameter must be last parameter"));
2567 for
(std
::vector
<unoidl
::detail
::SourceProviderSingleInterfaceBasedServiceEntityPad
::Constructor
::Parameter
>::iterator
2568 i
(pad
->constructors.back
().parameters.begin
());
2569 i
!= pad
->constructors.back
().parameters.end
(); ++i
)
2571 if
(id
== i
->name
) {
2574 ("single-interface--based service " + data
->currentName
2575 + " constructor " + pad
->constructors.back
().name
2576 + " parameter " + id
2577 + " has same identifier as another parameter"));
2581 pad
->constructors.back
().parameters.push_back
(
2582 unoidl
::detail
::SourceProviderSingleInterfaceBasedServiceEntityPad
::Constructor
::Parameter
(
2588 TOK_ELLIPSIS
{ $$
= true
; }
2589 |
/* empty */ { $$
= false
; }
2591 accumulationBasedServiceDefn:
2592 deprecated_opt published_opt TOK_SERVICE identifier
2594 unoidl
::detail
::SourceProviderScannerData
* data
= yyget_extra
(yyscanner
);
2595 data
->publishedContext
= $2;
2596 convertToCurrentName
(data
, $4);
2597 if
(!data
->entities.insert
(
2598 std
::map
<OUString
, unoidl
::detail
::SourceProviderEntity
>::value_type
(
2600 unoidl
::detail
::SourceProviderEntity
(
2601 new unoidl
::detail
::SourceProviderAccumulationBasedServiceEntityPad
(
2605 error(@
4, yyscanner
, "multiple entities named " + data
->currentName
);
2609 '{' serviceMembers
'}' ';'
2611 unoidl
::detail
::SourceProviderScannerData
* data
= yyget_extra
(yyscanner
);
2612 unoidl
::detail
::SourceProviderEntity
* ent
= getCurrentEntity
(data
);
2613 unoidl
::detail
::SourceProviderAccumulationBasedServiceEntityPad
* pad
=
2614 dynamic_cast
<unoidl
::detail
::SourceProviderAccumulationBasedServiceEntityPad
*>(
2617 ent
->entity
= new unoidl
::AccumulationBasedServiceEntity
(
2618 pad
->isPublished
(), pad
->directMandatoryBaseServices
,
2619 pad
->directOptionalBaseServices
, pad
->directMandatoryBaseInterfaces
,
2620 pad
->directOptionalBaseInterfaces
, pad
->directProperties
,
2623 clearCurrentState
(data
);
2628 serviceMembers serviceMember
2634 | serviceInterfaceBase
2639 deprecated_opt flagSection_opt TOK_SERVICE name
';'
2641 unoidl
::detail
::SourceProviderScannerData
* data
= yyget_extra
(yyscanner
);
2642 OUString name
(convertName
($4));
2643 rtl
::Reference
<unoidl
::detail
::SourceProviderAccumulationBasedServiceEntityPad
> pad
(
2644 getCurrentPad
<unoidl
::detail
::SourceProviderAccumulationBasedServiceEntityPad
>(
2646 if
(($2 & ~unoidl
::detail
::FLAG_OPTIONAL
) != 0) {
2649 "service base can only be flagged as [optional]");
2652 bool opt
= ($2 & unoidl
::detail
::FLAG_OPTIONAL
) != 0;
2653 unoidl
::detail
::SourceProviderEntity
const * p
;
2654 if
(findEntity
(@
4, yyscanner
, data
, false
, &name
, &p
, 0, 0)
2659 if
(p
== 0 ||
!p
->entity.is
()
2660 ||
(p
->entity
->getSort
()
2661 != unoidl
::Entity
::SORT_ACCUMULATION_BASED_SERVICE
))
2665 ("accumulation-based service " + data
->currentName
2666 + " direct base service " + name
2667 + " does not resolve to an accumulation-based service"));
2670 if
(data
->publishedContext
2671 && !static_cast
<unoidl
::AccumulationBasedServiceEntity
*>(
2672 p
->entity.get
())->isPublished
())
2676 ("published accumulation-based service " + data
->currentName
2677 + " direct base service " + name
+ " is unpublished"));
2680 std
::vector
<unoidl
::AnnotatedReference
> & v
(
2682 ? pad
->directOptionalBaseServices
: pad
->directMandatoryBaseServices
);
2683 for
(std
::vector
<unoidl
::AnnotatedReference
>::iterator i
(v.begin
());
2686 if
(name
== i
->name
) {
2689 ("accumulation-based service " + data
->currentName
2690 + " duplicate direct base service " + name
));
2694 v.push_back
(unoidl
::AnnotatedReference
(name
, annotations
($1)));
2698 serviceInterfaceBase:
2699 deprecated_opt flagSection_opt TOK_INTERFACE name
';'
2701 unoidl
::detail
::SourceProviderScannerData
* data
= yyget_extra
(yyscanner
);
2702 OUString name
(convertName
($4));
2703 rtl
::Reference
<unoidl
::detail
::SourceProviderAccumulationBasedServiceEntityPad
> pad
(
2704 getCurrentPad
<unoidl
::detail
::SourceProviderAccumulationBasedServiceEntityPad
>(
2706 if
(($2 & ~unoidl
::detail
::FLAG_OPTIONAL
) != 0) {
2709 "interface base can only be flagged as [optional]");
2712 bool opt
= ($2 & unoidl
::detail
::FLAG_OPTIONAL
) != 0;
2713 unoidl
::detail
::SourceProviderEntity
const * p
;
2714 if
(findEntity
(@
4, yyscanner
, data
, false
, &name
, &p
, 0, 0)
2719 bool ifcBase
= false
;
2720 bool pubBase
= false
;
2723 case unoidl
::detail
::SourceProviderEntity
::KIND_INTERFACE_DECL
:
2727 case unoidl
::detail
::SourceProviderEntity
::KIND_PUBLISHED_INTERFACE_DECL
:
2733 && (p
->entity
->getSort
()
2734 == unoidl
::Entity
::SORT_INTERFACE_TYPE
))
2737 pubBase
= static_cast
<unoidl
::InterfaceTypeEntity
*>(
2738 p
->entity.get
())->isPublished
();
2746 ("accumulation-based service " + data
->currentName
2747 + " direct base interface " + name
2748 + " does not resolve to an interface type"));
2751 if
(data
->publishedContext
&& !opt
&& !pubBase
) {
2754 ("published accumulation-based service " + data
->currentName
2755 + " direct base interface " + name
+ " is unpublished"));
2758 std
::vector
<unoidl
::AnnotatedReference
> & v
(
2760 ? pad
->directOptionalBaseInterfaces
2761 : pad
->directMandatoryBaseInterfaces
);
2762 for
(std
::vector
<unoidl
::AnnotatedReference
>::iterator i
(v.begin
());
2765 if
(name
== i
->name
) {
2768 ("accumulation-based service " + data
->currentName
2769 + " duplicate direct base interface " + name
));
2773 v.push_back
(unoidl
::AnnotatedReference
(name
, annotations
($1)));
2778 deprecated_opt flagSection type identifier
';'
2780 unoidl
::detail
::SourceProviderScannerData
* data
= yyget_extra
(yyscanner
);
2781 unoidl
::detail
::SourceProviderType t
(*$3);
2783 OUString id
(convertName
($4));
2784 if
(($2 & unoidl
::detail
::FLAG_PROPERTY
) == 0) {
2787 ("accumulation-based service property must be flagged as"
2792 & ~
(unoidl
::detail
::FLAG_BOUND | unoidl
::detail
::FLAG_CONSTRAINED
2793 | unoidl
::detail
::FLAG_MAYBEAMBIGUOUS
2794 | unoidl
::detail
::FLAG_MAYBEDEFAULT
2795 | unoidl
::detail
::FLAG_MAYBEVOID | unoidl
::detail
::FLAG_OPTIONAL
2796 | unoidl
::detail
::FLAG_PROPERTY | unoidl
::detail
::FLAG_READONLY
2797 | unoidl
::detail
::FLAG_REMOVABLE
2798 | unoidl
::detail
::FLAG_TRANSIENT
))
2803 ("accumulation-based service property can only be flagged as"
2804 " [property, bound, constrained, maybeambiguous, maybedefault,"
2805 " maybevoid, optional, readonly, removable, transient]"));
2809 if
(($2 & unoidl
::detail
::FLAG_BOUND
) != 0) {
2810 att |
= unoidl
::AccumulationBasedServiceEntity
::Property
::ATTRIBUTE_BOUND
;
2812 if
(($2 & unoidl
::detail
::FLAG_CONSTRAINED
) != 0) {
2813 att |
= unoidl
::AccumulationBasedServiceEntity
::Property
::ATTRIBUTE_CONSTRAINED
;
2815 if
(($2 & unoidl
::detail
::FLAG_MAYBEAMBIGUOUS
) != 0) {
2816 att |
= unoidl
::AccumulationBasedServiceEntity
::Property
::ATTRIBUTE_MAYBE_AMBIGUOUS
;
2818 if
(($2 & unoidl
::detail
::FLAG_MAYBEDEFAULT
) != 0) {
2819 att |
= unoidl
::AccumulationBasedServiceEntity
::Property
::ATTRIBUTE_MAYBE_DEFAULT
;
2821 if
(($2 & unoidl
::detail
::FLAG_MAYBEVOID
) != 0) {
2822 att |
= unoidl
::AccumulationBasedServiceEntity
::Property
::ATTRIBUTE_MAYBE_VOID
;
2824 if
(($2 & unoidl
::detail
::FLAG_OPTIONAL
) != 0) {
2825 att |
= unoidl
::AccumulationBasedServiceEntity
::Property
::ATTRIBUTE_OPTIONAL
;
2827 if
(($2 & unoidl
::detail
::FLAG_READONLY
) != 0) {
2828 att |
= unoidl
::AccumulationBasedServiceEntity
::Property
::ATTRIBUTE_READ_ONLY
;
2830 if
(($2 & unoidl
::detail
::FLAG_REMOVABLE
) != 0) {
2831 att |
= unoidl
::AccumulationBasedServiceEntity
::Property
::ATTRIBUTE_REMOVABLE
;
2833 if
(($2 & unoidl
::detail
::FLAG_TRANSIENT
) != 0) {
2834 att |
= unoidl
::AccumulationBasedServiceEntity
::Property
::ATTRIBUTE_TRANSIENT
;
2837 case unoidl
::detail
::SourceProviderType
::TYPE_VOID
:
2838 case unoidl
::detail
::SourceProviderType
::TYPE_EXCEPTION
:
2841 ("illegal accumulation-based service " + data
->currentName
2842 + " direct property " + id
+ " type"));
2848 rtl
::Reference
<unoidl
::detail
::SourceProviderAccumulationBasedServiceEntityPad
>
2849 pad
(getCurrentPad
<unoidl
::detail
::SourceProviderAccumulationBasedServiceEntityPad
>(
2851 for
(std
::vector
<unoidl
::AccumulationBasedServiceEntity
::Property
>::iterator
2852 i
(pad
->directProperties.begin
());
2853 i
!= pad
->directProperties.end
(); ++i
)
2855 if
(id
== i
->name
) {
2858 ("accumulation-based service " + data
->currentName
2859 + " duplicate direct property " + id
));
2863 pad
->directProperties.push_back
(
2864 unoidl
::AccumulationBasedServiceEntity
::Property
(
2866 unoidl
::AccumulationBasedServiceEntity
::Property
::Attributes
(att
),
2871 interfaceBasedSingletonDefn:
2872 deprecated_opt published_opt TOK_SINGLETON identifier singleInheritance
';'
2874 unoidl
::detail
::SourceProviderScannerData
* data
= yyget_extra
(yyscanner
);
2875 data
->publishedContext
= $2;
2876 OUString name
(convertToFullName
(data
, $4));
2877 OUString base
(convertName
($5));
2878 unoidl
::detail
::SourceProviderEntity
const * p
;
2879 if
(findEntity
(@
5, yyscanner
, data
, false
, &base
, &p
, 0, 0)
2884 bool ifcBase
= false
;
2885 bool pubBase
= false
;
2888 case unoidl
::detail
::SourceProviderEntity
::KIND_INTERFACE_DECL
:
2892 case unoidl
::detail
::SourceProviderEntity
::KIND_PUBLISHED_INTERFACE_DECL
:
2898 && (p
->entity
->getSort
()
2899 == unoidl
::Entity
::SORT_INTERFACE_TYPE
))
2902 pubBase
= static_cast
<unoidl
::InterfaceTypeEntity
*>(
2903 p
->entity.get
())->isPublished
();
2911 ("interface-based singleton " + name
+ " base " + base
2912 + " does not resolve to an interface type"));
2915 if
($2 && !pubBase
) {
2918 ("published interface-based singleton " + name
+ " base " + base
2919 + " is unpublished"));
2922 if
(!data
->entities.insert
(
2923 std
::map
<OUString
, unoidl
::detail
::SourceProviderEntity
>::value_type
(
2925 unoidl
::detail
::SourceProviderEntity
(
2926 unoidl
::detail
::SourceProviderEntity
::KIND_LOCAL
,
2927 new unoidl
::InterfaceBasedSingletonEntity
(
2928 $2, base
, annotations
($1))))).
2931 error(@
4, yyscanner
, "multiple entities named " + name
);
2934 clearCurrentState
(data
);
2938 serviceBasedSingletonDefn:
2939 deprecated_opt published_opt TOK_SINGLETON identifier
'{' TOK_SERVICE name
';'
2942 unoidl
::detail
::SourceProviderScannerData
* data
= yyget_extra
(yyscanner
);
2943 data
->publishedContext
= $2;
2944 OUString name
(convertToFullName
(data
, $4));
2945 OUString base
(convertName
($7));
2946 unoidl
::detail
::SourceProviderEntity
const * p
;
2947 if
(findEntity
(@
7, yyscanner
, data
, false
, &base
, &p
, 0, 0)
2954 ||
(p
->entity
->getSort
()
2955 != unoidl
::Entity
::SORT_ACCUMULATION_BASED_SERVICE
))
2959 ("service-based singleton " + name
+ " base " + base
2960 + " does not resolve to an accumulation-based service"));
2964 && !static_cast
<unoidl
::AccumulationBasedServiceEntity
*>(
2965 p
->entity.get
())->isPublished
())
2969 ("published service-based singleton " + name
+ " base " + base
2970 + " is unpublished"));
2973 if
(!data
->entities.insert
(
2974 std
::map
<OUString
, unoidl
::detail
::SourceProviderEntity
>::value_type
(
2976 unoidl
::detail
::SourceProviderEntity
(
2977 unoidl
::detail
::SourceProviderEntity
::KIND_LOCAL
,
2978 new unoidl
::ServiceBasedSingletonEntity
(
2979 $2, base
, annotations
($1))))).
2982 error(@
4, yyscanner
, "multiple entities named " + name
);
2985 clearCurrentState
(data
);
2989 singleInheritance_opt:
2991 |
/* empty */ { $$
= 0; }
2994 singleInheritance: ':' name
{ $$
= $2; }
2999 |
/* empty */ { $$
= 0; }
3002 exceptionSpec: TOK_RAISES
'(' exceptions
')' { $$
= $3; }
3008 unoidl
::detail
::SourceProviderScannerData
* data
= yyget_extra
(yyscanner
);
3009 OUString name
(convertName
($3));
3010 unoidl
::detail
::SourceProviderEntity
const * p
;
3011 if
(findEntity
(@
3, yyscanner
, data
, false
, &name
, &p
, 0, 0)
3014 delete
$1; /* see commented-out %destructor above */
3019 ||
(p
->entity
->getSort
() != unoidl
::Entity
::SORT_EXCEPTION_TYPE
))
3021 delete
$1; /* see commented-out %destructor above */
3024 ("exception " + name
+ " does not resolve to an exception type"));
3027 if
(data
->publishedContext
3028 && !(static_cast
<unoidl
::ExceptionTypeEntity
*>(p
->entity.get
())
3031 delete
$1; /* see commented-out %destructor above */
3034 ("unpublished exception " + name
+ " used in published context"));
3037 if
(std
::find
($1->begin
(), $1->end
(), name
) != $1->end
()) {
3038 delete
$1; /* see commented-out %destructor above */
3040 @
3, yyscanner
, ("exception " + name
+ " listed more than once"));
3043 $1->push_back
(name
);
3048 unoidl
::detail
::SourceProviderScannerData
* data
= yyget_extra
(yyscanner
);
3049 OUString name
(convertName
($1));
3050 unoidl
::detail
::SourceProviderEntity
const * p
;
3051 if
(findEntity
(@
1, yyscanner
, data
, false
, &name
, &p
, 0, 0)
3058 ||
(p
->entity
->getSort
() != unoidl
::Entity
::SORT_EXCEPTION_TYPE
))
3062 ("exception " + name
+ " does not resolve to an exception type"));
3065 if
(data
->publishedContext
3066 && !(static_cast
<unoidl
::ExceptionTypeEntity
*>(p
->entity.get
())
3071 ("unpublished exception " + name
+ " used in published context"));
3074 $$
= new std
::vector
<OUString
>; $$
->push_back
(name
);
3079 deprecated_opt
/*ignored*/ published_opt TOK_INTERFACE identifier
';'
3081 unoidl
::detail
::SourceProviderScannerData
* data
= yyget_extra
(yyscanner
);
3082 data
->publishedContext
= $2;
3083 OUString name
(convertToFullName
(data
, $4));
3084 std
::pair
<std
::map
<OUString
, unoidl
::detail
::SourceProviderEntity
>::iterator
, bool> p
(
3085 data
->entities.insert
(
3086 std
::map
<OUString
, unoidl
::detail
::SourceProviderEntity
>::value_type
(
3088 unoidl
::detail
::SourceProviderEntity
(
3090 ? unoidl
::detail
::SourceProviderEntity
::KIND_PUBLISHED_INTERFACE_DECL
3091 : unoidl
::detail
::SourceProviderEntity
::KIND_INTERFACE_DECL
))));
3093 switch
(p.first
->second.kind
) {
3094 case unoidl
::detail
::SourceProviderEntity
::KIND_INTERFACE_DECL
:
3096 p.first
->second.kind
3097 = unoidl
::detail
::SourceProviderEntity
::KIND_PUBLISHED_INTERFACE_DECL
;
3100 case unoidl
::detail
::SourceProviderEntity
::KIND_PUBLISHED_INTERFACE_DECL
:
3103 assert
(p.first
->second.entity.is
());
3104 if
(p.first
->second.entity
->getSort
()
3105 != unoidl
::Entity
::SORT_INTERFACE_TYPE
)
3109 "multiple entities named " + data
->currentName
);
3113 && !static_cast
<unoidl
::InterfaceTypeEntity
*>(
3114 p.first
->second.entity.get
())->isPublished
())
3118 ("published interface type declaration "
3119 + data
->currentName
+ " has been defined unpublished"));
3124 clearCurrentState
(data
);
3129 TOK_PUBLISHED
{ $$
= true
; }
3130 |
/* empty */ { $$
= false
; }
3135 |
/* empty */ { $$
= unoidl
::detail
::SourceProviderFlags
(0); }
3138 flagSection: '[' flags
']' { $$
= $2; }
3144 if
(($1 & $3) != 0) {
3145 error(@
3, yyscanner
, "duplicate flag " + flagName
($3));
3148 $$
= unoidl
::detail
::SourceProviderFlags
($1 |
$3);
3154 TOK_ATTRIBUTE
{ $$
= unoidl
::detail
::FLAG_ATTRIBUTE
; }
3155 | TOK_BOUND
{ $$
= unoidl
::detail
::FLAG_BOUND
; }
3156 | TOK_CONSTRAINED
{ $$
= unoidl
::detail
::FLAG_CONSTRAINED
; }
3157 | TOK_MAYBEAMBIGUOUS
{ $$
= unoidl
::detail
::FLAG_MAYBEAMBIGUOUS
; }
3158 | TOK_MAYBEDEFAULT
{ $$
= unoidl
::detail
::FLAG_MAYBEDEFAULT
; }
3159 | TOK_MAYBEVOID
{ $$
= unoidl
::detail
::FLAG_MAYBEVOID
; }
3160 | TOK_OPTIONAL
{ $$
= unoidl
::detail
::FLAG_OPTIONAL
; }
3161 | TOK_PROPERTY
{ $$
= unoidl
::detail
::FLAG_PROPERTY
; }
3162 | TOK_READONLY
{ $$
= unoidl
::detail
::FLAG_READONLY
; }
3163 | TOK_REMOVABLE
{ $$
= unoidl
::detail
::FLAG_REMOVABLE
; }
3164 | TOK_TRANSIENT
{ $$
= unoidl
::detail
::FLAG_TRANSIENT
; }
3173 if
(!coerce
(@
1, yyscanner
, &$1, &$3)) {
3177 case unoidl
::detail
::SourceProviderExpr
::TYPE_INT
:
3178 $$
= unoidl
::detail
::SourceProviderExpr
::Int
($1.ival |
$3.ival
);
3180 case unoidl
::detail
::SourceProviderExpr
::TYPE_UINT
:
3181 $$
= unoidl
::detail
::SourceProviderExpr
::Uint
($1.uval |
$3.uval
);
3184 error(@
1, yyscanner
, "arguments of non-integer type to \"|\"");
3195 if
(!coerce
(@
1, yyscanner
, &$1, &$3)) {
3199 case unoidl
::detail
::SourceProviderExpr
::TYPE_INT
:
3200 $$
= unoidl
::detail
::SourceProviderExpr
::Int
($1.ival ^
$3.ival
);
3202 case unoidl
::detail
::SourceProviderExpr
::TYPE_UINT
:
3203 $$
= unoidl
::detail
::SourceProviderExpr
::Uint
($1.uval ^
$3.uval
);
3206 error(@
1, yyscanner
, "arguments of non-integer type to \"^\"");
3215 andExpr
'&' shiftExpr
3217 if
(!coerce
(@
1, yyscanner
, &$1, &$3)) {
3221 case unoidl
::detail
::SourceProviderExpr
::TYPE_INT
:
3222 $$
= unoidl
::detail
::SourceProviderExpr
::Int
($1.ival
& $3.ival
);
3224 case unoidl
::detail
::SourceProviderExpr
::TYPE_UINT
:
3225 $$
= unoidl
::detail
::SourceProviderExpr
::Uint
($1.uval
& $3.uval
);
3228 error(@
1, yyscanner
, "arguments of non-integer type to \"&\"");
3237 shiftExpr TOK_LEFTSHIFT addExpr
3241 case unoidl
::detail
::SourceProviderExpr
::TYPE_INT
:
3242 if
($3.ival
< 0 ||
$3.ival
> 63) {
3245 ("out-of-range shift argument " + OUString
::number
($3.ival
)
3249 n
= static_cast
<int>($3.ival
);
3251 case unoidl
::detail
::SourceProviderExpr
::TYPE_UINT
:
3255 ("out-of-range shift argument " + OUString
::number
($3.uval
)
3259 n
= static_cast
<int>($3.uval
);
3262 error(@
3, yyscanner
, "right argument of non-integer type to \"<<\"");
3266 case unoidl
::detail
::SourceProviderExpr
::TYPE_INT
:
3270 ("cannot left-shift negative argument "
3271 + OUString
::number
($1.ival
)));
3274 $$
= unoidl
::detail
::SourceProviderExpr
::Int
($1.ival
<< n
);
3276 case unoidl
::detail
::SourceProviderExpr
::TYPE_UINT
:
3277 $$
= unoidl
::detail
::SourceProviderExpr
::Uint
($1.uval
<< n
);
3280 error(@
1, yyscanner
, "left argument of non-integer type to \"<<\"");
3285 | shiftExpr TOK_RIGHTSHIFT addExpr
3289 case unoidl
::detail
::SourceProviderExpr
::TYPE_INT
:
3290 if
($3.ival
< 0 ||
$3.ival
> 63) {
3293 ("out-of-range shift argument " + OUString
::number
($3.ival
)
3297 n
= static_cast
<int>($3.ival
);
3299 case unoidl
::detail
::SourceProviderExpr
::TYPE_UINT
:
3303 ("out-of-range shift argument " + OUString
::number
($3.uval
)
3307 n
= static_cast
<int>($3.uval
);
3310 error(@
3, yyscanner
, "right argument of non-integer type to \">>\"");
3315 case unoidl
::detail
::SourceProviderExpr
::TYPE_INT
:
3316 $$
= unoidl
::detail
::SourceProviderExpr
::Int
($1.ival
>> n
);
3318 case unoidl
::detail
::SourceProviderExpr
::TYPE_UINT
:
3319 $$
= unoidl
::detail
::SourceProviderExpr
::Uint
($1.uval
>> n
);
3322 error(@
1, yyscanner
, "left argument of non-integer type to \">>\"");
3331 addExpr
'+' multExpr
3333 if
(!coerce
(@
1, yyscanner
, &$1, &$3)) {
3337 case unoidl
::detail
::SourceProviderExpr
::TYPE_BOOL
:
3338 error(@
1, yyscanner
, "arguments of boolean type to binary \"+\"");
3341 case unoidl
::detail
::SourceProviderExpr
::TYPE_INT
:
3342 $$
= unoidl
::detail
::SourceProviderExpr
::Int
($1.ival
+ $3.ival
); //TODO: overflow
3344 case unoidl
::detail
::SourceProviderExpr
::TYPE_UINT
:
3345 $$
= unoidl
::detail
::SourceProviderExpr
::Uint
($1.uval
+ $3.uval
); //TODO: overflow
3347 case unoidl
::detail
::SourceProviderExpr
::TYPE_FLOAT
:
3348 $$
= unoidl
::detail
::SourceProviderExpr
::Float
($1.fval
+ $3.fval
);
3352 | addExpr
'-' multExpr
3354 if
(!coerce
(@
1, yyscanner
, &$1, &$3)) {
3358 case unoidl
::detail
::SourceProviderExpr
::TYPE_BOOL
:
3359 error(@
1, yyscanner
, "arguments of boolean type to binary \"-\"");
3362 case unoidl
::detail
::SourceProviderExpr
::TYPE_INT
:
3363 $$
= unoidl
::detail
::SourceProviderExpr
::Int
($1.ival
- $3.ival
); //TODO: overflow
3365 case unoidl
::detail
::SourceProviderExpr
::TYPE_UINT
:
3366 $$
= unoidl
::detail
::SourceProviderExpr
::Uint
($1.uval
- $3.uval
); //TODO: overflow
3368 case unoidl
::detail
::SourceProviderExpr
::TYPE_FLOAT
:
3369 $$
= unoidl
::detail
::SourceProviderExpr
::Float
($1.fval
- $3.fval
);
3377 multExpr
'*' unaryExpr
3379 if
(!coerce
(@
1, yyscanner
, &$1, &$3)) {
3383 case unoidl
::detail
::SourceProviderExpr
::TYPE_BOOL
:
3384 error(@
1, yyscanner
, "arguments of boolean type to \"*\"");
3387 case unoidl
::detail
::SourceProviderExpr
::TYPE_INT
:
3388 $$
= unoidl
::detail
::SourceProviderExpr
::Int
($1.ival
* $3.ival
); //TODO: overflow
3390 case unoidl
::detail
::SourceProviderExpr
::TYPE_UINT
:
3391 $$
= unoidl
::detail
::SourceProviderExpr
::Uint
($1.uval
* $3.uval
); //TODO: overflow
3393 case unoidl
::detail
::SourceProviderExpr
::TYPE_FLOAT
:
3394 $$
= unoidl
::detail
::SourceProviderExpr
::Float
($1.fval
* $3.fval
);
3398 | multExpr
'/' unaryExpr
3400 if
(!coerce
(@
1, yyscanner
, &$1, &$3)) {
3404 case unoidl
::detail
::SourceProviderExpr
::TYPE_BOOL
:
3405 error(@
1, yyscanner
, "arguments of boolean type to \"/\"");
3408 case unoidl
::detail
::SourceProviderExpr
::TYPE_INT
:
3410 error(@
3, yyscanner
, "cannot divide by zero");
3413 $$
= unoidl
::detail
::SourceProviderExpr
::Int
($1.ival
/ $3.ival
);
3415 case unoidl
::detail
::SourceProviderExpr
::TYPE_UINT
:
3417 error(@
3, yyscanner
, "cannot divide by zero");
3420 $$
= unoidl
::detail
::SourceProviderExpr
::Uint
($1.uval
/ $3.uval
);
3422 case unoidl
::detail
::SourceProviderExpr
::TYPE_FLOAT
:
3424 error(@
3, yyscanner
, "cannot divide by zero");
3427 $$
= unoidl
::detail
::SourceProviderExpr
::Float
($1.fval
- $3.fval
);
3431 | multExpr
'%' unaryExpr
3433 if
(!coerce
(@
1, yyscanner
, &$1, &$3)) {
3437 case unoidl
::detail
::SourceProviderExpr
::TYPE_INT
:
3439 error(@
3, yyscanner
, "cannot divide by zero");
3442 $$
= unoidl
::detail
::SourceProviderExpr
::Int
($1.ival %
$3.ival
);
3444 case unoidl
::detail
::SourceProviderExpr
::TYPE_UINT
:
3446 error(@
3, yyscanner
, "cannot divide by zero");
3449 $$
= unoidl
::detail
::SourceProviderExpr
::Uint
($1.uval %
$3.uval
);
3452 error(@
1, yyscanner
, "arguments of non-integer type to \"%\"");
3463 if
($2.type
== unoidl
::detail
::SourceProviderExpr
::TYPE_BOOL
) {
3464 error(@
2, yyscanner
, "argument of boolean type to unary \"+\"");
3472 case unoidl
::detail
::SourceProviderExpr
::TYPE_BOOL
:
3473 error(@
2, yyscanner
, "argument of boolean type to unary \"-\"");
3476 case unoidl
::detail
::SourceProviderExpr
::TYPE_INT
:
3477 if
($2.ival
== SAL_MIN_INT64
) {
3478 error(@
2, yyscanner
, "cannot negate -2^63");
3481 $$
= unoidl
::detail
::SourceProviderExpr
::Int
(-$2.ival
);
3483 case unoidl
::detail
::SourceProviderExpr
::TYPE_UINT
:
3484 if
($2.uval
== SAL_CONST_UINT64
(0x8000000000000000)) {
3485 $$
= unoidl
::detail
::SourceProviderExpr
::Int
(SAL_MIN_INT64
);
3487 if
($2.uval
> SAL_MAX_INT64
) {
3490 ("cannot negate out-of-range value "
3491 + OUString
::number
($2.uval
)));
3494 $$
= unoidl
::detail
::SourceProviderExpr
::Int
(
3495 -static_cast
<sal_Int64
>($2.uval
));
3498 case unoidl
::detail
::SourceProviderExpr
::TYPE_FLOAT
:
3499 $$
= unoidl
::detail
::SourceProviderExpr
::Float
(-$2.fval
);
3506 case unoidl
::detail
::SourceProviderExpr
::TYPE_INT
:
3507 $$
= unoidl
::detail
::SourceProviderExpr
::Int
(~
$2.ival
);
3509 case unoidl
::detail
::SourceProviderExpr
::TYPE_UINT
:
3510 $$
= unoidl
::detail
::SourceProviderExpr
::Uint
(~
$2.uval
);
3513 error(@
2, yyscanner
, "argument of non-integer type to \"~\"");
3522 '(' expr
')' { $$
= $2; }
3523 | TOK_FALSE
{ $$
= unoidl
::detail
::SourceProviderExpr
::Bool
(false
); }
3524 | TOK_TRUE
{ $$
= unoidl
::detail
::SourceProviderExpr
::Bool
(true
); }
3525 | TOK_INTEGER
{ $$
= unoidl
::detail
::SourceProviderExpr
::Uint
($1); }
3526 | TOK_FLOATING
{ $$
= unoidl
::detail
::SourceProviderExpr
::Float
($1); }
3529 OUString name
(convertName
($1));
3530 unoidl
::detail
::SourceProviderScannerData
* data
= yyget_extra
(yyscanner
);
3531 unoidl
::ConstantValue v
(false
); // dummy value
3534 sal_Int32 i
= name.lastIndexOf
('.');
3536 rtl
::Reference
<unoidl
::detail
::SourceProviderEntityPad
> pad
(
3537 getCurrentEntity
(data
)->pad
);
3538 unoidl
::detail
::SourceProviderEnumTypeEntityPad
* p1
= dynamic_cast
<
3539 unoidl
::detail
::SourceProviderEnumTypeEntityPad
*>(pad.get
());
3541 for
(std
::vector
<unoidl
::EnumTypeEntity
::Member
>::const_iterator
3542 j
(p1
->members.begin
());
3543 j
!= p1
->members.end
(); ++j
)
3545 if
(j
->name
== name
) {
3546 v
= unoidl
::ConstantValue
(j
->value
);
3552 unoidl
::detail
::SourceProviderConstantGroupEntityPad
* p2
3554 unoidl
::detail
::SourceProviderConstantGroupEntityPad
*>(
3557 for
(std
::vector
<unoidl
::ConstantGroupEntity
::Member
>::const_iterator
3558 j
(p2
->members.begin
());
3559 j
!= p2
->members.end
(); ++j
)
3561 if
(j
->name
== name
) {
3570 OUString scope
(name.copy
(0, i
));
3571 unoidl
::detail
::SourceProviderEntity
const * ent
;
3572 if
(findEntity
(@
1, yyscanner
, data
, false
, &scope
, &ent
, 0, 0)
3578 OUString id
(name.copy
(i
+ 1));
3579 // No need to check for enum members here, as they cannot be
3580 // referenced in expressions by qualified name (TODO: is that true?):
3581 if
(ent
->entity.is
()) {
3582 if
(ent
->entity
->getSort
()
3583 == unoidl
::Entity
::SORT_CONSTANT_GROUP
)
3585 std
::vector
<unoidl
::ConstantGroupEntity
::Member
> const &
3587 static_cast
<unoidl
::ConstantGroupEntity
*>(
3588 ent
->entity.get
())->
3590 for
(std
::vector
<unoidl
::ConstantGroupEntity
::Member
>::const_iterator j
(
3592 j
!= mems.end
(); ++j
)
3594 if
(j
->name
== id
) {
3598 = !static_cast
<unoidl
::ConstantGroupEntity
*>(
3599 ent
->entity.get
())->isPublished
();
3604 } else if
(ent
->pad.is
()) {
3605 unoidl
::detail
::SourceProviderConstantGroupEntityPad
* pad
3607 unoidl
::detail
::SourceProviderConstantGroupEntityPad
*>(
3610 for
(std
::vector
<unoidl
::ConstantGroupEntity
::Member
>::const_iterator j
(
3611 pad
->members.begin
());
3612 j
!= pad
->members.end
(); ++j
)
3614 if
(j
->name
== id
) {
3617 unpub
= !ent
->pad
->isPublished
();
3629 + (" does not resolve to neither a constant nor an unqualified"
3633 if
(data
->publishedContext
&& unpub
) {
3636 "unpublished value " + name
+ " used in published context");
3640 case unoidl
::ConstantValue
::TYPE_BOOLEAN
:
3641 $$
= unoidl
::detail
::SourceProviderExpr
::Bool
(v.booleanValue
);
3643 case unoidl
::ConstantValue
::TYPE_BYTE
:
3644 $$
= unoidl
::detail
::SourceProviderExpr
::Int
(v.byteValue
);
3646 case unoidl
::ConstantValue
::TYPE_SHORT
:
3647 $$
= unoidl
::detail
::SourceProviderExpr
::Int
(v.shortValue
);
3649 case unoidl
::ConstantValue
::TYPE_UNSIGNED_SHORT
:
3650 $$
= unoidl
::detail
::SourceProviderExpr
::Uint
(v.unsignedShortValue
);
3652 case unoidl
::ConstantValue
::TYPE_LONG
:
3653 $$
= unoidl
::detail
::SourceProviderExpr
::Int
(v.longValue
);
3655 case unoidl
::ConstantValue
::TYPE_UNSIGNED_LONG
:
3656 $$
= unoidl
::detail
::SourceProviderExpr
::Uint
(v.unsignedLongValue
);
3658 case unoidl
::ConstantValue
::TYPE_HYPER
:
3659 $$
= unoidl
::detail
::SourceProviderExpr
::Int
(v.hyperValue
);
3661 case unoidl
::ConstantValue
::TYPE_UNSIGNED_HYPER
:
3662 $$
= unoidl
::detail
::SourceProviderExpr
::Uint
(v.unsignedHyperValue
);
3664 case unoidl
::ConstantValue
::TYPE_FLOAT
:
3665 $$
= unoidl
::detail
::SourceProviderExpr
::Float
(v.floatValue
);
3667 case unoidl
::ConstantValue
::TYPE_DOUBLE
:
3668 $$
= unoidl
::detail
::SourceProviderExpr
::Float
(v.doubleValue
);
3675 typeArguments
',' type
3677 unoidl
::detail
::SourceProviderType t
(*$3);
3679 if
(!checkTypeArgument
(@
3, yyscanner
, t
)) {
3680 delete
$1; /* see commented-out %destructor above */
3688 unoidl
::detail
::SourceProviderType t
(*$1);
3690 if
(!checkTypeArgument
(@
1, yyscanner
, t
)) {
3693 $$
= new std
::vector
<unoidl
::detail
::SourceProviderType
>;
3701 $$
= new unoidl
::detail
::SourceProviderType
(
3702 unoidl
::detail
::SourceProviderType
::TYPE_VOID
);
3706 $$
= new unoidl
::detail
::SourceProviderType
(
3707 unoidl
::detail
::SourceProviderType
::TYPE_BOOLEAN
);
3711 $$
= new unoidl
::detail
::SourceProviderType
(
3712 unoidl
::detail
::SourceProviderType
::TYPE_BYTE
);
3716 $$
= new unoidl
::detail
::SourceProviderType
(
3717 unoidl
::detail
::SourceProviderType
::TYPE_SHORT
);
3719 | TOK_UNSIGNED TOK_SHORT
3721 $$
= new unoidl
::detail
::SourceProviderType
(
3722 unoidl
::detail
::SourceProviderType
::TYPE_UNSIGNED_SHORT
);
3726 $$
= new unoidl
::detail
::SourceProviderType
(
3727 unoidl
::detail
::SourceProviderType
::TYPE_LONG
);
3729 | TOK_UNSIGNED TOK_LONG
3731 $$
= new unoidl
::detail
::SourceProviderType
(
3732 unoidl
::detail
::SourceProviderType
::TYPE_UNSIGNED_LONG
);
3736 $$
= new unoidl
::detail
::SourceProviderType
(
3737 unoidl
::detail
::SourceProviderType
::TYPE_HYPER
);
3739 | TOK_UNSIGNED TOK_HYPER
3741 $$
= new unoidl
::detail
::SourceProviderType
(
3742 unoidl
::detail
::SourceProviderType
::TYPE_UNSIGNED_HYPER
);
3746 $$
= new unoidl
::detail
::SourceProviderType
(
3747 unoidl
::detail
::SourceProviderType
::TYPE_FLOAT
);
3751 $$
= new unoidl
::detail
::SourceProviderType
(
3752 unoidl
::detail
::SourceProviderType
::TYPE_DOUBLE
);
3756 $$
= new unoidl
::detail
::SourceProviderType
(
3757 unoidl
::detail
::SourceProviderType
::TYPE_CHAR
);
3761 $$
= new unoidl
::detail
::SourceProviderType
(
3762 unoidl
::detail
::SourceProviderType
::TYPE_STRING
);
3766 $$
= new unoidl
::detail
::SourceProviderType
(
3767 unoidl
::detail
::SourceProviderType
::TYPE_TYPE
);
3771 $$
= new unoidl
::detail
::SourceProviderType
(
3772 unoidl
::detail
::SourceProviderType
::TYPE_ANY
);
3774 | TOK_SEQUENCE
'<' type
'>'
3777 case unoidl
::detail
::SourceProviderType
::TYPE_VOID
:
3778 case unoidl
::detail
::SourceProviderType
::TYPE_EXCEPTION
:
3779 case unoidl
::detail
::SourceProviderType
::TYPE_PARAMETER
: //TODO?
3780 error(@
3, yyscanner
, "illegal sequence type component type");
3786 $$
= new unoidl
::detail
::SourceProviderType
($3);
3791 unoidl
::detail
::SourceProviderScannerData
* data
= yyget_extra
(yyscanner
);
3792 OUString name
(convertName
($1));
3794 if
(name.indexOf
('.') == -1 && !data
->currentName.isEmpty
()) {
3795 unoidl
::detail
::SourceProviderEntity
* ent
= getCurrentEntity
(data
);
3796 unoidl
::detail
::SourceProviderPolymorphicStructTypeTemplateEntityPad
*
3798 unoidl
::detail
::SourceProviderPolymorphicStructTypeTemplateEntityPad
*>(
3802 pad
->typeParameters.begin
(), pad
->typeParameters.end
(),
3804 != pad
->typeParameters.end
()))
3806 $$
= new unoidl
::detail
::SourceProviderType
(name
);
3811 unoidl
::detail
::SourceProviderEntity
const * ent
;
3812 unoidl
::detail
::SourceProviderType t
;
3813 switch
(findEntity
(@
1, yyscanner
, data
, false
, &name
, &ent
, 0, &t
)) {
3818 $$
= new unoidl
::detail
::SourceProviderType
(t
);
3822 error(@
1, yyscanner
, "unknown entity " + name
);
3826 switch
(ent
->kind
) {
3827 case unoidl
::detail
::SourceProviderEntity
::KIND_LOCAL
:
3828 if
(ent
->pad.is
()) {
3829 if
(data
->publishedContext
&& !ent
->pad
->isPublished
()) {
3832 ("unpublished entity " + name
3833 + " used in published context"));
3836 if
(dynamic_cast
<unoidl
::detail
::SourceProviderEnumTypeEntityPad
*>(
3840 $$
= new unoidl
::detail
::SourceProviderType
(
3841 unoidl
::detail
::SourceProviderType
::TYPE_ENUM
,
3844 } else if
(dynamic_cast
<unoidl
::detail
::SourceProviderPlainStructTypeEntityPad
*>(
3848 $$
= new unoidl
::detail
::SourceProviderType
(
3849 unoidl
::detail
::SourceProviderType
::TYPE_PLAIN_STRUCT
,
3852 } else if
(dynamic_cast
<unoidl
::detail
::SourceProviderPolymorphicStructTypeTemplateEntityPad
*>(
3858 (("recursive reference to polymorphic struct type"
3862 } else if
(dynamic_cast
<unoidl
::detail
::SourceProviderExceptionTypeEntityPad
*>(
3866 $$
= new unoidl
::detail
::SourceProviderType
(
3867 unoidl
::detail
::SourceProviderType
::TYPE_EXCEPTION
,
3870 } else if
(dynamic_cast
<unoidl
::detail
::SourceProviderInterfaceTypeEntityPad
*>(
3874 $$
= new unoidl
::detail
::SourceProviderType
(
3875 unoidl
::detail
::SourceProviderType
::TYPE_INTERFACE
,
3881 assert
(ent
->entity.is
());
3883 case unoidl
::detail
::SourceProviderEntity
::KIND_EXTERNAL
:
3884 if
(data
->publishedContext
3885 && ent
->entity
->getSort
() != unoidl
::Entity
::SORT_MODULE
3886 && !static_cast
<unoidl
::PublishableEntity
*>(
3887 ent
->entity.get
())->isPublished
())
3891 ("unpublished entity " + name
3892 + " used in published context"));
3895 switch
(ent
->entity
->getSort
()) {
3896 case unoidl
::Entity
::SORT_ENUM_TYPE
:
3897 $$
= new unoidl
::detail
::SourceProviderType
(
3898 unoidl
::detail
::SourceProviderType
::TYPE_ENUM
, name
,
3902 case unoidl
::Entity
::SORT_PLAIN_STRUCT_TYPE
:
3903 $$
= new unoidl
::detail
::SourceProviderType
(
3904 unoidl
::detail
::SourceProviderType
::TYPE_PLAIN_STRUCT
,
3908 case unoidl
::Entity
::SORT_POLYMORPHIC_STRUCT_TYPE_TEMPLATE
:
3911 ("polymorphic struct type template " + name
3912 + " without type arguments"));
3915 case unoidl
::Entity
::SORT_EXCEPTION_TYPE
:
3916 $$
= new unoidl
::detail
::SourceProviderType
(
3917 unoidl
::detail
::SourceProviderType
::TYPE_EXCEPTION
,
3921 case unoidl
::Entity
::SORT_INTERFACE_TYPE
:
3922 $$
= new unoidl
::detail
::SourceProviderType
(
3923 unoidl
::detail
::SourceProviderType
::TYPE_INTERFACE
,
3927 case unoidl
::Entity
::SORT_TYPEDEF
:
3928 assert
(false
&& "this cannot happen");
3934 case unoidl
::detail
::SourceProviderEntity
::KIND_INTERFACE_DECL
:
3935 if
(data
->publishedContext
) {
3938 ("unpublished entity " + name
3939 + " used in published context"));
3943 case unoidl
::detail
::SourceProviderEntity
::KIND_PUBLISHED_INTERFACE_DECL
:
3944 $$
= new unoidl
::detail
::SourceProviderType
(
3945 unoidl
::detail
::SourceProviderType
::TYPE_INTERFACE
, name
,
3949 case unoidl
::detail
::SourceProviderEntity
::KIND_MODULE
:
3950 assert
(false
&& "this cannot happen");
3953 error(@
1, yyscanner
, "non-type entity " + name
);
3960 | name
'<' typeArguments
'>'
3962 unoidl
::detail
::SourceProviderScannerData
* data
= yyget_extra
(yyscanner
);
3963 OUString name
(convertName
($1));
3964 std
::vector
<unoidl
::detail
::SourceProviderType
> args
(*$3);
3966 unoidl
::detail
::SourceProviderEntity
const * ent
;
3967 if
(findEntity
(@
1, yyscanner
, data
, false
, &name
, &ent
, 0, 0)
3973 error(@
1, yyscanner
, "unknown entity " + name
);
3977 switch
(ent
->kind
) {
3978 case unoidl
::detail
::SourceProviderEntity
::KIND_LOCAL
:
3979 if
(ent
->pad.is
()) {
3980 if
(dynamic_cast
<unoidl
::detail
::SourceProviderPolymorphicStructTypeTemplateEntityPad
*>(
3986 (("recursive reference to polymorphic struct type"
3993 assert
(ent
->entity.is
());
3995 case unoidl
::detail
::SourceProviderEntity
::KIND_EXTERNAL
:
3996 if
(ent
->entity
->getSort
()
3997 == unoidl
::Entity
::SORT_POLYMORPHIC_STRUCT_TYPE_TEMPLATE
)
3999 rtl
::Reference
<unoidl
::PolymorphicStructTypeTemplateEntity
> e
(
4000 static_cast
<unoidl
::PolymorphicStructTypeTemplateEntity
*>(
4001 ent
->entity.get
()));
4002 if
(args.size
() != e
->getTypeParameters
().size
()) {
4005 ("bad number of polymorphic struct type template " + name
4006 + " type arguments"));
4009 if
(data
->publishedContext
&& !e
->isPublished
()) {
4012 ("unpublished polymorphic struct type template " + name
4013 + " used in published context"));
4016 $$
= new unoidl
::detail
::SourceProviderType
(name
, ent
, args
);
4020 case unoidl
::detail
::SourceProviderEntity
::KIND_INTERFACE_DECL
:
4021 case unoidl
::detail
::SourceProviderEntity
::KIND_PUBLISHED_INTERFACE_DECL
:
4023 case unoidl
::detail
::SourceProviderEntity
::KIND_MODULE
:
4024 assert
(false
&& "this cannot happen");
4027 error(@
1, yyscanner
, "non-type entity " + name
);
4034 name TOK_COLONS identifier
{ *$1 += "." + *$3; delete
$3; $$
= $1; }
4035 | TOK_COLONS identifier
{ *$2 = "." + *$2; $$
= $2; }
4041 | TOK_GET
{ $$
= new OString
("get"); }
4042 | TOK_PUBLISHED
{ $$
= new OString
("published"); }
4043 | TOK_SET
{ $$
= new OString
("set"); }
4047 TOK_DEPRECATED
{ $$
= true
; }
4048 |
/* empty */ { $$
= false
; }
4053 namespace unoidl
{ namespace detail
{
4055 OUString SourceProviderType
::getName
() const {
4056 if
(!typedefName.isEmpty
()) {
4060 case unoidl
::detail
::SourceProviderType
::TYPE_VOID
:
4061 return OUString
("void");
4062 case unoidl
::detail
::SourceProviderType
::TYPE_BOOLEAN
:
4063 return OUString
("boolean");
4064 case unoidl
::detail
::SourceProviderType
::TYPE_BYTE
:
4065 return OUString
("byte");
4066 case unoidl
::detail
::SourceProviderType
::TYPE_SHORT
:
4067 return OUString
("short");
4068 case unoidl
::detail
::SourceProviderType
::TYPE_UNSIGNED_SHORT
:
4069 return OUString
("unsigned short");
4070 case unoidl
::detail
::SourceProviderType
::TYPE_LONG
:
4071 return OUString
("long");
4072 case unoidl
::detail
::SourceProviderType
::TYPE_UNSIGNED_LONG
:
4073 return OUString
("unsigned long");
4074 case unoidl
::detail
::SourceProviderType
::TYPE_HYPER
:
4075 return OUString
("hyper");
4076 case unoidl
::detail
::SourceProviderType
::TYPE_UNSIGNED_HYPER
:
4077 return OUString
("unsigned hyper");
4078 case unoidl
::detail
::SourceProviderType
::TYPE_FLOAT
:
4079 return OUString
("float");
4080 case unoidl
::detail
::SourceProviderType
::TYPE_DOUBLE
:
4081 return OUString
("double");
4082 case unoidl
::detail
::SourceProviderType
::TYPE_CHAR
:
4083 return OUString
("char");
4084 case unoidl
::detail
::SourceProviderType
::TYPE_STRING
:
4085 return OUString
("string");
4086 case unoidl
::detail
::SourceProviderType
::TYPE_TYPE
:
4087 return OUString
("type");
4088 case unoidl
::detail
::SourceProviderType
::TYPE_ANY
:
4089 return OUString
("any");
4090 case unoidl
::detail
::SourceProviderType
::TYPE_SEQUENCE
:
4091 assert
(subtypes.size
() == 1);
4092 return
"[]" + subtypes.front
().getName
();
4093 case unoidl
::detail
::SourceProviderType
::TYPE_ENUM
:
4094 case unoidl
::detail
::SourceProviderType
::TYPE_PLAIN_STRUCT
:
4095 case unoidl
::detail
::SourceProviderType
::TYPE_EXCEPTION
:
4096 case unoidl
::detail
::SourceProviderType
::TYPE_INTERFACE
:
4097 case unoidl
::detail
::SourceProviderType
::TYPE_PARAMETER
:
4099 case unoidl
::detail
::SourceProviderType
::TYPE_INSTANTIATED_POLYMORPHIC_STRUCT
:
4101 OUString n
(name
+ "<");
4102 for
(std
::vector
<SourceProviderType
>::const_iterator i
(
4104 i
!= subtypes.end
(); ++i
)
4106 if
(i
!= subtypes.begin
()) {
4114 assert
(false
&& "this cannot happen"); for
(;;) { std
::abort
(); }
4118 bool SourceProviderType
::equals
(SourceProviderType
const & other
) const {
4119 if
(type
!= other.type || name
!= other.name
4120 || subtypes.size
() != other.subtypes.size
())
4124 for
(std
::vector
<SourceProviderType
>::const_iterator
4125 i
(subtypes.begin
()), j
(other.subtypes.begin
());
4126 i
!= subtypes.end
(); ++i
, ++j
)
4128 if
(!i
->equals
(*j
)) {
4135 bool SourceProviderInterfaceTypeEntityPad
::addDirectBase
(
4136 YYLTYPE location
, yyscan_t yyscanner
, SourceProviderScannerData
* data
,
4137 DirectBase
const & base
, bool optional
)
4139 std
::set
<OUString
> seen
;
4140 if
(!(checkBaseClashes
(
4141 location
, yyscanner
, data
, base.name
, base.entity
, true
, optional
,
4144 location
, yyscanner
, data
, base.name
, base.name
, base.entity
,
4150 addOptionalBaseMembers
(
4151 location
, yyscanner
, data
, base.name
, base.entity
);
4153 (optional ? directOptionalBases
: directMandatoryBases
).push_back
(base
);
4157 bool SourceProviderInterfaceTypeEntityPad
::addDirectMember
(
4158 YYLTYPE location
, yyscan_t yyscanner
, SourceProviderScannerData
* data
,
4159 OUString
const & name
)
4162 if
(!checkMemberClashes
(location
, yyscanner
, data
, "", name
, true
)) {
4166 std
::map
<OUString
, Member
>::value_type
(
4167 name
, Member
(data
->currentName
)));
4171 bool SourceProviderInterfaceTypeEntityPad
::checkBaseClashes
(
4172 YYLTYPE location
, yyscan_t yyscanner
, SourceProviderScannerData
* data
,
4173 OUString
const & name
,
4174 rtl
::Reference
<unoidl
::InterfaceTypeEntity
> const & entity
, bool direct
,
4175 bool optional
, bool outerOptional
, std
::set
<OUString
> * seen
) const
4178 assert
(entity.is
());
4180 if
(direct || optional || seen
->insert
(name
).second
) {
4181 std
::map
<OUString
, BaseKind
>::const_iterator i
(allBases.find
(name
));
4182 if
(i
!= allBases.end
()) {
4183 switch
(i
->second
) {
4184 case BASE_INDIRECT_OPTIONAL
:
4185 if
(direct
&& optional
) {
4187 location
, yyscanner
,
4188 ("interface type " + data
->currentName
4189 + " duplicate base " + name
));
4193 case BASE_DIRECT_OPTIONAL
:
4194 if
(direct ||
!outerOptional
) {
4196 location
, yyscanner
,
4197 ("interface type " + data
->currentName
4198 + " duplicate base " + name
));
4202 case BASE_INDIRECT_MANDATORY
:
4205 location
, yyscanner
,
4206 ("interface type " + data
->currentName
4207 + " duplicate base " + name
));
4211 case BASE_DIRECT_MANDATORY
:
4212 if
(direct ||
(!optional
&& !outerOptional
)) {
4214 location
, yyscanner
,
4215 ("interface type " + data
->currentName
4216 + " duplicate base " + name
));
4222 if
(direct ||
!optional
) {
4223 for
(std
::vector
<unoidl
::AnnotatedReference
>::const_iterator j
(
4224 entity
->getDirectMandatoryBases
().begin
());
4225 j
!= entity
->getDirectMandatoryBases
().end
(); ++j
)
4227 OUString n
("." + j
->name
);
4228 unoidl
::detail
::SourceProviderEntity
const * p
;
4229 if
(findEntity
(location
, yyscanner
, data
, true
, &n
, &p
, 0, 0)
4234 if
(p
== 0 ||
!p
->entity.is
()
4235 ||
(p
->entity
->getSort
()
4236 != unoidl
::Entity
::SORT_INTERFACE_TYPE
))
4239 location
, yyscanner
,
4240 ("inconsistent type manager: interface type "
4241 + data
->currentName
+ " base " + n
4242 + " does not resolve to an existing interface type"));
4245 if
(!checkBaseClashes
(
4246 location
, yyscanner
, data
, n
,
4247 static_cast
<unoidl
::InterfaceTypeEntity
*>(
4249 false
, false
, outerOptional
, seen
))
4254 for
(std
::vector
<unoidl
::AnnotatedReference
>::const_iterator j
(
4255 entity
->getDirectOptionalBases
().begin
());
4256 j
!= entity
->getDirectOptionalBases
().end
(); ++j
)
4258 OUString n
("." + j
->name
);
4259 unoidl
::detail
::SourceProviderEntity
const * p
;
4260 if
(findEntity
(location
, yyscanner
, data
, true
, &n
, &p
, 0, 0)
4265 if
(p
== 0 ||
!p
->entity.is
()
4266 ||
(p
->entity
->getSort
()
4267 != unoidl
::Entity
::SORT_INTERFACE_TYPE
))
4270 location
, yyscanner
,
4271 ("inconsistent type manager: interface type "
4272 + data
->currentName
+ " base " + n
4273 + " does not resolve to an existing interface type"));
4276 if
(!checkBaseClashes
(
4277 location
, yyscanner
, data
, n
,
4278 static_cast
<unoidl
::InterfaceTypeEntity
*>(
4280 false
, true
, outerOptional
, seen
))
4285 for
(std
::vector
<unoidl
::InterfaceTypeEntity
::Attribute
>::const_iterator
4286 j
(entity
->getDirectAttributes
().begin
());
4287 j
!= entity
->getDirectAttributes
().end
(); ++j
)
4289 if
(!checkMemberClashes
(
4290 location
, yyscanner
, data
, name
, j
->name
,
4296 for
(std
::vector
<unoidl
::InterfaceTypeEntity
::Method
>::const_iterator
4297 j
(entity
->getDirectMethods
().begin
());
4298 j
!= entity
->getDirectMethods
().end
(); ++j
)
4300 if
(!checkMemberClashes
(
4301 location
, yyscanner
, data
, name
, j
->name
,
4312 bool SourceProviderInterfaceTypeEntityPad
::checkMemberClashes
(
4313 YYLTYPE location
, yyscan_t yyscanner
, SourceProviderScannerData
* data
,
4314 OUString
const & interfaceName
, OUString
const & memberName
,
4315 bool checkOptional
) const
4317 std
::map
<OUString
, Member
>::const_iterator i
(allMembers.find
(memberName
));
4318 if
(i
!= allMembers.end
()) {
4319 if
(!i
->second.mandatory.isEmpty
()) {
4320 // For a direct member, interfaceName will be empty, so this will
4321 // catch two direct members with the same name:
4322 if
(i
->second.mandatory
!= interfaceName
) {
4324 location
, yyscanner
,
4325 ("interface type " + data
->currentName
4326 + " duplicate member " + memberName
));
4329 } else if
(checkOptional
) {
4330 for
(std
::set
<OUString
>::const_iterator j
(
4331 i
->second.optional.begin
());
4332 j
!= i
->second.optional.end
(); ++j
)
4334 if
(*j
!= interfaceName
) {
4336 location
, yyscanner
,
4337 ("interface type " + data
->currentName
4338 + " duplicate member " + memberName
));
4347 bool SourceProviderInterfaceTypeEntityPad
::addBase
(
4348 YYLTYPE location
, yyscan_t yyscanner
, SourceProviderScannerData
* data
,
4349 OUString
const & directBaseName
, OUString
const & name
,
4350 rtl
::Reference
<unoidl
::InterfaceTypeEntity
> const & entity
, bool direct
,
4354 assert
(entity.is
());
4355 BaseKind kind
= optional
4356 ? direct ? BASE_DIRECT_OPTIONAL
: BASE_INDIRECT_OPTIONAL
4357 : direct ? BASE_DIRECT_MANDATORY
: BASE_INDIRECT_MANDATORY
;
4358 std
::pair
<std
::map
<OUString
, BaseKind
>::iterator
, bool> p
(
4360 std
::map
<OUString
, BaseKind
>::value_type
(name
, kind
)));
4361 bool seen
= !p.second
&& p.first
->second
>= BASE_INDIRECT_MANDATORY
;
4362 if
(!p.second
&& kind
> p.first
->second
) {
4363 p.first
->second
= kind
;
4365 if
(!optional
&& !seen
) {
4366 for
(std
::vector
<unoidl
::AnnotatedReference
>::const_iterator i
(
4367 entity
->getDirectMandatoryBases
().begin
());
4368 i
!= entity
->getDirectMandatoryBases
().end
(); ++i
)
4370 OUString n
("." + i
->name
);
4371 unoidl
::detail
::SourceProviderEntity
const * q
;
4372 if
(findEntity
(location
, yyscanner
, data
, true
, &n
, &q
, 0, 0)
4377 if
(q
== 0 ||
!q
->entity.is
()
4378 || q
->entity
->getSort
() != unoidl
::Entity
::SORT_INTERFACE_TYPE
)
4381 location
, yyscanner
,
4382 ("inconsistent type manager: interface type "
4383 + data
->currentName
+ " base " + n
4384 + " does not resolve to an existing interface type"));
4388 location
, yyscanner
, data
, directBaseName
, n
,
4389 static_cast
<unoidl
::InterfaceTypeEntity
*>(q
->entity.get
()),
4395 for
(std
::vector
<unoidl
::AnnotatedReference
>::const_iterator i
(
4396 entity
->getDirectOptionalBases
().begin
());
4397 i
!= entity
->getDirectOptionalBases
().end
(); ++i
)
4399 OUString n
("." + i
->name
);
4400 unoidl
::detail
::SourceProviderEntity
const * q
;
4401 if
(findEntity
(location
, yyscanner
, data
, true
, &n
, &q
, 0, 0)
4406 if
(q
== 0 ||
!q
->entity.is
()
4407 || q
->entity
->getSort
() != unoidl
::Entity
::SORT_INTERFACE_TYPE
)
4410 location
, yyscanner
,
4411 ("inconsistent type manager: interface type "
4412 + data
->currentName
+ " base " + n
4413 + " does not resolve to an existing interface type"));
4417 location
, yyscanner
, data
, directBaseName
, n
,
4418 static_cast
<unoidl
::InterfaceTypeEntity
*>(q
->entity.get
()),
4424 for
(std
::vector
<unoidl
::InterfaceTypeEntity
::Attribute
>::const_iterator
4425 i
(entity
->getDirectAttributes
().begin
());
4426 i
!= entity
->getDirectAttributes
().end
(); ++i
)
4429 std
::map
<OUString
, Member
>::value_type
(i
->name
, Member
(name
)));
4431 for
(std
::vector
<unoidl
::InterfaceTypeEntity
::Method
>::const_iterator i
(
4432 entity
->getDirectMethods
().begin
());
4433 i
!= entity
->getDirectMethods
().end
(); ++i
)
4436 std
::map
<OUString
, Member
>::value_type
(i
->name
, Member
(name
)));
4442 bool SourceProviderInterfaceTypeEntityPad
::addOptionalBaseMembers
(
4443 YYLTYPE location
, yyscan_t yyscanner
, SourceProviderScannerData
* data
,
4444 OUString
const & name
,
4445 rtl
::Reference
<unoidl
::InterfaceTypeEntity
> const & entity
)
4447 assert
(entity.is
());
4448 for
(std
::vector
<unoidl
::AnnotatedReference
>::const_iterator i
(
4449 entity
->getDirectMandatoryBases
().begin
());
4450 i
!= entity
->getDirectMandatoryBases
().end
(); ++i
)
4452 OUString n
("." + i
->name
);
4453 unoidl
::detail
::SourceProviderEntity
const * p
;
4454 if
(findEntity
(location
, yyscanner
, data
, true
, &n
, &p
, 0, 0)
4459 if
(p
== 0 ||
!p
->entity.is
()
4460 || p
->entity
->getSort
() != unoidl
::Entity
::SORT_INTERFACE_TYPE
)
4463 location
, yyscanner
,
4464 ("inconsistent type manager: interface type "
4465 + data
->currentName
+ " base " + n
4466 + " does not resolve to an existing interface type"));
4469 if
(!addOptionalBaseMembers
(
4470 location
, yyscanner
, data
, n
,
4471 static_cast
<unoidl
::InterfaceTypeEntity
*>(p
->entity.get
())))
4476 for
(std
::vector
<unoidl
::InterfaceTypeEntity
::Attribute
>::const_iterator i
(
4477 entity
->getDirectAttributes
().begin
());
4478 i
!= entity
->getDirectAttributes
().end
(); ++i
)
4482 std
::map
<OUString
, Member
>::value_type
(
4483 i
->name
, Member
("")))
4485 if
(m.mandatory.isEmpty
()) {
4486 m.optional.insert
(name
);
4489 for
(std
::vector
<unoidl
::InterfaceTypeEntity
::Method
>::const_iterator i
(
4490 entity
->getDirectMethods
().begin
());
4491 i
!= entity
->getDirectMethods
().end
(); ++i
)
4495 std
::map
<OUString
, Member
>::value_type
(
4496 i
->name
, Member
("")))
4498 if
(m.mandatory.isEmpty
()) {
4499 m.optional.insert
(name
);
4505 bool parse
(OUString
const & uri
, SourceProviderScannerData
* data
) {
4507 oslFileHandle handle
;
4508 oslFileError e
= osl_openFile
(uri.pData
, &handle
, osl_File_OpenFlag_Read
);
4510 case osl_File_E_None
:
4512 case osl_File_E_NOENT
:
4515 throw FileFormatException
(uri
, "cannot open: " + OUString
::number
(e
));
4518 e
= osl_getFileSize
(handle
, &size
);
4519 if
(e
!= osl_File_E_None
) {
4520 oslFileError e2
= osl_closeFile
(handle
);
4522 e2
!= osl_File_E_None
, "unoidl",
4523 "cannot close " << uri
<< ": " << +e2
);
4524 throw FileFormatException
(
4525 uri
, "cannot get size: " + OUString
::number
(e
));
4528 e
= osl_mapFile
(handle
, &address
, size
, 0, osl_File_MapFlag_RandomAccess
);
4529 if
(e
!= osl_File_E_None
) {
4530 oslFileError e2
= osl_closeFile
(handle
);
4532 e2
!= osl_File_E_None
, "unoidl",
4533 "cannot close " << uri
<< ": " << +e2
);
4534 throw FileFormatException
(uri
, "cannot mmap: " + OUString
::number
(e
));
4537 data
->setSource
(address
, size
);
4539 if
(yylex_init_extra
(data
, &yyscanner
) != 0) {
4540 // Checking errno for the specific EINVAL, ENOMEM documented for
4541 // yylex_init_extra would not work as those values are not defined
4542 // by the C++ Standard:
4544 throw FileFormatException
(
4546 "yylex_init_extra failed with errno " + OUString
::number
(e2
));
4548 int e2
= yyparse(yyscanner
);
4549 yylex_destroy
(yyscanner
);
4557 throw FileFormatException
(
4560 + (data
->errorLine
== 0
4561 ? OUString
() : " line " + OUString
::number
(data
->errorLine
))
4562 + (data
->parserError.isEmpty
()
4565 + OStringToOUString
(
4566 data
->parserError
, osl_getThreadTextEncoding
())))
4567 + (data
->errorMessage.isEmpty
()
4568 ? OUString
() : ": \"" + data
->errorMessage
+ "\"")));
4570 throw std
::bad_alloc
();
4573 e
= osl_unmapMappedFile
(handle
, address
, size
);
4574 SAL_WARN_IF
(e
!= osl_File_E_None
, "unoidl", "cannot unmap: " << +e
);
4575 e
= osl_closeFile
(handle
);
4576 SAL_WARN_IF
(e
!= osl_File_E_None
, "unoidl", "cannot close: " << +e
);
4579 e
= osl_unmapMappedFile
(handle
, address
, size
);
4580 SAL_WARN_IF
(e
!= osl_File_E_None
, "unoidl", "cannot unmap: " << +e
);
4581 e
= osl_closeFile
(handle
);
4582 SAL_WARN_IF
(e
!= osl_File_E_None
, "unoidl", "cannot close: " << +e
);
4588 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */