1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-09 06:21:09 +03:00

Adopt latest bison's spelling of 'syntax error' rather than 'parse error'

for grammar-detected problems.  Revert Makefile hack that kept it looking
like the pre-bison-1.875 output.
This commit is contained in:
Tom Lane
2003-05-29 20:40:36 +00:00
parent 268313a95b
commit 9fbd52808e
8 changed files with 47 additions and 47 deletions

View File

@@ -2,7 +2,7 @@
#
# Makefile for parser
#
# $Header: /cvsroot/pgsql/src/backend/parser/Makefile,v 1.40 2003/02/10 04:44:45 tgl Exp $
# $Header: /cvsroot/pgsql/src/backend/parser/Makefile,v 1.41 2003/05/29 20:40:36 tgl Exp $
#
#-------------------------------------------------------------------------
@@ -38,17 +38,11 @@ gram.o: $(srcdir)/scan.c
$(srcdir)/gram.c: $(srcdir)/parse.h ;
# The sed hack is so that we can get the same error messages with
# bison 1.875 and later as we did with earlier bisons. Eventually,
# I suppose, we should re-standardize on "syntax error" --- in which
# case flip the sed translation, but don't remove it.
$(srcdir)/parse.h: gram.y
ifdef YACC
$(YACC) -d $(YFLAGS) $<
sed -e 's/"syntax error/"parse error/' < y.tab.c > $(srcdir)/gram.c
mv -f y.tab.c $(srcdir)/gram.c
mv -f y.tab.h $(srcdir)/parse.h
rm -f y.tab.c
else
@$(missing) bison $< $@
endif

View File

@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.415 2003/05/28 16:03:57 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.416 2003/05/29 20:40:36 tgl Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@@ -4680,7 +4680,7 @@ table_ref: relation_expr
* popular demand, but for now let's just implement
* the spec and see if anyone complains.
* However, it does seem like a good idea to emit
* an error message that's better than "parse error".
* an error message that's better than "syntax error".
*/
elog(ERROR, "sub-SELECT in FROM must have an alias"
"\n\tFor example, FROM (SELECT ...) [AS] foo");

View File

@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.105 2003/04/27 20:09:44 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.106 2003/05/29 20:40:36 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -581,13 +581,19 @@ yyerror(const char *message)
cursorpos = pg_mbstrlen_with_len(scanbuf, loc - scanbuf) + 1;
if (*loc == YY_END_OF_BUFFER_CHAR)
{
/* translator: %s is typically "syntax error" */
ereport(ERROR,
(errmsg("parser: %s at end of input", message),
(errmsg("%s at end of input", message),
errposition(cursorpos)));
}
else
{
/* translator: first %s is typically "syntax error" */
ereport(ERROR,
(errmsg("parser: %s at or near \"%s\"", message, loc),
(errmsg("%s at or near \"%s\"", message, loc),
errposition(cursorpos)));
}
}