Handle tabs after backslash at end of file

Commit 6fbb25c added support for tabs between a \ and the newline it escapes,
but yy_create_buffer() was not updated to handle tabs.
This commit is contained in:
dbrotz
2019-09-09 12:25:26 -07:00
parent 2e6f5ac679
commit 89eda89838
3 changed files with 10 additions and 2 deletions

View File

@@ -325,8 +325,9 @@ YY_BUFFER_STATE yy_create_buffer(FILE *f)
if (pBuffer->nBufferSize >= 2) {
size_t pos = pBuffer->nBufferSize - 2;
/* Skip spaces */
while (pos > 0 && pBuffer->pBufferStart[pos] == ' ')
/* Skip spaces and tabs */
while (pos > 0 && (pBuffer->pBufferStart[pos] == ' '
|| pBuffer->pBufferStart[pos] == '\t'))
pos--;
if (pBuffer->pBufferStart[pos] == '\\')

View File

@@ -0,0 +1,7 @@
; Test that \ followed by whitespace after a macro invocation at the end of the
; file doesn't cause a segfault.
bar: MACRO
ENDM
foo bar baz\