guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Nyacc: how to lex comments?


From: Matt Wette
Subject: Re: Nyacc: how to lex comments?
Date: Tue, 17 Mar 2020 05:31:32 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1



On 3/17/20 12:46 AM, address@hidden wrote:
On Mon, Mar 16, 2020 at 05:11:59PM -0700, Matt Wette wrote:
On 3/16/20 2:39 PM, address@hidden wrote:
Hi,

in my quest to play parsing, I'm failing when I try to cope with
comments.

[...]

make-comm-reader will not eat newlines at end of comment by default.
If you want the comment # ... \n to include the newline try adding
#:eat-newline #t.
D'oh, thanks. Also, I noticed I've to set #:comm-skipper in 'gen-lexer',
instead of #:comm-reader.

I didn't quite understand the difference between both. Would I have
to include comments explicitly in the grammar if the lexer uses
#:comment-reader?

Thanks again
-- tomás
Yes.  Use comm-reader if your grammar accepts comments.
Use comm-skipper if your grammar does not.

The ffi-helper does read comments in the C grammar and
dumps them in the output files, for example.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]