Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9fbd528

Browse files
committed
Adopt latest bison's spelling of 'syntax error' rather than 'parse error'
for grammar-detected problems. Revert Makefile hack that kept it lookinglike the pre-bison-1.875 output.
1 parent268313a commit9fbd528

File tree

8 files changed

+47
-47
lines changed

8 files changed

+47
-47
lines changed

‎doc/src/sgml/xfunc.sgml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/xfunc.sgml,v 1.67 2003/04/10 01:22:45 petere Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/xfunc.sgml,v 1.68 2003/05/29 20:40:36 tgl Exp $
33
-->
44

55
<sect1 id="xfunc">
@@ -330,7 +330,7 @@ SELECT (new_emp()).name;
330330

331331
<screen>
332332
SELECT new_emp().name;
333-
ERROR:parser: parse error at or near "."
333+
ERROR:syntax error at or near "."
334334
</screen>
335335
</para>
336336

‎src/backend/parser/Makefile

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# Makefile for parser
44
#
5-
# $Header: /cvsroot/pgsql/src/backend/parser/Makefile,v 1.40 2003/02/10 04:44:45 tgl Exp $
5+
# $Header: /cvsroot/pgsql/src/backend/parser/Makefile,v 1.41 2003/05/29 20:40:36 tgl Exp $
66
#
77
#-------------------------------------------------------------------------
88

@@ -38,17 +38,11 @@ gram.o: $(srcdir)/scan.c
3838

3939
$(srcdir)/gram.c:$(srcdir)/parse.h ;
4040

41-
# The sed hack is so that we can get the same error messages with
42-
# bison 1.875 and later as we did with earlier bisons. Eventually,
43-
# I suppose, we should re-standardize on "syntax error" --- in which
44-
# case flip the sed translation, but don't remove it.
45-
4641
$(srcdir)/parse.h: gram.y
4742
ifdefYACC
4843
$(YACC) -d $(YFLAGS) $<
49-
sed -e 's/"syntax error/"parse error/' <y.tab.c > $(srcdir)/gram.c
44+
mv -fy.tab.c $(srcdir)/gram.c
5045
mv -f y.tab.h $(srcdir)/parse.h
51-
rm -f y.tab.c
5246
else
5347
@$(missing) bison $< $@
5448
endif

‎src/backend/parser/gram.y

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
*
1313
* IDENTIFICATION
14-
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.415 2003/05/28 16:03:57 tgl Exp $
14+
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.416 2003/05/29 20:40:36 tgl Exp $
1515
*
1616
* HISTORY
1717
* AUTHORDATEMAJOR EVENT
@@ -4680,7 +4680,7 @@ table_ref:relation_expr
46804680
* popular demand, but for now let's just implement
46814681
* the spec and see if anyone complains.
46824682
* However, it does seem like a good idea to emit
4683-
* an error message that's better than "parse error".
4683+
* an error message that's better than "syntax error".
46844684
*/
46854685
elog(ERROR,"sub-SELECT in FROM must have an alias"
46864686
"\n\tFor example, FROM (SELECT ...) [AS] foo");

‎src/backend/parser/scan.l

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.105 2003/04/27 20:09:44 tgl Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.106 2003/05/29 20:40:36 tgl Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -581,13 +581,19 @@ yyerror(const char *message)
581581
cursorpos =pg_mbstrlen_with_len(scanbuf, loc - scanbuf) +1;
582582

