Commit Graph
26 Commits
Author SHA1 Message Date
Calvin Rose 980999c97b Make test suite not shadow any variables. 2026-03-15 13:14:10 -05:00
Calvin Rose c7c3821aa6 Remove extra output from peg test. 2026-02-06 00:23:45 -06:00
Calvin Rose d2685594f9 VERBOSE=1 caused tests to fail as we did more asserts inside the assert.
Thenc checked stderr for messages. Since the helper makes assert write
to stderr, this caused extra cruft in our test output.
2026-02-06 00:17:11 -06:00
Calvin Rose ca5c617fba More tweaks to peg suite for arm32 failures. 2026-02-06 00:04:18 -06:00
Calvin Rose 16b449a137 Print "actual" output on verbose mode for suite-peg 2026-02-05 23:52:28 -06:00
Calvin Rose 2e8dd90a51 Line endings in tests. 2026-02-05 23:38:55 -06:00
Calvin Rose 0194115412 Auto-format janet. 2026-02-05 00:33:52 -06:00
Calvin Rose f33697d6a0 Show accumulation buffer and tagged capture in peg debug rule. 2026-02-04 21:17:08 -06:00
Calvin Rose b2bf70eace Move peg debug output to stderr in line with other internal debug tools.
Also allow disabling color in the debug output.
2026-02-04 18:52:20 -06:00
0xbec163andCopilot 416bba9bd9 Add ??/debug PEG rule (#1710)
* Add debug (short-form ??) PEG rule

* Display capture stack to debug PEG rule

* Revise spec_debug to emit just the rule

* Update to proper indentation

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Add a marshal/unmarshal test for ??/debug

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-04 18:44:46 -06:00
Michael Camilleri 6e4b0b9259 Update year in copyright disclaimer to 2026 2026-01-02 14:14:53 +09:00
Calvin Rose f79e4d6249 Address #1674 - Add cms combinator to peg.
It behaves like `cmt`, but flattens the result and can collect
multiple captures if an indexed data structure is returned.
2025-11-30 14:19:51 -06:00
Michael Camilleri a34b8ea68f Update older dates to 2025 2025-03-04 11:32:15 +09:00
Calvin Rose 410f8d69bc Merge pull request #1528 from ianthehenry/til-peg-special
add (til) PEG special
2025-02-03 19:07:08 -08:00
Calvin Rose 6da44bdb6a Get rid of early termination rule in all finite loops. 2025-02-03 07:36:00 -06:00
Calvin Rose d30fd27575 Address #1554 - capture first 0-width match in repeating rules and
optionals.

This fixes some undesirable interplay between lookaheads and looping
(repeating) rules where lookaheads caused the loop to immediately
terminate _and_ discard any captures. This change adds an exception if
there is a 0-width match at the first iteration of the loop, in which
case captures will be kept, although the loop will still be terminated
(any further iteration of the loop would possibly cause an infinite
 loop).

This allows optionals to work as expected when combined with lookahead.
There is also a question of whether or not optional should be
implemented as separate rule rather than as `(between 0 1 subrule)`.
2025-02-02 20:34:36 -06:00
Calvin Rose fa75a395cb Add support for buffer peg literals - address #1549 2025-01-26 09:48:48 -06:00
Calvin Rose 60d9f97750 Address issue #1539 - infinite loop in peg split
Other looping rules ensure forward progress by terminating if an
iteration is at the same location as the previous iteration. Do the same
for split.
2025-01-01 11:28:10 -06:00
Ian Henry 952906279c add (til) PEG special
(til sep subpattern) is a specialized (sub) that behaves like
(sub (to sep) subpattern), but advances over the input like (thru sep).
2024-12-04 21:17:10 -08:00
Calvin Rose 9694aee819 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.
2024-09-12 17:23:34 -05:00
Philip Nelson 0b51ab157d Fix typos 2024-06-16 06:59:27 -07:00
Ian Henry 61f38fab37 add a new (split) PEG special
This works similarly to string/split, but the separator is a PEG.
2024-01-05 22:02:52 -08:00
Ian Henry ea75086300 add a new (sub) PEG special
(sub) will first match one pattern, then match another pattern against the
text that the first pattern advanced over.
2023-12-28 22:15:54 -08:00
sogaiu 5a5e70b001 Update and ascii-sort string escapes in peg 2023-07-08 17:54:00 +09:00
primo-ppcg b3db367ae7 Add test cases for div and mod 2023-06-30 19:48:45 +07:00
sogaiu 9675411f35 Reorganize tests 2023-06-02 07:04:07 +09:00