My working notes for project Breccia
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Regular-expression pattern matching
─────────────────────────────────────
/ Based on the standard of Perl, not PCRE. No standard in itself, PCRE is merely C’s
implementation of the Perl standard.
- The pattern language must include just those formal elements of Perl that can be supported
(whether directly or through a translational preprocessor) by the regular-expression engines
of the major programming languages and text editors.
: see https://stackoverflow.com/a/1448213/2402790
/ My proxies for the latter are Java and Emacs.
──────────────────────────────────────────────────────────
pattern-matcher compilation based on referrer similarity
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
: see @ `^^ Notes$` @ language_definition.brec
: re `referrer similarity` see @ `^^inferential referent indicant$` @
language_definition.brec
- Toward a definition.
─────────
salvage
┈┈┈┈┈┈┈┈┈
/ Copied from an earlier version of the language definition.
anchored and broadened to division titles( p )
/ A variant of head pattern `p` that broadens its matches to include division titles.
+ Anchor `p` by prepending ‘^ *’.
\ As opposed to ‘^^’, which would fail in this case.
+ Ensure that `p` functions in case insensitive mode (`i`).
: re `case insensitive mode` see
https://perldoc.perl.org/perlreref.html#OPERATORS
return+ `p`
broadened to task and alarm bullets( p )
/ A variant of head pattern `p` that broadens its matches to include task
and alarm bullets.
+ Append ‘(?:\+|!!)?’ to `p`.
return+ `p`
head pattern( f )
/ The generalized pattern of the head of fractum `f`.
deem+ `p` a string buffer, initialized to the head text of `f`
+ Trim `p` of comment carriers and indent blinds.
+ Trim `p` of leading and trailing whitespace.
+ Set `p` to `literalized pattern( p )`.
+ Collapse all remaining whitespace of `p` to ‘\s+’.
/ Neutralizing differences of indentation and line wrapping.
if( `f` is a division )
for( each repetitive sequence `s` in `p` of the same
divider drawing character `c` )
+ Set `s` in `p` to one instance of `c` followed by ‘+’.
/ Neutralizing differences in horizontal length owing e.g. to indentation.
+ Set `p` to `broadened to task and alarm bullets( p )`.
else if( `p` ends with suffix `literalized pattern(‘+’)`
or `literalized pattern(‘!!’)` )
unless( `p` comprises that suffix )
+ Remove that suffix from `p`.
+ Set `p` to `broadened to task and alarm bullets( p )`.
else
+ Set `p` to `broadened to task and alarm bullets( p )`.
+ Set `p` to `anchored and broadened to division titles( p )`.
+ Anchor `p` by appending ‘$$’.
return+ `p`
\ Copyright © 2020, 2022 Michael Allan. Licence MIT.