unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Ramin Honary <ramin.honary@gmail.com>
To: guile-devel@gnu.org
Subject: How to submit a small patch, update to Emacs Lisp parser
Date: Wed, 20 Nov 2024 08:43:08 +0000	[thread overview]
Message-ID: <CAFhnQTQUYwwskJQxh4NQVbYDEacPuSjtz5XS36gKqpz2EdSr4g@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1632 bytes --]

Hello Guile developers:

I have made a small bug fix for the Emacs Lisp parser in the (language
elisp) module.

  - I fixed a simple bug in the lexer that decodes the carat encoding
for control characters (for example "^@" translates to #\null),

  - and I implemented octal digit decoding in the lexer.

I have tested these changes against Emacs Lisp code from the GNU Emacs
source code. I can confirm that files like "subr.el" can be fully
parsed to list data structures in Scheme now. Here is a simple test
program that parses "subr.el" from GNU Emacs:

(use-modules ((language elisp parser) #:select (read-elisp)))

(define (file-read-all-forms filepath)
  (call-with-port (open-input-file filepath)
    (lambda (port)
      (let loop ((forms-list '()))
        (let ((form (read-elisp port)))
          (cond
           ((eof-object? form) (reverse forms-list))
           (else (loop (cons form forms-list)))
           ))))))

(define path-to-test-el "/home/ramin/src/emacs-29.4/lisp/subr.el")

(define (main)
  (for-each
   (lambda (form) (display form) (newline))
   (file-read-all-forms path-to-test-el)))

Before applying my patch, the above test program fails with:

ice-9/boot-9.scm:1685:16: In procedure raise-exception:
In procedure integer->char: Argument 1 out of range: 67108955

After applying my patch, the whole file parses successfully.

The patch is not that large, so I am attaching it to this e-mail. But
if you would prefer, I can submit it by some other means, such as the
Savannah Git server, if you can instruct me how to do so.

Regards,

-- Ramin Honary


(ActivityPub: @ramin_hal9001@fe.disroot.org)

[-- Attachment #2: 2024-11-20_ramin-honary_improve-elisp-parser.patch.gz --]
[-- Type: application/gzip, Size: 3723 bytes --]

             reply	other threads:[~2024-11-20  8:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-20  8:43 Ramin Honary [this message]
2024-11-20 19:17 ` How to submit a small patch, update to Emacs Lisp parser lloda

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

  List information: https://www.gnu.org/software/guile/

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

  git send-email \
    --in-reply-to=CAFhnQTQUYwwskJQxh4NQVbYDEacPuSjtz5XS36gKqpz2EdSr4g@mail.gmail.com \
    --to=ramin.honary@gmail.com \
    --cc=guile-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.
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).