* lexer_errposition * Report a lexical-analysis-time cursor position, if possible. * * This is expected to be used within an ereport() call. The return value * is a dummy (always 0, in fact). * * Note that this can only be used for messages from the lexer itself, * since it depends on scanbuf to still be valid. */
| 3164 | * since it depends on scanbuf to still be valid. |
| 3165 | */ |
| 3166 | static int |
| 3167 | lexer_errposition(void) |
| 3168 | { |
| 3169 | int pos; |
| 3170 | |
| 3171 | /* Convert byte offset to character number */ |
| 3172 | pos = _pg_mbstrlen_with_len(scanbuf, orafce_sql_yylval.val.lloc) + 1; |
| 3173 | /* And pass it to the ereport mechanism */ |
| 3174 | |
| 3175 | #if PG_VERSION_NUM >= 120000 |
| 3176 | |
| 3177 | errposition(pos); |
| 3178 | |
| 3179 | return pos; |
| 3180 | |
| 3181 | #else |
| 3182 | |
| 3183 | return errposition(pos); |
| 3184 | |
| 3185 | #endif |
| 3186 | |
| 3187 | } |
| 3188 | |
| 3189 | /* |
| 3190 | * yyerror |
no test coverage detected