1
0
Fork 0

Fix Nasal string.match with trailing *

As discussed in:
https://sourceforge.net/p/flightgear/codetickets/2016/

Fix a bug where string.match(‘747’, ‘747*’) returned false.
This commit is contained in:
James Turner 2018-06-16 20:53:07 +01:00
parent 74a14a7dbc
commit bc00f8d436

View file

@ -177,6 +177,11 @@ match = func(str, patt) {
s += 1;
p += 1;
}
# eat trailing * in the pattern; this is needed to fix:
# https://sourceforge.net/p/flightgear/codetickets/2016/
for (;p < size(patt) and patt[p] == `*`; p += 1) {}
return s == size(str) and p == size(patt);
}