Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reentrant lexer: YY_LESS_LINENO taking care of yycolumn #82

Open
jannick0 opened this issue Sep 14, 2016 · 0 comments
Open

reentrant lexer: YY_LESS_LINENO taking care of yycolumn #82

jannick0 opened this issue Sep 14, 2016 · 0 comments
Milestone

Comments

@jannick0
Copy link
Contributor

For a reentrant lexer YY_CURRENT_BUFFER_LVALUE contains as members the current line number, but also the current column number. It would be great if the macro YY_LESS_LINENO could take care of yycolumn, too.
For now I am currently using the snippit below in the .l footer as a workaround which might be a starting point for a patch supposedly to flex.skl:

--- YY_LESS_LINENO_v0.c
+++ YY_LESS_LINENO_v1.c
 #undef YY_LESS_LINENO
 #define  YY_LESS_LINENO(n) \
             do { \
                 int yyl;\
-                for ( yyl = n; yyl < yyleng; ++yyl )\
-                    if ( yytext[yyl] == '\n' )\
-                        --yylineno;\
+                for ( yyl = n; yyl < yyleng; ++yyl ){\
+                    yycolumn--; \
+                    if ( yytext[yyl] == '\n' ){\
+                        --yylineno;yycolumn=0;}\
+                }\
             }while(0)

Thanks,
J.

@westes westes modified the milestone: 2.6.5 Feb 10, 2017
@westes westes modified the milestones: 2.6.5, 2.6.6 Sep 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants