summaryrefslogtreecommitdiff
path: root/idlc
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-01-30 17:53:02 +0100
committerStephan Bergmann <sbergman@redhat.com>2014-01-30 17:53:45 +0100
commit8e71d9400bd350d63723c5489ddaadb3d3610baf (patch)
tree51ec29e538c6ea301faef5125421101ddf47461c /idlc
parenta0bd814fb5c2ed1d8a1583eb59c783290c7c3dc9 (diff)
Remove UNOIDL "array" and "union" vaporware from idlc
Change-Id: Iccd5a78b54620796cfde672388b70ad97d17b7a5
Diffstat (limited to 'idlc')
-rw-r--r--idlc/Executable_idlc.mk2
-rw-r--r--idlc/inc/idlc/astarray.hxx55
-rw-r--r--idlc/inc/idlc/astdeclaration.hxx3
-rw-r--r--idlc/inc/idlc/astunion.hxx61
-rw-r--r--idlc/inc/idlc/astunionbranch.hxx39
-rw-r--r--idlc/inc/idlc/astunionlabel.hxx45
-rw-r--r--idlc/inc/idlc/errorhandler.hxx15
-rw-r--r--idlc/inc/idlc/idlctypes.hxx33
-rw-r--r--idlc/source/astarray.cxx66
-rw-r--r--idlc/source/astdeclaration.cxx3
-rw-r--r--idlc/source/astscope.cxx6
-rw-r--r--idlc/source/astunion.cxx382
-rw-r--r--idlc/source/errorhandler.cxx71
-rw-r--r--idlc/source/fehelper.cxx21
-rw-r--r--idlc/source/idlc.cxx5
-rw-r--r--idlc/source/parser.y453
-rw-r--r--idlc/source/scanner.l5
-rw-r--r--idlc/test/struct.idl6
-rw-r--r--idlc/test/typelookup.idl4
-rw-r--r--idlc/test/union.idl55
20 files changed, 7 insertions, 1323 deletions
diff --git a/idlc/Executable_idlc.mk b/idlc/Executable_idlc.mk
index 2eaa30cd9f01..1ddc72a470b9 100644
--- a/idlc/Executable_idlc.mk
+++ b/idlc/Executable_idlc.mk
@@ -58,8 +58,6 @@ $(eval $(call gb_Executable_add_exception_objects,idlc,\
idlc/source/astoperation \
idlc/source/astconstant \
idlc/source/astenum \
- idlc/source/astarray \
- idlc/source/astunion \
idlc/source/astexpression \
idlc/source/astservice \
))
diff --git a/idlc/inc/idlc/astarray.hxx b/idlc/inc/idlc/astarray.hxx
deleted file mode 100644
index e75e0100b25a..000000000000
--- a/idlc/inc/idlc/astarray.hxx
+++ /dev/null
@@ -1,55 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-#ifndef _IDLC_ASTARRAY_HXX_
-#define _IDLC_ASTARRAY_HXX_
-
-#include <idlc/asttype.hxx>
-#include <idlc/astscope.hxx>
-
-class AstArray : public AstType
-{
-public:
- AstArray(const OString& name, AstType* pType, const ExprList& rDimExpr, AstScope* pScope);
- AstArray(AstType* pType, const ExprList& rDimExpr, AstScope* pScope);
-
- virtual ~AstArray() {}
-
- AstType* getType()
- { return m_pType; }
- void setType(AstType* pType)
- {
- m_pType = pType;
- setName(makeName());
- }
- ExprList* getDimExpressions()
- { return &m_dimExpressions; }
- sal_uInt32 getDimension()
- { return m_dimension; }
-
-private:
- OString makeName();
-
- AstType* m_pType;
- sal_uInt32 m_dimension;
- ExprList m_dimExpressions;
-};
-
-#endif // _IDLC_ASTARRAY_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/idlc/inc/idlc/astdeclaration.hxx b/idlc/inc/idlc/astdeclaration.hxx
index a52565ad9012..424e5b2ae8d3 100644
--- a/idlc/inc/idlc/astdeclaration.hxx
+++ b/idlc/inc/idlc/astdeclaration.hxx
@@ -43,8 +43,6 @@ enum NodeType
NT_property, // Denotes an property
NT_operation, // Denotes an operation
NT_parameter, // Denotes an op. parameter
- NT_union, // Denotes a union
- NT_union_branch, // Denotes a union branch
NT_struct, // Denotes either a plain struct type, or a
// polymorphic struct type template
NT_type_parameter, // Denotes a type parameter of a polymorphic struct
@@ -53,7 +51,6 @@ enum NodeType
NT_member, // Denotes a member in structure, exception
NT_enum, // Denotes an enumeration
NT_enum_val, // Denotes an enum. value
- NT_array, // Denotes an IDL array
NT_sequence, // Denotes an IDL sequence
NT_typedef, // Denotes a typedef
NT_predefined, // Denotes a predefined type
diff --git a/idlc/inc/idlc/astunion.hxx b/idlc/inc/idlc/astunion.hxx
deleted file mode 100644
index d1b9b477c7b7..000000000000
--- a/idlc/inc/idlc/astunion.hxx
+++ /dev/null
@@ -1,61 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-#ifndef _IDLC_ASTUNION_HXX_
-#define _IDLC_ASTUNION_HXX_
-
-#include <idlc/aststruct.hxx>
-#include <idlc/astunionbranch.hxx>
-
-class AstUnion : public AstStruct
-{
-public:
- AstUnion(const OString& name, AstType* pDiscType, AstScope* pScope);
- virtual ~AstUnion();
-
- AstType* getDiscrimantType()
- { return m_pDiscriminantType; }
- ExprType getDiscrimantExprType()
- { return m_discExprType; }
-
- virtual sal_Bool dump(RegistryKey& rKey);
-
- virtual AstDeclaration* addDeclaration(AstDeclaration* pDecl);
-protected:
- // Look up a branch by node pointer
- AstUnionBranch* lookupBranch(AstUnionBranch* pBranch);
-
- // Look up the branch with the "default" label
- AstUnionBranch* lookupDefault(sal_Bool bReportError = sal_True );
-
- // Look up a branch given a branch with a label. This is used to
- // check for duplicate labels
- AstUnionBranch* lookupLabel(AstUnionBranch* pBranch);
-
- // Look up a union branch given an enumerator. This is used to
- // check for duplicate enum labels
- AstUnionBranch* lookupEnum(AstUnionBranch* pBranch);
-
-private:
- AstType* m_pDiscriminantType;
- ExprType m_discExprType;
-};
-
-#endif // _IDLC_ASTUNION_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/idlc/inc/idlc/astunionbranch.hxx b/idlc/inc/idlc/astunionbranch.hxx
deleted file mode 100644
index 9c114da45152..000000000000
--- a/idlc/inc/idlc/astunionbranch.hxx
+++ /dev/null
@@ -1,39 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-#ifndef _IDLC_ASTUNIONBRANCH_HXX_
-#define _IDLC_ASTUNIONBRANCH_HXX_
-
-#include <idlc/astmember.hxx>
-#include <idlc/astunionlabel.hxx>
-
-class AstUnionBranch : public AstMember
-{
-public:
- AstUnionBranch(AstUnionLabel* pLabel, AstType const * pType, const OString& name, AstScope* pScope);
- virtual ~AstUnionBranch();
-
- AstUnionLabel* getLabel()
- { return m_pLabel; }
-private:
- AstUnionLabel* m_pLabel;
-};
-
-#endif // _IDLC_ASTUNIONBRANCH_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/idlc/inc/idlc/astunionlabel.hxx b/idlc/inc/idlc/astunionlabel.hxx
deleted file mode 100644
index a280dfbccf25..000000000000
--- a/idlc/inc/idlc/astunionlabel.hxx
+++ /dev/null
@@ -1,45 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-#ifndef _IDLC_ASTUNIONLABEL_HXX_
-#define _IDLC_ASTUNIONLABEL_HXX_
-
-enum UnionLabel
-{
- UL_default, // Label is "default"
- UL_label // Regular label
-};
-
-class AstUnionLabel
-{
-public:
- AstUnionLabel(UnionLabel labelKind, AstExpression* pExpr);
- virtual ~AstUnionLabel();
-
- UnionLabel getLabelKind()
- { return m_label; }
- AstExpression* getLabelValue()
- { return m_pLabelValue; }
-private:
- UnionLabel m_label;
- AstExpression* m_pLabelValue;
-};
-
-#endif // _IDLC_ASTUNIONLABEL_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/idlc/inc/idlc/errorhandler.hxx b/idlc/inc/idlc/errorhandler.hxx
index 8a7b1e4b07e2..085aac541545 100644
--- a/idlc/inc/idlc/errorhandler.hxx
+++ b/idlc/inc/idlc/errorhandler.hxx
@@ -21,7 +21,6 @@
#include <idlc/astdeclaration.hxx>
#include <idlc/astexpression.hxx>
-#include <idlc/astunion.hxx>
#include <idlc/astenum.hxx>
enum ErrorCode
@@ -33,11 +32,8 @@ enum ErrorCode
EIDL_REDEF, // Redefinition
EIDL_REDEF_SCOPE, // Redefinition inside defining scope
EIDL_DEF_USE, // Definition after use
- EIDL_MULTIPLE_BRANCH, // More than one union branch with this label
EIDL_COERCION_FAILURE, // Coercion failure
EIDL_SCOPE_CONFLICT, // Between fwd declare and full declare
- EIDL_DISC_TYPE, // Illegal discriminator type in union
- EIDL_LABEL_TYPE, // Mismatch with discriminator type in union
EIDL_ILLEGAL_ADD, // Illegal add action
EIDL_ILLEGAL_USE, // Illegal type used in expression
EIDL_ILLEGAL_RAISES, // Error in "raises" clause
@@ -46,8 +42,6 @@ enum ErrorCode
EIDL_INHERIT_FWD_ERROR, // Cannot inherit from fwd decl interface
EIDL_CONSTANT_EXPECTED, // We got something else..
EIDL_NAME_CASE_ERROR, // Spelling differences found
- EIDL_ENUM_VAL_EXPECTED, // Expected an enumerator
- EIDL_ENUM_VAL_NOT_FOUND, // Didnt find an enumerator with that name
EIDL_EVAL_ERROR, // Error in evaluating expression
EIDL_AMBIGUOUS, // Ambiguous name definition
EIDL_DECL_NOT_DEFINED, // Forward declared but never defined
@@ -130,15 +124,6 @@ public:
void evalError(AstExpression* pExpr);
- // Report a situation where an enumerator was expected but we got
- // something else instead. This occurs when a union with an enum
- // discriminator is being parsed and one of the branch labels is
- // not an enumerator in that enum
- void enumValExpected(AstUnion* pUnion);
-
- // Report a failed enumerator lookup in an enum
- void enumValLookupFailure(AstUnion* pUnion, AstEnum* pEnum, const OString& name);
-
bool checkPublished(AstDeclaration const * decl, bool bOptiional=false);
};
diff --git a/idlc/inc/idlc/idlctypes.hxx b/idlc/inc/idlc/idlctypes.hxx
index 842ef68e11cf..fcda52100538 100644
--- a/idlc/inc/idlc/idlctypes.hxx
+++ b/idlc/inc/idlc/idlctypes.hxx
@@ -58,12 +58,6 @@ typedef ::std::list< OString > StringList;
typedef ::std::vector< OString > StringVector;
typedef ::std::set< OString, LessString > StringSet;
-class AstExpression;
-typedef ::std::list< AstExpression* > ExprList;
-
-class AstUnionLabel;
-typedef ::std::list< AstUnionLabel* > LabelList;
-
class AstDeclaration;
typedef ::boost::unordered_map< OString, AstDeclaration*, HashString, EqualString > DeclMap;
@@ -171,25 +165,6 @@ enum ParseState
PS_MemberDeclsSeen, // Seen decls of struct or except members
PS_MemberDeclsCompleted,// Completed one struct or except member to ';'
- PS_UnionSeen, // Seen a UNION keyword
- PS_UnionIDSeen, // Seen the union ID
- PS_SwitchSeen, // Seen the SWITCH keyword
- PS_SwitchOpenParSeen, // Seen the switch open par.
- PS_SwitchTypeSeen, // Seen the switch type spec
- PS_SwitchCloseParSeen, // Seen the switch close par.
- PS_UnionSqSeen, // '{' seen for union
- PS_UnionQsSeen, // '}' seen for union
- PS_DefaultSeen, // Seen DEFAULT keyword
- PS_UnionLabelSeen, // Seen label of union element
- PS_LabelColonSeen, // Seen ':' of union branch label
- PS_LabelExprSeen, // Seen expression of union branch label
- PS_UnionElemSeen, // Seen a union element
- PS_UnionElemCompleted, // Completed one union member up to ';'
- PS_CaseSeen, // Seen a CASE keyword
- PS_UnionElemTypeSeen, // Seen type spec for union element
- PS_UnionElemDeclSeen, // Seen declarator for union element
- PS_UnionBodySeen, // Seen completed union body
-
PS_EnumSeen, // Seen an ENUM keyword
PS_EnumIDSeen, // Seen the enum ID
PS_EnumSqSeen, // Seen '{' for enum
@@ -202,14 +177,6 @@ enum ParseState
PS_SequenceQsSeen, // Seen '>' for sequence
PS_SequenceTypeSeen, // Seen type decl for sequence
- PS_ArrayIDSeen, // Seen array ID
- PS_ArrayTypeSeen, // Seen array type
- PS_ArrayCompleted, // Seen completed array declaration
- PS_DimSqSeen, // Seen '[' for array dimension
- PS_DimQsSeen, // Seen ']' for array dimension
- PS_DimExprSeen, // Seen size expression for array dimension
-
-
PS_FlagHeaderSeen, // Seen the attribute|property|interface member head
PS_AttrSeen, // Seen ATTRIBUTE keyword
PS_AttrTypeSeen, // Seen type decl for attribute
diff --git a/idlc/source/astarray.cxx b/idlc/source/astarray.cxx
deleted file mode 100644
index 43a9e82cc666..000000000000
--- a/idlc/source/astarray.cxx
+++ /dev/null
@@ -1,66 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <idlc/astarray.hxx>
-
-using namespace ::rtl;
-
-AstArray::AstArray(const OString& name, AstType* pType, const ExprList& rDimExpr, AstScope* pScope)
- : AstType(NT_array, name, pScope)
- , m_pType(pType)
- , m_dimension((sal_uInt32)(rDimExpr.size()))
- , m_dimExpressions(rDimExpr)
-{
- if ( m_pType )
- setName(makeName());
-}
-
-AstArray::AstArray(AstType* pType, const ExprList& rDimExpr, AstScope* pScope)
- : AstType(NT_array, OString("arrary_"), pScope)
- , m_pType(pType)
- , m_dimension((sal_uInt32)(rDimExpr.size()))
- , m_dimExpressions(rDimExpr)
-{
- if ( m_pType )
- setName(makeName());
-}
-
-OString AstArray::makeName()
-{
- if ( m_pType )
- {
- OString name(m_pType->getScopedName());
- OString openBracket("[");
- OString closeBracket("]");
- ExprList::iterator iter = m_dimExpressions.begin();
- ExprList::iterator end = m_dimExpressions.end();
-
- while ( iter != end )
- {
- name += openBracket;
- name += (*iter)->toString();
- name += closeBracket;
- ++iter;
- }
- return name;
- }
- return OString();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/idlc/source/astdeclaration.cxx b/idlc/source/astdeclaration.cxx
index c5733f9ccb4c..e8df3a6d5550 100644
--- a/idlc/source/astdeclaration.cxx
+++ b/idlc/source/astdeclaration.cxx
@@ -134,10 +134,8 @@ bool AstDeclaration::isType() const {
switch (m_nodeType) {
case NT_interface:
case NT_instantiated_struct:
- case NT_union:
case NT_enum:
case NT_sequence:
- case NT_array:
case NT_typedef:
case NT_predefined:
case NT_type_parameter:
@@ -181,7 +179,6 @@ sal_Bool AstDeclaration::dump(RegistryKey& rKey)
case NT_struct:
case NT_exception:
case NT_enum:
- case NT_union:
case NT_typedef:
case NT_service:
case NT_singleton:
diff --git a/idlc/source/astscope.cxx b/idlc/source/astscope.cxx
index ba06611feb1a..b127cf936c06 100644
--- a/idlc/source/astscope.cxx
+++ b/idlc/source/astscope.cxx
@@ -47,11 +47,6 @@ AstDeclaration* AstScope::addDeclaration(AstDeclaration* pDecl)
if ((pDeclaration = lookupForAdd(pDecl)) != NULL)
{
- if (pDecl->getNodeType() == NT_union_branch )
- {
- m_declarations.push_back(pDecl);
- return pDecl;
- }
if ( pDecl->hasAncestor(pDeclaration) )
{
idlc()->error()->error2(EIDL_REDEF_SCOPE, pDecl, pDeclaration);
@@ -59,7 +54,6 @@ AstDeclaration* AstScope::addDeclaration(AstDeclaration* pDecl)
}
if ( (pDecl->getNodeType() == pDeclaration->getNodeType()) &&
(pDecl->getNodeType() == NT_sequence
- || pDecl->getNodeType() == NT_array
|| pDecl->getNodeType() == NT_instantiated_struct) )
{
return pDeclaration;
diff --git a/idlc/source/astunion.cxx b/idlc/source/astunion.cxx
deleted file mode 100644
index 45e2f3128345..000000000000
--- a/idlc/source/astunion.cxx
+++ /dev/null
@@ -1,382 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <idlc/astunion.hxx>
-#include <idlc/astbasetype.hxx>
-#include <idlc/errorhandler.hxx>
-
-#include "registry/version.h"
-#include "registry/writer.hxx"
-
-using namespace ::rtl;
-
-AstUnion::AstUnion(const OString& name, AstType* pDiscType, AstScope* pScope)
- : AstStruct(NT_union, name, NULL, pScope)
- , m_pDiscriminantType(pDiscType)
- , m_discExprType(ET_long)
-{
- AstBaseType* pBaseType;
-
- if ( !pDiscType )
- {
- m_pDiscriminantType = NULL;
- m_discExprType = ET_none;
- return;
- }
- /*
- * If the discriminator type is a predefined type
- * then install the equivalent coercion target type in
- * the pd_udisc_type field.
- */
- if ( pDiscType->getNodeType() == NT_predefined )
- {
- pBaseType = (AstBaseType*)pDiscType;
- m_pDiscriminantType = pDiscType;
- switch (pBaseType->getExprType())
- {
- case ET_long:
- case ET_ulong:
- case ET_short:
- case ET_ushort:
- case ET_char:
- case ET_boolean:
- m_discExprType = pBaseType->getExprType();
- break;
- default:
- m_discExprType = ET_none;
- m_pDiscriminantType = NULL;
- break;
- }
- } else
- if (pDiscType->getNodeType() == NT_enum)
- {
- m_discExprType = ET_any;
- m_pDiscriminantType = pDiscType;
- } else
- {
- m_discExprType = ET_none;
- m_pDiscriminantType = NULL;
- }
-
- if ( !m_pDiscriminantType )
- idlc()->error()->error2(EIDL_DISC_TYPE, this, pDiscType);
-}
-
-AstUnion::~AstUnion()
-{
-}
-
-AstDeclaration* AstUnion::addDeclaration(AstDeclaration* pDecl)
-{
- if ( pDecl->getNodeType() == NT_union_branch )
- {
- AstUnionBranch* pBranch = (AstUnionBranch*)pDecl;
- if ( lookupBranch(pBranch) )
- {
- idlc()->error()->error2(EIDL_MULTIPLE_BRANCH, this, pDecl);
- return NULL;
- }
- }
-
- return AstScope::addDeclaration(pDecl);
-}
-
-AstUnionBranch* AstUnion::lookupBranch(AstUnionBranch* pBranch)
-{
- AstUnionLabel* pLabel = NULL;
-
- if ( pBranch )
- pLabel = pBranch->getLabel();
-
- if ( pLabel )
- {
- if (pLabel->getLabelKind() == UL_default)
- return lookupDefault();
- if (m_discExprType == ET_any)
- /* CONVENTION: indicates enum discr */
- return lookupEnum(pBranch);
- return lookupLabel(pBranch);
- }
- return NULL;
-}
-
-AstUnionBranch* AstUnion::lookupDefault(sal_Bool bReportError)
-{
- DeclList::const_iterator iter = getIteratorBegin();
- DeclList::const_iterator end = getIteratorEnd();
- AstUnionBranch *pBranch = NULL;
- AstDeclaration *pDecl = NULL;
-
- while ( iter != end )
- {
- pDecl = *iter;
- if ( pDecl->getNodeType() == NT_union_branch )
- {
- pBranch = (AstUnionBranch*)pDecl;
- if (pBranch == NULL)
- {
- ++iter;
- continue;
- }
- if ( pBranch->getLabel() != NULL &&
- pBranch->getLabel()->getLabelKind() == UL_default)
- {
- if ( bReportError )
- idlc()->error()->error2(EIDL_MULTIPLE_BRANCH, this, pBranch);
- return pBranch;
- }
- }
- ++iter;
- }
- return NULL;
-}
-
-AstUnionBranch* AstUnion::lookupLabel(AstUnionBranch* pBranch)
-{
- AstUnionLabel* pLabel = pBranch->getLabel();
-
- if ( !pLabel->getLabelValue() )
- return pBranch;
-// pLabel->getLabelValue()->setExprValue(pLabel->getLabelValue()->coerce(m_discExprType, sal_False));
- AstExprValue* pLabelValue = pLabel->getLabelValue()->coerce(
- m_discExprType, sal_False);
- if ( !pLabelValue )
- {
- idlc()->error()->evalError(pLabel->getLabelValue());
- return pBranch;
- } else
- {
- pLabel->getLabelValue()->setExprValue(pLabelValue);
- }
-
- DeclList::const_iterator iter = getIteratorBegin();
- DeclList::const_iterator end = getIteratorEnd();
- AstUnionBranch* pB = NULL;
- AstDeclaration* pDecl = NULL;
-
- while ( iter != end )
- {
- pDecl = *iter;
- if ( pDecl->getNodeType() == NT_union_branch )
- {
- pB = (AstUnionBranch*)pDecl;
- if ( !pB )
- {
- ++iter;
- continue;
- }
- if ( pB->getLabel() != NULL &&
- pB->getLabel()->getLabelKind() == UL_label &&
- pB->getLabel()->getLabelValue()->compare(pLabel->getLabelValue()) )
- {
- idlc()->error()->error2(EIDL_MULTIPLE_BRANCH, this, pBranch);
- return pBranch;
- }
- }
- ++iter;
- }
- return NULL;
-}
-
-AstUnionBranch* AstUnion::lookupEnum(AstUnionBranch* pBranch)
-{
- AstDeclaration const * pType = resolveTypedefs(m_pDiscriminantType);
- if ( pType->getNodeType() != NT_enum )
- return NULL;
-
- AstUnionLabel* pLabel = pBranch->getLabel();
- AstExpression* pExpr = pLabel->getLabelValue();
- if ( !pExpr )
- return pBranch;
-
- /*
- * Expecting a symbol label
- */
- if ( pExpr->getCombOperator() != EC_symbol)
- {
- idlc()->error()->enumValExpected(this);
- return pBranch;
- }
-
- /*
- * See if the symbol defines a constant in the discriminator enum
- */
- AstEnum* pEnum = (AstEnum*)pType;
- AstDeclaration* pDecl = pEnum->lookupByName(*pExpr->getSymbolicName());
- if ( pDecl == NULL || pDecl->getScope() != pEnum)
- {
- idlc()->error()->enumValLookupFailure(this, pEnum, *pExpr->getSymbolicName());
- return pBranch;
- }
-
-
- DeclList::const_iterator iter = getIteratorBegin();
- DeclList::const_iterator end = getIteratorEnd();
- AstUnionBranch* pB = NULL;
- pDecl = NULL;
-
- while ( iter != end )
- {
- pDecl = *iter;
- if ( pDecl->getNodeType() == NT_union_branch )
- {
- pB = (AstUnionBranch*)pDecl;
- if ( !pB )
- {
- ++iter;
- continue;
- }
- if ( pB->getLabel() != NULL &&
- pB->getLabel()->getLabelKind() == UL_label &&
- pB->getLabel()->getLabelValue()->compare(pLabel->getLabelValue()) )
- {
- idlc()->error()->error2(EIDL_MULTIPLE_BRANCH, this, pBranch);
- return pBranch;
- }
- }
- ++iter;
- }
- return NULL;
-}
-
-sal_Bool AstUnion::dump(RegistryKey& rKey)
-{
- RegistryKey localKey;
- if (rKey.createKey( OStringToOUString(getFullName(), RTL_TEXTENCODING_UTF8 ), localKey))
- {
- fprintf(stderr, "%s: warning, could not create key '%s' in '%s'\n",
- idlc()->getOptions()->getProgramName().getStr(),
- getFullName().getStr(), OUStringToOString(rKey.getRegistryName(), RTL_TEXTENCODING_UTF8).getStr());
- return sal_False;
- }
-
- sal_uInt16 nMember = getNodeCount(NT_union_branch);
-
- OUString emptyStr;
- typereg::Writer aBlob(
- TYPEREG_VERSION_0, getDocumentation(), emptyStr, RT_TYPE_UNION,
- false, OStringToOUString(getRelativName(), RTL_TEXTENCODING_UTF8), 1,
- nMember, 0, 0);
- aBlob.setSuperTypeName(
- 0,
- OStringToOUString(
- getDiscrimantType()->getScopedName(), RTL_TEXTENCODING_UTF8));
-
- if ( nMember > 0 )
- {
- DeclList::const_iterator iter = getIteratorBegin();
- DeclList::const_iterator end = getIteratorEnd();
- AstDeclaration* pDecl = NULL;
- AstUnionBranch* pBranch = NULL;
- AstUnionBranch* pDefault = lookupDefault(sal_False);
- AstUnionLabel* pLabel = NULL;
- AstExprValue* pExprValue = NULL;
- RTConstValue aConst;
- sal_uInt16 index = 0;
- if ( pDefault )
- index = 1;
-
- sal_Int64 disc = 0;
- while ( iter != end )
- {
- pDecl = *iter;
- if ( pDecl->getNodeType() == NT_union_branch )
- {
- pBranch = (AstUnionBranch*)pDecl;
- if (pBranch == pDefault)
- {
- ++iter;
- continue;
- }
-
- pLabel = pBranch->getLabel();
- pExprValue = pLabel->getLabelValue()->coerce(ET_hyper, sal_False);
- aConst.m_type = RT_TYPE_INT64;
- aConst.m_value.aHyper = pExprValue->u.hval;
- if ( aConst.m_value.aHyper > disc )
- disc = aConst.m_value.aHyper;
-
- aBlob.setFieldData(
- index++, pBranch->getDocumentation(), emptyStr, RT_ACCESS_READWRITE,
- OStringToOUString(
- pBranch->getLocalName(), RTL_TEXTENCODING_UTF8),
- OStringToOUString(
- pBranch->getType()->getRelativName(),
- RTL_TEXTENCODING_UTF8),
- aConst);
- }
- ++iter;
- }
-
- if ( pDefault )
- {
- aConst.m_type = RT_TYPE_INT64;
- aConst.m_value.aHyper = disc + 1;
- aBlob.setFieldData(
- 0, pDefault->getDocumentation(), emptyStr, RT_ACCESS_DEFAULT,
- OStringToOUString(
- pDefault->getLocalName(), RTL_TEXTENCODING_UTF8),
- OStringToOUString(
- pDefault->getType()->getRelativName(),
- RTL_TEXTENCODING_UTF8),
- aConst);
- }
- }
-
- sal_uInt32 aBlobSize;
- void const * pBlob = aBlob.getBlob(&aBlobSize);
-
- if (localKey.setValue(OUString(), RG_VALUETYPE_BINARY,
- (RegValue)pBlob, aBlobSize))
- {
- fprintf(stderr, "%s: warning, could not set value of key \"%s\" in %s\n",
- idlc()->getOptions()->getProgramName().getStr(),
- getFullName().getStr(), OUStringToOString(localKey.getRegistryName(), RTL_TEXTENCODING_UTF8).getStr());
- return sal_False;
- }
-
- return sal_True;
-}
-
-AstUnionBranch::AstUnionBranch(AstUnionLabel* pLabel, AstType const * pType, const OString& name, AstScope* pScope)
- : AstMember(NT_union_branch, pType, name, pScope)
- , m_pLabel(pLabel)
-{
-}
-
-AstUnionBranch::~AstUnionBranch()
-{
- delete m_pLabel;
-}
-
-AstUnionLabel::AstUnionLabel(UnionLabel labelKind, AstExpression* pExpr)
- : m_label(labelKind)
- , m_pLabelValue(pExpr)
-{
- if ( m_pLabelValue )
- m_pLabelValue->evaluate(EK_const);
-}
-
-AstUnionLabel::~AstUnionLabel()
-{
- delete m_pLabelValue;
-}
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/idlc/source/errorhandler.cxx b/idlc/source/errorhandler.cxx
index f591f0b04dcd..323f16b59a17 100644
--- a/idlc/source/errorhandler.cxx
+++ b/idlc/source/errorhandler.cxx
@@ -36,16 +36,10 @@ static const sal_Char* errorCodeToMessage(ErrorCode eCode)
return "illegal redefinition in scope ";
case EIDL_DEF_USE:
return "redefinition after use, ";
- case EIDL_MULTIPLE_BRANCH:
- return "union with duplicate branch label ";
case EIDL_COERCION_FAILURE:
return "coercion failure ";
case EIDL_SCOPE_CONFLICT:
return "definition scope is different than fwd declare scope, ";
- case EIDL_DISC_TYPE:
- return "union with illegal discriminator type, ";
- case EIDL_LABEL_TYPE:
- return "label type incompatible with union discriminator type, ";
case EIDL_ILLEGAL_ADD:
return "illegal add operation, ";
case EIDL_ILLEGAL_USE:
@@ -62,10 +56,6 @@ static const sal_Char* errorCodeToMessage(ErrorCode eCode)
return "constant expected: ";
case EIDL_NAME_CASE_ERROR:
return "identifier used with two differing spellings: ";
- case EIDL_ENUM_VAL_EXPECTED:
- return "enumerator expected: ";
- case EIDL_ENUM_VAL_NOT_FOUND:
- return "enumerator by this name not defined: ";
case EIDL_EVAL_ERROR:
return "expression evaluation error: ";
case EIDL_AMBIGUOUS:
@@ -293,41 +283,6 @@ static const sal_Char* parseStateToMessage(ParseState state)
return "Illegal syntax following member declarator(s)";
case PS_MemberDeclsCompleted:
return "Missing ',' between member decls of same type(?)";
- case PS_UnionSeen:
- return "Missing identifier following UNION keyword";
- case PS_UnionIDSeen:
- return "Illegal syntax following union identifier";
- case PS_SwitchSeen:
- return "Illegal syntax following SWITCH keyword";
- case PS_SwitchOpenParSeen:
- return "Illegal syntax following '(' in switch in union";
- case PS_SwitchTypeSeen:
- return "Illegal syntax following type decl in switch in union";
- case PS_SwitchCloseParSeen:
- return "Missing union '{' opener";
- case PS_UnionSqSeen:
- return "Illegal syntax following union '{' opener";
- case PS_UnionQsSeen:
- return "Illegal syntax following union '}' closer";
- case PS_DefaultSeen:
- return "Illegal syntax or missing ':' following DEFAULT keyword";
- case PS_UnionLabelSeen:
- return "Illegal syntax following branch label in union";
- case PS_LabelColonSeen:
- return "Illegal syntax following ':' in branch label in union";
- case PS_LabelExprSeen:
- return "Illegal syntax following label expression in union";
- case PS_UnionElemSeen:
- case PS_UnionElemCompleted:
- return "Illegal syntax following union element";
- case PS_CaseSeen:
- return "Illegal syntax following CASE keyword in union";
- case PS_UnionElemTypeSeen:
- return "Illegal syntax following type decl in union element";
- case PS_UnionElemDeclSeen:
- return "Illegal syntax following declarator in union element";
- case PS_UnionBodySeen:
- return "Illegal syntax following union body statement(s)";
case PS_EnumSeen:
return "Illegal syntax or missing identifier following ENUM keyword";
case PS_EnumIDSeen:
@@ -348,16 +303,6 @@ static const sal_Char* parseStateToMessage(ParseState state)
return "Illegal syntax following '>' in sequence";
case PS_SequenceTypeSeen:
return "Illegal syntax following sequence type declaration";
- case PS_ArrayIDSeen:
- return "Illegal syntax or missing dimensions after array identifier";
- case PS_ArrayCompleted:
- return "Illegal syntax after array declaration";
- case PS_DimSqSeen:
- return "Illegal syntax or missing size expr after '[' in array declaration";
- case PS_DimQsSeen:
- return "Illegal syntax after ']' in array declaration";
- case PS_DimExprSeen:
- return "Illegal syntax or missing ']' after size expr in array declaration";
case PS_FlagHeaderSeen:
return "Illegal syntax after flags";
case PS_AttrSeen:
@@ -658,22 +603,6 @@ void ErrorHandler::evalError(AstExpression* pExpr)
idlc()->incErrorCount();
}
-void ErrorHandler::enumValExpected(AstUnion* pUnion)
-{
- errorHeader(EIDL_ENUM_VAL_EXPECTED);
- fprintf(stderr, " union %s\n", pUnion->getLocalName().getStr());
- idlc()->incErrorCount();
-}
-
-void ErrorHandler::enumValLookupFailure(AstUnion* pUnion, AstEnum* pEnum, const OString& name)
-{
- errorHeader(EIDL_ENUM_VAL_NOT_FOUND);
- fprintf(stderr, " union %s, enum %s, enumerator %s\n",
- pUnion->getLocalName().getStr(),
- pEnum->getLocalName().getStr(), name.getStr());
- idlc()->incErrorCount();
-}
-
bool ErrorHandler::checkPublished(AstDeclaration const * decl, bool bOptional) {
if (idlc()->isPublished() && !decl->isPublished() && !bOptional) {
error1(EIDL_PUBLISHED_USES_UNPUBLISHED, decl);
diff --git a/idlc/source/fehelper.cxx b/idlc/source/fehelper.cxx
index 02df3a824d71..053473a2deb4 100644
--- a/idlc/source/fehelper.cxx
+++ b/idlc/source/fehelper.cxx
@@ -19,7 +19,6 @@
#include <idlc/fehelper.hxx>
#include <idlc/errorhandler.hxx>
-#include <idlc/astarray.hxx>
#include "idlc/idlc.hxx"
using namespace ::rtl;
@@ -65,26 +64,6 @@ AstType const * FeDeclarator::compose(AstDeclaration const * pDecl)
if (m_declType == FD_simple || m_pComplexPart == NULL)
return pType;
- if (m_pComplexPart->getNodeType() == NT_array)
- {
- AstArray* pArray = (AstArray*)m_pComplexPart;
- pArray->setType(pType);
-
- // insert array type in global scope
- AstScope* pScope = idlc()->scopes()->bottom();
- if ( pScope )
- {
- AstDeclaration* pDecl2 = pScope->addDeclaration(pArray);
- if ( (AstDeclaration*)pArray != pDecl2 )
- {
- delete m_pComplexPart;
- m_pComplexPart = pDecl2;
- return (AstType*)pDecl2;
- }
- }
- return pArray;
- }
-
return NULL; // return through this statement should not happen
}
diff --git a/idlc/source/idlc.cxx b/idlc/source/idlc.cxx
index 7e880261a8ae..363815709e6a 100644
--- a/idlc/source/idlc.cxx
+++ b/idlc/source/idlc.cxx
@@ -24,7 +24,6 @@
#include <idlc/astservice.hxx>
#include <idlc/astconstants.hxx>
#include <idlc/astexception.hxx>
-#include <idlc/astunion.hxx>
#include <idlc/astenum.hxx>
#include <idlc/astinterface.hxx>
#include <idlc/astoperation.hxx>
@@ -61,8 +60,6 @@ AstDeclaration* SAL_CALL scopeAsDecl(AstScope* pScope)
return (AstOperation*)(pScope);
case NT_exception:
return (AstException*)(pScope);
- case NT_union:
- return (AstUnion*)(pScope);
case NT_struct:
return (AstStruct*)(pScope);
case NT_enum:
@@ -90,8 +87,6 @@ AstScope* SAL_CALL declAsScope(AstDeclaration* pDecl)
return (AstConstants*)(pDecl);
case NT_exception:
return (AstException*)(pDecl);
- case NT_union:
- return (AstUnion*)(pDecl);
case NT_struct:
return (AstStruct*)(pDecl);
case NT_enum:
diff --git a/idlc/source/parser.y b/idlc/source/parser.y
index b31cabc09e31..e06b967f4225 100644
--- a/idlc/source/parser.y
+++ b/idlc/source/parser.y
@@ -30,7 +30,6 @@
#include <idlc/astexpression.hxx>
#include <idlc/astconstants.hxx>
#include <idlc/astconstant.hxx>
-#include <idlc/astarray.hxx>
#include <idlc/astbasetype.hxx>
#include <idlc/asttypedef.hxx>
#include <idlc/astexception.hxx>
@@ -44,7 +43,6 @@
#include <idlc/astservicemember.hxx>
#include <idlc/astobserves.hxx>
#include <idlc/astneeds.hxx>
-#include <idlc/astunion.hxx>
#include "idlc/aststructinstance.hxx"
@@ -224,7 +222,6 @@ bool includes(AstDeclaration const * type1, AstDeclaration const * type2) {
AstDeclaration const * cdclval;
DeclList * dclsval;
AstExpression* exval; /* expression value */
- ExprList* exlval; /* expression list value */
FeDeclarator* fdval; /* declarator value */
FeDeclList* dlval; /* declarator list value */
FeInheritanceHeader* ihval; /* inheritance header value */
@@ -238,9 +235,6 @@ bool includes(AstDeclaration const * type1, AstDeclaration const * type2) {
double dval; /* double value */
float fval; /* float value */
StringList* slval; /* StringList value */
- LabelList* llval; /* LabelList value */
- AstUnionLabel* lbval; /* union label value */
- AstMember* mval; /* member value */
AttributeExceptions::Part attexcpval;
AttributeExceptions attexcval;
}
@@ -252,11 +246,9 @@ bool includes(AstDeclaration const * type1, AstDeclaration const * type2) {
%token <sval> IDL_IDENTIFIER
%token IDL_ATTRIBUTE
%token IDL_BOUND
-%token IDL_CASE
%token IDL_CONST
%token IDL_CONSTANTS
%token IDL_CONSTRAINED
-%token IDL_DEFAULT
%token IDL_ENUM
%token IDL_EXCEPTION
%token IDL_INTERFACE
@@ -275,10 +267,8 @@ bool includes(AstDeclaration const * type1, AstDeclaration const * type2) {
%token IDL_SEQUENCE
%token IDL_SINGLETON
%token IDL_STRUCT
-%token IDL_SWITCH
%token IDL_TYPEDEF
%token IDL_TRANSIENT
-%token IDL_UNION
%token IDL_ANY
%token IDL_CHAR
@@ -320,11 +310,10 @@ bool includes(AstDeclaration const * type1, AstDeclaration const * type2) {
* These are production names:
*/
%type <dclval> type_dcl
-%type <dclval> array_declarator
%type <dclval> exception_name
-%type <cdclval> array_type constructed_type_spec enum_type op_type_spec
-%type <cdclval> sequence_type_spec simple_type_spec struct_type switch_type_spec
-%type <cdclval> template_type_spec type_spec union_type
+%type <cdclval> constructed_type_spec enum_type op_type_spec
+%type <cdclval> sequence_type_spec simple_type_spec struct_type
+%type <cdclval> type_spec
%type <cdclval> fundamental_type type_arg type_or_parameter
%type <dclsval> opt_raises raises exception_list
%type <attexcpval> opt_attribute_get_raises attribute_get_raises
@@ -342,11 +331,9 @@ bool includes(AstDeclaration const * type1, AstDeclaration const * type2) {
%type <exval> expression const_expr or_expr xor_expr and_expr
%type <exval> add_expr mult_expr unary_expr primary_expr shift_expr
-%type <exval> literal positive_int_expr array_dim
+%type <exval> literal positive_int_expr
-%type <exlval> at_least_one_array_dim array_dims
-
-%type <fdval> declarator simple_declarator complex_declarator
+%type <fdval> declarator
%type <dlval> declarators at_least_one_declarator
%type <ihval> exception_header structure_header interfaceheader
@@ -354,10 +341,6 @@ bool includes(AstDeclaration const * type1, AstDeclaration const * type2) {
%type <ulval> flag_header opt_attrflags opt_attrflag
%type <ulval> direction service_interface_header service_service_header
-%type <llval> case_labels at_least_one_case_label
-%type <lbval> case_label
-%type <mval> element_spec
-
%type <bval> optional_inherited_interface opt_rest opt_service_body
%type <attexcval> opt_attribute_block attribute_block_rest opt_attribute_raises
@@ -741,7 +724,7 @@ attribute :
{
idlc()->setParseState(PS_AttrTypeSeen);
}
- simple_declarator
+ declarator
{
idlc()->setParseState(PS_AttrCompleted);
if (($1 & ~(AF_BOUND | AF_READONLY)) != AF_ATTRIBUTE) {
@@ -2042,7 +2025,6 @@ type_dcl :
}
type_declarator {}
| struct_type {}
- | union_type {}
| enum_type {}
;
@@ -2144,11 +2126,6 @@ declarators :
;
declarator :
- simple_declarator
- | complex_declarator
- ;
-
-simple_declarator :
identifier
{
// For historic reasons, the struct com.sun.star.uno.Uik contains
@@ -2167,88 +2144,6 @@ simple_declarator :
}
;
-complex_declarator :
- array_declarator
- {
- $$ = new FeDeclarator($1->getLocalName(), FeDeclarator::FD_complex, $1);
- }
- ;
-
-array_declarator :
- identifier
- {
- idlc()->setParseState(PS_ArrayIDSeen);
- checkIdentifier($1);
- }
- at_least_one_array_dim
- {
- idlc()->setParseState(PS_ArrayCompleted);
- $$ = new AstArray(*$1, NULL, *$3, idlc()->scopes()->bottom());
- delete $1;
- }
- ;
-
-at_least_one_array_dim :
- array_dim array_dims
- {
- if( $2 )
- {
- $2->push_front($1);
- $$ = $2;
- } else
- {
- ExprList* pList = new ExprList();
- pList->push_back($1);
- $$ = pList;
- }
- }
- ;
-
-array_dims :
- array_dims array_dim
- {
- if( $1 )
- {
- $1->push_back($2);
- $$ = $1;
- } else
- {
- ExprList* pList = new ExprList();
- pList->push_back($2);
- $$ = pList;
- }
- }
- | /* EMPTY */
- {
- $$ = NULL;
- }
- ;
-
-array_dim :
- '['
- {
- idlc()->setParseState(PS_DimSqSeen);
- }
- positive_int_expr
- {
- idlc()->setParseState(PS_DimExprSeen);
- }
- ']'
- {
- idlc()->setParseState(PS_DimQsSeen);
- /*
- * Array dimensions are expressions which must be coerced to
- * positive integers
- */
- if ( !$3 || !$3->coerce(ET_uhyper) )
- {
- idlc()->error()->coercionError($3, ET_uhyper);
- $$ = NULL;
- } else
- $$ = $3;
- }
- ;
-
at_least_one_scoped_name :
scoped_name scoped_names
{
@@ -2344,7 +2239,7 @@ fundamental_type:
{
$$ = idlc()->scopes()->bottom()->lookupPrimitiveType($1);
}
- | template_type_spec
+ | sequence_type_spec
;
opt_type_args:
@@ -2474,48 +2369,11 @@ string_type :
}
;
-template_type_spec :
- sequence_type_spec
- | array_type
- ;
-
constructed_type_spec :
struct_type
- | union_type
| enum_type
;
-array_type :
- simple_type_spec
- {
- idlc()->setParseState(PS_ArrayTypeSeen);
- }
- at_least_one_array_dim
- {
- idlc()->setParseState(PS_ArrayCompleted);
-
- AstScope* pScope = idlc()->scopes()->bottom();
- AstDeclaration* pDecl = NULL;
- AstDeclaration* pArray = NULL;
-
- if ( $1 )
- {
- pArray = new AstArray((AstType*)$1, *$3, idlc()->scopes()->bottom());
- if ( pScope )
- {
- pDecl = pScope->addDeclaration(pArray);
- if ( pArray != pDecl )
- {
- // if array type already defined then use it
- delete pArray;
- pArray = pDecl;
- }
- }
- }
- $$ = pArray;
- }
- ;
-
sequence_type_spec :
IDL_SEQUENCE
{
@@ -2900,303 +2758,6 @@ enumerator :
}
;
-union_type :
- IDL_UNION
- {
- idlc()->setParseState(PS_UnionSeen);
- }
- identifier
- {
- idlc()->setParseState(PS_UnionIDSeen);
- checkIdentifier($3);
- }
- IDL_SWITCH
- {
- idlc()->setParseState(PS_SwitchSeen);
- }
- '('
- {
- idlc()->setParseState(PS_SwitchOpenParSeen);
- }
- switch_type_spec
- {
- idlc()->setParseState(PS_SwitchTypeSeen);
- }
- ')'
- {
- idlc()->setParseState(PS_SwitchCloseParSeen);
-
- AstScope* pScope = idlc()->scopes()->topNonNull();
- AstUnion* pUnion = NULL;
-
- /*
- * Create a node representing a union. Add it to its enclosing
- * scope
- */
- if ( $9 && pScope )
- {
- AstType* pType = (AstType*)$9;
- if ( !pType)
- {
- idlc()->error()->noTypeError($9);
- } else
- {
- pUnion = new AstUnion(*$3, pType, pScope);
- pScope->addDeclaration(pUnion);
- }
- }
- delete $3;
- /*
- * Push the scope of the union on the scopes stack
- */
- idlc()->scopes()->push(pUnion);
- }
- '{'
- {
- idlc()->setParseState(PS_UnionSqSeen);
- }
- at_least_one_case_branch
- {
- idlc()->setParseState(PS_UnionBodySeen);
- }
- '}'
- {
- idlc()->setParseState(PS_UnionQsSeen);
- /* this union is finished, pop its scope from the stack */
- idlc()->scopes()->pop();
- }
- ;
-
-switch_type_spec :
- integer_type
- {
- $$ = idlc()->scopes()->bottom()->lookupPrimitiveType($1);
- }
- | char_type
- {
- $$ = idlc()->scopes()->bottom()->lookupPrimitiveType($1);
- }
- | boolean_type
- {
- $$ = idlc()->scopes()->bottom()->lookupPrimitiveType($1);
- }
- | enum_type
- | scoped_name
- {
- AstScope* pScope = idlc()->scopes()->topNonNull();
- AstBaseType* pBaseType = NULL;
- AstDeclaration const * pDecl = NULL;
- AstTypeDef* pTypeDef = NULL;
- sal_Bool bFound = sal_False;
- /*
- * If the constant's type is a scoped name, it must resolve
- * to a scalar constant type
- */
- if ( pScope && (pDecl = pScope->lookupByName(*$1)) )
- {
- /*
- * Look through typedefs
- */
- while ( !bFound )
- {
- switch (pDecl->getNodeType())
- {
- case NT_enum:
- $$ = pDecl;
- bFound = sal_True;
- break;
- case NT_predefined:
- pBaseType = (AstBaseType*)pDecl;
- if ( pBaseType )
- {
- switch (pBaseType->getExprType())
- {
- case ET_short:
- case ET_ushort:
- case ET_long:
- case ET_ulong:
- case ET_hyper:
- case ET_uhyper:
- case ET_char:
- case ET_byte:
- case ET_boolean:
- $$ = pBaseType;
- bFound = sal_True;
- break;
- default:
- $$ = NULL;
- bFound = sal_True;
- break;
- }
- }
- break;
- case NT_typedef:
- pTypeDef = (AstTypeDef*)pDecl;
- if ( pTypeDef )
- pDecl = pTypeDef->getBaseType();
- break;
- default:
- $$ = NULL;
- bFound = sal_True;
- break;
- }
- }
- } else
- $$ = NULL;
-
- if ($$ == NULL)
- idlc()->error()->lookupError(*$1);
- }
- ;
-
-at_least_one_case_branch : case_branch case_branches ;
-
-case_branches :
- case_branches case_branch
- | /* EMPTY */
- ;
-
-case_branch :
- at_least_one_case_label
- {
- idlc()->setParseState(PS_UnionLabelSeen);
- }
- element_spec
- {
- idlc()->setParseState(PS_UnionElemSeen);
-
- AstScope* pScope = idlc()->scopes()->topNonNull();
- AstUnionLabel* pLabel = NULL;
- AstUnionBranch* pBranch = NULL;
- AstMember* pMember = $3;
-
- /*
- * Create several nodes representing branches of a union.
- * Add them to the enclosing scope (the union scope)
- */
- if ( pScope && $1 && $3 )
- {
- LabelList::iterator iter = $1->begin();
- LabelList::iterator end = $1->end();
- for (;iter != end; iter++)
- {
- pLabel = *iter;
- if ( !pLabel )
- {
- iter++;
- continue;
- }
- pBranch = new AstUnionBranch(pLabel, pMember->getType(),
- pMember->getLocalName(), pScope);
- pScope->addDeclaration(pBranch);
- }
- }
- if ( $1 ) delete($1);
- }
- ;
-
-at_least_one_case_label :
- case_label case_labels
- {
- if ( $2 )
- {
- $2->push_front($1);
- $$ = $2;
- } else
- {
- LabelList* pLabels = new LabelList();
- pLabels->push_back($1);
- $$ = pLabels;
- }
- }
- ;
-
-case_labels :
- case_labels case_label
- {
- if ( $1 )
- {
- $1->push_back($2);
- $$ = $1;
- } else
- {
- LabelList* pLabels = new LabelList();
- pLabels->push_back($2);
- $$ = pLabels;
- }
- }
- | /* EMPTY */
- {
- $$ = NULL;
- }
- ;
-
-case_label :
- IDL_DEFAULT
- {
- idlc()->setParseState(PS_DefaultSeen);
- }
- ':'
- {
- idlc()->setParseState(PS_LabelColonSeen);
- $$ = new AstUnionLabel(UL_default, NULL);
- }
- | IDL_CASE
- {
- idlc()->setParseState(PS_CaseSeen);
- }
- const_expr
- {
- idlc()->setParseState(PS_LabelExprSeen);
- }
- ':'
- {
- idlc()->setParseState(PS_LabelColonSeen);
- $$ = new AstUnionLabel(UL_label, $3);
- }
- ;
-
-element_spec :
- type_spec
- {
- idlc()->setParseState(PS_UnionElemTypeSeen);
- }
- declarator
- {
- idlc()->setParseState(PS_UnionElemDeclSeen);
- }
- ';'
- {
- idlc()->setParseState(PS_UnionElemCompleted);
-
- AstScope* pScope = idlc()->scopes()->topNonNull();
- /*
- * Check for illegal recursive use of type
- */
-// if ( $1 && AST_illegal_recursive_type($1))
-// idlc()->error()->error1(EIDL_RECURSIVE_TYPE, $1);
- /*
- * Create a field in a union branch
- */
- if ( $1 && $3 )
- {
- AstType const * pType = $3->compose($1);
- if ( !pType )
- $$ = NULL;
- else
- $$ = new AstMember(pType, $3->getName(), pScope);
- } else
- $$ = NULL;
-
- if ( $3 ) delete $3;
- }
- | error
- ';'
- {
- $$ = NULL;
- }
- ;
-
identifier:
IDL_IDENTIFIER
| IDL_GET { $$ = new OString("get"); }
diff --git a/idlc/source/scanner.l b/idlc/source/scanner.l
index 7787124d1d2c..f904fb66b839 100644
--- a/idlc/source/scanner.l
+++ b/idlc/source/scanner.l
@@ -37,7 +37,6 @@
class AstExpression;
-class AstArray;
class AstMember;
#include <parser.hxx>
@@ -283,11 +282,9 @@ IDENTIFIER ("_"?({ALPHA}|{DIGIT})+)*
attribute return IDL_ATTRIBUTE;
bound return IDL_BOUND;
-case return IDL_CASE;
const return IDL_CONST;
constants return IDL_CONSTANTS;
constrained return IDL_CONSTRAINED;
-default return IDL_DEFAULT;
enum return IDL_ENUM;
exception return IDL_EXCEPTION;
interface return IDL_INTERFACE;
@@ -306,10 +303,8 @@ service return IDL_SERVICE;
sequence return IDL_SEQUENCE;
singleton return IDL_SINGLETON;
struct return IDL_STRUCT;
-switch return IDL_SWITCH;
transient return IDL_TRANSIENT;
typedef return IDL_TYPEDEF;
-union return IDL_UNION;
any return IDL_ANY;
boolean return IDL_BOOLEAN;
diff --git a/idlc/test/struct.idl b/idlc/test/struct.idl
index a6c53a651d93..6871a5e2deef 100644
--- a/idlc/test/struct.idl
+++ b/idlc/test/struct.idl
@@ -102,12 +102,6 @@ struct TestStruct : BaseStruct
/// a sequence< sequence< long > > member
sequence< sequence< long > > ms2;
- /// a long array member with dimesion 5,10
-// long ms3[5][10];
-
- /// a string array member with dimension 4,8
-// long[5][10] ms4;
-
/// an interface member
XTestBaseTypes ms5;
diff --git a/idlc/test/typelookup.idl b/idlc/test/typelookup.idl
index 47932b0674a9..df2c4763d6d6 100644
--- a/idlc/test/typelookup.idl
+++ b/idlc/test/typelookup.idl
@@ -71,10 +71,6 @@ struct TestStruct : BaseStruct
hyper ms2;
/// a sequence<long> member
sequence< long > ms3;
- /// a long array member with dimesion 5,10
- long ms4[5][10];
- /// a string array member with dimension 4,8
- long[5][10] ms5;
};
}; // test
diff --git a/idlc/test/union.idl b/idlc/test/union.idl
deleted file mode 100644
index e958d68a289d..000000000000
--- a/idlc/test/union.idl
+++ /dev/null
@@ -1,55 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-module idlc
-{
-module test
-{
-
-union UnionTest switch (long) {
- case 1: long x;
- case 2: byte y;
- case 3: string z;
- case 4:
- case 5: short w;
- case 6: long array[ 10 ][ 20 ];
- case 7: sequence<long> seq;
- default: any a;
-};
-
-typedef enum E {
- A,
- B
-} EAlias;
-
-// Union with no default label
-union U2 switch(EAlias) {
- case E::A : long x;
- case E::B : short y;
-};
-
-union U3 switch(char) {
- case 2 : long x;
- case 4 : short y;
-};
-
-};
-};
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */