all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Jakub T. Jankiewicz" <jcubic@onet.pl>
To: emacs-devel@gnu.org
Subject: Scheme Mode and Regular Expression Literals
Date: Tue, 27 Feb 2024 15:46:55 +0100	[thread overview]
Message-ID: <20240227154655.1f6057a0@jcubic> (raw)

Hi,

I'm working on Scheme interpreter written in JavaScript called LIPS
Scheme. It has the same syntax for [Regular expressions as Gauche][1]
but with more flags, because they are just JavaScript RegExp.

Is there a way to add support for regular expressions in the native scheme
mode without modification of the code? Something I can do from my .emacs file?

Regexes in LIPS and Gauche look like this `#/[a-b]+/`, it gives a lot of
problems inside Emacs. Sometimes you need to add comments with stuff after
to make the syntax highlighting and indentation work.

Example:


    (let ((x #/foo|bar/)) ;; |))
      (write x))

Emacs thinks that the vertical bar is a scheme extended symbol syntax and you
need to add a comment to close the symbol and close the lists otherwise the
code will not display and evaluate properly.

And if you want to send this to scheme REPL and have proper highlighting you
need something like this:

    (let ((x #/foo|bar/)) ;; |))
      (write x)
      (display " ;; |")
      (newline))

it would be cool if you could configure the scheme mode to allow such syntax.

[1]:
https://practical-scheme.net/gauche/man/gauche-refe/Regular-expressions.html

Jakub

--
Jakub T. Jankiewicz, Senior Front-End Developer
https://jcubic.pl/me
https://lips.js.org
https://koduj.org



             reply	other threads:[~2024-02-27 14:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-27 14:46 Jakub T. Jankiewicz [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-03-09  2:59 Scheme Mode and Regular Expression Literals Toshi Umehara
2024-03-09 13:37 ` Jakub T. Jankiewicz
2024-03-14  8:40 ` Eli Zaretskii
2024-03-14 11:38   ` Mattias Engdegård
2024-03-14 13:34     ` Stefan Monnier
2024-03-14 15:09       ` Jakub T. Jankiewicz
2024-03-17  0:28 Toshi Umehara
2024-03-17  2:02 ` Stefan Monnier
2024-03-19  3:06 Toshi Umehara
2024-03-19 13:36 ` Stefan Monnier
2024-03-23  2:45   ` Toshi Umehara

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=20240227154655.1f6057a0@jcubic \
    --to=jcubic@onet.pl \
    --cc=emacs-devel@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.