From tim@menzies.com Tue Oct  9 17:58:33 2001
Received: from femail23.sdc1.sfba.home.com (femail23.sdc1.sfba.home.com [24.0.95.148])
	by swi.psy.uva.nl (8.11.2/8.11.2) with ESMTP id f99FwXt05043
	for <prolog@swi.psy.uva.nl>; Tue, 9 Oct 2001 17:58:33 +0200 (MET DST)
Received: from thoughtfox ([24.78.72.224]) by femail23.sdc1.sfba.home.com
          (InterMail vM.4.01.03.20 201-229-121-120-20010223) with SMTP
          id <20011009155825.MJZA29951.femail23.sdc1.sfba.home.com@thoughtfox>;
          Tue, 9 Oct 2001 08:58:25 -0700
Message-ID: <002b01c150db$b7de3ea0$6401a8c0@thoughtfox>
Reply-To: "tim menzies" <tim@menzies.com>
From: "tim menzies" <tim@menzies.com>
To: "Lyosha" <ai@solvo.ru>, <prolog@swi.psy.uva.nl>
References: <00b201c150b1$3b7659d0$102cc9c3@solvo.ru>
Subject: Re: [SWIPL] DCG rules and error reporting
Date: Tue, 9 Oct 2001 09:01:54 -0700
MIME-Version: 1.0
Content-Type: text/plain;
	charset="Windows-1252"
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 5.50.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400

in swi prolog, the predicate here/2 will return the name and line numebr of
the current file being read.

here(File,Line) :-
 source_location(Path,Line),
 file_base_name(Path,File).

----- Original Message -----
From: "Lyosha" <ai@solvo.ru>
To: <prolog@swi.psy.uva.nl>
Sent: Tuesday, October 09, 2001 3:57 AM
Subject: [SWIPL] DCG rules and error reporting


> Hi,
>
> I have a question about parsing with DCG rules.
> Maybe someone can suggest me a solution. I know
> it's something simple, but I just can't see it.
>
> I use DCG rules in my parser. Is there a way to implement
> error reporting mechanism refering to lines in the source stream?
> I want my parser to point me at the specific line where the error
> happened.
>
> For example, I could define:
> newline --> "\n".
> and put a counter for lines in there, but it won't work with
> combination of rollback and cut that I use in my other DCG rules.
>
> Thanks,
> Lyosha
>
>
> ----------------
> * To UNSUBSCRIBE, please use the HTML form at
>
>     http://www.swi.psy.uva.nl/projects/SWI-Prolog/index.html#mailinglist
>
> or send mail to prolog-request@swi.psy.uva.nl using the Subject:
"unsubscribe"
> (without the quotes) and *no* message body.
>
> ** An ARCHIVE of this list is maintained at
>
>     http://www.swi.psy.uva.nl/projects/SWI-Prolog/mailinglist/archive/
>
>

