Hello! I'm using PLY-2.3 to build a C language compiler, and I need to know if there's any way to restart the lineno counter between lexical and syntactic analysis.
What I mean with that is that, first of all, I analyze the source code and show the tokens found by the lexer with lex.token() function. With that I obtain tokens that look like this: LexToken(RBRACE, '}', 22, 485). The problem comes with the syntactic analysis, where I use yacc.parse() function. At this point, when it detects an error I made it print the token that caused it, but the line number isn't the real line number, it doesn't restart the lineno counter between lex.token() and yacc.parse(). For example, in a source code with 20 lines, lex.token() says that line 1 is line 1, but yacc.parse() says that line 1 is line 21... What can I do?? Thanks for your help!! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "ply-hack" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/ply-hack?hl=en -~----------~----~----~----~------~----~------~--~---
