[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: multiline regex mode?
From: |
Dieter Wilhelm |
Subject: |
Re: multiline regex mode? |
Date: |
Sat, 25 Nov 2006 19:27:55 +0100 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
Harald Hanche-Olsen <hanche@math.ntnu.no> writes:
> + Peter Dyballa <Peter_Dyballa@Web.DE>:
>
> | I think you can't use one regular expression for a variety of nested
> | "*balanced* brackets like { { } }".
>
Got it Pete, in this case regexps are a no no! Good to know.
> You think rightly. In formal language theory, the regular languages
> are precisely the ones that can be defined by regular grammars. It is
> a theorem that they are precisely the languages that can be recognized
> by a finite state automaton (FSA). A regular expression is a way of
> specifying a regular grammar, i.e., a regular language, and so they
> are not powerful enough to recognize balanced parentheses. The reason
> is that you need to be able to count arbitrarily high, in order to be
> able to tell the difference between expressions like
> {{{{{{{{{{{{{{{{}}}}}}}}}}}}}}}} and {{{{{{{{{{{{{{{{}}}}}}}}}}}}}}}}}.
> A FSA with fifteen states cannot tell the difference between the two
> expressions above, since it would need to be able to count to sixteen
> in order to do so.
Thank you for the background.
> So the paren mathcing algorithms in emacs need to be written in code.
> And indeed it is: At the bottom you'll find the function scan-sexps,
> which is written in C (for efficiency, no doubt).
OK, then it has to be scan-sexps in the code.
>
> See also:
>
> http://en.wikipedia.org/wiki/Regular_grammar
I don't have to understand it, must I? ;-) Thank you for the pointers.
--
Best wishes
H. Dieter Wilhelm
Darmstadt, Germany
- Re: multiline regex mode?, (continued)
- Re: multiline regex mode?, Peter Dyballa, 2006/11/24
- Re: multiline regex mode?, Dieter Wilhelm, 2006/11/25
- Re: multiline regex mode?, Peter Dyballa, 2006/11/25
- Re: multiline regex mode?, Perry Smith, 2006/11/25
- Re: multiline regex mode?, Dieter Wilhelm, 2006/11/25
- Message not available
- [OT] Re: multiline regex mode?, Harald Hanche-Olsen, 2006/11/25
- Message not available
- Re: multiline regex mode?, Harald Hanche-Olsen, 2006/11/25
- Re: multiline regex mode?,
Dieter Wilhelm <=
- Message not available
- Re: multiline regex mode?, Harald Hanche-Olsen, 2006/11/25