summaryrefslogtreecommitdiff
path: root/cpp/src/Slice/GrammarUtil.h
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/GrammarUtil.h
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/GrammarUtil.h')
-rw-r--r--cpp/src/Slice/GrammarUtil.h30
1 files changed, 27 insertions, 3 deletions
diff --git a/cpp/src/Slice/GrammarUtil.h b/cpp/src/Slice/GrammarUtil.h
index ea89bacd7bb..685475b74aa 100644
--- a/cpp/src/Slice/GrammarUtil.h
+++ b/cpp/src/Slice/GrammarUtil.h
@@ -12,11 +12,10 @@
//
// **********************************************************************
-#ifndef SLICE_GRAMMER_UTIL_H
-#define SLICE_GRAMMER_UTIL_H
+#ifndef SLICE_GRAMMAR_UTIL_H
+#define SLICE_GRAMMAR_UTIL_H
#include <Slice/Parser.h>
-#include <map>
namespace Slice
{
@@ -179,4 +178,29 @@ public:
}
+//
+// Stuff for flex and bison
+//
+
+#define YYSTYPE Slice::GrammarBasePtr
+#define YY_DECL int slice_lex(YYSTYPE* yylvalp)
+YY_DECL;
+int slice_parse();
+
+//
+// I must set the initial stack depth to the maximum stack depth to
+// disable bison stack resizing. The bison stack resizing routines use
+// simple malloc/alloc/memcpy calls, which do not work for the
+// YYSTYPE, since YYSTYPE is a C++ type, with constructor, destructor,
+// assignment operator, etc.
+//
+#define YYMAXDEPTH 20000 // 20000 should suffice. Bison default is 10000 as maximum.
+#define YYINITDEPTH YYMAXDEPTH // Initial depth is set to max depth, for the reasons described above.
+
+//
+// Newer bison versions allow to disable stack resizing by defining
+// yyoverflow.
+//
+#define yyoverflow(a, b, c, d, e, f) yyerror(a)
+
#endif