From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Robert Thorpe" Newsgroups: gmane.emacs.help Subject: Re: State-machine based syntax highlighting Date: 8 Dec 2006 02:01:12 -0800 Organization: http://groups.google.com Message-ID: <1165572072.202281.11800@n67g2000cwd.googlegroups.com> References: <1165472049.496117.320630@79g2000cws.googlegroups.com> <1165488825.132862.189340@79g2000cws.googlegroups.com> <1165492567.864982.59980@79g2000cws.googlegroups.com> <1165495364.560960.271250@f1g2000cwa.googlegroups.com> <1165501630.172348.157180@j72g2000cwa.googlegroups.com> <1165502373.932709.15860@79g2000cws.googlegroups.com> <1165510932.276718.251220@73g2000cwn.googlegroups.com> <1165516558.657188.21610@j44g2000cwa.googlegroups.com> <1165517838.526624.171950@f1g2000cwa.googlegroups.com> NNTP-Posting-Host: dough.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Trace: sea.gmane.org 1165574499 13272 80.91.229.10 (8 Dec 2006 10:41:39 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 8 Dec 2006 10:41:39 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Dec 08 11:41:38 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by dough.gmane.org with esmtp (Exim 4.50) id 1GsdAV-00026Z-1o for geh-help-gnu-emacs@m.gmane.org; Fri, 08 Dec 2006 11:41:27 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GsdAU-0001V3-Jk for geh-help-gnu-emacs@m.gmane.org; Fri, 08 Dec 2006 05:41:26 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!n67g2000cwd.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 32 Original-NNTP-Posting-Host: 213.94.228.210 Original-X-Trace: posting.google.com 1165572078 32615 127.0.0.1 (8 Dec 2006 10:01:18 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Fri, 8 Dec 2006 10:01:18 +0000 (UTC) In-Reply-To: User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.10) Gecko/20050716 Firefox/1.0.6,gzip(gfe),gzip(gfe) X-HTTP-Via: 1.0 EMF3ASPROXY03 Complaints-To: groups-abuse@google.com Injection-Info: n67g2000cwd.googlegroups.com; posting-host=213.94.228.210; posting-account=hWoAPxMAAAAnBKSBz1ZivwUPPjEuve7bvVCHZQ8rhrluPfwcBJd92w Original-Xref: shelby.stanford.edu gnu.emacs.help:143743 Original-To: help-gnu-emacs@gnu.org 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:39345 Archived-At: Perry Smith wrote: > On Dec 7, 2006, at 12:57 PM, Robert Thorpe wrote: > > spamfilteraccount@gmail.com wrote: > >> Stefan Monnier wrote: > >>> > >>> Actually, font-locking *is* implemented in C. The elisp part > >>> usually takes > >>> a negligible amount of time. The problem start appearing when the > >>> functionality of the C code is not sufficient and you start > >>> trying to parse > >>> the code in elisp, which is slow. > >> > >> Good to know. I thought font-lock was implemented in elisp and didn't > >> bother to check. > > > > Precisely speaking... > > The code that determines what rules are used to font-lock text is in > > Elisp. > > The regexp engine that finds the things to be font-locked is in the > > core of Emacs. > > The colourisation is implemented in the Emacs core. > > Instead of a state machine, how about a lalr parser? It would be a fun > project to take the lalr table generation logic from bison, smash it > into emacs, along with some predefined actions and hooks back > into emacs. The grammers could be loaded when needed. Yes. I've thought about doing that myself, even better would be the GLR parser system in recent versions of Bison. It is capable of parsing any context-free grammar. I haven't got enough time to work on such a thing for Emacs myself though, unfortunately.