12
12
*
13
13
*
14
14
* IDENTIFICATION
15
- * $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.49 2000/01/26 05:58:41 momjian Exp $
15
+ * $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.50 2000/01/27 19:00:39 meskes Exp $
16
16
*
17
17
*-------------------------------------------------------------------------
18
18
*/
@@ -246,7 +246,7 @@ cppline {space}*#(.*\\{line_end})*.*
246
246
errno = 0 ;
247
247
yylval.ival = strtol (literalbuf, &endptr, 2 );
248
248
if (*endptr != ' \0 ' || errno == ERANGE)
249
- yyerror ( " ERROR: Bad binary integer input!" );
249
+ mmerror (ET_ERROR, " Bad binary integer input!" );
250
250
return ICONST;
251
251
}
252
252
<xh >{xhinside } |
@@ -268,7 +268,7 @@ cppline {space}*#(.*\\{line_end})*.*
268
268
errno = 0 ;
269
269
yylval.ival = strtol (literalbuf, &endptr, 16 );
270
270
if (*endptr != ' \0 ' || errno == ERANGE)
271
- yyerror ( " ERROR: Bad hexadecimal integer input" );
271
+ mmerror (ET_ERROR, " Bad hexadecimal integer input" );
272
272
return ICONST;
273
273
}
274
274
@@ -355,7 +355,7 @@ cppline {space}*#(.*\\{line_end})*.*
355
355
errno = 0 ;
356
356
yylval.dval = strtod ((char *)yytext,&endptr);
357
357
if (*endptr != ' \0 ' || errno == ERANGE)
358
- yyerror ( " ERROR: Bad float8 input" );
358
+ mmerror (ET_ERROR, " Bad float8 input" );
359
359
return FCONST;
360
360
}
361
361
yylval.str = mm_strdup ((char *)yytext);
@@ -367,7 +367,7 @@ cppline {space}*#(.*\\{line_end})*.*
367
367
errno = 0 ;
368
368
yylval.dval = strtod ((char *)yytext,&endptr);
369
369
if (*endptr != ' \0 ' || errno == ERANGE)
370
- yyerror ( " ERROR: Bad float input" );
370
+ mmerror (ET_ERROR, " Bad float input" );
371
371
return FCONST;
372
372
}
373
373
<SQL >:{identifier }((" ->" | \. ){identifier })* {
@@ -385,6 +385,13 @@ cppline {space}*#(.*\\{line_end})*.*
385
385
if (isascii ((unsigned char )lower_text[i]) && isupper (lower_text[i]))
386
386
lower_text[i] = tolower (lower_text[i]);
387
387
388
+ if (i >= NAMEDATALEN)
389
+ {
390
+ sprintf (errortext, " Identifier \" %s\" will be truncated to \" %.*s\" " , yytext, NAMEDATALEN-1 , yytext);
391
+ mmerror (ET_WARN, errortext);
392
+ yytext[NAMEDATALEN-1 ] = ' \0 ' ;
393
+ }
394
+
388
395
keyword = ScanKeywordLookup ((char *)lower_text);
389
396
if (keyword != NULL ) {
390
397
return keyword->value ;
@@ -509,10 +516,10 @@ cppline {space}*#(.*\\{line_end})*.*
509
516
510
517
<C ,xskip >{exec_sql }{elif }{space_or_nl }* { /* pop stack */
511
518
if ( preproc_tos == 0 ) {
512
- yyerror ( " ERROR: missing matching 'EXEC SQL IFDEF / EXEC SQL IFNDEF'" );
519
+ mmerror (ET_FATAL, " Missing matching 'EXEC SQL IFDEF / EXEC SQL IFNDEF'" );
513
520
}
514
521
else if ( stacked_if_value[preproc_tos].else_branch ) {
515
- yyerror ( " ERROR: missing 'EXEC SQL ENDIF;'" );
522
+ mmerror (ET_FATAL, " Missing 'EXEC SQL ENDIF;'" );
516
523
}
517
524
else {
518
525
preproc_tos--;
@@ -523,7 +530,7 @@ cppline {space}*#(.*\\{line_end})*.*
523
530
524
531
<C ,xskip >{exec_sql }{else }{space_or_nl }* " ;" { /* only exec sql endif pops the stack, so take care of duplicated 'else' */
525
532
if ( stacked_if_value[preproc_tos].else_branch ) {
526
- yyerror ( " ERROR: duplicated 'EXEC SQL ELSE;'" );
533
+ mmerror (ET_FATAL, " Duplicated 'EXEC SQL ELSE;'" );
527
534
}
528
535
else {
529
536
stacked_if_value[preproc_tos].else_branch = TRUE ;
@@ -541,7 +548,7 @@ cppline {space}*#(.*\\{line_end})*.*
541
548
}
542
549
<C ,xskip >{exec_sql }{endif }{space_or_nl }* " ;" {
543
550
if ( preproc_tos == 0 ) {
544
- yyerror ( " ERROR: unmatched 'EXEC SQL ENDIF;'" );
551
+ mmerror (ET_FATAL, " Unmatched 'EXEC SQL ENDIF;'" );
545
552
}
546
553
else {
547
554
preproc_tos--;
@@ -559,7 +566,7 @@ cppline {space}*#(.*\\{line_end})*.*
559
566
560
567
<xcond >{identifier }{space_or_nl }* " ;" {
561
568
if ( preproc_tos >= MAX_NESTED_IF-1 ) {
562
- yyerror ( " ERROR: too many nested 'EXEC SQL IFDEF' conditions" );
569
+ mmerror (ET_FATAL, " Too many nested 'EXEC SQL IFDEF' conditions" );
563
570
}
564
571
else {
565
572
struct _defines *defptr;
@@ -680,7 +687,7 @@ cppline {space}*#(.*\\{line_end})*.*
680
687
if ( preproc_tos > 0 ) {
681
688
preproc_tos = 0 ;
682
689
683
- yyerror ( " ERROR: missing 'EXEC SQL ENDIF;'" );
690
+ mmerror (ET_FATAL, " Missing 'EXEC SQL ENDIF;'" );
684
691
}
685
692
686
693
if (yy_buffer == NULL )
0 commit comments