]> git.eshelyaron.com Git - emacs.git/commit
(with-peg-rules): Fix references to rulesets (bug#74018)
authorStefan Monnier <monnier@iro.umontreal.ca>
Tue, 29 Oct 2024 02:14:10 +0000 (22:14 -0400)
committerEshel Yaron <me@eshelyaron.com>
Tue, 5 Nov 2024 11:05:31 +0000 (12:05 +0100)
commit8effb99632240f4b9e106d574bf336bd8149945e
tree657f851894434a6fefcf7ee5256c2c5bc7b9156d
parent3bb36beac64ec5c50ae3700a6d22bc87879d0549
(with-peg-rules): Fix references to rulesets (bug#74018)

PEG rules get "compiled" to functions with name `peg-rule <RULE>`.
`define-peg-ruleset` instead defines it PEG rules with name
`peg-rule <RULESET> <RULE>`, so that they can be made visible
by `with-peg-rules` simply by adding local aliases from
`peg-rule <RULE>` to `peg-rule <RULESET> <RULE>`.

Apparently when I added `define-peg-ruleset` I somehow failed to
install some of the corresponding code in `with-peg-rules`, so
the aliases were not installed, making it "impossible" to use
rulesets.
[ I still have no idea how this happened and/or where
  the missing code went, so I "recreated" it.  ]

* lisp/progmodes/peg.el (with-peg-rules): Install the aliases
for the rulesets.
(peg--translate-rule-body): Try and preserve
location info when emitting a warning.

* test/lisp/progmodes/peg-tests.el (peg-test-myrules): New ruleset.
(peg-test-ruleset): New test.

(cherry picked from commit cc6a11f4832076acb7c0b5301eb1add026fabe4b)
lisp/progmodes/peg.el
test/lisp/progmodes/peg-tests.el