octave-maintainers
[Top][All Lists]
Advanced

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

Re: handling comments in the parser


From: John W. Eaton
Subject: Re: handling comments in the parser
Date: Wed, 6 Jun 2012 17:23:36 -0400

On  6-Jun-2012, Daniel J Sebald wrote:

| On 06/06/2012 04:04 PM, John W. Eaton wrote:
| 
| > So would there be any objection to simplifying the parser so that it
| > discards comments (except for the first block that defines the
| > docstring for a function; we would continue to store that as needed)?
| > Can anyone think of trouble that this change would cause?
| 
| Would this throw off the line numbers for debugging in some way?

No, line numbers for actual tokens is stored separately, and comment
lines would still be counted.

| Might it be worth keeping this code in some form as a translator 
| feature?  I.e., creates canonical syntax from users code?

OK, so that is one place where it would be convenient to have
comments.

But I don't see Octave's purpose as a translator to some other
language and I'm not really interested in writing one in a way that
would need to preserve comments, so I'm not sure why I should be
paying for the baggage related to storing comments.

I was also never really sure where to attach comments in the parse
tree so that they could be faithfully reproduced in the output, even
when simply generating text in Octave syntax from the parse tree
representation.  So the current code falls way short of handling them
properly.

jwe


reply via email to

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