* yyerror * Report a lexer or grammar error. * * The message's cursor position identifies the most recently lexed token. * This is OK for syntax error messages from the Bison parser, because Bison * parsers report error as soon as the first unparsable token is reached. * Beware of using yyerror for other purposes, as the cursor position might * be misleading! */
| 3197 | * be misleading! |
| 3198 | */ |
| 3199 | void |
| 3200 | orafce_sql_yyerror(List **result, const char *message) |
| 3201 | { |
| 3202 | const char *loc = scanbuf + orafce_sql_yylval.val.lloc; |
| 3203 | |
| 3204 | if (*loc == YY_END_OF_BUFFER_CHAR) |
| 3205 | { |
| 3206 | ereport(ERROR, |
| 3207 | (errcode(ERRCODE_SYNTAX_ERROR), |
| 3208 | errmsg("%s at end of input", message), |
| 3209 | lexer_errposition())); |
| 3210 | } |
| 3211 | else |
| 3212 | { |
| 3213 | ereport(ERROR, |
| 3214 | (errcode(ERRCODE_SYNTAX_ERROR), |
| 3215 | errmsg("%s at or near \"%s\"", message, loc), |
| 3216 | lexer_errposition())); |
| 3217 | } |
| 3218 | } |
| 3219 | |
| 3220 | |
| 3221 | /* |
no test coverage detected