From: Dieter Wilhelm <dieter@duenenhof-wilhelm.de>
Cc: help-gnu-emacs@gnu.org
Subject: Re: multiline regex mode?
Date: Sat, 25 Nov 2006 19:27:55 +0100 [thread overview]
Message-ID: <87mz6fz8ic.fsf@hans.local.net> (raw)
In-Reply-To: <pcoy7pzboql.fsf@shuttle.math.ntnu.no> (Harald Hanche-Olsen's message of "Sat\, 25 Nov 2006 15\:11\:14 +0100")
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
next prev parent reply other threads:[~2006-11-25 18:27 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-09 12:57 multiline regex mode? Giles Chamberlin
2006-10-13 20:02 ` Dieter Wilhelm
[not found] ` <mailman.8131.1160774366.9609.help-gnu-emacs@gnu.org>
2006-10-16 10:20 ` Giles Chamberlin
2006-10-16 11:24 ` Michaël Cadilhac
[not found] ` <mailman.8206.1160997864.9609.help-gnu-emacs@gnu.org>
2006-10-16 15:42 ` Giles Chamberlin
2006-11-23 19:25 ` Stefan Monnier
2006-11-24 21:14 ` Dieter Wilhelm
2006-11-24 22:51 ` Peter Dyballa
2006-11-25 3:01 ` Dieter Wilhelm
2006-11-25 13:14 ` Peter Dyballa
2006-11-25 16:32 ` Perry Smith
2006-11-25 18:33 ` Dieter Wilhelm
[not found] ` <mailman.1100.1164472360.2155.help-gnu-emacs@gnu.org>
2006-11-25 17:23 ` [OT] " Harald Hanche-Olsen
[not found] ` <mailman.1092.1164460454.2155.help-gnu-emacs@gnu.org>
2006-11-25 14:11 ` Harald Hanche-Olsen
2006-11-25 18:27 ` Dieter Wilhelm [this message]
[not found] ` <mailman.1107.1164479289.2155.help-gnu-emacs@gnu.org>
2006-11-25 19:29 ` Harald Hanche-Olsen
2006-11-25 3:32 ` Perry Smith
2006-11-25 10:11 ` Quoting style of arguments etc. [was: multiline regex mode?] Dieter Wilhelm
2006-11-25 10:23 ` multiline regex mode? Peter Dyballa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87mz6fz8ic.fsf@hans.local.net \
--to=dieter@duenenhof-wilhelm.de \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).