583583
if (*loc == YY_END_OF_BUFFER_CHAR)
584+
{
585+
/* translator: %s is typically "syntax error" */
584586
ereport(ERROR,
585-
(errmsg("parser:%s at end of input", message),
587+
(errmsg("%s at end of input", message),
586588
errposition(cursorpos)));
589+
}
587590
else
591+
{
592+
/* translator: first %s is typically "syntax error" */
588593
ereport(ERROR,
589-
(errmsg("parser:%s at or near\"%s\"", message, loc),
594+
(errmsg("%s at or near\"%s\"", message, loc),
590595
errposition(cursorpos)));
596+
}
591597
}
592598

593599

‎src/test/regress/expected/errors.out

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ select 1;
2222

2323
-- missing relation name
2424
select;
25-
ERROR:parser: parse error at or near ";" at character 7
25+
ERROR:syntax error at or near ";" at character 7
2626
-- no such relation
2727
select * from nonesuch;
2828
ERROR: Relation "nonesuch" does not exist
2929
-- missing target list
3030
select from pg_database;
31-
ERROR:parser: parse error at or near "from" at character 8
31+
ERROR:syntax error at or near "from" at character 8
3232
-- bad name in target list
3333
select nonesuch from pg_database;
3434
ERROR: Attribute "nonesuch" not found
@@ -40,7 +40,7 @@ select * from pg_database where pg_database.datname = nonesuch;
4040
ERROR: Attribute "nonesuch" not found
4141
-- bad select distinct on syntax, distinct attribute missing
4242
select distinct on (foobar) from pg_database;
43-
ERROR:parser: parse error at or near "from" at character 29
43+
ERROR:syntax error at or near "from" at character 29
4444
-- bad select distinct on syntax, distinct attribute not in target list
4545
select distinct on (foobar) * from pg_database;
4646
ERROR: Attribute "foobar" not found
@@ -49,7 +49,7 @@ ERROR: Attribute "foobar" not found
4949

5050
-- missing relation name (this had better not wildcard!)
5151
delete from;
52-
ERROR:parser: parse error at or near ";" at character 12
52+
ERROR:syntax error at or near ";" at character 12
5353
-- no such relation
5454
delete from nonesuch;
5555
ERROR: Relation "nonesuch" does not exist
@@ -58,7 +58,7 @@ ERROR: Relation "nonesuch" does not exist
5858

5959
-- missing relation name (this had better not wildcard!)
6060
drop table;
61-
ERROR:parser: parse error at or near ";" at character 11
61+
ERROR:syntax error at or near ";" at character 11
6262
-- no such relation
6363
drop table nonesuch;
6464
ERROR: table "nonesuch" does not exist
@@ -68,7 +68,7 @@ ERROR: table "nonesuch" does not exist
6868
-- relation renaming
6969
-- missing relation name
7070
alter table rename;
71-
ERROR:parser: parse error at or near ";" at character 19
71+
ERROR:syntax error at or near ";" at character 19
7272
-- no such relation
7373
alter table nonesuch rename to newnonesuch;
7474
ERROR: Relation "nonesuch" does not exist
@@ -122,10 +122,10 @@ ERROR: Define: "basetype" unspecified
122122

123123
-- missing index name
124124
drop index;
125-
ERROR:parser: parse error at or near ";" at character 11
125+
ERROR:syntax error at or near ";" at character 11
126126
-- bad index name
127127
drop index 314159;
128-
ERROR:parser: parse error at or near "314159" at character 12
128+
ERROR:syntax error at or near "314159" at character 12
129129
-- no such index
130130
drop index nonesuch;
131131
ERROR: index "nonesuch" does not exist
@@ -134,13 +134,13 @@ ERROR: index "nonesuch" does not exist
134134

135135
-- missing aggregate name
136136
drop aggregate;
137-
ERROR:parser: parse error at or near ";" at character 15
137+
ERROR:syntax error at or near ";" at character 15
138138
-- missing aggregate type
139139
drop aggregate newcnt1;
140-
ERROR:parser: parse error at or near ";" at character 23
140+
ERROR:syntax error at or near ";" at character 23
141141
-- bad aggregate name
142142
drop aggregate 314159 (int);
143-
ERROR:parser: parse error at or near "314159" at character 16
143+
ERROR:syntax error at or near "314159" at character 16
144144
-- bad aggregate type
145145
drop aggregate newcnt (nonesuch);
146146
ERROR: Type "nonesuch" does not exist
@@ -155,10 +155,10 @@ ERROR: RemoveAggregate: aggregate newcnt(real) does not exist
155155

156156
-- missing function name
157157
drop function ();
158-
ERROR:parser: parse error at or near "(" at character 15
158+
ERROR:syntax error at or near "(" at character 15
159159
-- bad function name
160160
drop function 314159();
161-
ERROR:parser: parse error at or near "314159" at character 15
161+
ERROR:syntax error at or near "314159" at character 15
162162
-- no such function
163163
drop function nonesuch();
164164
ERROR: RemoveFunction: function nonesuch() does not exist
@@ -167,10 +167,10 @@ ERROR: RemoveFunction: function nonesuch() does not exist
167167

168168
-- missing type name
169169
drop type;
170-
ERROR:parser: parse error at or near ";" at character 10
170+
ERROR:syntax error at or near ";" at character 10
171171
-- bad type name
172172
drop type 314159;
173-
ERROR:parser: parse error at or near "314159" at character 11
173+
ERROR:syntax error at or near "314159" at character 11
174174
-- no such type
175175
drop type nonesuch;
176176
ERROR: Type "nonesuch" does not exist
@@ -179,22 +179,22 @@ ERROR: Type "nonesuch" does not exist
179179

180180
-- missing everything
181181
drop operator;
182-
ERROR:parser: parse error at or near ";" at character 14
182+
ERROR:syntax error at or near ";" at character 14
183183
-- bad operator name
184184
drop operator equals;
185-
ERROR:parser: parse error at or near ";" at character 21
185+
ERROR:syntax error at or near ";" at character 21
186186
-- missing type list
187187
drop operator ===;
188-
ERROR:parser: parse error at or near ";" at character 18
188+
ERROR:syntax error at or near ";" at character 18
189189
-- missing parentheses
190190
drop operator int4, int4;
191-
ERROR:parser: parse error at or near "," at character 19
191+
ERROR:syntax error at or near "," at character 19
192192
-- missing operator name
193193
drop operator (int4, int4);
194-
ERROR:parser: parse error at or near "(" at character 15
194+
ERROR:syntax error at or near "(" at character 15
195195
-- missing type list contents
196196
drop operator === ();
197-
ERROR:parser: parse error at or near ")" at character 20
197+
ERROR:syntax error at or near ")" at character 20
198198
-- no such operator
199199
drop operator === (int4);
200200
ERROR: parser: argument type missing (use NONE for unary operators)
@@ -206,7 +206,7 @@ drop operator = (nonesuch);
206206
ERROR: parser: argument type missing (use NONE for unary operators)
207207
-- no such type1
208208
drop operator = ( , int4);
209-
ERROR:parser: parse error at or near "," at character 19
209+
ERROR:syntax error at or near "," at character 19
210210
-- no such type1
211211
drop operator = (nonesuch, int4);
212212
ERROR: Type "nonesuch" does not exist
@@ -215,28 +215,28 @@ drop operator = (int4, nonesuch);
215215
ERROR: Type "nonesuch" does not exist
216216
-- no such type2
217217
drop operator = (int4, );
218-
ERROR:parser: parse error at or near ")" at character 24
218+
ERROR:syntax error at or near ")" at character 24
219219
--
220220
-- DROP RULE
221221

222222
-- missing rule name
223223
drop rule;
224-
ERROR:parser: parse error at or near ";" at character 10
224+
ERROR:syntax error at or near ";" at character 10
225225
-- bad rule name
226226
drop rule 314159;
227-
ERROR:parser: parse error at or near "314159" at character 11
227+
ERROR:syntax error at or near "314159" at character 11
228228
-- no such rule
229229
drop rule nonesuch on noplace;
230230
ERROR: Relation "noplace" does not exist
231231
-- bad keyword
232232
drop tuple rule nonesuch;
233-
ERROR:parser: parse error at or near "tuple" at character 6
233+
ERROR:syntax error at or near "tuple" at character 6
234234
-- no such rule
235235
drop instance rule nonesuch on noplace;
236-
ERROR:parser: parse error at or near "instance" at character 6
236+
ERROR:syntax error at or near "instance" at character 6
237237
-- no such rule
238238
drop rewrite rule nonesuch;
239-
ERROR:parser: parse error at or near "rewrite" at character 6
239+
ERROR:syntax error at or near "rewrite" at character 6
240240
--
241241
-- Check that division-by-zero is properly caught.
242242
--

‎src/test/regress/expected/strings.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ SELECT 'first line'
1818
' - next line' /* this comment is not allowed here */
1919
' - third line'
2020
AS "Illegal comment within continuation";
21-
ERROR:parser: parse error at or near "' - third line'" at character 75
21+
ERROR:syntax error at or near "' - third line'" at character 75
2222
--
2323
-- test conversions between various string types
2424
-- E021-10 implicit casting among the character data types

‎src/test/regress/output/constraints.source

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ SELECT '' AS four, * FROM DEFAULTEXPR_TBL;
4545
-- syntax errors
4646
-- test for extraneous comma
4747
CREATE TABLE error_tbl (i int DEFAULT (100, ));
48-
ERROR:parser: parse error at or near "," at character 43
48+
ERROR:syntax error at or near "," at character 43
4949
-- this will fail because gram.y uses b_expr not a_expr for defaults,
5050
-- to avoid a shift/reduce conflict that arises from NOT NULL being
5151
-- part of the column definition syntax:
5252
CREATE TABLE error_tbl (b1 bool DEFAULT 1 IN (1, 2));
53-
ERROR:parser: parse error at or near "IN" at character 43
53+
ERROR:syntax error at or near "IN" at character 43
5454
-- this should work, however:
5555
CREATE TABLE error_tbl (b1 bool DEFAULT (1 IN (1, 2)));
5656
DROP TABLE error_tbl;

‎src/test/regress/output/create_function_1.source

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ CREATE FUNCTION test1 (int) RETURNS int LANGUAGE sql
5151
ERROR: return type mismatch in function: declared to return integer, returns "unknown"
5252
CREATE FUNCTION test1 (int) RETURNS int LANGUAGE sql
5353
AS 'not even SQL';
54-
ERROR:parser: parse error at or near "not" at character 1
54+
ERROR:syntax error at or near "not" at character 1
5555
CREATE FUNCTION test1 (int) RETURNS int LANGUAGE sql
5656
AS 'SELECT 1, 2, 3;';
5757
ERROR: function declared to return integer returns multiple columns in final SELECT

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp