On Mon, 29 Nov 1999 07:21:54 +0100, Rejo Zenger
<subs(_at_)sisterray(_dot_)xs4all(_dot_)nl> wrote:
++ 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.
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.
<...>
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).
What do you mean one can't use INCLUDERC=? That's exactly how you
would do it. But it might become moderately complex.
By the way, there's a reason those syntax diagrams are written in BNF,
not as regular expressions. I would heartily recommend reading a book
about computational complexity if you're trying to get into these
things. (Or do a web search for something like "regular languages".)
/* era */
--
Too much to say to fit into this .signature anyway: <http://www.iki.fi/era/>
Fight spam in Europe: <http://www.euro.cauce.org/> * Sign the EU petition