summaryrefslogtreecommitdiff
path: root/cpp/src/Slice/Parser.cpp
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2003-10-22 00:56:51 +0000
committerMark Spruiell <mes@zeroc.com>2003-10-22 00:56:51 +0000
commitb88eaeca46e1beb3aa045a228d9c0ed7543ee9e7 (patch)
treeb78d298625d784a172db2f270f355ecb3c68c918 /cpp/src/Slice/Parser.cpp
parentadding line number support (diff)
downloadice-b88eaeca46e1beb3aa045a228d9c0ed7543ee9e7.tar.bz2
ice-b88eaeca46e1beb3aa045a228d9c0ed7543ee9e7.tar.xz
ice-b88eaeca46e1beb3aa045a228d9c0ed7543ee9e7.zip
removing bison stuff from Parser.h; adding type() accessor to Enum
Diffstat (limited to 'cpp/src/Slice/Parser.cpp')
-rw-r--r--cpp/src/Slice/Parser.cpp28
1 files changed, 23 insertions, 5 deletions
diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp
index 5b99481a082..bc110a0d4f0 100644
--- a/cpp/src/Slice/Parser.cpp
+++ b/cpp/src/Slice/Parser.cpp
@@ -14,12 +14,13 @@
#include <IceUtil/Functional.h>
#include <Slice/Parser.h>
+#include <Slice/GrammarUtil.h>
using namespace std;
using namespace Slice;
-extern FILE* yyin;
-extern int yydebug;
+extern FILE* slice_in;
+extern int slice_debug;
namespace Slice
{
@@ -3148,6 +3149,13 @@ Slice::Dictionary::Dictionary(const ContainerPtr& container, const string& name,
// Enum
// ----------------------------------------------------------------------
+void
+Slice::Enum::destroy()
+{
+ _enumerators.clear();
+ SyntaxTreeBase::destroy();
+}
+
EnumeratorList
Slice::Enum::getEnumerators()
{
@@ -3158,6 +3166,10 @@ void
Slice::Enum::setEnumerators(const EnumeratorList& ens)
{
_enumerators = ens;
+ for(EnumeratorList::iterator p = _enumerators.begin(); p != _enumerators.end(); ++p)
+ {
+ (*p)->_type = this;
+ }
}
Contained::ContainedType
@@ -3208,6 +3220,12 @@ Slice::Enum::Enum(const ContainerPtr& container, const string& name, bool local)
// Enumerator
// ----------------------------------------------------------------------
+EnumPtr
+Slice::Enumerator::type() const
+{
+ return _type;
+}
+
Contained::ContainedType
Slice::Enumerator::containedType() const
{
@@ -4315,7 +4333,7 @@ Slice::Unit::includeFiles() const
int
Slice::Unit::parse(FILE* file, bool debug)
{
- yydebug = debug ? 1 : 0;
+ slice_debug = debug ? 1 : 0;
assert(!Slice::unit);
Slice::unit = this;
@@ -4327,8 +4345,8 @@ Slice::Unit::parse(FILE* file, bool debug)
_topLevelFile = "";
pushContainer(this);
- yyin = file;
- int status = yyparse();
+ slice_in = file;
+ int status = slice_parse();
if(_errors)
{
status = EXIT_FAILURE;