From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dieter Wilhelm Newsgroups: gmane.emacs.help Subject: Re: multiline regex mode? Date: Sat, 25 Nov 2006 19:27:55 +0100 Organization: The Church of Emacs Message-ID: <87mz6fz8ic.fsf@hans.local.net> References: <87u00o1r9r.fsf@hans.local.net> <87lkm01b6y.fsf@hans.local.net> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1164479331 12832 80.91.229.2 (25 Nov 2006 18:28:51 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 25 Nov 2006 18:28:51 +0000 (UTC) Cc: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Nov 25 19:28:49 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Go2Gb-0002vG-NU for geh-help-gnu-emacs@m.gmane.org; Sat, 25 Nov 2006 19:28:46 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Go2Gb-0006RG-6B for geh-help-gnu-emacs@m.gmane.org; Sat, 25 Nov 2006 13:28:45 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Go2Fu-0006BJ-1E for help-gnu-emacs@gnu.org; Sat, 25 Nov 2006 13:28:02 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Go2Fs-0006AC-9Y for help-gnu-emacs@gnu.org; Sat, 25 Nov 2006 13:28:01 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Go2Fs-0006A9-4G for help-gnu-emacs@gnu.org; Sat, 25 Nov 2006 13:28:00 -0500 Original-Received: from [212.227.126.186] (helo=moutng.kundenserver.de) by monty-python.gnu.org with esmtp (Exim 4.52) id 1Go2Fr-0005Fa-SV for help-gnu-emacs@gnu.org; Sat, 25 Nov 2006 13:28:00 -0500 Original-Received: from [84.167.44.164] (helo=duenenhof-wilhelm.de) by mrelayeu.kundenserver.de (node=mrelayeu3) with ESMTP (Nemesis), id 0MKxQS-1Go2Fp1jRP-0004Xk; Sat, 25 Nov 2006 19:27:57 +0100 Original-Received: by duenenhof-wilhelm.de (Postfix, from userid 1000) id 07BBD7619B; Sat, 25 Nov 2006 19:27:56 +0100 (CET) Original-To: Harald Hanche-Olsen In-Reply-To: (Harald Hanche-Olsen's message of "Sat\, 25 Nov 2006 15\:11\:14 +0100") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-Provags-ID: kundenserver.de abuse@kundenserver.de login:d7ab225b98a136e1c2910381f940ecb9 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:38984 Archived-At: Harald Hanche-Olsen writes: > + Peter Dyballa : > > | 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