Update regex lookahead to match when there are no characters

This commit is contained in:
Shing Him Ng 2024-12-19 16:28:21 -06:00
parent 9cb302e477
commit 23f75a098c
1 changed files with 2 additions and 2 deletions

View File

@ -99,12 +99,12 @@ main() {
# Print all public structs and enums.
structs_and_enums() {
grep -oP 'pub (struct|enum) \K[\w:]+(?=\(|;| )' "$file" | sed "s/^${crate_full_name}:://"
grep -oP 'pub (struct|enum) \K[\w:]+(?=\(|;| |$)' "$file" | sed "s/^${crate_full_name}:://"
}
# Print all public structs and enums excluding error types.
structs_and_enums_no_err() {
grep -oP 'pub (struct|enum) \K[\w:]+(?=\(|;| )' "$file" | sed "s/^${crate_full_name}:://" | grep -v Error
grep -oP 'pub (struct|enum) \K[\w:]+(?=\(|;| |$)' "$file" | sed "s/^${crate_full_name}:://" | grep -v Error
}
# Print all public traits.