script: Use a stack to push/pop recursed line numbers.

Still not entirely helpful in the event of recursive parsing without a
reference to the file as well as the line number in the event of an
exception.
This commit is contained in:
Chris Wilson 2010-03-21 20:42:34 +00:00
parent 4b4de940ee
commit c8a8e57d6a

View file

@ -1374,6 +1374,7 @@ csi_status_t
_csi_scan_file (csi_t *ctx, csi_file_t *src)
{
csi_status_t status;
int old_line_number;
/* This function needs to be reentrant to handle recursive scanners.
* i.e. one script executes a second.
@ -1384,12 +1385,15 @@ _csi_scan_file (csi_t *ctx, csi_file_t *src)
ctx->scanner.depth = 0;
return status;
}
ctx->scanner.line_number = 0; /* XXX broken by recursive scanning */
}
old_line_number = ctx->scanner.line_number;
ctx->scanner.line_number = 0;
_scan_file (ctx, src);
ctx->scanner.line_number = old_line_number;
--ctx->scanner.depth;
return CSI_STATUS_SUCCESS;
}