diff --git a/lib/read.c b/lib/read.c index 2a8a7af..f7bc2f9 100644 --- a/lib/read.c +++ b/lib/read.c @@ -2984,7 +2984,7 @@ not_consumed: /* ------------------------------------------------------------------------ */ -static int feed_char (hcl_t* hcl, hcl_ooci_t c) +static int _feed_char (hcl_t* hcl, hcl_ooci_t c) { /*hcl_logbfmt (hcl, HCL_LOG_STDERR, "FEED->[%jc] %d STATE->%d\n", c, c, FLX_STATE(hcl));*/ @@ -3016,6 +3016,19 @@ static int feed_char (hcl_t* hcl, hcl_ooci_t c) return -1; } +static int feed_char (hcl_t* hcl, hcl_ooci_t c) +{ + int n; + n = _feed_char(hcl, c); + if (n <= -1) + { + /* arrange to read from the start phase next time + * in case feeding continues after an error */ + FEED_CONTINUE (hcl, HCL_FLX_START); + } + return n; +} + static void feed_update_lx_loc (hcl_t* hcl, hcl_ooci_t ch) { if (is_linebreak(ch))