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

Commit2efb8e8

Browse files
committed
Code review for 'at character n' patch --- point at proper end of
a token scanned by multiple lex rules.
1 parent2c6b34d commit2efb8e8

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

‎src/backend/parser/scan.l‎

Lines changed: 8 additions & 7 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.99 2002/08/17 13:06:50 momjian Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.100 2002/08/18 03:35:08 tgl Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -582,12 +582,13 @@ other.
582582
void
583583
yyerror(constchar *message)
584584
{
585-
if(yyleng ==1 && *yytext == YY_END_OF_BUFFER_CHAR)
586-
elog(ERROR,"parser: %s at end of input",message);
587-
else
588-
elog(ERROR,"parser: %s at or near\"%s\" at character %i",
589-
message,token_start ? token_start : yytext,
590-
(unsignedint)(yytext - scanbuf +1));
585+
constchar *loc = token_start ? token_start : yytext;
586+
587+
if (*loc == YY_END_OF_BUFFER_CHAR)
588+
elog(ERROR,"parser: %s at end of input", message);
589+
else
590+
elog(ERROR,"parser: %s at or near\"%s\" at character %d",
591+
message, loc, (loc - scanbuf +1));
591592
}
592593

593594

‎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 character89
21+
ERROR: parser: parse error at or near "' - third line'" at character75
2222
--
2323
-- test conversions between various string types
2424
-- E021-10 implicit casting among the character data types

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp