help-flex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

yacc question, maybe related or very OT


From: Shayne K
Subject: yacc question, maybe related or very OT
Date: Tue, 25 Nov 2003 08:26:33 +0000

Hey everyone

I'm currently writing a parser with Flex and Yacc and I'm trying to find a decent method of implementing functions (ie: I want to be able to store the function locations and then when that function is called, jump to that location and execute that function block).

I was wondering if there is a way to get the current file cursor position of what is being parsed?

In my flex file, I currently have a line that basically looks like this:

"function" {
       printf("debug: current file position: %d\n", ftell(yyin));
        return(FUNCTION);
}

but I don't think this is sufficient enough. Or it is and i'm doing something wrong. I know the yylineno works, but I would rather fseek to the position I want and the yyreset().

And well I could always write my own prescanner but I'm hoping that I won't have to...

Any help would be great

Thanks
Shayne

_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. http://join.msn.com/?page=features/virus&pgmarket=en-ca&RU=http%3a%2f%2fjoin.msn.com%2f%3fpage%3dmisc%2fspecialoffers%26pgmarket%3den-ca





reply via email to

[Prev in Thread] Current Thread [Next in Thread]