(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)
committerStefan Monnier <monnier@iro.umontreal.ca>
Tue, 29 Oct 2024 02:14:10 +0000 (22:14 -0400)
commitcc6a11f4832076acb7c0b5301eb1add026fabe4b
treee18a54aa16bfa2954f9ef4ac00b2de5a12badf7e
parent70f084db2ff36be2eb183a5c7f6aa88a44ff0d5e
(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.
lisp/progmodes/peg.el
test/lisp/progmodes/peg-tests.el