mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-11 13:23:04 +00:00
merge branch 'maint'
* upstream/maint: maint: post-release administrivia version 3.5.3 news: update for 3.5.3 yacc.c: make sure we properly propagated the user's number for error diagnostics: don't crash because of repeated definitions of error style: initialize some struct members diagnostics: beware of zero-width characters diagnostics: be sure to close the styling when lines are too short muscles: fix incorrect decoding of $ code: be robust to reference with invalid tags build: fix typo doc: update recommandation for libtextstyle style: comment changes examples: use consistently the GFDL header for readmes style: remove useless declarations typo: succesful -> successful README: point to tests/bison, and document --trace gnulib: update maint: post-release administrivia
This commit is contained in:
@@ -175,6 +175,8 @@ location_print (location loc, FILE *out)
|
||||
}
|
||||
else
|
||||
{
|
||||
aver (loc.start.file);
|
||||
aver (loc.end.file);
|
||||
int end_col = 0 != loc.end.column ? loc.end.column - 1 : 0;
|
||||
res += fprintf (out, "%s",
|
||||
quotearg_n_style (3, escape_quoting_style, loc.start.file));
|
||||
@@ -317,7 +319,7 @@ caret_getc_internal (mbchar_t *res)
|
||||
|
||||
/* Move CARET_INFO (which has a valid FILE) to the line number LINE.
|
||||
Compute and cache that line's length in CARET_INFO.LINE_LEN.
|
||||
Return whether successful.*/
|
||||
Return whether successful. */
|
||||
static bool
|
||||
caret_set_line (int line)
|
||||
{
|
||||
@@ -423,12 +425,14 @@ location_caret (location loc, const char *style, FILE *out)
|
||||
{
|
||||
/* The last column to highlight. Only the first line of
|
||||
multiline locations are quoted, in which case the ending
|
||||
column is the end of line. Single point locations (with
|
||||
equal boundaries) denote the character that they
|
||||
follow. */
|
||||
int col_end
|
||||
column is the end of line.
|
||||
|
||||
We used to work with byte offsets, and that was much
|
||||
easier. However, we went back to using (visual) columns to
|
||||
support truncating of long lines. */
|
||||
const int col_end
|
||||
= loc.start.line == loc.end.line
|
||||
? loc.end.column + (loc.start.column == loc.end.column)
|
||||
? loc.end.column
|
||||
: caret_info.line_len;
|
||||
/* Quote the file (at most the first line in the case of
|
||||
multiline locations). */
|
||||
@@ -438,24 +442,28 @@ location_caret (location loc, const char *style, FILE *out)
|
||||
expected (maybe the file was changed since the scanner
|
||||
ran), we might reach the end before we actually saw the
|
||||
opening column. */
|
||||
bool opened = false;
|
||||
enum { before, inside, after } state = before;
|
||||
while (!mb_iseof (c) && !mb_iseq (c, '\n'))
|
||||
{
|
||||
if (caret_info.pos.column == loc.start.column)
|
||||
// We might have already opened (and even closed!) the
|
||||
// style and yet have the equality of the columns if we
|
||||
// just saw zero-width characters.
|
||||
if (state == before
|
||||
&& caret_info.pos.column == loc.start.column)
|
||||
{
|
||||
begin_use_class (style, out);
|
||||
opened = true;
|
||||
state = inside;
|
||||
}
|
||||
if (skip < caret_info.pos.column)
|
||||
mb_putc (c, out);
|
||||
boundary_compute (&caret_info.pos, mb_ptr (c), mb_len (c));
|
||||
caret_getc (c);
|
||||
if (opened
|
||||
if (state == inside
|
||||
&& (caret_info.pos.column == col_end
|
||||
|| width < caret_info.pos.column - skip))
|
||||
{
|
||||
end_use_class (style, out);
|
||||
opened = false;
|
||||
state = after;
|
||||
}
|
||||
if (width < caret_info.pos.column - skip)
|
||||
{
|
||||
@@ -463,6 +471,12 @@ location_caret (location loc, const char *style, FILE *out)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (state == inside)
|
||||
{
|
||||
// The line is shorter than expected.
|
||||
end_use_class (style, out);
|
||||
state = after;
|
||||
}
|
||||
putc ('\n', out);
|
||||
}
|
||||
|
||||
|
||||
@@ -42,16 +42,14 @@ typedef struct
|
||||
|
||||
/* If positive, the column (starting at 1) just after the boundary.
|
||||
This is neither a byte count, nor a character count; it is a
|
||||
column count. If this is INT_MAX, the column number has
|
||||
(visual) column count. If this is INT_MAX, the column number has
|
||||
overflowed.
|
||||
|
||||
Meaningless and not displayed if nonpositive.
|
||||
*/
|
||||
Meaningless and not displayed if nonpositive. */
|
||||
int column;
|
||||
|
||||
/* If nonnegative, the byte number (starting at 0) in the current line.
|
||||
Never displayed, used when printing error messages with colors to
|
||||
know where colors start and end. */
|
||||
/* If nonnegative, the byte number (starting at 0) in the current
|
||||
line. Not displayed (unless --trace=location). */
|
||||
int byte;
|
||||
|
||||
} boundary;
|
||||
|
||||
@@ -292,7 +292,6 @@ muscle_location_grow (char const *key, location loc)
|
||||
|
||||
#define COMMON_DECODE(Value) \
|
||||
case '$': \
|
||||
++(Value); aver (*(Value) == '['); \
|
||||
++(Value); aver (*(Value) == ']'); \
|
||||
++(Value); aver (*(Value) == '['); \
|
||||
obstack_sgrow (&muscle_obstack, "$"); \
|
||||
|
||||
@@ -81,7 +81,7 @@ static bool untyped_var_seen;
|
||||
historically almost any character is allowed in a tag. We disallow
|
||||
NUL and newline, as this simplifies our implementation. We allow
|
||||
"->" as a means to dereference a pointer. */
|
||||
tag ([^\0\n>]|->)+
|
||||
tag ([^\0\n>]|->)*[^-]
|
||||
|
||||
/* Zero or more instances of backslash-newline. Following GCC, allow
|
||||
white space between the backslash and the newline. */
|
||||
|
||||
@@ -77,10 +77,12 @@ sym_content_new (symbol *s)
|
||||
res->symbol = s;
|
||||
|
||||
res->type_name = NULL;
|
||||
res->type_loc = empty_loc;
|
||||
for (int i = 0; i < CODE_PROPS_SIZE; ++i)
|
||||
code_props_none_init (&res->props[i]);
|
||||
|
||||
res->number = NUMBER_UNDEFINED;
|
||||
res->prec_loc = empty_loc;
|
||||
res->prec = 0;
|
||||
res->assoc = undef_assoc;
|
||||
res->user_token_number = USER_NUMBER_UNDEFINED;
|
||||
@@ -539,7 +541,10 @@ symbol_class_set (symbol *sym, symbol_class class, location loc, bool declaring)
|
||||
_("previous declaration"));
|
||||
}
|
||||
else
|
||||
s->status = declared;
|
||||
{
|
||||
sym->location = loc;
|
||||
s->status = declared;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -209,10 +209,10 @@ typedef size_t uintptr_t;
|
||||
|
||||
/* Output Str both quoted for M4 (i.e., embed in [[...]]), and escaped
|
||||
for our postprocessing (i.e., escape M4 special characters). If
|
||||
Str is empty (or NULL), output "[]" instead of "[[]]" as it make M4
|
||||
programming easier (m4_ifval can be used).
|
||||
Str is empty (or NULL), output "[]" instead of "[[]]" as it makes
|
||||
M4 programming easier (m4_ifval can be used).
|
||||
|
||||
For instance "[foo]" -> "[[@{foo@}]]", "$$" -> "[[$][$][]]". */
|
||||
For instance "[foo]" -> "[[@{foo@}]]", "$$" -> "[[$][$][]]". */
|
||||
|
||||
# define obstack_quote(Obs, Str) \
|
||||
do { \
|
||||
|
||||
Reference in New Issue
Block a user