1
0
mirror of https://github.com/janet-lang/janet synced 2025-12-12 11:38:08 +00:00

Add rules for nth and only-tags. Address #1503

These rules allow selecting from a number of sub-captures
while dropping the rest. `nth` is more succinct in many cases, but `only-tags` is
more general and corresponds to an internal mechanism already present.
This commit is contained in:
Calvin Rose
2024-09-12 17:03:03 -05:00
parent 2697b0e425
commit 9694aee819
4 changed files with 74 additions and 1 deletions

View File

@@ -2180,7 +2180,9 @@ typedef enum {
RULE_UNREF, /* [rule, tag] */
RULE_CAPTURE_NUM, /* [rule, tag] */
RULE_SUB, /* [rule, rule] */
RULE_SPLIT /* [rule, rule] */
RULE_SPLIT, /* [rule, rule] */
RULE_NTH, /* [nth, rule, tag] */
RULE_ONLY_TAGS, /* [rule] */
} JanetPegOpcod;
typedef struct {