From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ben Pfaff Newsgroups: gmane.emacs.devel,gmane.comp.statistics.pspp.devel Subject: Re: Fwd: [ELPA] New package: pspp-mode.el for PSPP/SPSS syntax highlighting Date: Sun, 5 Jul 2020 15:17:17 -0700 Message-ID: References: <4836167B-33A9-46A3-B586-20768E333E1D@gmx.de> <20200704151535.GA31917@jocasta.intra> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26341"; mail-complaints-to="usenet@ciao.gmane.io" Cc: PSPP Development Mailing List , mail@vasilij.de, John Darrington , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Jul 06 00:52:04 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jsDUS-0006j3-8A for ged-emacs-devel@m.gmane-mx.org; Mon, 06 Jul 2020 00:52:04 +0200 Original-Received: from localhost ([::1]:57490 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jsDUR-0004vb-6A for ged-emacs-devel@m.gmane-mx.org; Sun, 05 Jul 2020 18:52:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37576) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jsCx8-0007eR-Gu; Sun, 05 Jul 2020 18:17:38 -0400 Original-Received: from smtp1.cs.stanford.edu ([171.64.64.25]:55046) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jsCx6-0006t3-4M; Sun, 05 Jul 2020 18:17:37 -0400 Original-Received: from mail-il1-f173.google.com ([209.85.166.173]:41239) by smtp1.cs.Stanford.EDU with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.92.3) (envelope-from ) id 1jsCx0-0007ou-RM; Sun, 05 Jul 2020 15:17:31 -0700 Original-Received: by mail-il1-f173.google.com with SMTP id q3so20634140ilt.8; Sun, 05 Jul 2020 15:17:30 -0700 (PDT) X-Gm-Message-State: AOAM533fuY6FCyaDCp0RnH4Ha2HlY64mq27wPhn+PB+syjNjcb04mO1y I1T42l9qkoJ7xXvb+QoJOxVEtf1pTBhXbvoa9CU= X-Google-Smtp-Source: ABdhPJxq48FhmRxyyQ5Cy3Y8oVDzCKaPl6kEUEZELtad0BHpd6lukeXq75Yu0picJseAzD7Q1NqWyI30IzIF3H/4jh8= X-Received: by 2002:a92:c989:: with SMTP id y9mr18069035iln.108.1593987450300; Sun, 05 Jul 2020 15:17:30 -0700 (PDT) In-Reply-To: X-Gmail-Original-Message-ID: X-Scan-Signature: cb5916722246bf80bd9488153e8e2604 Received-SPF: pass client-ip=171.64.64.25; envelope-from=blp@cs.stanford.edu; helo=smtp1.cs.Stanford.EDU X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/05 18:17:32 X-ACL-Warn: Detected OS = Linux 3.1-3.10 X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-Mailman-Approved-At: Sun, 05 Jul 2020 18:50:21 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:252719 gmane.comp.statistics.pspp.devel:7584 Archived-At: On Sun, Jul 5, 2020 at 3:01 PM Stefan Monnier wrote: > > SPSS syntax is bizarre. It has two modes: "batch" and "interactive" mode. > > Aha! > > > A syntax file might be written in either syntax. There's no way to > > easily guess which one. > > > > In "interactive" syntax, a command ends with a line that ends with . or > > with a blank line. > > So that's the syntax that's documented in the Texinfo, and that's the > syntax handled by `segmenter_parse_comment_1__`? I think that these modes are documented in the Texinfo, at least here: https://www.gnu.org/software/pspp/manual/html_node/Syntax-Variants.html Maybe there is some other place that the two forms are not acknowledged. If so, then I guess that I should fix that. > > PSPP can be configured to interpret files in either syntax mode. It's a pain > > requiring users to do this, so by default it tries to guess on a line-by-line > > basis: if a line is not indented and if it begins with keywords that are an > > SPSS command name, then it assumes that it is the beginning of a command > > and that the previous command ended. This is nasty also, but it works > > well most of the time regardless of what syntax mode the file was written > > in. > > Thanks. > I guess `pspp-mode.el` should try to reproduce the same DWIMish behavior. > > Yet another question: do comments (either "*" or "COMMENT") always start > in column 0 or can they start indented or even on the same line as some > other command, as in: > > input program. * let's get started. SPSS syntax doesn't allow for more than one command per line. That's because all the ways of ending a command, in both modes, involve a newline. Above, for example, the '.' does not end a command because it is not the last non-blank character on the line. Instead, it would be a syntax error because '.' by itself isn't valid syntax for the INPUT PROGRAM command. Comments that begin with * or COMMENT can start in any column, though, since there can be white space at the beginning of the line. But they have to follow the rules for starting SPSS commands. It's sort of like the : command in the Bourne shell: everything after the : keyword is ignored, but it still has to follow the Bourne shell syntax rules in ways that things that come after # do not. > > I think that's why the file above gets treated the way it does. > > > > Maybe PSPP should treat comment commands specially. That would > > be yet another special case in the lexer/parser, but maybe it is warranted. > > Of course, I prefer it when comments are handled in the lexer rather > than in the parser, so they can occur anywhere between tokens, but > I expect that this boat has sailed ;-) I know this syntax is insane. I didn't design it, I just implemented it. I think it's the way it is because it was designed for IBM 80-column cards back in the 1960s. SPSS is that old. However, SPSS has *another* comment syntax as well. It looks like I didn't document this one, although PSPP supports it. These comments start with /* and end with */ or at the end of the line, whichever comes first. I'll make a note to add this to the documentation.