mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
doc: explain why location's "column" are defined vaguely
Suuggested by Frank Heckenbach. <https://lists.gnu.org/r/bug-bison/2022-01/msg00000.html> * doc/bison.texi (Location Type): Explain why location's "column" are defined vaguely. Show tab handling in ltcalc and calc++. * examples/c/bistromathic/parse.y: Show tab handling. * examples/c++/calc++/calc++.test, * examples/c/bistromathic/bistromathic.test: Check tab handling.
This commit is contained in:
@@ -308,14 +308,15 @@ yylex (const char **line, YYSTYPE *yylval, YYLTYPE *yylloc,
|
||||
{
|
||||
int c;
|
||||
|
||||
// Ignore white space, get first nonwhite character.
|
||||
// Get next character, ignore white spaces.
|
||||
do {
|
||||
// Move the first position onto the last.
|
||||
yylloc->first_line = yylloc->last_line;
|
||||
yylloc->first_column = yylloc->last_column;
|
||||
|
||||
yylloc->last_column += 1;
|
||||
c = *((*line)++);
|
||||
// Tab characters go to the next column multiple of 8.
|
||||
yylloc->last_column +=
|
||||
c == '\t' ? 8 - ((yylloc->last_column - 1) & 7) : 1;
|
||||
} while (c == ' ' || c == '\t');
|
||||
|
||||
switch (c)
|
||||
|
||||
Reference in New Issue
Block a user