[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Grammatica-users] Empty file parsing
From: |
Yakov Keselman |
Subject: |
Re: [Grammatica-users] Empty file parsing |
Date: |
Thu, 8 Jun 2006 09:28:43 -0700 (PDT) |
Perhaps, for this specific case (parsing a file with
some comments only, not an empty file), it would be
easier not to ignore them (remove the %ignore% tag)?
Since comments will never propagate up the tree, the
overhead is likely to be minimal.
= Yakov
--- Per Cederberg <address@hidden> wrote:
> I assume that the comment tokens are marked with
> %ignore%.
> In that case it is not possible to do it with
> Grammatica,
> as all productions must match at least 1 token.
>
> You could do some kind of work-around, though, by
> ignoring
> parse errors on some occations. Perhaps the easiest
> way
> would be to subclass the Tokenizer to set a flag if
> it
> returns a token. In case of parse error, you can
> then check
> the flag to see if the cause was lack of input. Care
> must
> be taken to handle tokenizer exceptions properly
> though.
>
> I know this isn't an ideal solution. So I've
> registered a
> feature request on the issue:
>
>
https://savannah.nongnu.org/bugs/index.php?func=detailitem&item_id=16783
>
> Cheers,
>
> /Per
>
> Leszek Doniec wrote:
> > Hello,
> >
> > is there any possibility to parse a file that
> includes only comments?
> > I use grammatica 1.4.
> >
> > Thanks for help,
> > Leszek Doniec
> >
> >
> >
>
------------------------------------------------------------------------
> >
> > _______________________________________________
> > Grammatica-users mailing list
> > address@hidden
> >
>
http://lists.nongnu.org/mailman/listinfo/grammatica-users
>
>
> _______________________________________________
> Grammatica-users mailing list
> address@hidden
>
http://lists.nongnu.org/mailman/listinfo/grammatica-users
>
http://www.kinderspirit.org/yakovkeselman/
====
Nothing is so firmly believed as that which we least know.
-- Michel de Montaigne