From 370d365189fac39c5e6799cf4b347ebe2dd7fae6 Mon Sep 17 00:00:00 2001 From: David Norlin <norlin@roxen.com> Date: Fri, 27 Jul 2001 17:00:52 +0200 Subject: [PATCH] To get the right context in the thrown error string. Rev: lib/modules/Parser.pmod/C.pmod:1.25 Rev: lib/modules/Parser.pmod/Pike.pmod:1.10 --- lib/modules/Parser.pmod/C.pmod | 2 +- lib/modules/Parser.pmod/Pike.pmod | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/modules/Parser.pmod/C.pmod b/lib/modules/Parser.pmod/C.pmod index ff2310efaf..e18056485b 100644 --- a/lib/modules/Parser.pmod/C.pmod +++ b/lib/modules/Parser.pmod/C.pmod @@ -173,7 +173,7 @@ array(string) split(string data) if(data[pos]=='\\') pos++; int end=search(data, "'", pos+1)+1; if(!end) - throw( ({sprintf("Unknown token %O\n",data[pos..pos+20]) }) ); + throw( ({sprintf("Unknown token %O\n",data[pos-1..pos+19]) }) ); pos=end; break; diff --git a/lib/modules/Parser.pmod/Pike.pmod b/lib/modules/Parser.pmod/Pike.pmod index 4fa94b06bb..8f8f802900 100644 --- a/lib/modules/Parser.pmod/Pike.pmod +++ b/lib/modules/Parser.pmod/Pike.pmod @@ -205,8 +205,10 @@ array(string) split(string data) pos++; if(data[pos]=='\\') pos++; int end=search(data, "'", pos)+1; - if (!end) + if (!end) { + --pos; UNKNOWN_TOKEN; + } pos=end; break; -- GitLab