Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #ifndef INCLUDED_IDLC_INC_IDLC_IDLCTYPES_HXX
20 : #define INCLUDED_IDLC_INC_IDLC_IDLCTYPES_HXX
21 :
22 : #include <stdio.h>
23 :
24 : #include <list>
25 : #include <set>
26 : #include <string>
27 : #include <unordered_map>
28 : #include <vector>
29 :
30 : #include <sal/types.h>
31 : #include <rtl/ustring.hxx>
32 :
33 : struct LessString
34 : {
35 987 : bool operator()(const OString& str1, const OString& str2) const
36 : {
37 987 : return (str1 < str2);
38 : }
39 : };
40 :
41 : typedef ::std::list< OString > StringList;
42 : typedef ::std::vector< OString > StringVector;
43 : typedef ::std::set< OString, LessString > StringSet;
44 :
45 : class AstDeclaration;
46 :
47 : typedef std::list< AstDeclaration* > DeclList;
48 :
49 : class AstScope;
50 : AstDeclaration* SAL_CALL scopeAsDecl(AstScope* pScope);
51 : AstScope* SAL_CALL declAsScope(AstDeclaration* pDecl);
52 :
53 : #ifdef _MSC_VER
54 : #pragma warning( disable : 4541 )
55 : #endif
56 :
57 : // flags used for attributes, properties and services
58 : #define AF_INVALID 0x0000
59 : #define AF_READONLY 0x0001
60 : #define AF_OPTIONAL 0x0002
61 : #define AF_MAYBEVOID 0x0004
62 : #define AF_BOUND 0x0008
63 : #define AF_CONSTRAINED 0x0010
64 : #define AF_TRANSIENT 0x0020
65 : #define AF_MAYBEAMBIGUOUS 0x0040
66 : #define AF_MAYBEDEFAULT 0x0080
67 : #define AF_REMOVABLE 0x0100
68 : #define AF_ATTRIBUTE 0x0200
69 : #define AF_PROPERTY 0x0400
70 :
71 : enum ParseState
72 : {
73 : PS_NoState,
74 : PS_TypeDeclSeen, // Seen complete typedef declaration
75 : PS_ConstantDeclSeen, // Seen complete const declaration
76 : PS_ExceptionDeclSeen, // Seen complete exception declaration
77 : PS_InterfaceDeclSeen, // Seen complete interface declaration
78 : PS_ServiceDeclSeen, // Seen complete service declaration
79 : PS_SingletonDeclSeen, // Seen complete singleton declaration
80 : PS_ModuleDeclSeen, // Seen complete module declaration
81 : PS_AttributeDeclSeen, // Seen complete attribute declaration
82 : PS_PropertyDeclSeen, // Seen complete property declaration
83 : PS_OperationDeclSeen, // Seen complete operation declaration
84 : PS_InterfaceInheritanceDeclSeen, // Seen complete interface inheritance decl
85 : PS_ConstantsDeclSeen, // Seen complete constants declaration
86 :
87 : PS_ServiceSeen, // Seen a SERVICE keyword
88 : PS_ServiceIDSeen, // Seen the service ID
89 : PS_ServiceSqSeen, // '{' seen for service
90 : PS_ServiceQsSeen, // '}' seen for service
91 : PS_ServiceBodySeen, // Seen complete service body
92 : PS_ServiceMemberSeen, // Seen a service member
93 : PS_ServiceIFHeadSeen, // Seen an interface member header
94 : PS_ServiceSHeadSeen, // Seen an service member header
95 :
96 : PS_SingletonSeen, // Seen a SINGLETON keyword
97 : PS_SingletonIDSeen, // Seen the singleton ID
98 : PS_SingletonSqSeen, // '{' seen for singleton
99 : PS_SingletonQsSeen, // '}' seen for singleton
100 : PS_SingletonBodySeen, // Seen complete singleton body
101 : PS_SingletonMemberSeen, // Seen a singleton member
102 :
103 : PS_ModuleSeen, // Seen a MODULE keyword
104 : PS_ModuleIDSeen, // Seen the module ID
105 : PS_ModuleSqSeen, // '{' seen for module
106 : PS_ModuleQsSeen, // '}' seen for module
107 : PS_ModuleBodySeen, // Seen complete module body
108 :
109 : PS_ConstantsSeen, // Seen a CONSTANTS keyword
110 : PS_ConstantsIDSeen, // Seen the constants ID
111 : PS_ConstantsSqSeen, // '{' seen for constants
112 : PS_ConstantsQsSeen, // '}' seen for constants
113 : PS_ConstantsBodySeen, // Seen complete constants body
114 :
115 : PS_InterfaceSeen, // Seen an INTERFACE keyword
116 : PS_InterfaceIDSeen, // Seen the interface ID
117 : PS_InterfaceHeadSeen, // Seen the interface head
118 : PS_InheritSpecSeen, // Seen a complete inheritance spec
119 : PS_ForwardDeclSeen, // Forward interface decl seen
120 : PS_InterfaceSqSeen, // '{' seen for interface
121 : PS_InterfaceQsSeen, // '}' seen for interface
122 : PS_InterfaceBodySeen, // Seen an interface body
123 : PS_InheritColonSeen, // Seen ':' in inheritance list
124 :
125 : PS_SNListCommaSeen, // Seen ',' in list of scoped names
126 : PS_ScopedNameSeen, // Seen a complete scoped name
127 : PS_SN_IDSeen, // Seen an identifier as part of a scoped name
128 : PS_ScopeDelimSeen, // Seen a scope delim as party of a scoped name
129 :
130 : PS_ConstSeen, // Seen a CONST keyword
131 : PS_ConstTypeSeen, // Parsed the type of a constant
132 : PS_ConstIDSeen, // Seen the constant ID
133 : PS_ConstAssignSeen, // Seen the '='
134 : PS_ConstExprSeen, // Seen the constant value expression
135 :
136 : PS_TypedefSeen, // Seen a TYPEDEF keyword
137 : PS_TypeSpecSeen, // Seen a complete type specification
138 : PS_DeclaratorsSeen, // Seen a complete list of declarators
139 :
140 : PS_StructSeen, // Seen a STRUCT keyword
141 : PS_StructHeaderSeen, // Seen struct header
142 : PS_StructIDSeen, // Seen the struct ID
143 : PS_StructSqSeen, // '{' seen for struct
144 : PS_StructQsSeen, // '}' seen for struct
145 : PS_StructBodySeen, // Seen complete body of struct decl
146 :
147 : PS_MemberTypeSeen, // Seen type of struct or except member
148 : PS_MemberDeclsSeen, // Seen decls of struct or except members
149 : PS_MemberDeclsCompleted,// Completed one struct or except member to ';'
150 :
151 : PS_EnumSeen, // Seen an ENUM keyword
152 : PS_EnumIDSeen, // Seen the enum ID
153 : PS_EnumSqSeen, // Seen '{' for enum
154 : PS_EnumQsSeen, // Seen '}' for enum
155 : PS_EnumBodySeen, // Seen complete enum body
156 : PS_EnumCommaSeen, // Seen ',' in list of enumerators
157 :
158 : PS_SequenceSeen, // Seen a SEQUENCE keyword
159 : PS_SequenceSqSeen, // Seen '<' for sequence
160 : PS_SequenceQsSeen, // Seen '>' for sequence
161 : PS_SequenceTypeSeen, // Seen type decl for sequence
162 :
163 : PS_FlagHeaderSeen, // Seen the attribute|property|interface member head
164 : PS_AttrSeen, // Seen ATTRIBUTE keyword
165 : PS_AttrTypeSeen, // Seen type decl for attribute
166 : PS_AttrCompleted, // Seen complete attribute declaration
167 : PS_ReadOnlySeen, // Seen READONLY keyword
168 : PS_OptionalSeen, // Seen OPTIONAL keyword
169 : PS_MayBeVoidSeen, // Seen MAYBEVOID yword
170 : PS_BoundSeen, // Seen BOUND keyword
171 : PS_ConstrainedSeen, // Seen CONSTRAINED keyword
172 : PS_TransientSeen, // Seen TRANSIENT keyword
173 : PS_MayBeAmbigiousSeen, // Seen MAYBEAMBIGIOUS keyword
174 : PS_MayBeDefaultSeen, // Seen MAYBEDEFAULT keyword
175 : PS_RemoveableSeen, // Seen REMOVABLE keyword
176 :
177 : PS_PropertySeen, // Seen PROPERTY keyword
178 : PS_PropertyTypeSeen, // Seen type decl for property
179 : PS_PropertyCompleted, // Seen complete property declaration
180 :
181 : PS_ExceptSeen, // Seen EXCEPTION keyword
182 : PS_ExceptHeaderSeen, // Seen exception header keyword
183 : PS_ExceptIDSeen, // Seen exception identifier
184 : PS_ExceptSqSeen, // Seen '{' for exception
185 : PS_ExceptQsSeen, // Seen '}' for exception
186 : PS_ExceptBodySeen, // Seen complete exception body
187 :
188 : PS_OpTypeSeen, // Seen operation return type
189 : PS_OpIDSeen, // Seen operation ID
190 : PS_OpParsCompleted, // Completed operation param list
191 : PS_OpCompleted, // Completed operation statement
192 : PS_OpSqSeen, // Seen '(' for operation
193 : PS_OpQsSeen, // Seen ')' for operation
194 : PS_OpParCommaSeen, // Seen ',' in list of op params
195 : PS_OpParDirSeen, // Seen parameter direction
196 : PS_OpParTypeSeen, // Seen parameter type
197 : PS_OpParDeclSeen, // Seen parameter declaration
198 :
199 : PS_RaiseSeen, // Seen RAISES keyword
200 : PS_RaiseSqSeen, // Seen '(' for RAISES
201 : PS_RaiseQsSeen, // Seen ')' for RAISES
202 :
203 : PS_DeclsCommaSeen, // Seen ',' in declarators list
204 : PS_DeclsDeclSeen // Seen complete decl in decls list
205 : };
206 :
207 : #endif // INCLUDED_IDLC_INC_IDLC_IDLCTYPES_HXX
208 :
209 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|