unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* smie-next-sexp make last seen keyword available
@ 2012-09-30 11:57 Stephen Leake
  0 siblings, 0 replies; only message in thread
From: Stephen Leake @ 2012-09-30 11:57 UTC (permalink / raw)
  To: emacs-devel

I'm rewriting the Emacs Ada mode indentation engine. The trigger was the
new Ada 2012 syntax; it was just too daunting a task to try to squeeze
that into the Ada mode 4.01 indentation code, which is totally ad hoc.

Someone pointed me to SMIE; thank you Stefan! It is a very useful tool.
I was worried that Ada would prove too complex for operator precedence
parsing, but so far it is going well.

My current code is at
http://stephe-leake.org/emacs/ada-mode/emacs-ada-mode.html#ada-mode-5.0
It is still a work in progress.

I'm currently using Emacs 24.2; I could move to trunk if necessary.

I have a request for an additional feature for smie-next-sexp; make the
last seen keyword available.

Consider the following Ada code:

   type Private_Type_2 is abstract tagged limited
      record
         Component_1 : Integer;
         Component_2 : Integer;
         Component_3 : Integer;
      end record;

In order to have "end record" align with "with record", I've arranged
the precedence for "record" to be higher than "is". "abstract" "tagged"
"limited" are all identifiers in the smie grammar; they are optional
keywords in Ada.

Starting from "end", smie-backward-sexp leaves point on "abstract",
and returns "is" as the found token. But I need point on "record", which
is the last smie keyword seen. I can easily navigate back to "record"
using "smie-default-forward-token", but since "smie-backward-sexp" has
already seen "record", it would be cleaner to have it cache the info,
and either return it in its return value, or store it in a smie global
variable.

Any suggestions on whether this is a good idea, or the best way to
implement it?

--
-- Stephe



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-09-30 11:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-30 11:57 smie-next-sexp make last seen keyword available Stephen Leake

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).