all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ben Pfaff <blp@cs.stanford.edu>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: PSPP Development Mailing List <pspp-dev@gnu.org>,
	mail@vasilij.de, John Darrington <john@darrington.wattle.id.au>,
	emacs-devel@gnu.org
Subject: Re: Fwd: [ELPA] New package: pspp-mode.el for PSPP/SPSS syntax highlighting
Date: Sun, 5 Jul 2020 15:17:17 -0700	[thread overview]
Message-ID: <CAA_G9+g5Bu3uBB0orf_e70aVeBD-K9L=mDj2bYdesN+t=M6Y2A@mail.gmail.com> (raw)
In-Reply-To: <jwvv9j1myhm.fsf-monnier+emacs@gnu.org>

On Sun, Jul 5, 2020 at 3:01 PM Stefan Monnier <monnier@iro.umontreal.ca> 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.



  reply	other threads:[~2020-07-05 22:17 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <jwvr1twzlte.fsf-monnier+emacs@gnu.org>
2020-06-30 21:55 ` Fwd: [ELPA] New package: pspp-mode.el for PSPP/SPSS syntax highlighting Friedrich Beckmann
2020-07-04  9:20   ` John Darrington
2020-07-04 13:12   ` Stefan Monnier
2020-07-04 15:15     ` John Darrington
2020-07-04 22:45       ` Stefan Monnier
2020-07-05  6:06         ` John Darrington
2020-07-05 14:59           ` Stefan Monnier
2020-07-05 17:17             ` Ben Pfaff
2020-07-05 17:16         ` Ben Pfaff
2020-07-05 22:01           ` Stefan Monnier
2020-07-05 22:17             ` Ben Pfaff [this message]
2020-07-05  9:44       ` Friedrich Beckmann
2020-07-05 11:18         ` John Darrington
2020-07-05 16:51         ` Sean Whitton
2020-07-05 17:14           ` Friedrich Beckmann
2020-07-05 18:35           ` John Darrington
2020-07-05 18:50             ` tomas
2020-07-05 20:20             ` Sean Whitton
2020-07-06  5:53               ` Dmitry Alexandrov
2020-07-06  6:01                 ` Sean Whitton
2020-07-06  6:38                   ` Dmitry Alexandrov
2020-07-07  4:51                     ` Sean Whitton

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAA_G9+g5Bu3uBB0orf_e70aVeBD-K9L=mDj2bYdesN+t=M6Y2A@mail.gmail.com' \
    --to=blp@cs.stanford.edu \
    --cc=emacs-devel@gnu.org \
    --cc=john@darrington.wattle.id.au \
    --cc=mail@vasilij.de \
    --cc=monnier@iro.umontreal.ca \
    --cc=pspp-dev@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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.