From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ted Zlatanov Newsgroups: gmane.emacs.devel Subject: Re: asking for advice for changing the cfengine.el progmode to support CFEngine 3.x Date: Tue, 21 Jun 2011 14:26:24 -0500 Organization: =?utf-8?B?0KLQtdC+0LTQvtGAINCX0LvQsNGC0LDQvdC+0LI=?= @ Cienfuegos Message-ID: <87fwn3oujj.fsf@lifelogs.com> References: <87mxhgl44t.fsf@lifelogs.com> <87r56oz146.fsf@lifelogs.com> Reply-To: emacs-devel@gnu.org NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1308684611 25967 80.91.229.12 (21 Jun 2011 19:30:11 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 21 Jun 2011 19:30:11 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jun 21 21:30:07 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QZ6eF-00042x-HH for ged-emacs-devel@m.gmane.org; Tue, 21 Jun 2011 21:30:07 +0200 Original-Received: from localhost ([::1]:50633 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QZ6eE-00060n-HU for ged-emacs-devel@m.gmane.org; Tue, 21 Jun 2011 15:30:06 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:35893) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QZ6ay-0005Lz-6w for emacs-devel@gnu.org; Tue, 21 Jun 2011 15:26:45 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QZ6aw-0000SH-7S for emacs-devel@gnu.org; Tue, 21 Jun 2011 15:26:43 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:55567) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QZ6av-0000Rs-GK for emacs-devel@gnu.org; Tue, 21 Jun 2011 15:26:41 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1QZ6at-0002TR-VR for emacs-devel@gnu.org; Tue, 21 Jun 2011 21:26:39 +0200 Original-Received: from 38.98.147.133 ([38.98.147.133]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 21 Jun 2011 21:26:39 +0200 Original-Received: from tzz by 38.98.147.133 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 21 Jun 2011 21:26:39 +0200 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: emacs-devel@gnu.org Original-Lines: 55 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 38.98.147.133 X-Face: bd.DQ~'29fIs`T_%O%C\g%6jW)yi[zuz6; d4V0`@y-~$#3P_Ng{@m+e4o<4P'#(_GJQ%TT= D}[Ep*b!\e,fBZ'j_+#"Ps?s2!4H2-Y"sx" Mail-Copies-To: never User-Agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:0/+Y//5K9VZ5WNjBdXHdI8cucY0= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 80.91.229.12 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:140798 Archived-At: On Tue, 21 Jun 2011 10:59:55 -0400 Stefan Monnier wrote: SM> The patch below will at least give you better feedback for the immediate SM> problem in your grammar. I hope you can commit it eventually. >> See below. Perhaps I'm just too accustomed to LALR parsers, but they >> seem easier and less ambiguous. SM> Very likely. With SMIE you shouldn't try to parse the language in an SM> exact manner, but think about parsing the minimum needed to indent SM> properly ;-) I tried, but I can't examine the parser state at a buffer point or do anything else to debug the SMIE grammar. How do you do it? I'm used to the Perl Parse::RecDescent module, which can show line-by-line parsing traces and the actions taken. If you could post more SMIE parser examples, it would be helpful. As I said, I'm used to LALR grammars and the SMIE API plus the OPG grammars themselves are a pretty big challenge. I'm also surprised that Emacs doesn't have a decent LALR parser outside Semantic, and Semantic itself is poorly documented as far as writing new language support. >> (bundle_body (bundle_section) (bundle_section "\n" bundle_section)) SM> I'm surprised to see \n here (and in the previous rule). Are newlines SM> really significant in cfengine's syntax? I thought they were the best way to separate sections. As far as the syntax, newlines are separators but not operators, so I didn't do this right. SM> That means that SM> bundle edit_line block_append_if_no_line(data) SM> { SM> insert_lines: SM> any:: SM> "$(data)" insert_type => "preserve_block"; SM> } SM> will be parsed as "bundle" followed by 4 (one of them being SM> "(data)"), which is structurally incorrect (IIUC "(data)" is actually SM> structurally a child of "block_append_if_no_line" rather than of SM> "bundle"), but we can hope that it won't matter for indentation. Can you do a SMIE parser for the above to get me started? It would really help. Or point me to an example that's similar to it. Thanks Ted