--- l2_spec_scan.l 2001/11/08 21:58:00 1.5
+++ l2_spec_scan.l 2001/12/14 12:42:07 1.6
@@ -42,6 +42,16 @@
#undef YY_INPUT
#define YY_INPUT(buf,result,max_size) (result = yyinput(CTX, buf, max_size))
static int yyinput(l2_spec_ctx_t *ctx, char *buf, int max_size);
+
+/* location tracking */
+#define YY_USER_INIT \
+ yylloc->first = 0; \
+ yylloc->last = 0;
+#define YY_USER_ACTION \
+ yylloc->first = yylloc->last; \
+ yylloc->last += yyleng;
+#define YY_USER_ACTION_ROLLBACK \
+ yylloc->last = yylloc->first
%}
/* scanner options */
@@ -86,22 +96,21 @@
yylval->cpValue = strdup(caParam);
cpParam = NULL;
yyless(0);
+ YY_USER_ACTION_ROLLBACK;
return T_PARAM;
}
<SS_PARAM_Q>\" {
BEGIN(SS_PARAM);
}
<SS_PARAM_Q>\n {
- l2_env_errorinfo(CTX->env, L2_ERR_ARG, "%s", "Unterminated string");
- CTX->rv = L2_ERR_ARG;
+ l2_spec_error(CTX, L2_ERR_SYN, yylloc, "Unterminated string");
return 0;
}
<SS_PARAM_Q>\\[0-7]{1,3} {
unsigned int result;
(void)sscanf(yytext+1, "%o", &result);
if (result > 0xff) {
- l2_env_errorinfo(CTX->env, L2_ERR_ARG, "%s", "Escape sequence out of bound");
- CTX->rv = L2_ERR_ARG;
+ l2_spec_error(CTX, L2_ERR_SYN, yylloc, "Escape sequence out of bound");
return 0;
}
else
@@ -111,8 +120,7 @@
unsigned int result;
(void)sscanf(yytext+1, "%x", &result);
if (result > 0xff) {
- l2_env_errorinfo(CTX->env, L2_ERR_ARG, "%s", "Escape sequence out of bound");
- CTX->rv = L2_ERR_ARG;
+ l2_spec_error(CTX, L2_ERR_SYN, yylloc, "Escape sequence out of bound");
return 0;
}
else
|