]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/TianoTools/Pccts/h/DLexerBase.cpp
Restructuring for better separation of Tool packages.
[mirror_edk2.git] / Tools / Source / TianoTools / Pccts / h / DLexerBase.cpp
diff --git a/Tools/Source/TianoTools/Pccts/h/DLexerBase.cpp b/Tools/Source/TianoTools/Pccts/h/DLexerBase.cpp
deleted file mode 100644 (file)
index b218afc..0000000
+++ /dev/null
@@ -1,302 +0,0 @@
-/* DLGLexerBase.c\r
- *\r
- * SOFTWARE RIGHTS\r
- *\r
- * We reserve no LEGAL rights to the Purdue Compiler Construction Tool\r
- * Set (PCCTS) -- PCCTS is in the public domain.  An individual or\r
- * company may do whatever they wish with source code distributed with\r
- * PCCTS or the code generated by PCCTS, including the incorporation of\r
- * PCCTS, or its output, into commerical software.\r
- *\r
- * We encourage users to develop software with PCCTS.  However, we do ask\r
- * that credit is given to us for developing PCCTS.  By "credit",\r
- * we mean that if you incorporate our source code into one of your\r
- * programs (commercial product, research project, or otherwise) that you\r
- * acknowledge this fact somewhere in the documentation, research report,\r
- * etc...  If you like PCCTS and have developed a nice tool with the\r
- * output, please mention that you developed it using PCCTS.  In\r
- * addition, we ask that this header remain intact in our source code.\r
- * As long as these guidelines are kept, we expect to continue enhancing\r
- * this system and expect to make other tools available as they are\r
- * completed.\r
- *\r
- * ANTLR 1.33\r
- * Terence Parr\r
- * Parr Research Corporation\r
- * with Purdue University and AHPCRC, University of Minnesota\r
- * 1989-2000\r
- */\r
-\r
-#include "pcctscfg.h"\r
-\r
-#include "pccts_stdio.h"\r
-#include "pccts_stdlib.h"\r
-\r
-PCCTS_NAMESPACE_STD\r
-\r
-/* I have to put this here due to C++ limitation\r
- * that you can't have a 'forward' decl for enums.\r
- * I hate C++!!!!!!!!!!!!!!!\r
- */\r
-\r
-// MR1\r
-// MR1  10-Apr-97  133MR1  Prevent use of varying sizes for the\r
-// MR1                         ANTLRTokenType enum\r
-// MR1\r
-\r
-enum ANTLRTokenType { TER_HATES_CPP=0, ITS_UTTER_GARBAGE,              // MR1\r
-                                        WITH_SOME_GOOD_IDEAS=9999};    // MR1\r
-\r
-#define ANTLR_SUPPORT_CODE\r
-\r
-#include "pcctscfg.h"\r
-#include DLEXERBASE_H\r
-#include APARSER_H             // MR23\r
-\r
-DLGLexerBase::\r
-DLGLexerBase(DLGInputStream *in,\r
-            unsigned bufsize,\r
-            int _interactive,\r
-            int _track_columns)\r
-{\r
-       this->_bufsize = bufsize;\r
-       this->_lextext = new DLGChar[_bufsize];\r
-       if ( this->_lextext==NULL ) {\r
-           panic("text buffer is NULL");\r
-       }\r
-       this->_begexpr = this->_endexpr = NULL;\r
-       this->ch = this->bufovf = 0;\r
-       this->nextpos = NULL;\r
-       this->cl = 0;\r
-       this->add_erase = 0;\r
-       this->input = in;\r
-       this->_begcol = 0;\r
-       this->_endcol = 0;\r
-       this->_line = 1;\r
-       this->charfull = 0;\r
-       this->automaton = 0;\r
-       this->token_to_fill = NULL;\r
-       this->interactive = _interactive;\r
-       this->track_columns = _track_columns;\r
-       this->debugLexerFlag = 0;                                       // MR1\r
-       this->parser = NULL;                                            // MR1\r
-    this->lexErrCount=0;                        // MR11\r
-}\r
-\r
-// MR19  THM \r
-\r
-void DLGLexerBase::reset()\r
-{\r
-       this->charfull = 0;\r
-       this->_begcol = 0;\r
-       this->_endcol = 0;\r
-       this->automaton = 0;\r
-       this->_line=1;\r
-       this->lexErrCount=0;\r
-}\r
-\r
-void DLGLexerBase::\r
-setInputStream( DLGInputStream *in )\r
-{\r
-       this->input = in;\r
-       _line = 1;\r
-       charfull = 0;\r
-}\r
-\r
-/* saves dlg state, but not what feeds dlg (such as file position) */\r
-void DLGLexerBase::\r
-saveState(DLGState *state)\r
-{\r
-       state->input = input;\r
-       state->interactive = interactive;\r
-       state->track_columns = track_columns;\r
-       state->auto_num = automaton;\r
-       state->add_erase = add_erase;\r
-       state->lookc = ch;\r
-       state->char_full = charfull;\r
-       state->begcol = _begcol;\r
-       state->endcol = _endcol;\r
-       state->line = _line;\r
-       state->lextext = _lextext;\r
-       state->begexpr = _begexpr;\r
-       state->endexpr = _endexpr;\r
-       state->bufsize = _bufsize;\r
-       state->bufovf = bufovf;\r
-       state->nextpos = nextpos;\r
-       state->class_num = cl;\r
-       state->debugLexerFlag = debugLexerFlag;                         // MR1\r
-       state->parser = parser;                                         // MR1\r
-}\r
-\r
-void DLGLexerBase::\r
-restoreState(DLGState *state)\r
-{\r
-       input = state->input;\r
-       interactive = state->interactive;\r
-       track_columns = state->track_columns;\r
-       automaton = state->auto_num;\r
-       add_erase = state->add_erase;\r
-       ch = state->lookc;\r
-       charfull = state->char_full;\r
-       _begcol = state->begcol;\r
-       _endcol = state->endcol;\r
-       _line = state->line;\r
-       _lextext = state->lextext;\r
-       _begexpr = state->begexpr;\r
-       _endexpr = state->endexpr;\r
-       _bufsize = state->bufsize;\r
-       bufovf = state->bufovf;\r
-       nextpos = state->nextpos;\r
-       cl = state->class_num;\r
-       debugLexerFlag = state->debugLexerFlag;                         // MR1\r
-       parser = state->parser;                                         // MR1\r
-}\r
-\r
-/* erase what is currently in the buffer, and get a new reg. expr */\r
-void DLGLexerBase::\r
-skip()\r
-{\r
-       add_erase = 1;\r
-}\r
-\r
-/* don't erase what is in the lextext buffer, add on to it */\r
-void DLGLexerBase::\r
-more()\r
-{\r
-       add_erase = 2;\r
-}\r
-\r
-/* substitute c for the reg. expr last matched and is in the buffer */\r
-void DLGLexerBase::\r
-replchar(DLGChar c)\r
-{\r
-       /* can't allow overwriting null at end of string */\r
-       if (_begexpr < &_lextext[_bufsize-1]){\r
-               *_begexpr = c;\r
-               *(_begexpr+1) = '\0';\r
-       }\r
-       _endexpr = _begexpr;\r
-       if (c != '\0') {\r
-               nextpos = _begexpr + 1;\r
-       }\r
-       else {\r
-               nextpos = _begexpr;     /* MR30 Zero terminates string. */\r
-       }\r
-}\r
-\r
-/* replace the string s for the reg. expr last matched and in the buffer */\r
-\r
-#ifdef _MSC_VER  // MR23\r
-//Turn off "assignment within conditional expression" warning\r
-#pragma warning(disable : 4706)\r
-#endif\r
-void DLGLexerBase::\r
-replstr(const DLGChar *s) /* MR20 const */\r
-{\r
-       register DLGChar *l= &_lextext[_bufsize -1];\r
-\r
-       nextpos = _begexpr;\r
-       if (s){\r
-               while ((nextpos <= l) && (*(nextpos++) = *(s++))){\r
-                       /* empty */\r
-               }\r
-               /* correct for NULL at end of string */\r
-               nextpos--;\r
-       }\r
-       if ((nextpos <= l) && (*(--s) == 0)){\r
-               bufovf = 0;\r
-       }else{\r
-               bufovf = 1;\r
-       }\r
-       *(nextpos) = '\0';\r
-       _endexpr = nextpos - 1;\r
-}\r
-#ifdef _MSC_VER  // MR23\r
-#pragma warning(default: 4706)\r
-#endif\r
-\r
-void DLGLexerBase::\r
-errstd(const char *s)                               /* MR20 const */\r
-{\r
-        lexErrCount++;                              /* MR11 */\r
-        /* MR23 */ printMessage(stderr,\r
-                "%s near line %d (text was '%s')\n",\r
-                ((s == NULL) ? "Lexical error" : s),\r
-                _line,_lextext);\r
-}\r
-\r
-int DLGLexerBase::\r
-err_in()\r
-{\r
-       /* MR23 */ printMessage(stderr,"No input stream, function, or string\n");\r
-       /* return eof to get out gracefully */\r
-       return EOF;\r
-}\r
-\r
-ANTLRTokenType DLGLexerBase::\r
-erraction()\r
-{\r
-       errstd("invalid token");\r
-       advance();\r
-       skip();\r
-       return (ANTLRTokenType) 0;      // bogus, but satisfies compiler\r
-}\r
-\r
-_ANTLRTokenPtr DLGLexerBase::\r
-getToken()\r
-{\r
-       if ( token_to_fill==NULL ) panic("NULL token_to_fill");\r
-       ANTLRTokenType tt = nextTokenType();\r
-       _ANTLRTokenPtr tk = token_to_fill->makeToken(tt, _lextext,_line);\r
-       return tk;\r
-}\r
-\r
-void DLGLexerBase::\r
-panic(const char *msg)      /* MR20 const */\r
-{\r
-       if (parser)                             //MR23\r
-               parser->panic(msg);     //MR23\r
-       else                                    //MR23\r
-       {\r
-               /* MR23 */ printMessage(stderr, "DLG panic: %s\n", msg);\r
-       //\r
-       //  7-Apr-97 133MR1\r
-       //\r
-               exit(PCCTS_EXIT_FAILURE);                                       // MR1\r
-       }\r
-}\r
-\r
-ANTLRParser * DLGLexerBase::                                           // MR1\r
-setParser(ANTLRParser *p) {                                            // MR1\r
-  ANTLRParser  *oldValue=parser;                                       // MR1\r
-  parser=p;                                                            // MR1\r
-  return oldValue;                                                     // MR1\r
-}                                                                      // MR1\r
-                                                                       // MR1\r
-ANTLRParser * DLGLexerBase::                                           // MR1\r
-getParser() {                                                          // MR1\r
-  return parser;                                                       // MR1\r
-}                                                                      // MR1\r
-                                                                       // MR1\r
-int DLGLexerBase::                                                     // MR1\r
-debugLexer(int newValue) {                                             // MR1\r
-  int  oldValue=debugLexerFlag;                                        // MR1\r
-  debugLexerFlag=newValue;                                             // MR1\r
-  return oldValue;                                                     // MR1\r
-}                                                                      // MR1\r
-\r
-//MR23\r
-int DLGLexerBase::printMessage(FILE* pFile, const char* pFormat, ...)\r
-{\r
-       va_list marker;\r
-       va_start( marker, pFormat );\r
-\r
-       int iRet = 0;\r
-       if (parser)\r
-               parser->printMessageV(pFile, pFormat, marker);\r
-       else\r
-               iRet = vfprintf(pFile, pFormat, marker);\r
-\r
-       va_end( marker );\r
-       return iRet;\r
-}\r