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

Reset yy_at_bol in yyless() if yyleng is non-zero. #452

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Reset yy_at_bol in yyless() if yyleng is non-zero.
Fixes a bug where calling yyless() to unput all the chars before a
newline would not reset the beginning of line marker.  Otherwise,
flex won't match rules that start with a caret (^) after calling
yyless() in thise case.  AT&T lex behaves correctly.
  • Loading branch information
millert committed Aug 4, 2020
commit a134c26b44e5bb03c856915e29808d256b73fdbd
3 changes: 3 additions & 0 deletions src/flex.skl
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,9 @@ m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
YY_RESTORE_YY_MORE_OFFSET \
YY_G(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
YY_DO_BEFORE_ACTION; /* set up yytext again */ \
if ( yyleng > 0 ) \
YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
(yytext[yyleng - 1] == '\n'); \
} \
while ( 0 )
#define unput(c) yyunput( c, YY_G(yytext_ptr) M4_YY_CALL_LAST_ARG )
Expand Down