1
1
Fork
You've already forked actions
0
Introduce "actions" keyword in the Raku Programming Language https://raku.land/zef:lizmat/actions
  • Raku 100%
2026年06月26日 08:23:43 +02:00
.github CI test prior to release 2026年06月26日 08:23:43 +02:00
.META CI test prior to release 2026年06月26日 08:23:43 +02:00
doc CI test prior to release 2026年06月26日 08:23:43 +02:00
lib CI test prior to release 2026年06月26日 08:23:43 +02:00
t CI test prior to release 2026年06月26日 08:23:43 +02:00
xt Move doc and add coverage tests 2025年01月14日 22:13:42 +01:00
.gitignore Add preliminary coverage testing 2025年01月08日 17:25:41 +01:00
Changes 0.0.2 2024年09月23日 14:35:12 +02:00
dist.ini Move doc and add coverage tests 2025年01月14日 22:13:42 +01:00
LICENSE Initial commit 2023年11月25日 15:16:17 +01:00
META6.json CI test prior to release 2026年06月26日 08:23:43 +02:00
README.md CI test prior to release 2026年06月26日 08:23:43 +02:00
run-tests CI test prior to release 2026年06月26日 08:23:43 +02:00

Actions Status Actions Status Actions Status

NAME

actions - Introduce "actions" keyword

SYNOPSIS

use actions;
grammar A { token TOP {<.print>+} }
actions B { }
say A.parse("foo", :actions(B)); # 「foo」

DESCRIPTION

The actions distribution adds an actions keyword that is almost identical to the class keyword, except that it limits the execution of methods to methods that only exist within the actions itself.

This is important when a class is used to have associated methods executed whenever a regex / token / rule in the grammar matches. The above example would fail if it were a class B, because it would try to execute the Mu::print method, which doesn't accept any arguments, resulting in:

Cannot resolve caller print(B:U: A:D); none of these signatures matches:
(Mu: *%_)

Inspired by a discussion in the Raku Problem Solving repository.

AUTHOR

Elizabeth Mattijsen liz@raku.rocks

Source can be located at: https://codeberg.org/lizmat/actions . Comments and Pull Requests are welcome.

If you like this module, or what I'm doing more generally, committing to a small sponsorship would mean a great deal to me!

COPYRIGHT AND LICENSE

Copyright 2023, 2024, 2026 Elizabeth Mattijsen

This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.