Reusing same pattern in a rule
See original GitHub issueHere is an example of grammar that I would like to have:
heredoc = "<<<" marker:[\w]+ "\n" text:[\s\S]+ "\n" marker {
return text.join('');
}
Right now it doesn’t work but It would be nice to be able to use marker later in the rule. So I properly parse:
<<<HELLO
1
2
3
HELLO
Issue Analytics
- State:
- Created 2 years ago
- Comments:16 (8 by maintainers)
Top Results From Across the Web
How to reuse a pattern rule for the same target in (GNU) make?
Sometimes I have to re-run the same operation within the same command chain to get a certain target, e.g. make input.filtered.sorted.updated.
Read more >Rule reuse through inheritance | Pega Academy
Pattern inheritance is automatic. Pattern inheritance uses the existing class name structure to determine which rules are available for reuse.
Read more >How to reuse variable - Error: Pattern appears on the right ...
"Rule: Pattern x_fake appears on the right-hand side of rule..." and "ListPlot: x_fake is not a list of numbers or pairs of numbers"....
Read more >A Patterns-Based Rules Methodology | Enforcing Business ...
This article introduces a pattern-based rules methodology that includes proactive rules checking, a categorization scheme for business rules ...
Read more >Reusing Custom Attributes in Condition Patterns - Noodlesoft
If you use the same custom attribute in an action for this rule, it will have the value of the first condition that...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

See #196 for a fully-worked example of a stack when parsing XML.
@Mingun I again needed to add validation with error (now I fully understand how this works), but I think that your example is not documented. The README don’t shows that you can use
{}anywhere in the code and that you can use this pattern:Are there any other patterns like this? If yes then they should be documented separately (maybe on Wiki list of useful single rule examples on one page), no one have time to read full grammar to search for patterns that you can use.