This commit is contained in:
parent
124a15101b
commit
5e18b667ef
11 changed files with 218 additions and 230 deletions
|
@ -16,12 +16,21 @@
|
|||
Includes
|
||||
-------- */
|
||||
|
||||
#include "myparser.h"
|
||||
#ifndef _PARSER_H
|
||||
#include "parser.h"
|
||||
#endif
|
||||
|
||||
#ifndef _LEXER_H
|
||||
#include "lexer.h"
|
||||
#endif
|
||||
|
||||
|
||||
/* Std Lib
|
||||
------- */
|
||||
|
||||
#include <yacc.h>
|
||||
|
||||
|
||||
/* Data
|
||||
---- */
|
||||
|
||||
|
@ -47,6 +56,57 @@
|
|||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
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)
|
||||
{
|
||||
fprintf(yyparseerr,"ERROR: %s\n",_text);
|
||||
fprintf(yyparseerr," line %d char %d\n",m_currentLexer->getCurrentLine(),m_currentLexer->getCurrentCharOnLine());
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
/*===========================================================================
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue