1212 *
1313 *
1414 * 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 $
1616 *
1717 *-------------------------------------------------------------------------
1818*/
@@ -246,7 +246,7 @@ cppline{space}*#(.*\\{line_end})*.*
246246errno =0 ;
247247yylval.ival =strtol (literalbuf, &endptr,2 );
248248if (*endptr !=' \0 ' || errno == ERANGE)
249- yyerror ( " ERROR: Bad binary integer input!" );
249+ mmerror (ET_ERROR, " Bad binary integer input!" );
250250return ICONST;
251251}
252252<xh >{xhinside }|
@@ -268,7 +268,7 @@ cppline{space}*#(.*\\{line_end})*.*
268268errno =0 ;
269269yylval.ival =strtol (literalbuf, &endptr,16 );
270270if (*endptr !=' \0 ' || errno == ERANGE)
271- yyerror ( " ERROR: Bad hexadecimal integer input" );
271+ mmerror (ET_ERROR, " Bad hexadecimal integer input" );
272272return ICONST;
273273}
274274
@@ -355,7 +355,7 @@ cppline{space}*#(.*\\{line_end})*.*
355355errno =0 ;
356356yylval.dval =strtod ((char *)yytext,&endptr);
357357if (*endptr !=' \0 ' || errno == ERANGE)
358- yyerror ( " ERROR: Bad float8 input" );
358+ mmerror (ET_ERROR, " Bad float8 input" );
359359return FCONST;
360360}
361361yylval.str =mm_strdup ((char *)yytext);
@@ -367,7 +367,7 @@ cppline{space}*#(.*\\{line_end})*.*
367367errno =0 ;
368368yylval.dval =strtod ((char *)yytext,&endptr);
369369if (*endptr !=' \0 ' || errno == ERANGE)
370- yyerror ( " ERROR: Bad float input" );
370+ mmerror (ET_ERROR, " Bad float input" );
371371return FCONST;
372372}
373373<SQL >:{identifier }((" ->" | \. ){identifier })* {
@@ -385,6 +385,13 @@ cppline{space}*#(.*\\{line_end})*.*
385385if (isascii ((unsigned char )lower_text[i]) &&isupper (lower_text[i]))
386386lower_text[i] =tolower (lower_text[i]);
387387
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+
388395keyword =ScanKeywordLookup ((char *)lower_text);
389396if (keyword !=NULL ) {
390397return keyword->value ;
@@ -509,10 +516,10 @@ cppline{space}*#(.*\\{line_end})*.*
509516
510517<C ,xskip >{exec_sql }{elif }{space_or_nl }* {/* pop stack */
511518if ( 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'" );
513520}
514521else if ( stacked_if_value[preproc_tos].else_branch ) {
515- yyerror ( " ERROR: missing 'EXEC SQL ENDIF;'" );
522+ mmerror (ET_FATAL, " Missing 'EXEC SQL ENDIF;'" );
516523}
517524else {
518525 preproc_tos--;
@@ -523,7 +530,7 @@ cppline{space}*#(.*\\{line_end})*.*
523530
524531<C ,xskip >{exec_sql }{else }{space_or_nl }* " ;" {/* only exec sql endif pops the stack, so take care of duplicated 'else' */
525532if ( stacked_if_value[preproc_tos].else_branch ) {
526- yyerror ( " ERROR: duplicated 'EXEC SQL ELSE;'" );
533+ mmerror (ET_FATAL, " Duplicated 'EXEC SQL ELSE;'" );
527534}
528535else {
529536 stacked_if_value[preproc_tos].else_branch =TRUE ;
@@ -541,7 +548,7 @@ cppline{space}*#(.*\\{line_end})*.*
541548}
542549<C ,xskip >{exec_sql }{endif }{space_or_nl }* " ;" {
543550if ( preproc_tos ==0 ) {
544- yyerror ( " ERROR: unmatched 'EXEC SQL ENDIF;'" );
551+ mmerror (ET_FATAL, " Unmatched 'EXEC SQL ENDIF;'" );
545552}
546553else {
547554 preproc_tos--;
@@ -559,7 +566,7 @@ cppline{space}*#(.*\\{line_end})*.*
559566
560567<xcond >{identifier }{space_or_nl }* " ;" {
561568if ( 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" );
563570}
564571else {
565572struct _defines *defptr;
@@ -680,7 +687,7 @@ cppline{space}*#(.*\\{line_end})*.*
680687if ( preproc_tos >0 ) {
681688 preproc_tos =0 ;
682689
683- yyerror ( " ERROR: missing 'EXEC SQL ENDIF;'" );
690+ mmerror (ET_FATAL, " Missing 'EXEC SQL ENDIF;'" );
684691 }
685692
686693if (yy_buffer ==NULL )