mirror of
https://github.com/dschmenk/PLASMA.git
synced 2025-01-10 06:30:41 +00:00
Match patterns with ending wildcard
This commit is contained in:
parent
12f8cf8053
commit
fb3a4964c8
Binary file not shown.
@ -6,17 +6,21 @@ var dirbuf
|
||||
// Match next section of source and expression
|
||||
//
|
||||
def matchNext(src, srcofst, exp, expofst)
|
||||
if ^src >= srcofst and ^exp >= expofst
|
||||
if ^exp >= expofst
|
||||
when exp->[expofst]
|
||||
is '*' // Multi-char wildcard
|
||||
if matchNext(src, srcofst + 1, exp, expofst + 1)
|
||||
if matchNext(src, srcofst, exp, expofst + 1) // Match zero wild chars
|
||||
return TRUE
|
||||
elsif ^src >= srcofst and matchNext(src, srcofst + 1, exp, expofst) // Match more wild chars
|
||||
return TRUE
|
||||
fin
|
||||
return matchNext(src, srcofst + 1, exp, expofst)
|
||||
is '?' // Single char wildcard
|
||||
return matchNext(src, srcofst + 1, exp, expofst + 1)
|
||||
if ^src >= srcofst
|
||||
return matchNext(src, srcofst + 1, exp, expofst + 1)
|
||||
fin
|
||||
return FALSE
|
||||
otherwise // verbatim match
|
||||
if src->[srcofst] == exp->[expofst]
|
||||
if ^src >= srcofst and src->[srcofst] == exp->[expofst]
|
||||
return matchNext(src, srcofst + 1, exp, expofst + 1)
|
||||
fin
|
||||
return FALSE
|
||||
|
Loading…
x
Reference in New Issue
Block a user