Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion content/docs/peg.mdz
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,17 @@ compiled to bytecode).
@code`patt` cannot match more than @code`window-patt`; it will
see end-of-input at the end of the substring matched by
@code`window-patt`. If @code`patt` also succeeds, @code`sub` will
advance to the end of what @code`window-patt` matched. }}}
advance to the end of what @code`window-patt` matched. }}

@tr{@td{@code`(split separator-patt patt)` }
@td{ Split the remaining input by @code`separator-patt`, and execute
@code`patt` on each substring. @code`patt` will execute with its
input constrained to the next instance of @code`separator-patt`,
as if narrowed by @code`(sub (to separator-patt) ...)`.
@code`split` will continue to match separators and patterns until
it reaches the end of the input; if you don't want to match to the
end of the input you should first narrow it with
@code`(sub ... (split ...))`. }}}

PEGs try to match an input text with a pattern in a greedy manner. This means
that if a rule fails to match, that rule will fail and not try again. The only
Expand Down
Loading