summaryrefslogtreecommitdiff
path: root/cpp/src/Slice/Parser.cpp
diff options
context:
space:
mode:
authorMarc Laukien <marc@zeroc.com>2001-09-19 04:34:00 +0000
committerMarc Laukien <marc@zeroc.com>2001-09-19 04:34:00 +0000
commitdc4709557bdda23892237a6301fff159bc1bd452 (patch)
tree043f95608acad51e1e18d7dad472e9ee559cee64 /cpp/src/Slice/Parser.cpp
parentfixes (diff)
downloadice-dc4709557bdda23892237a6301fff159bc1bd452.tar.bz2
ice-dc4709557bdda23892237a6301fff159bc1bd452.tar.xz
ice-dc4709557bdda23892237a6301fff159bc1bd452.zip
slice2docbook fixes, Evictor for Freeze
Diffstat (limited to 'cpp/src/Slice/Parser.cpp')
-rw-r--r--cpp/src/Slice/Parser.cpp92
1 files changed, 85 insertions, 7 deletions
diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp
index 5e187eca9be..c2580ba2e78 100644
--- a/cpp/src/Slice/Parser.cpp
+++ b/cpp/src/Slice/Parser.cpp
@@ -11,6 +11,16 @@
#include <IceUtil/Functional.h>
#include <Slice/Parser.h>
+//
+// Stupid Visual C++ defines min and max as macros :-(
+//
+#ifdef min
+# undef min
+#endif
+#ifdef max
+# undef max
+#endif
+
using namespace std;
using namespace Slice;
@@ -109,6 +119,12 @@ Slice::Contained::comment()
return _comment;
}
+string
+Slice::Contained::file()
+{
+ return _file;
+}
+
Slice::Contained::Contained(const ContainerPtr& container, const string& name) :
SyntaxTreeBase(container->unit()),
_container(container),
@@ -123,6 +139,7 @@ Slice::Contained::Contained(const ContainerPtr& container, const string& name) :
assert(_unit);
_unit->addContent(this);
_comment = _unit->currentComment();
+ _file = _unit->currentFile();
}
bool
@@ -133,13 +150,59 @@ Slice::operator<(Contained& l, Contained& r)
return static_cast<int>(l.containedType()) < static_cast<int>(r.containedType());
}
- return l.scoped() < r.scoped();
+ if(l.scoped() < r.scoped())
+ {
+ return true;
+ }
+ else if(l.scoped() != r.scoped())
+ {
+ return false;
+ }
+
+/*
+ if(l.comment() < r.comment())
+ {
+ return true;
+ }
+ else if(l.comment() != r.comment())
+ {
+ return false;
+ }
+
+ if(l.file() < r.file())
+ {
+ return true;
+ }
+ else if(l.file() != r.file())
+ {
+ return false;
+ }
+*/
+
+ return false;
}
bool
Slice::operator==(Contained& l, Contained& r)
{
- return l.scoped() == r.scoped();
+ if(l.scoped() != r.scoped())
+ {
+ return false;
+ }
+
+/*
+ if(l.comment() != r.comment())
+ {
+ return false;
+ }
+
+ if(l.file() != r.file())
+ {
+ return false;
+ }
+*/
+
+ return true;
}
// ----------------------------------------------------------------------
@@ -200,6 +263,7 @@ Slice::Container::createClassDef(const string& name, bool local, bool intf, cons
{
if (_unit->ignRedefs())
{
+ def->updateIncludeLevel();
return def;
}
@@ -463,7 +527,7 @@ Slice::Container::createEnum(const string& name, const StringList& enumerators)
}
EnumeratorPtr
-Slice::Container::createEnumerator(const std::string& name)
+Slice::Container::createEnumerator(const string& name)
{
ContainedList matches = _unit->findContents(thisScope() + name);
if (!matches.empty())
@@ -769,6 +833,12 @@ Slice::Container::includeLevel()
return _includeLevel;
}
+void
+Slice::Container::updateIncludeLevel()
+{
+ _includeLevel = min(_includeLevel, _unit->currentIncludeLevel());
+}
+
bool
Slice::Container::hasProxies()
{
@@ -898,6 +968,8 @@ Slice::Container::mergeModules()
mod1->_comment.swap(mod2->_comment);
}
+ mod1->_includeLevel = min(mod1->_includeLevel, mod2->_includeLevel);
+
_unit->removeContent(*q);
q = _contents.erase(q);
}
@@ -1744,7 +1816,7 @@ Slice::Unit::ignRedefs()
}
void
-Slice::Unit::setComment(const std::string& comment)
+Slice::Unit::setComment(const string& comment)
{
_currentComment = "";
@@ -1762,7 +1834,7 @@ Slice::Unit::setComment(const std::string& comment)
}
}
-std::string
+string
Slice::Unit::currentComment()
{
string comment;
@@ -1770,6 +1842,12 @@ Slice::Unit::currentComment()
return comment;
}
+string
+Slice::Unit::currentFile()
+{
+ return _currentFile;
+}
+
void
Slice::Unit::nextLine()
{
@@ -1968,8 +2046,8 @@ Slice::Unit::parse(FILE* file, bool debug)
_currentComment = "";
_currentLine = 1;
_currentIncludeLevel = 0;
- _currentFile = "<standard input>";
- _topLevelFile = _currentFile;
+ _currentFile.clear();
+ _topLevelFile.clear();
_includeFiles.clear();
pushContainer(this);