Added | as alias for \b
This commit is contained in:
parent
a6d6e39f3f
commit
9c05f880b0
5
bp.1
5
bp.1
@ -189,8 +189,11 @@ An identifier character (e.g.\ alphanumeric characters or underscores).
|
|||||||
An identifier character, not including numbers (e.g.\ alphabetic
|
An identifier character, not including numbers (e.g.\ alphabetic
|
||||||
characters or underscores).
|
characters or underscores).
|
||||||
.TP
|
.TP
|
||||||
|
\f[B]|\f[R]
|
||||||
|
A word boundary (i.e.\ the edge of a word).
|
||||||
|
.TP
|
||||||
\f[B]\[rs]b\f[R]
|
\f[B]\[rs]b\f[R]
|
||||||
A word boundary.
|
Alias for \f[B]|\f[R] (word boundary)
|
||||||
.TP
|
.TP
|
||||||
\f[B]!\f[R] \f[I]pat\f[R]
|
\f[B]!\f[R] \f[I]pat\f[R]
|
||||||
Not \f[I]pat\f[R]
|
Not \f[I]pat\f[R]
|
||||||
|
5
bp.1.md
5
bp.1.md
@ -168,8 +168,11 @@ by the same indentation that occurs on the current line.
|
|||||||
`\I`
|
`\I`
|
||||||
: An identifier character, not including numbers (e.g. alphabetic characters or underscores).
|
: An identifier character, not including numbers (e.g. alphabetic characters or underscores).
|
||||||
|
|
||||||
|
`|`
|
||||||
|
: A word boundary (i.e. the edge of a word).
|
||||||
|
|
||||||
`\b`
|
`\b`
|
||||||
: A word boundary.
|
: Alias for `|` (word boundary)
|
||||||
|
|
||||||
`!` *pat*
|
`!` *pat*
|
||||||
: Not *pat*
|
: Not *pat*
|
||||||
|
@ -48,7 +48,7 @@ escape-sequence: (
|
|||||||
)
|
)
|
||||||
No: `! (__@pat / (!)=>"Expected a pattern after the exclamation mark")
|
No: `! (__@pat / (!)=>"Expected a pattern after the exclamation mark")
|
||||||
Nodent: "\N"
|
Nodent: "\N"
|
||||||
Word-boundary: "\b"
|
Word-boundary: `| / "\b"
|
||||||
Identifier-char: "\i"
|
Identifier-char: "\i"
|
||||||
Identifier-start: "\I"
|
Identifier-start: "\I"
|
||||||
Upto-and: ".." [__(`%/`=)__@second=simple-pat] [__@first=simple-pat]
|
Upto-and: ".." [__(`%/`=)__@second=simple-pat] [__@first=simple-pat]
|
||||||
|
@ -14,7 +14,7 @@ string-escape: `\ (`x 2 Hex / 1-3 `0-7 / `u 1-4 Hex / .)
|
|||||||
id: \I *\i
|
id: \I *\i
|
||||||
var: \I *\i
|
var: \I *\i
|
||||||
keyword: !"" # No keywords defined by default
|
keyword: !"" # No keywords defined by default
|
||||||
word: \b +\i
|
word: | +\i
|
||||||
HEX: `0-9,A-F
|
HEX: `0-9,A-F
|
||||||
Hex: `0-9,a-f,A-F
|
Hex: `0-9,a-f,A-F
|
||||||
hex: `0-9,a-f
|
hex: `0-9,a-f
|
||||||
|
@ -24,5 +24,5 @@ keyword:
|
|||||||
"unsigned" / "using" / "virtual" / "void" / "volatile" / "wchar_t" / "while" / "xor" / "xor_eq"
|
"unsigned" / "using" / "virtual" / "void" / "volatile" / "wchar_t" / "while" / "xor" / "xor_eq"
|
||||||
function-def: ^_ 2+(id / keyword / anglebraces / `*) % __ parens (__`; / >(__`{))
|
function-def: ^_ 2+(id / keyword / anglebraces / `*) % __ parens (__`; / >(__`{))
|
||||||
function: function-def __ braces
|
function: function-def __ braces
|
||||||
macro: ^"#define"\b ..$ *(<`\ \n..$)
|
macro: ^"#define"| ..$ *(<`\ \n..$)
|
||||||
import: ^`#("include"/"import")\b __ (string / `<..`>)
|
import: ^`#("include"/"import")| __ (string / `<..`>)
|
||||||
|
@ -17,5 +17,5 @@ keyword:
|
|||||||
"volatile" / "while"
|
"volatile" / "while"
|
||||||
function-def: ^_ 2+(id / keyword / `*) % __ parens (__`; / >(__`{))
|
function-def: ^_ 2+(id / keyword / `*) % __ parens (__`; / >(__`{))
|
||||||
function: function-def __ braces
|
function: function-def __ braces
|
||||||
macro: ^"#define"\b ..$ *(<`\ \n..$)
|
macro: ^"#define"| ..$ *(<`\ \n..$)
|
||||||
import: ^"#include"\b __ (string / `<..`>)
|
import: ^"#include"| __ (string / `<..`>)
|
||||||
|
@ -12,6 +12,6 @@ keyword:
|
|||||||
"break" / "default" / "func" / "interface" / "select" / "case" / "defer" / "go" /
|
"break" / "default" / "func" / "interface" / "select" / "case" / "defer" / "go" /
|
||||||
"map" / "struct" / "chan" / "else" / "goto" / "package" / "switch" / "const" /
|
"map" / "struct" / "chan" / "else" / "goto" / "package" / "switch" / "const" /
|
||||||
"fallthrough" / "if" / "range" / "type" / "continue" / "for" / "import" / "return" / "var"
|
"fallthrough" / "if" / "range" / "type" / "continue" / "for" / "import" / "return" / "var"
|
||||||
function-def: \b"func"\b __ id __ parens __ [id / parens] >(__`{)
|
function-def: |"func"| __ id __ parens __ [id / parens] >(__`{)
|
||||||
function: function-def __ braces
|
function: function-def __ braces
|
||||||
import: \b"import"\b __ (parens / string)
|
import: |"import"| __ (parens / string)
|
||||||
|
@ -18,6 +18,6 @@ keyword:
|
|||||||
"public" / "return" / "short" / "static" / "super" / "switch" / "synchronized" /
|
"public" / "return" / "short" / "static" / "super" / "switch" / "synchronized" /
|
||||||
"this" / "throw" / "throws" / "transient" / "true" / "try" / "typeof" / "var" /
|
"this" / "throw" / "throws" / "transient" / "true" / "try" / "typeof" / "var" /
|
||||||
"void" / "volatile" / "while" / "with" / "yield"
|
"void" / "volatile" / "while" / "with" / "yield"
|
||||||
function-def: \b"function"\b __ [id__] parens / (id / parens) __ "=>"
|
function-def: |"function"| __ [id__] parens / (id / parens) __ "=>"
|
||||||
function: function-def __ braces
|
function: function-def __ braces
|
||||||
import: \b"import"\b ..%braces (`; / $)
|
import: |"import"| ..%braces (`; / $)
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
comment: ";" ..$
|
comment: ";" ..$
|
||||||
string: `" ..%string-escape `"
|
string: `" ..%string-escape `"
|
||||||
list: parens
|
list: parens
|
||||||
function-def: `(__"defun"\b__id
|
function-def: `(__"defun"|__id
|
||||||
function: function-def ..%parens `)
|
function: function-def ..%parens `)
|
||||||
id-char: `A-Z,a-z,0-9,!,$,%,&,*,+,-,.,/,:,<,=,>,?,@,^,_,~
|
id-char: `A-Z,a-z,0-9,!,$,%,&,*,+,-,.,/,:,<,=,>,?,@,^,_,~
|
||||||
id: !<`A-Z,a-z,0-9,!,$,%,&,*,+,-,.,/,:,<,=,>,?,@,^,_,~ +`A-Z,a-z,0-9,!,$,%,&,*,+,-,.,/,:,<,=,>,?,@,^,_,~
|
id: !<`A-Z,a-z,0-9,!,$,%,&,*,+,-,.,/,:,<,=,>,?,@,^,_,~ +`A-Z,a-z,0-9,!,$,%,&,*,+,-,.,/,:,<,=,>,?,@,^,_,~
|
||||||
|
@ -13,11 +13,11 @@ keyword:
|
|||||||
"and" / "break" / "do" / "else" / "elseif" / "end" / "false" / "for" /
|
"and" / "break" / "do" / "else" / "elseif" / "end" / "false" / "for" /
|
||||||
"function" / "goto" / "if" / "in" / "local" / "nil" / "not" / "or" /
|
"function" / "goto" / "if" / "in" / "local" / "nil" / "not" / "or" /
|
||||||
"repeat" / "return" / "then" / "true" / "until" / "while"
|
"repeat" / "return" / "then" / "true" / "until" / "while"
|
||||||
function-def: \b"function"\b[_id (*(`.id)[`:id])]_ parens
|
function-def: |"function"|[_id (*(`.id)[`:id])]_ parens
|
||||||
block: function / if-block / while-block / for-block / repeat-block / do-block
|
block: function / if-block / while-block / for-block / repeat-block / do-block
|
||||||
repeat-block: \b"repeat"\b ..%(comment/string/\n) (\b"until"\b)
|
repeat-block: |"repeat"| ..%(comment/string/\n) (|"until"|)
|
||||||
do-block: \b"do"\b ..%(comment/string/block/\n) (\b"end"\b)
|
do-block: |"do"| ..%(comment/string/block/\n) (|"end"|)
|
||||||
for-block: \b"for"\b ..%\n >(\b"do"\b) do-block
|
for-block: |"for"| ..%\n >(|"do"|) do-block
|
||||||
while-block: \b"while"\b ..%\n >(\b"do"\b) do-block
|
while-block: |"while"| ..%\n >(|"do"|) do-block
|
||||||
if-block: \b"if"\b ..%\n \b"then"\b ..%(comment/string/\n) (\b"end"\b)
|
if-block: |"if"| ..%\n |"then"| ..%(comment/string/\n) (|"end"|)
|
||||||
function: function-def ..%(comment/string/block/\n) (\b"end"\b)
|
function: function-def ..%(comment/string/block/\n) (|"end"|)
|
||||||
|
@ -14,7 +14,7 @@ keyword: "and" / "as" / "assert" / "break" / "class" / "continue" / "def" /
|
|||||||
"not" / "or" / "pass" / "raise" / "return" / "try" / "while" /
|
"not" / "or" / "pass" / "raise" / "return" / "try" / "while" /
|
||||||
"with" / "yield"
|
"with" / "yield"
|
||||||
class: class-def +(\N ..$)
|
class: class-def +(\N ..$)
|
||||||
class-def: ^_"class"\b_id[_parens]_`:
|
class-def: ^_"class"|_id[_parens]_`:
|
||||||
function: function-def +(\N ..$)
|
function: function-def +(\N ..$)
|
||||||
function-def: ^_"def"\b_id parens `:
|
function-def: ^_"def"|_id parens `:
|
||||||
import: ^_["from"\b ..%parens >(\b"import"\b)] \b"import"\b ..%parens $
|
import: ^_["from"| ..%parens >(|"import"|)] |"import"| ..%parens $
|
||||||
|
@ -13,6 +13,6 @@ keyword:
|
|||||||
"false" / "fn" / "for" / "if" / "impl" / "in" / "let" / "loop" / "match" /
|
"false" / "fn" / "for" / "if" / "impl" / "in" / "let" / "loop" / "match" /
|
||||||
"mod" / "move" / "mut" / "pub" / "ref" / "return" / "self" / "Self" / "static" /
|
"mod" / "move" / "mut" / "pub" / "ref" / "return" / "self" / "Self" / "static" /
|
||||||
"struct" / "super" / "trait" / "true" / "type" / "unsafe" / "use" / "where" / "while"
|
"struct" / "super" / "trait" / "true" / "type" / "unsafe" / "use" / "where" / "while"
|
||||||
function-def: \b"fn"\b __ id __ parens __ ["->"__(id / parens)] >(__`{)
|
function-def: |"fn"| __ id __ parens __ ["->"__(id / parens)] >(__`{)
|
||||||
function: function-def __ braces
|
function: function-def __ braces
|
||||||
import: \b"use"\b _ *(id / braces) % "::" _ `;
|
import: |"use"| _ *(id / braces) % "::" _ `;
|
||||||
|
@ -332,6 +332,10 @@ static pat_t *_bp_simplepattern(file_t *f, const char *str)
|
|||||||
|
|
||||||
return all;
|
return all;
|
||||||
}
|
}
|
||||||
|
// Word boundary
|
||||||
|
case '|': {
|
||||||
|
return new_pat(f, start, str, 0, 0, BP_WORD_BOUNDARY);
|
||||||
|
}
|
||||||
// String literal
|
// String literal
|
||||||
case '"': case '\'': case '\002': {
|
case '"': case '\'': case '\002': {
|
||||||
char endquote = c == '\002' ? '\003' : c;
|
char endquote = c == '\002' ? '\003' : c;
|
||||||
|
Loading…
Reference in New Issue
Block a user