summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-03-21 20:42:34 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2010-03-21 20:42:34 +0000
commitc8a8e57d6af7261d70103ddd46f8da409896b5e7 (patch)
tree808ed3d2aee745f03fadff0bdb419ca2a84d74b7 /util
parent4b4de940ee6e76ec9677b5468ebf709c6d2db982 (diff)
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.
Diffstat (limited to 'util')
-rw-r--r--util/cairo-script/cairo-script-scanner.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/util/cairo-script/cairo-script-scanner.c b/util/cairo-script/cairo-script-scanner.c
index 99606a933..0422fe066 100644
--- a/util/cairo-script/cairo-script-scanner.c
+++ b/util/cairo-script/cairo-script-scanner.c
@@ -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;
}