[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
About passing parameters to yylex
From: |
Jesus M. Diaz Hernandez |
Subject: |
About passing parameters to yylex |
Date: |
Mon, 17 Dec 2001 15:41:48 -0500 (EST) |
Hi, i'm working with the c++ parser generator genarated by flex, but i
need to pass a parameter to the function yylex(). I follow the steps:
1.- i declare a new prototype for my lexical function and i set the
%option yyclass= to the class i'm defining:
%{
#include "Parser.h"
#undef YY_DECL
#define YY_DECL int Lexer::yylex (YYSTYPE* yylval)
%}
2.- in Parser.h, i define the new lexer class:
...
class Lexer : public yyFlexLexer {
public:
Lexer(istream* arg_yyin = 0, ostream* arg_yyout = 0 );
int yylex(YYSTYPE* yylval);
};
3.- in a .C file i wrote the implementation of the constructor:
(i wrote it on the .y file)
Lexer::Lexer (istream* arg_yyin = 0, ostream* arg_yyout = 0)
: yyFlexLexer(arg_yyin,arg_yyout) {};
then, i get a link error:
parser/sforza.tab.o: In function `Lexer::Lexer(istream *, ostream *)':
/home/jesus/wdir/sforza/sforza.y:1038: undefined reference to `Lexer
virtual table'
That confuses me...if somone can help, i will apreciate it ;)
--
Jesus Miguel Diaz Hdez
__________________________________
Grupo de Redes
Facultad de Matematica y Cibernetica
Universidad de la Habana, Cuba
e-mail:
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- About passing parameters to yylex,
Jesus M. Diaz Hernandez <=