Re: Dan's comment remover

new topic     » goto parent     » topic index » view thread      » older message » newer message

Alan,

The problem is recognizing *for sure* what is a comment and what is not.
For instance, a line of code *could* have a pair of dashes *inside* a quoted
piece of text, which must *not* be interpreted as a comment tag, or it would
chop off the rest of the line, wrongfully.  That's why I had to look for
quote symbols, and pairs of them, to see if "--" was inside quotes or
outside them.  But I had to *ignore* any "literalized" quotes,  ie, \" which
would be intended to be included in a text string, not be defining the
beginning or end of a text string.

example:
setText(window1, "this is some text--and this is more of the same, NOT a
comment!")

and that example could have a comment *after* it, that is, after  the last
of a *pair* of quotes, which *must* be recognized as a comment.

My way seems to work, (with the exception of not handling mixed spaces and
tabs before a comment exactly as I would like), it just looked too complex
to be optimal.

Dan

----- Original Message -----
From: "Alan Oxley" <fizzpop at icon.co.za>
To: "EUforum" <EUforum at topica.com>
Sent: Sunday, September 30, 2001 8:23 AM
Subject: Dan's comment remover


>
> Hi Dan and group,
> Can you not set a (delete) flag based on whether there is code data on the
> same line, *before* the
> comment? That would need to exclude tabs and spaces. Preferable to simply
> looking for a quote.
> Sorry if this is obvious, have I missed something and encouraged
derision..
> ;))
>
> Alan
>
>
>

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu