diff options
author | boris <boris@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-08-28 17:39:41 +0000 |
---|---|---|
committer | boris <boris@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-08-28 17:39:41 +0000 |
commit | 6e8e77215371d73e9347a2f0ed25aa8b934643e7 (patch) | |
tree | 6523c9afb8e2fa9036c62967eaacde3619180321 | |
parent | db0a57a90e120cc6421e4e5df6728f7bbe44ce23 (diff) | |
download | ATCD-6e8e77215371d73e9347a2f0ed25aa8b934643e7.tar.gz |
ChangeLogTag: Thu Aug 28 12:30:10 2003 Boris Kolpackov <boris@dre.vanderbilt.edu>
37 files changed, 807 insertions, 148 deletions
diff --git a/TAO/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/HomeExecutor.hpp b/TAO/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/HomeExecutor.hpp index 83944a9a3ab..8ae25f81112 100644 --- a/TAO/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/HomeExecutor.hpp +++ b/TAO/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/HomeExecutor.hpp @@ -31,9 +31,9 @@ namespace CCF HomeExecutor (bool trace, SyntaxTree::ScopePtr& scope) : ScopeBase<SyntaxTree::HomeExecutorPtr> (scope), trace_ (trace), - name_ (""), - implements_ (""), - manages_ ("") + name_ ("::"), //@@ this is dirty + implements_ ("::"), + manages_ ("::") { } @@ -71,7 +71,7 @@ namespace CCF }; virtual bool - test (DeclarationPtr const& d) + test (DeclarationPtr const& d) const throw (IncompatibleType) { std::string type = d->declaration_class (); diff --git a/TAO/CIAO/CCF/CCF/IDL2/LexicalAnalyzer.cpp b/TAO/CIAO/CCF/CCF/IDL2/LexicalAnalyzer.cpp index d2c5242fbf2..a875055ca6b 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/LexicalAnalyzer.cpp +++ b/TAO/CIAO/CCF/CCF/IDL2/LexicalAnalyzer.cpp @@ -19,18 +19,20 @@ namespace CCF { // Keywords (alphabetic order). - keyword_table_.insert ("abstract" ); - keyword_table_.insert ("attribute"); - keyword_table_.insert ("factory" ); - keyword_table_.insert ("in" ); - keyword_table_.insert ("include" ); - keyword_table_.insert ("inout" ); - keyword_table_.insert ("interface"); - keyword_table_.insert ("local" ); - keyword_table_.insert ("module" ); - keyword_table_.insert ("out" ); - keyword_table_.insert ("sinclude" ); - keyword_table_.insert ("supports" ); + keyword_table_.insert ("abstract" ); + keyword_table_.insert ("attribute" ); + keyword_table_.insert ("factory" ); + keyword_table_.insert ("in" ); + keyword_table_.insert ("include" ); + keyword_table_.insert ("inout" ); + keyword_table_.insert ("interface" ); + keyword_table_.insert ("local" ); + keyword_table_.insert ("module" ); + keyword_table_.insert ("out" ); + keyword_table_.insert ("sinclude" ); + keyword_table_.insert ("supports" ); + keyword_table_.insert ("typeid" ); + keyword_table_.insert ("typeprefix"); punctuation_table_.insert (":"); punctuation_table_.insert (","); diff --git a/TAO/CIAO/CCF/CCF/IDL2/Makefile.archive b/TAO/CIAO/CCF/CCF/IDL2/Makefile.archive index 1bbd69556d9..648efd94e18 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/Makefile.archive +++ b/TAO/CIAO/CCF/CCF/IDL2/Makefile.archive @@ -20,6 +20,7 @@ translated_units := SyntaxTree/BuiltIn.o \ SyntaxTree/Module.o \ SyntaxTree/Operation.o \ SyntaxTree/Translation.o \ + SyntaxTree/TypeId.o \ SyntaxTree/ValueType.o translated_units += Traversal/BuiltIn.o \ diff --git a/TAO/CIAO/CCF/CCF/IDL2/Parser.cpp b/TAO/CIAO/CCF/CCF/IDL2/Parser.cpp index de98d944ca2..6a8bcd6e84a 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/Parser.cpp +++ b/TAO/CIAO/CCF/CCF/IDL2/Parser.cpp @@ -32,18 +32,20 @@ namespace CCF error_handler (context, dout), - ABSTRACT ("abstract"), - ATTRIBUTE ("attribute"), - FACTORY ("factory"), - IN ("in"), - INCLUDE ("include"), - INOUT ("inout"), - INTERFACE ("interface"), - LOCAL ("local"), - MODULE ("module"), - OUT ("out"), - SINCLUDE ("sinclude"), - SUPPORTS ("supports"), + ABSTRACT ("abstract"), + ATTRIBUTE ("attribute"), + FACTORY ("factory"), + IN ("in"), + INCLUDE ("include"), + INOUT ("inout"), + INTERFACE ("interface"), + LOCAL ("local"), + MODULE ("module"), + OUT ("out"), + SINCLUDE ("sinclude"), + SUPPORTS ("supports"), + TYPEID ("typeid"), + TYPEPREFIX ("typeprefix"), COLON (":"), COMMA (","), @@ -59,6 +61,21 @@ namespace CCF act_include_begin (f.include (), &SemanticAction::Include::begin), act_include_end (f.include (), &SemanticAction::Include::end), + // TypeId + // + // + act_type_id_begin (f.type_id (), &SemanticAction::TypeId::begin), + act_type_id_end (f.type_id (), &SemanticAction::TypeId::end), + + // TypePrefix + // + // + act_type_prefix_begin (f.type_prefix (), + &SemanticAction::TypePrefix::begin), + + act_type_prefix_end (f.type_prefix (), + &SemanticAction::TypePrefix::end), + // Module // // @@ -148,6 +165,26 @@ namespace CCF | module_decl | unconstrained_interface_decl | extension + | type_id + | type_prefix + ; + + type_id = + TYPEID + >> ( + identifier + >> string_literal + )[act_type_id_begin] + >> SEMI[act_type_id_end] + ; + + type_prefix = + TYPEPREFIX + >> ( + identifier + >> string_literal + )[act_type_prefix_begin] + >> SEMI[act_type_prefix_end] ; abstract_type_decl = diff --git a/TAO/CIAO/CCF/CCF/IDL2/Parser.hpp b/TAO/CIAO/CCF/CCF/IDL2/Parser.hpp index 6382f2a8c17..aa74109512b 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/Parser.hpp +++ b/TAO/CIAO/CCF/CCF/IDL2/Parser.hpp @@ -311,6 +311,8 @@ namespace CCF KeywordParser OUT; KeywordParser SINCLUDE; KeywordParser SUPPORTS; + KeywordParser TYPEID; + KeywordParser TYPEPREFIX; // Punctuation parsers (alphabetic group order). PunctuationParser COLON; @@ -342,6 +344,9 @@ namespace CCF Rule include_decl; Rule system_include_decl; + Rule type_id; + Rule type_prefix; + Rule module_decl; Rule abstract_type_decl; @@ -384,18 +389,40 @@ namespace CCF NoArgAction<SemanticAction::Scope> ScopeAction; - // // Include // + // OneArgAction<StringLiteralPtr, SemanticAction::Include> act_include_begin; NoArgAction<SemanticAction::Include> act_include_end; + // TypeId + // + // + TwoArgAction<IdentifierPtr, + StringLiteralPtr, + SemanticAction::TypeId> + act_type_id_begin; + + NoArgAction<SemanticAction::TypeId> + act_type_id_end; + + // TypePrefix // + // + TwoArgAction<IdentifierPtr, + StringLiteralPtr, + SemanticAction::TypePrefix> + act_type_prefix_begin; + + NoArgAction<SemanticAction::TypePrefix> + act_type_prefix_end; + // Module // + // OneArgAction<SimpleIdentifierPtr, SemanticAction::Module> act_module_begin; @@ -409,9 +436,9 @@ namespace CCF NoArgAction<SemanticAction::Module> act_module_end; - // // Interface // + // OneArgAction<SimpleIdentifierPtr, SemanticAction::Interface> act_abstract_interface_begin; @@ -434,18 +461,18 @@ namespace CCF NoArgAction<SemanticAction::Interface> act_interface_end; - // // Attribute // + // OneArgAction<IdentifierPtr, SemanticAction::Attribute> act_attribute_type; OneArgAction<SimpleIdentifierPtr, SemanticAction::Attribute> act_attribute_name; - // // Operation // + // TwoArgAction<IdentifierPtr, SimpleIdentifierPtr, SemanticAction::Operation> diff --git a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction.hpp b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction.hpp index 8d0bc93e8d4..28132ae8147 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction.hpp +++ b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction.hpp @@ -5,9 +5,10 @@ #ifndef CCF_IDL2_SEMANTIC_ACTION_HPP #define CCF_IDL2_SEMANTIC_ACTION_HPP +#include "CCF/IDL2/SemanticAction/Include.hpp" +#include "CCF/IDL2/SemanticAction/TypeId.hpp" #include "CCF/IDL2/SemanticAction/Elements.hpp" #include "CCF/IDL2/SemanticAction/Attribute.hpp" -#include "CCF/IDL2/SemanticAction/Include.hpp" #include "CCF/IDL2/SemanticAction/Interface.hpp" #include "CCF/IDL2/SemanticAction/Module.hpp" #include "CCF/IDL2/SemanticAction/Operation.hpp" diff --git a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Factory.hpp b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Factory.hpp index 65ec9eb2b3a..6d566d6dd3b 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Factory.hpp +++ b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Factory.hpp @@ -16,6 +16,8 @@ namespace CCF class Interface; class Attribute; class Operation; + class TypeId; + class TypePrefix; // // @@ -29,6 +31,12 @@ namespace CCF virtual Include& include () = 0; + virtual TypeId& + type_id () = 0; + + virtual TypePrefix& + type_prefix () = 0; + virtual Module& module () = 0; diff --git a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Attribute.hpp b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Attribute.hpp index 3c444b12ee1..a619c80146c 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Attribute.hpp +++ b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Attribute.hpp @@ -27,7 +27,7 @@ namespace CCF Attribute (bool trace, SyntaxTree::ScopePtr& current) : trace_ (trace), scope_ (current), - type_ ("") + type_ ("::") //@@ this is dirty { } @@ -44,7 +44,7 @@ namespace CCF struct Predicate : public DeclarationTable::ResolvePredicate { virtual bool - test (DeclarationPtr const& d) throw () + test (DeclarationPtr const& d) const throw () { return d->is_a<TypeDecl> (); } @@ -92,7 +92,7 @@ namespace CCF scope_->insert (a); - type_ = ScopedName (""); + type_ = ScopedName ("::"); } private: diff --git a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Factory.hpp b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Factory.hpp index 80dfcdfcdd4..e6f9d1c56fd 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Factory.hpp +++ b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Factory.hpp @@ -8,6 +8,7 @@ #include "CCF/IDL2/SemanticAction/Factory.hpp" #include "CCF/IDL2/SemanticAction/Impl/Include.hpp" +#include "CCF/IDL2/SemanticAction/Impl/TypeId.hpp" #include "CCF/IDL2/SemanticAction/Impl/Module.hpp" #include "CCF/IDL2/SemanticAction/Impl/Interface.hpp" #include "CCF/IDL2/SemanticAction/Impl/Attribute.hpp" @@ -39,6 +40,8 @@ namespace CCF scope_ (r->scope ()), include_ (trace_, *this, r, scope_), + type_id_ (trace_, scope_), + type_prefix_ (trace_, scope_), module_ (trace_, scope_), interface_ (trace_, scope_), attribute_ (trace_, scope_), @@ -52,6 +55,18 @@ namespace CCF return include_; } + virtual SemanticAction::TypeId& + type_id () + { + return type_id_; + } + + virtual SemanticAction::TypePrefix& + type_prefix () + { + return type_prefix_; + } + virtual SemanticAction::Module& module () { @@ -83,6 +98,8 @@ namespace CCF SyntaxTree::TranslationRegionPtr region_; Include include_; + TypeId type_id_; + TypePrefix type_prefix_; Module module_; Interface interface_; Attribute attribute_; diff --git a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Include.hpp b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Include.hpp index 8c05b52100e..e025fa0865e 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Include.hpp +++ b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Include.hpp @@ -40,7 +40,7 @@ namespace CCF virtual void begin (StringLiteralPtr const& sl) { - if (trace_) cerr << "include \"" << sl << "\"" << endl; + if (trace_) cerr << "include " << sl << endl; /* @@ this code is experimentla and temporarlily disabled diff --git a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Interface.hpp b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Interface.hpp index a05d7acf164..8351d30a837 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Interface.hpp +++ b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Interface.hpp @@ -31,7 +31,7 @@ namespace CCF SyntaxTree::ScopePtr& scope) : ScopeBase<SyntaxTree::InterfaceDeclPtr> (scope), trace_ (trace), - name_ ("") + name_ ("::") //@@ this is dirty { } @@ -84,7 +84,7 @@ namespace CCF }; virtual bool - test (DeclarationPtr const& d) throw (IncompatibleType) + test (DeclarationPtr const& d) const throw (IncompatibleType) { bool passed = false; @@ -215,7 +215,7 @@ namespace CCF push (def); scope_ = def; - name_ = SimpleName (""); //indicate that we are done + name_ = SimpleName ("::"); //indicate that we are done inherits_.clear (); } @@ -233,7 +233,7 @@ namespace CCF if (trace_) cerr << "end" << endl; - if (name_ != SimpleName ("")) + if (name_ != SimpleName ("::")) { InterfaceDeclPtr decl; diff --git a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Operation.hpp b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Operation.hpp index 686d851e8f3..44f8d32d168 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Operation.hpp +++ b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Operation.hpp @@ -32,16 +32,15 @@ namespace CCF { } - bool - lookup_type (SyntaxTree::Name const& name, - SyntaxTree::ScopedName& result) + SyntaxTree::ScopedName + lookup_type (SyntaxTree::Name const& name) { using namespace SyntaxTree; struct Predicate : public DeclarationTable::ResolvePredicate { virtual bool - test (DeclarationPtr const& d) throw () + test (DeclarationPtr const& d) const throw () { return d->is_a<TypeDecl> (); } @@ -49,13 +48,11 @@ namespace CCF try { - result = scope_->table ().resolve ( + return scope_->table ().resolve ( name, scope_->name (), scope_->peek_order (), p); - - return true; } catch (DeclarationTable::NameNotFound const&) { @@ -63,6 +60,7 @@ namespace CCF cerr << "no type with name \'" << name << "\' visible from scope \'" << scope_->name () << "\'" << endl; + throw; } catch (DeclarationTable::PredicateNotMet const&) { @@ -73,9 +71,8 @@ namespace CCF cerr << "using non-type as operation parameter type " << " or return type is illegal" << endl; + throw; } - - return false; } @@ -88,15 +85,18 @@ namespace CCF using namespace SyntaxTree; - ScopedName type_name; - - if (lookup_type (Name (type_id->lexeme ()), type_name)) + try { + ScopedName type_name = lookup_type (Name (type_id->lexeme ())); + operation_ = OperationDeclPtr ( new OperationDecl (SimpleName (name_id->lexeme ()), type_name, scope_)); } + catch (...) + { + } } @@ -111,11 +111,12 @@ namespace CCF using namespace SyntaxTree; - ScopedName type_name (""); + if (operation_ == 0) return; - if (lookup_type (Name (type_id->lexeme ()), type_name) && - operation_ != 0) + try { + ScopedName type_name = lookup_type (Name (type_id->lexeme ())); + OperationParameter::Direction::Value d = OperationParameter::Direction::INOUT; @@ -135,6 +136,9 @@ namespace CCF scope_->table ())); operation_->insert (p); } + catch (...) + { + } } virtual void diff --git a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/TypeId.cpp b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/TypeId.cpp new file mode 100644 index 00000000000..1c14fd4de10 --- /dev/null +++ b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/TypeId.cpp @@ -0,0 +1,18 @@ +// file : CCF/IDL2/SemanticAction/Impl/TypeId.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/IDL2/SemanticAction/Impl/TypeId.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticAction + { + namespace Impl + { + } + } + } +} diff --git a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/TypeId.hpp b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/TypeId.hpp new file mode 100644 index 00000000000..4ae2a09462d --- /dev/null +++ b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/TypeId.hpp @@ -0,0 +1,198 @@ +// file : CCF/IDL2/SemanticAction/Impl/TypeId.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_IDL2_SEMANTIC_ACTION_IMPL_TYPE_ID_HPP +#define CCF_IDL2_SEMANTIC_ACTION_IMPL_TYPE_ID_HPP + +#include "CCF/IDL2/SyntaxTree/TypeId.hpp" + +// These inclusions are needed to ensure that typeprefix is applied to a +// suitable declaration. + +#include "CCF/IDL2/SyntaxTree/Module.hpp" +#include "CCF/IDL2/SyntaxTree/Interface.hpp" +#include "CCF/IDL2/SyntaxTree/ValueType.hpp" + + +#include "CCF/IDL2/SemanticAction/TypeId.hpp" + +#include <sstream> + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticAction + { + namespace Impl + { + // + // + // + class TypeId : public virtual SemanticAction::TypeId + { + public: + virtual + ~TypeId () throw () {} + + TypeId (bool trace, SyntaxTree::ScopePtr& current) + : trace_ (trace), + scope_ (current) + { + } + + virtual void + begin (IdentifierPtr const& d, StringLiteralPtr const& id) + { + if (trace_) cerr << "typeid " << d << " " << id << endl; + + using namespace SyntaxTree; + + Name dn (d->lexeme ()); + + try + { + ScopedName dsn = scope_->table ().resolve ( + dn, + scope_->name (), + scope_->peek_order ()); + + Order order = scope_->create_order (); + + std::ostringstream ostr; + ostr << order; + + SimpleName name (ostr.str ()); + + TypeIdPtr ti ( + new SyntaxTree::TypeId ( + name, + order, + scope_, + dsn, + SyntaxTree::StringLiteral (id->lexeme ()))); + + scope_->insert (ti); + + if (trace_) cerr << "assigned declaration name " << ti->name () + << endl; + } + catch (DeclarationTable::NameNotFound const&) + { + cerr << "error: invalid typeid declaration" << endl; + cerr << "no declaration with name \'" + << dn << "\' visible from scope \'" + << scope_->name () << "\'" << endl; + } + } + + virtual void + end () + { + if (trace_) cerr << "end" << endl; + } + + private: + bool trace_; + SyntaxTree::ScopePtr& scope_; + }; + + + // + // + // + class TypePrefix : public virtual SemanticAction::TypePrefix + { + public: + virtual + ~TypePrefix () throw () {} + + TypePrefix (bool trace, SyntaxTree::ScopePtr& current) + : trace_ (trace), + scope_ (current) + { + } + + virtual void + begin (IdentifierPtr const& d, StringLiteralPtr const& prefix) + { + if (trace_) cerr << "typeprefix " << d << " " << prefix << endl; + + using namespace SyntaxTree; + + Name dn (d->lexeme ()); + + try + { + struct Predicate : public DeclarationTable::ResolvePredicate + { + virtual bool + test (DeclarationPtr const& d) const throw () + { + return + d->is_a<SyntaxTree::Module> () + || d->is_a<SyntaxTree::FileScope> () + || d->is_a<SyntaxTree::InterfaceDecl> () + || d->is_a<SyntaxTree::ValueTypeDecl> (); + } + } p; + + ScopedName dsn = scope_->table ().resolve ( + dn, + scope_->name (), + scope_->peek_order (), + p); + + Order order = scope_->create_order (); + + std::ostringstream ostr; + ostr << order; + + SimpleName name (ostr.str ()); + + TypePrefixPtr tp ( + new SyntaxTree::TypePrefix ( + name, + order, + scope_, + dsn, + SyntaxTree::StringLiteral (prefix->lexeme ()))); + + scope_->insert (tp); + + if (trace_) cerr << "assigned declaration name " << tp->name () + << endl; + } + catch (DeclarationTable::NameNotFound const&) + { + cerr << "error: invalid typeprefix declaration" << endl; + cerr << "no declaration with name \'" + << dn << "\' visible from scope \'" + << scope_->name () << "\'" << endl; + } + catch (DeclarationTable::PredicateNotMet const&) + { + cerr << "error: invalid typeprefix declaration" << endl; + cerr << "no suitable declaration with name \'" + << dn << "\' visible from scope \'" + << scope_->name () << "\'" << endl; + } + } + + virtual void + end () + { + if (trace_) cerr << "end" << endl; + } + + private: + bool trace_; + SyntaxTree::ScopePtr& scope_; + }; + } + } + } +} + +#endif // CCF_IDL2_SEMANTIC_ACTION_IMPL_TYPE_ID_HPP diff --git a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/TypeId.hpp b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/TypeId.hpp new file mode 100644 index 00000000000..83836ef5fc8 --- /dev/null +++ b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/TypeId.hpp @@ -0,0 +1,51 @@ +// file : CCF/IDL2/SemanticAction/TypeId.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_IDL2_SEMANTIC_ACTION_TYPE_ID_HPP +#define CCF_IDL2_SEMANTIC_ACTION_TYPE_ID_HPP + +#include "CCF/IDL2/SemanticAction/Elements.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticAction + { + // + // + // + class TypeId + { + public: + virtual + ~TypeId () throw () {} + + virtual void + begin (IdentifierPtr const& name, StringLiteralPtr const& id) = 0; + + virtual void + end () = 0; + }; + + // + // + // + class TypePrefix + { + public: + virtual + ~TypePrefix () throw () {} + + virtual void + begin (IdentifierPtr const& name, StringLiteralPtr const& prefix) = 0; + + virtual void + end () = 0; + }; + } + } +} + +#endif // CCF_IDL2_SEMANTIC_ACTION_TYPE_ID_HPP diff --git a/TAO/CIAO/CCF/CCF/IDL2/SyntaxTree.hpp b/TAO/CIAO/CCF/CCF/IDL2/SyntaxTree.hpp index 30f84070215..89af73bd1cf 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/SyntaxTree.hpp +++ b/TAO/CIAO/CCF/CCF/IDL2/SyntaxTree.hpp @@ -6,6 +6,7 @@ #define CCF_IDL2_SYNTAX_TREE_HPP #include "CCF/IDL2/SyntaxTree/Elements.hpp" +#include "CCF/IDL2/SyntaxTree/TypeId.hpp" #include "CCF/IDL2/SyntaxTree/BuiltIn.hpp" #include "CCF/IDL2/SyntaxTree/Interface.hpp" #include "CCF/IDL2/SyntaxTree/Module.hpp" diff --git a/TAO/CIAO/CCF/CCF/IDL2/SyntaxTree/Elements.cpp b/TAO/CIAO/CCF/CCF/IDL2/SyntaxTree/Elements.cpp index d71f3d656c4..bfe3418a29d 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/SyntaxTree/Elements.cpp +++ b/TAO/CIAO/CCF/CCF/IDL2/SyntaxTree/Elements.cpp @@ -85,6 +85,19 @@ namespace CCF } Declaration:: + Declaration (SimpleName const& name, + Order const& order, + ScopePtr const& scope) + : order_ (order), + name_ (scope->name (), name), + scope_ (scope->table (), + scope->name (), + scope->order ()) // Hint: scope->scope () may throw + { + type_info (static_type_info ()); + } + + Declaration:: Declaration (ScopedName const& name, Order const& order, DeclarationTable const& table) @@ -186,9 +199,9 @@ namespace CCF resolve (Name const& name, ScopedName const& from, Order const& before, - ResolvePredicate& p) const throw (ResolutionFailure) + ResolvePredicate const& p) const throw (ResolutionFailure) { - ScopedName result (""); + ScopedName result ("::"); //@@ bad. need to recode this function // Check if name is already scoped try @@ -204,7 +217,7 @@ namespace CCF { result = ScopedName (base, name); - //cerr << "*** resolve: considering: " << result << endl; + // cerr << "*** resolve: considering: " << result << endl; IteratorPair pair = lookup (result); @@ -227,7 +240,7 @@ namespace CCF } } } - catch (ScopedName::AtRoot const&) + catch (ScopedName::FileScope const&) { // didn't find anything throw NameNotFound (); diff --git a/TAO/CIAO/CCF/CCF/IDL2/SyntaxTree/Elements.hpp b/TAO/CIAO/CCF/CCF/IDL2/SyntaxTree/Elements.hpp index f37eafa64df..9574ce5ced2 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/SyntaxTree/Elements.hpp +++ b/TAO/CIAO/CCF/CCF/IDL2/SyntaxTree/Elements.hpp @@ -5,10 +5,11 @@ #ifndef CCF_IDL2_SYNTAX_TREE_ELEMENTS_HPP #define CCF_IDL2_SYNTAX_TREE_ELEMENTS_HPP -#include <vector> #include <map> #include <set> +#include <vector> #include <string> +#include <memory> //@@ this should go to .cpp #include <iostream> @@ -16,6 +17,7 @@ #include "CCF/CompilerElements/FileSystem.hpp" #include "CCF/CompilerElements/ReferenceCounting.hpp" #include "CCF/CompilerElements/Introspection.hpp" +#include "CCF/CompilerElements/Context.hpp" namespace CCF { @@ -26,18 +28,27 @@ namespace CCF using ReferenceCounting::StrictPtr; + // Can be scoped or simple. "::" refers to file-scope. // - // Can be scoped or simple. // class Name { public: - Name () : name_ () {} + class InvalidArgument {}; + public: explicit - Name (std::string const& name) + Name (std::string const& name) throw (InvalidArgument) : name_ (name) { + if (name.empty ()) + { + throw InvalidArgument (); + } + else if (name == "::") + { + name_ = ""; + } } bool @@ -55,11 +66,9 @@ namespace CCF bool operator!= (Name const& other) const { - return name_ == other.name_; + return name_ != other.name_; } - - protected: std::string name_; @@ -73,16 +82,15 @@ namespace CCF }; - // + // Simple name (i.e. without "::") or just "::" + // (which denotes a file-scope). // // class SimpleName : public Name { public: - SimpleName () : Name () {} - explicit - SimpleName (std::string const& name) + SimpleName (std::string const& name) throw (InvalidArgument) : Name (name) { //@@ need some checking @@ -106,39 +114,35 @@ namespace CCF return name_ != other.name_; } - private: - std::string - str () const - { - return name_; - } + protected: + + using Name::name_; friend SimpleName operator+ (SimpleName const& s1, std::string const& s2) { - return SimpleName (s1.str () + s2); + return SimpleName (s1.name_ + s2); } friend SimpleName operator+ (std::string const& s1, SimpleName const& s2) { - return SimpleName (s1 + s2.str ()); + + return SimpleName (s1 + s2.name_); } }; - // + // Shuld always start with "::". Can be just "::" which + // means it's a file-scope. // // class ScopedName : public Name { - public: + private: class InconsistentState {}; - class InvalidArgument {}; public: - ScopedName () : Name () {} - explicit ScopedName (std::string const& name) throw (InvalidArgument) : Name (name) @@ -206,32 +210,35 @@ namespace CCF std::string::size_type pos = name_.rfind ("::"); if (pos == std::string::npos) { - if (name_.empty ()) return SimpleName(""); //file scope name - else throw InconsistentState (); + if (name_.empty ()) return SimpleName("::"); //file scope name + else throw InconsistentState (); //@@ this should never happen } return SimpleName(std::string (name_.begin () + pos + 2, name_.end ())); } - class AtRoot {}; + class FileScope {}; ScopedName - scope () const throw (AtRoot) + scope () const throw (FileScope) { std::string::size_type pos = name_.rfind ("::"); if (pos == std::string::npos) { - throw AtRoot (); + throw FileScope (); } - return ScopedName(std::string (name_.begin (), - name_.begin () + pos)); + std::string tmp (name_.begin (), name_.begin () + pos); + + return ScopedName(tmp.empty () ? std::string ("::") : tmp); } Name - in_file_scope () const + in_file_scope () const throw (FileScope) { + if (name_.empty ()) throw FileScope (); + return Name(std::string (name_.begin () + 2, name_.end ())); } @@ -264,7 +271,6 @@ namespace CCF } } } - }; typedef @@ -279,6 +285,34 @@ namespace CCF // // // + class StringLiteral + { + public: + StringLiteral (std::string literal) + : literal_ (literal) + { + } + + std::string + str () const + { + return literal_; + } + + friend std::ostream& + operator << (std::ostream& o, StringLiteral const& lit) + { + return o << '\"' << lit.str () << '\"'; + } + + private: + std::string literal_; + }; + + + // + // + // class Order { public: @@ -369,7 +403,7 @@ namespace CCF i != order.list_.end (); i++) { - if (i != order.list_.begin ()) o << ':'; + if (i != order.list_.begin ()) o << '.'; o << *i; } @@ -417,9 +451,37 @@ namespace CCF return ReferenceCounting::strict_cast<Type>(self); } + // Context + public: + + CompilerElements::Context& + context () + { + if (context_.get () == 0) + { + context_.reset (new CompilerElements::Context); + } + + return *context_; + } + + CompilerElements::Context const& + context () const + { + if (context_.get () == 0) + { + context_.reset (new CompilerElements::Context); + } + + return *context_; + } + public: static Introspection::TypeInfo const& static_type_info (); + + private: + mutable std::auto_ptr<CompilerElements::Context> context_; }; @@ -546,6 +608,10 @@ namespace CCF Declaration (SimpleName const& name, ScopePtr const& scope); + Declaration (SimpleName const& name, + Order const& order, + ScopePtr const& scope); + // This c-tor is here for Declarations that are not in scope // e.g. FileScope Declaration (ScopedName const& name, @@ -708,14 +774,18 @@ namespace CCF struct ResolvePredicate { virtual bool - test (DeclarationPtr const& d) throw (ResolutionFailure) = 0; + test (DeclarationPtr const&) const throw (ResolutionFailure) + { + return true; + } }; ScopedName resolve (Name const& name, ScopedName const& from, Order const& before, - ResolvePredicate& p) const throw (ResolutionFailure); + ResolvePredicate const& p = ResolvePredicate ()) + const throw (ResolutionFailure); private: DeclarationSet decl_set_; diff --git a/TAO/CIAO/CCF/CCF/IDL2/SyntaxTree/Elements.tpp b/TAO/CIAO/CCF/CCF/IDL2/SyntaxTree/Elements.tpp index 1bf6eafd4c1..bc8b9ba131b 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/SyntaxTree/Elements.tpp +++ b/TAO/CIAO/CCF/CCF/IDL2/SyntaxTree/Elements.tpp @@ -50,7 +50,7 @@ namespace CCF DeclarationRef<T, Ptr>:: DeclarationRef (DeclarationTable const& table) : table_ (table), - name_ (""), + name_ ("::"), //@@ this is bad order_ (0), initialized_ (false), with_order_ (false) @@ -80,7 +80,7 @@ namespace CCF } } - + // // DeclarationTable // diff --git a/TAO/CIAO/CCF/CCF/IDL2/SyntaxTree/Makefile.alt b/TAO/CIAO/CCF/CCF/IDL2/SyntaxTree/Makefile.alt index a224f3b0fe1..41d218a4d96 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/SyntaxTree/Makefile.alt +++ b/TAO/CIAO/CCF/CCF/IDL2/SyntaxTree/Makefile.alt @@ -16,6 +16,7 @@ cxx_translation_units := BuiltIn.cpp \ Module.cpp \ Operation.cpp \ Translation.cpp \ + TypeId.cpp \ ValueType.cpp diff --git a/TAO/CIAO/CCF/CCF/IDL2/SyntaxTree/Module.hpp b/TAO/CIAO/CCF/CCF/IDL2/SyntaxTree/Module.hpp index 03c9b468216..003d6d77c14 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/SyntaxTree/Module.hpp +++ b/TAO/CIAO/CCF/CCF/IDL2/SyntaxTree/Module.hpp @@ -13,9 +13,9 @@ namespace CCF { namespace SyntaxTree { - // // Module // + // class Module : public virtual Scope { public: diff --git a/TAO/CIAO/CCF/CCF/IDL2/SyntaxTree/Translation.cpp b/TAO/CIAO/CCF/CCF/IDL2/SyntaxTree/Translation.cpp index f69dc2e7a36..ce37a67bf1c 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/SyntaxTree/Translation.cpp +++ b/TAO/CIAO/CCF/CCF/IDL2/SyntaxTree/Translation.cpp @@ -34,8 +34,8 @@ namespace CCF FileScope:: FileScope (DeclarationTable& table, Order const& order) - : Declaration (ScopedName (""), order, table), - Scope (table, ScopedName (""), order) + : Declaration (ScopedName ("::"), order, table), + Scope (table, ScopedName ("::"), order) { type_info (static_type_info ()); } diff --git a/TAO/CIAO/CCF/CCF/IDL2/SyntaxTree/TypeId.cpp b/TAO/CIAO/CCF/CCF/IDL2/SyntaxTree/TypeId.cpp new file mode 100644 index 00000000000..367462e7f26 --- /dev/null +++ b/TAO/CIAO/CCF/CCF/IDL2/SyntaxTree/TypeId.cpp @@ -0,0 +1,55 @@ +// file : CCF/IDL2/SyntaxTree/TypeId.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/IDL2/SyntaxTree/TypeId.hpp" + +using namespace Introspection; + +namespace CCF +{ + namespace IDL2 + { + namespace SyntaxTree + { + // TypeId + // + // + namespace + { + TypeInfo + typeid_init_ () + { + TypeInfo ti (typeid (TypeId)); + ti.add_base (Access::PUBLIC, true, Node::static_type_info ()); + return ti; + } + + TypeInfo typeid_ (typeid_init_ ()); + } + + TypeInfo const& TypeId:: + static_type_info () { return typeid_; } + + + // Typeprefix + // + // + namespace + { + TypeInfo + typeprefix_init_ () + { + TypeInfo ti (typeid (TypePrefix)); + ti.add_base (Access::PUBLIC, true, Node::static_type_info ()); + return ti; + } + + TypeInfo typeprefix_ (typeprefix_init_ ()); + } + + TypeInfo const& TypePrefix:: + static_type_info () { return typeprefix_; } + } + } +} diff --git a/TAO/CIAO/CCF/CCF/IDL2/SyntaxTree/TypeId.hpp b/TAO/CIAO/CCF/CCF/IDL2/SyntaxTree/TypeId.hpp new file mode 100644 index 00000000000..cba19da10e2 --- /dev/null +++ b/TAO/CIAO/CCF/CCF/IDL2/SyntaxTree/TypeId.hpp @@ -0,0 +1,130 @@ +// file : CCF/IDL2/SyntaxTree/TypeId.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_IDL2_SYNTAX_TREE_TYPE_ID_HPP +#define CCF_IDL2_SYNTAX_TREE_TYPE_ID_HPP + +#include "CCF/IDL2/SyntaxTree/Elements.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace SyntaxTree + { + // + // + // + class TypeId : public virtual Declaration + { + public: + virtual + ~TypeId () throw () {} + + TypeId (SimpleName const& name, + Order const& order, + ScopePtr const& scope, + ScopedName const& declaration, + StringLiteral const& id) + : Declaration (name, order, scope), + declaration_ (declaration), + id_ (id) + { + type_info (static_type_info ()); + } + + public: + ScopedName const& + declaration () const + { + return declaration_; + } + + StringLiteral const& + id () const + { + return id_; + } + + // Runtime declaration type information + public: + virtual std::string + declaration_class () + { + return "typeid"; + } + + public: + static Introspection::TypeInfo const& + static_type_info (); + + private: + ScopedName declaration_; + StringLiteral id_; + }; + + typedef + StrictPtr<TypeId> + TypeIdPtr; + + + // + // + // + class TypePrefix : public virtual Declaration + { + public: + virtual + ~TypePrefix () throw () {} + + TypePrefix (SimpleName const& name, + Order const& order, + ScopePtr const& scope, + ScopedName const& declaration, + StringLiteral const& prefix) + : Declaration (name, order, scope), + declaration_ (declaration), + prefix_ (prefix) + { + type_info (static_type_info ()); + } + + public: + ScopedName const& + declaration () const + { + return declaration_; + } + + StringLiteral const& + prefix () const + { + return prefix_; + } + + // Runtime declaration type information + public: + virtual std::string + declaration_class () + { + return "typeprefix"; + } + + public: + static Introspection::TypeInfo const& + static_type_info (); + + private: + ScopedName declaration_; + StringLiteral prefix_; + }; + + typedef + StrictPtr<TypePrefix> + TypePrefixPtr; + } + } +} + +#endif // CCF_IDL2_SYNTAX_TREE_TYPE_ID_HPP diff --git a/TAO/CIAO/CCF/CCF/IDL2/SyntaxTree/ValueType.hpp b/TAO/CIAO/CCF/CCF/IDL2/SyntaxTree/ValueType.hpp index 4a76622a691..4fd69746124 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/SyntaxTree/ValueType.hpp +++ b/TAO/CIAO/CCF/CCF/IDL2/SyntaxTree/ValueType.hpp @@ -13,8 +13,8 @@ namespace CCF { namespace SyntaxTree { - - // + + // // // class ValueTypeDecl : public virtual TypeDecl diff --git a/TAO/CIAO/CCF/CCF/IDL2/Token.hpp b/TAO/CIAO/CCF/CCF/IDL2/Token.hpp index 54b9f00b2ab..48d27f69805 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/Token.hpp +++ b/TAO/CIAO/CCF/CCF/IDL2/Token.hpp @@ -28,8 +28,15 @@ namespace CCF } public: - virtual ~Token () throw () {} + virtual + ~Token () throw () {} + virtual void + print (std::ostream& o) + { + o << lexeme (); + } + public: std::string lexeme () const @@ -59,7 +66,7 @@ namespace CCF inline std::ostream& operator<< (std::ostream& o, TokenPtr const& t) { - if (t != 0) o << t->lexeme (); + if (t != 0) t->print (o); return o; } @@ -95,8 +102,6 @@ namespace CCF ReferenceCounting::StrictPtr<Keyword> KeywordPtr; - - // // // @@ -132,7 +137,7 @@ namespace CCF typedef ReferenceCounting::StrictPtr<Identifier> IdentifierPtr; - + // // @@ -149,7 +154,7 @@ namespace CCF typedef ReferenceCounting::StrictPtr<SimpleIdentifier> SimpleIdentifierPtr; - + // // @@ -178,6 +183,13 @@ namespace CCF : Token (lexeme, line) { } + + virtual void + print (std::ostream& o) + { + o << '\"' << lexeme () << '\"'; + } + }; typedef diff --git a/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Component.hpp b/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Component.hpp index ebf8504edd1..421fdd9d190 100644 --- a/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Component.hpp +++ b/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Component.hpp @@ -32,8 +32,8 @@ namespace CCF Component (bool trace, SyntaxTree::ScopePtr& scope) : ScopeBase<SyntaxTree::ComponentDeclPtr> (scope), trace_ (trace), - name_ (""), - inherits_ ("") + name_ ("::"), //@@ this is dirty + inherits_ ("::") { } @@ -64,7 +64,7 @@ namespace CCF }; virtual bool - test (DeclarationPtr const& d) + test (DeclarationPtr const& d) const throw (IncompatibleType) { std::string type = d->declaration_class (); @@ -132,7 +132,7 @@ namespace CCF }; virtual bool - test (DeclarationPtr const& d) + test (DeclarationPtr const& d) const throw (IncompatibleType) { std::string type = d->declaration_class (); @@ -194,7 +194,7 @@ namespace CCF ComponentDefPtr def; - if (inherits_ == ScopedName ("")) + if (inherits_ == ScopedName ("::")) { def = ComponentDefPtr (new ComponentDef ( name_, @@ -214,8 +214,8 @@ namespace CCF push (def); scope_ = def; - name_ = SimpleName (""); //indicate that we are done - inherits_ = ScopedName (""); + name_ = SimpleName ("::"); //indicate that we are done + inherits_ = ScopedName ("::"); supports_.clear (); } @@ -232,7 +232,7 @@ namespace CCF using namespace SyntaxTree; - if (name_ != SimpleName ("")) + if (name_ != SimpleName ("::")) { ComponentDeclPtr decl (new ComponentForwardDecl (name_, scope_)); scope_->insert (decl); diff --git a/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Consumes.hpp b/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Consumes.hpp index f69662ebaf7..2e8bbf156ac 100644 --- a/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Consumes.hpp +++ b/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Consumes.hpp @@ -27,7 +27,7 @@ namespace CCF Consumes (bool trace, SyntaxTree::ScopePtr& current) : trace_ (trace), scope_ (current), - type_ ("") + type_ ("::") //@@ this is dirty { } @@ -43,7 +43,7 @@ namespace CCF struct Predicate : public DeclarationTable::ResolvePredicate { virtual bool - test (DeclarationPtr const& d) throw () + test (DeclarationPtr const& d) const throw () { return d->is_a<EventTypeDef> (); } @@ -91,7 +91,7 @@ namespace CCF scope_->insert (d); - type_ = ScopedName (""); + type_ = ScopedName ("::"); } private: diff --git a/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Emits.hpp b/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Emits.hpp index 922e8dc5c04..80f611e00ed 100644 --- a/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Emits.hpp +++ b/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Emits.hpp @@ -27,7 +27,7 @@ namespace CCF Emits (bool trace, SyntaxTree::ScopePtr& current) : trace_ (trace), scope_ (current), - type_ ("") + type_ ("::") //@@ this is dirty { } @@ -43,7 +43,7 @@ namespace CCF struct Predicate : public DeclarationTable::ResolvePredicate { virtual bool - test (DeclarationPtr const& d) throw () + test (DeclarationPtr const& d) const throw () { return d->is_a<EventTypeDef> (); } @@ -91,7 +91,7 @@ namespace CCF scope_->insert (d); - type_ = ScopedName (""); + type_ = ScopedName ("::"); } private: diff --git a/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/EventType.hpp b/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/EventType.hpp index e18e6af8bce..49c006fe1f1 100644 --- a/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/EventType.hpp +++ b/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/EventType.hpp @@ -30,7 +30,7 @@ namespace CCF EventType (bool trace, SyntaxTree::ScopePtr& scope) : ScopeBase<SyntaxTree::EventTypeDeclPtr> (scope), trace_ (trace), - name_ ("") + name_ ("::") //@@ this is dirty { } @@ -62,7 +62,7 @@ namespace CCF push (et); scope_ = et; - name_ = SimpleName (""); //indicate that we are done + name_ = SimpleName ("::"); //indicate that we are done inherits_.clear (); } diff --git a/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Home.hpp b/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Home.hpp index 644e09eee28..4c70811a83b 100644 --- a/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Home.hpp +++ b/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Home.hpp @@ -30,9 +30,9 @@ namespace CCF Home (bool trace, SyntaxTree::ScopePtr& scope) : ScopeBase<SyntaxTree::HomeDefPtr> (scope), trace_ (trace), - name_ (""), - inherits_ (""), - manages_ ("") + name_ ("::"), //@@ this is dirty + inherits_ ("::"), + manages_ ("::") { } @@ -64,7 +64,7 @@ namespace CCF }; virtual bool - test (DeclarationPtr const& d) + test (DeclarationPtr const& d) const throw (IncompatibleType) { std::string type = d->declaration_class (); @@ -134,7 +134,7 @@ namespace CCF }; virtual bool - test (DeclarationPtr const& d) + test (DeclarationPtr const& d) const throw (IncompatibleType) { std::string type = d->declaration_class (); @@ -210,7 +210,7 @@ namespace CCF }; virtual bool - test (DeclarationPtr const& d) + test (DeclarationPtr const& d) const throw (IncompatibleType) { std::string type = d->declaration_class (); @@ -268,7 +268,7 @@ namespace CCF supports_, manages_)); - if (inherits_ == ScopedName ("")) + if (inherits_ == ScopedName ("::")) { def = HomeDefPtr (new HomeDef ( name_, @@ -291,10 +291,10 @@ namespace CCF push (def); scope_ = def; - name_ = SimpleName (""); //indicate that we are done - inherits_ = ScopedName (""); + name_ = SimpleName ("::"); //indicate that we are done + inherits_ = ScopedName ("::"); supports_.clear (); - manages_ = ScopedName (""); + manages_ = ScopedName ("::"); } virtual void @@ -310,7 +310,7 @@ namespace CCF using namespace SyntaxTree; - if (name_ != SimpleName ("")) + if (name_ != SimpleName ("::")) { // this is not supported by spec yet } diff --git a/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/HomeFactory.hpp b/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/HomeFactory.hpp index 4bc1072048c..403c3477283 100644 --- a/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/HomeFactory.hpp +++ b/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/HomeFactory.hpp @@ -68,7 +68,7 @@ namespace CCF struct Predicate : public DeclarationTable::ResolvePredicate { virtual bool - test (DeclarationPtr const& d) throw () + test (DeclarationPtr const& d) const throw () { return d->is_a<TypeDecl> (); } diff --git a/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Include.hpp b/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Include.hpp index d7b0153803a..1557a38ab1c 100644 --- a/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Include.hpp +++ b/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Include.hpp @@ -46,7 +46,7 @@ namespace CCF virtual void begin (StringLiteralPtr const& sl) { - if (trace_) cerr << "include \"" << sl << "\"" << endl; + if (trace_) cerr << "include " << sl << endl; using namespace SyntaxTree; diff --git a/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Provides.hpp b/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Provides.hpp index c31733e671f..bcc25a6f145 100644 --- a/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Provides.hpp +++ b/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Provides.hpp @@ -27,7 +27,7 @@ namespace CCF Provides (bool trace, SyntaxTree::ScopePtr& current) : trace_ (trace), scope_ (current), - type_ ("") + type_ ("::") //@@ this is dirty { } @@ -43,7 +43,7 @@ namespace CCF struct Predicate : public DeclarationTable::ResolvePredicate { virtual bool - test (DeclarationPtr const& d) throw () + test (DeclarationPtr const& d) const throw () { return d->is_a<InterfaceDecl> (); } @@ -91,7 +91,7 @@ namespace CCF scope_->insert (d); - type_ = ScopedName (""); + type_ = ScopedName ("::"); } private: diff --git a/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Publishes.hpp b/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Publishes.hpp index 0698f7b3bb9..158f20a5fb7 100644 --- a/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Publishes.hpp +++ b/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Publishes.hpp @@ -27,7 +27,7 @@ namespace CCF Publishes (bool trace, SyntaxTree::ScopePtr& current) : trace_ (trace), scope_ (current), - type_ ("") + type_ ("::") //@@ this is dirty { } @@ -43,7 +43,7 @@ namespace CCF struct Predicate : public DeclarationTable::ResolvePredicate { virtual bool - test (DeclarationPtr const& d) throw () + test (DeclarationPtr const& d) const throw () { return d->is_a<EventTypeDef> (); } @@ -91,7 +91,7 @@ namespace CCF scope_->insert (d); - type_ = ScopedName (""); + type_ = ScopedName ("::"); } private: diff --git a/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Uses.hpp b/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Uses.hpp index 9ef9c5c97d3..b2093734f92 100644 --- a/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Uses.hpp +++ b/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Uses.hpp @@ -27,7 +27,7 @@ namespace CCF Uses (bool trace, SyntaxTree::ScopePtr& current) : trace_ (trace), scope_ (current), - type_ ("") + type_ ("::") //@@ this is dirty { } @@ -43,7 +43,7 @@ namespace CCF struct Predicate : public DeclarationTable::ResolvePredicate { virtual bool - test (DeclarationPtr const& d) throw () + test (DeclarationPtr const& d) const throw () { return d->is_a<InterfaceDecl> (); } @@ -91,7 +91,7 @@ namespace CCF scope_->insert (d); - type_ = ScopedName (""); + type_ = ScopedName ("::"); } private: diff --git a/TAO/CIAO/ChangeLog b/TAO/CIAO/ChangeLog index 6596928f647..4eb8748de9a 100644 --- a/TAO/CIAO/ChangeLog +++ b/TAO/CIAO/ChangeLog @@ -1,3 +1,16 @@ +Thu Aug 28 12:30:10 2003 Boris Kolpackov <boris@dre.vanderbilt.edu> + + * CCF/CFF/IDL2/SyntaxTree/Elements.*: Made SyntaxTree::Node + capable of holding arbitrary context information (see + SyntaxTree::Node::context ()). Plus some minor architectural + changes. + + * CCF/CFF/IDL2/SyntaxTree/TypeId.* + * CCF/CFF/IDL2/SemanticAction/TypeId.* + * CCF/CFF/IDL2/SemanticAction/Impl/TypeId.* + * CCF/CFF/IDL2/LexicalAnalyzer.* + * CCF/CFF/IDL2/Parser.*: Added support for typeid and typeprefix. + Tue Aug 26 16:59:49 2003 Nanbor Wang <nanbor@cs.wustl.edu> * tools/RTComponentServer/RTConfig_Manager.cpp: @@ -5,7 +18,7 @@ Tue Aug 26 16:59:49 2003 Nanbor Wang <nanbor@cs.wustl.edu> * tools/RTComponentServer/RTServer_Impl.cpp: * tools/RTComponentServer/RTServer_Impl.h: * tools/XML_Helpers/RTConfig_Handlers.cpp: Fixed compilation - problem on Linux. + problem on Linux. Tue Aug 26 10:14:03 2003 Diego Sevilla <dsevilla@ditec.um.es> |