summaryrefslogtreecommitdiff
path: root/cpp/src/Slice/Parser.cpp
diff options
context:
space:
mode:
authorMarc Laukien <marc@zeroc.com>2001-06-22 21:10:58 +0000
committerMarc Laukien <marc@zeroc.com>2001-06-22 21:10:58 +0000
commit825bd3c03cb9c735d1395a4084b6c49d924761af (patch)
tree9916bc1d92e4d12cc17dfa3c7d95bf5b95929829 /cpp/src/Slice/Parser.cpp
parentmore slice2html (diff)
downloadice-825bd3c03cb9c735d1395a4084b6c49d924761af.tar.bz2
ice-825bd3c03cb9c735d1395a4084b6c49d924761af.tar.xz
ice-825bd3c03cb9c735d1395a4084b6c49d924761af.zip
more slice2html
Diffstat (limited to 'cpp/src/Slice/Parser.cpp')
-rw-r--r--cpp/src/Slice/Parser.cpp40
1 files changed, 39 insertions, 1 deletions
diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp
index f2ba270b012..35af49c2dcc 100644
--- a/cpp/src/Slice/Parser.cpp
+++ b/cpp/src/Slice/Parser.cpp
@@ -142,8 +142,14 @@ Slice::Contained::scope()
return string(scoped_, 0, idx);
}
+string
+Slice::Contained::comment()
+{
+ return comment_;
+}
+
Slice::Contained::Contained(const Container_ptr& container,
- const string& name)
+ const string& name)
: SyntaxTreeBase(container -> parser()),
container_(container),
name_(name)
@@ -153,7 +159,10 @@ Slice::Contained::Contained(const Container_ptr& container,
scoped_ = cont -> scoped();
scoped_ += "::" + name_;
if(parser_)
+ {
parser_ -> addContent(this);
+ comment_ = parser_ -> currentComment();
+ }
}
bool
@@ -503,6 +512,10 @@ Slice::Container::mergeModules()
mod1 -> contents_.splice(mod1 -> contents_.end(),
mod2 -> contents_);
+
+ if(mod1 -> comment_.length() < mod2 -> comment_.length())
+ mod1 -> comment_ = mod2 -> comment_;
+
parser_ -> removeContent(*q);
q = contents_.erase(q);
}
@@ -950,6 +963,31 @@ Slice::Parser::ignRedefs()
}
void
+Slice::Parser::setComment(const std::string& comment)
+{
+ currentComment_.empty();
+
+ string::size_type end = 0;
+ while(true)
+ {
+ string::size_type begin = comment.find_first_not_of(" \t\r\n*", end);
+ if(begin == string::npos)
+ break;
+
+ end = comment.find('\n', begin);
+ currentComment_ += comment.substr(begin, end - begin + 1);
+ }
+}
+
+std::string
+Slice::Parser::currentComment()
+{
+ string comment;
+ comment.swap(currentComment_);
+ return comment;
+}
+
+void
Slice::Parser::nextLine()
{
currentLine_++;