procmail
[Top] [All Lists]

Re: Defining comments

1999-11-29 00:09:44
++ 27/11/99 21:06 -0600 - Philip Guenther:
But it doesn't matter that much for what i want to achieve i guess as it
doesn't matter how many opening parens there has been as long as the
first one is closed properly. I have to look for

 (foo bar)

and it doesn't matter if it is written as

 (foo (bar (baz) era))

as it is a comment anyway because of the first and last parentheses.
Correct?

Uh, which is the 'last' paren?  Note that answering involves keeping track
of how many open and close parens have been encountered so far.

No, i was in the understanding one doesn't need to know (which probably
makes the check no longer completely correct). I was thinking that a
regexp (simpliefied, possible some characters need to be excluded) like
this:

  (.*)

as the opening and the closing parens already say it's a comment.
However, i see another problem here, as it will catch the first closing
parenthes:

  (foo (bar (baz) era))
  ^             ^

instead of

  (foo (bar (baz) era))
  ^                   ^

This requires a push down automaton and not just a simple finite
automaton. Regexps just aren't powerful enough to express this type of
matching. The best you can do is to pick a number N and say "I'll match
parens upto a depth N of nesting".

That's a good idea. Too bad one cannot use the INCLUDERC to do this
recursivly (is that what they call it? - english is not my native
language).

As with the other parts of your message, i'll send in comments later. I
have to have a closer look before as it quite complex (the language
comes in here again).

        -Rejo.

-- 
= Rejo Zenger  [Sister Ray Crisiscentrum]               
rejo(_at_)sisterray(_dot_)xs4all(_dot_)nl
= http://mediaport.org/~sister                                  PGP: see headers
--------------------------------------------------------------------------------

<Prev in Thread] Current Thread [Next in Thread>