diff options
author | Rasmus Villemoes <ravi@prevas.dk> | 2025-05-13 10:40:32 +0200 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2025-05-29 08:25:18 -0600 |
commit | fe4f21185050ef3f2cc847ba04701d1e714522e3 (patch) | |
tree | c2f0dc8e71ed60814ff928fa2195813652310d04 /lib/tiny-printf.c | |
parent | 4d08883556b588bc1e6ef392349c51eceb550829 (diff) |
slre: implement support for ranges in character classes
When trying to use U-Boot's regex facility, it is a rather large
gotcha that [a-z] range syntax is not supported. It doesn't require a
lot of extra code to implement that; we just let the regular parsing
emit the start and end literal symbols as usual, and add a new
"escape" code RANGE.
At match time, this means the code will first just see an 'a' and try
to match that, and only then recognize that it's actually part of a
range and then do the 'a' <= ch <= 'z' test.
Of course, this means that a - in the middle of a [] pair no longer
matches a literal dash, but I highly doubt anybody relies on
that. Putting it first or last, or escaping it with \, as in most
other RE engines, continues to work.
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
Diffstat (limited to 'lib/tiny-printf.c')
0 files changed, 0 insertions, 0 deletions