<commit_before>=head1 TITLE

PGE::Text - rules for extracting delimited text sequences from strings

=head1 DESCRIPTION

The various rules in this module may be used to extract delimited
strings from within PGE rules.  (They can of course be called directly,
also.)

=cut

.namespace [ "PGE::Text" ]

.include "cclass.pasm"

.sub "__onload" :load
    .local pmc base
    $P0 = subclass 'PGE::Grammar', 'PGE::Text'
.end

=head2 Available rules

=over 4

=item C<bracketed(PMC target, string delim)>

Extracts a balanced-bracket-delimited substring from the
current position of C<target> using the delimiters specified
by C<delim>, and returns a C<Match> object containing the result
of the extraction.  

=cut

.sub "bracketed"
    .param pmc tgt                                 # target to match
    .param string delim        :optional           # optional delimiters
    .param int has_delim       :opt_flag
    .local pmc newfrom                             # newfrom sub
    .local pmc mob, mfrom, mpos                    # return match object
    .local string target                           # target as string
    .local string bal, bra, ket                    # balanced brackets
    .local string delim_bra, delim_ket             # delims for this match
    .local string lookket                          # closing bracket char
    .local int pos                                 # current match position
    .local int balanced                            # in balanced match
    .local pmc stack                               # lookket backtracking

    stack = new .ResizableStringArray
    newfrom = find_global "PGE::Match", "newfrom"<commit_msg>[PGE]: * Add required :slurpy :named to PGE::Text::bracketed.<commit_after>=head1 TITLE

PGE::Text - rules for extracting delimited text sequences from strings

=head1 DESCRIPTION

The various rules in this module may be used to extract delimited
strings from within PGE rules.  (They can of course be called directly,
also.)

=cut

.namespace [ "PGE::Text" ]

.include "cclass.pasm"

.sub "__onload" :load
    .local pmc base
    $P0 = subclass 'PGE::Grammar', 'PGE::Text'
.end

=head2 Available rules

=over 4

=item C<bracketed(PMC target, string delim)>

Extracts a balanced-bracket-delimited substring from the
current position of C<target> using the delimiters specified
by C<delim>, and returns a C<Match> object containing the result
of the extraction.  

=cut

.sub "bracketed"
    .param pmc tgt                                 # target to match
    .param string delim        :optional           # optional delimiters
    .param int has_delim       :opt_flag
    .param pmc adverbs         :slurpy :named      # named options
    .local pmc newfrom                             # newfrom sub
    .local pmc mob, mfrom, mpos                    # return match object
    .local string target                           # target as string
    .local string bal, bra, ket                    # balanced brackets
    .local string delim_bra, delim_ket             # delims for this match
    .local string lookket                          # closing bracket char
    .local int pos                                 # current match position
    .local int balanced                            # in balanced match
    .local pmc stack                               # lookket backtracking

    stack = new .ResizableStringArray
    newfrom = find_global "PGE::Match", "newfrom"
{'fraction_non_alphanumeric': 0.06495776288960094, 'fraction_numerical': 0.0029129041654529565, 'mean_word_length': 1.9225531914893617, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6183444', 'n_tokens_mistral': 954, 'n_tokens_neox': 898, 'n_words': 360}