Renamed boundary->edge

This commit is contained in:
Bruce Hill 2021-05-11 19:06:41 -07:00
parent a93220972f
commit 1a1b3ecfee
3 changed files with 9 additions and 9 deletions

View File

@ -16,18 +16,18 @@ brackets: `[ ..%(\n/brackets/string) `]
braces: `{ ..%(\n/braces/string) `}
parens: `( ..%(\n/parens/string) `)
string: `" ..%(`\.) `" / `' ..%(`\.) `'
left-id-boundary: ^ / <(\x00-x7f!=id-char) / <((\xc0-xdf \x80-xbf)!=id-char)
left-id-edge: ^ / <(\x00-x7f!=id-char) / <((\xc0-xdf \x80-xbf)!=id-char)
/ <((\xe0-xef 2\x80-xbf)!=id-char) / <((\xf0-xf7 3\x80-xbf)!=id-char)
right-id-boundary: !id-char
id: left-id-boundary !`0-9 (+id-char)!=keyword
right-id-edge: !id-char
id: left-id-edge !`0-9 (+id-char)!=keyword
id-char: `a-z,A-Z,_,0-9
var: id
keyword: !"" # No keywords defined by default
left-word-boundary: ^ / <(\x00-x7f!=word-char) / <((\xc0-xdf \x80-xbf)!=word-char)
left-word-edge: ^ / <(\x00-x7f!=word-char) / <((\xc0-xdf \x80-xbf)!=word-char)
/ <((\xe0-xef 2\x80-xbf)!=word-char) / <((\xf0-xf7 3\x80-xbf)!=word-char)
right-word-boundary: !word-char
right-word-edge: !word-char
word-char: `a-z,A-Z,_,0-9,-,'
word: left-word-boundary +word-char
word: left-word-edge +word-char
HEX: `0-9,A-F
Hex: `0-9,a-f,A-F
hex: `0-9,a-f

View File

@ -1,5 +1,5 @@
# Definitions of UTF8-compliant identifiers
id: left-word-boundary (utf8-id-start *utf8-id-cont)!=keyword
id: left-word-edge (utf8-id-start *utf8-id-cont)!=keyword
id-char: utf8-id-cont / utf8-id-start
word-char: utf8-id-cont / utf8-id-start

View File

@ -305,11 +305,11 @@ static pat_t *_bp_simplepattern(file_t *f, const char *str)
if (c == '{') { // Surround with `|` word boundaries
pat_t *left = new_pat(f, start, start+1, -1, BP_REF);
left->args.ref.name = "left-word-boundary";
left->args.ref.name = "left-word-edge";
left->args.ref.len = strlen(left->args.ref.name);
pat_t *right = new_pat(f, str, str+1, -1, BP_REF);
right->args.ref.name = "right-word-boundary";
right->args.ref.name = "right-word-edge";
right->args.ref.len = strlen(right->args.ref.name);
pat = chain_together(f, left, chain_together(f, pat, right));