SBSPSS/Utils/Scripter/myparser.cpp

114 lines
2.4 KiB
C++
Raw Normal View History

2000-12-11 23:20:36 +01:00
/*=========================================================================
myparser.cpp
Author: PKG
Created:
Project: Spongebob
Purpose:
Copyright (c) 2000 Climax Development Ltd
===========================================================================*/
/*----------------------------------------------------------------------
Includes
-------- */
2000-12-12 17:29:42 +01:00
#ifndef _PARSER_H
#include "parser.h"
#endif
#ifndef _LEXER_H
#include "lexer.h"
#endif
2000-12-11 23:20:36 +01:00
/* Std Lib
------- */
2000-12-12 17:29:42 +01:00
#include <yacc.h>
2000-12-11 23:20:36 +01:00
/* Data
---- */
/*----------------------------------------------------------------------
Tyepdefs && Defines
------------------- */
/*----------------------------------------------------------------------
Structure defintions
-------------------- */
/*----------------------------------------------------------------------
Function Prototypes
------------------- */
/*----------------------------------------------------------------------
Vars
---- */
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
2000-12-12 17:29:42 +01:00
void myparser::setCurrentLexer(mylexer *_lexer)
{
m_currentLexer=_lexer;
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void myparser::setBaseNode(class CTreeNode *_baseNode)
{
m_baseNode=_baseNode;
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void myparser::yyerror(const char *_text)
{
2000-12-12 21:51:59 +01:00
fprintf(yyparseerr,"PARSER ERROR: %s\n",_text);
// fprintf(yyparseerr," line %d char %d\n",m_currentLexer->getCurrentLine(),m_currentLexer->getCurrentCharOnLine());
2000-12-12 17:29:42 +01:00
m_currentLexer->error();
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
int myparser::yyparse()
{
int ret=YYEXIT_FAILURE;
if(yysetup()==0&&
yywork()==YYEXIT_SUCCESS&&
m_currentLexer->getErrorCount()==0)
{
ret=YYEXIT_SUCCESS;
}
return ret;
}
2000-12-11 23:20:36 +01:00
/*===========================================================================
end */