diff options
author | 2010-07-29 15:27:04 -0500 | |
---|---|---|
committer | 2010-08-04 13:03:21 -0500 | |
commit | 0d253a5f733317908c6ccf25e500fc896edd3373 (patch) | |
tree | 9124fbf8dd6029424ece70d2ed1def58ea1a7f0b /bashast/gunit/fname.gunit | |
parent | Test functional redirection (diff) | |
download | libbash-0d253a5f733317908c6ccf25e500fc896edd3373.tar.gz libbash-0d253a5f733317908c6ccf25e500fc896edd3373.tar.bz2 libbash-0d253a5f733317908c6ccf25e500fc896edd3373.zip |
Filename/string pattern matching
Parser now handles [] pattern matching, albeit very awkwardly.
Tree denotes a MATCH_PATTERN, but presents matches as string parts.
Runtime will have to combine the string parts and then do its own parsing.
This is due to tokens hiding other tokens.
Multiple characters in a row have their own token, which means can't do CHAR+.
Diffstat (limited to 'bashast/gunit/fname.gunit')
-rw-r--r-- | bashast/gunit/fname.gunit | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/bashast/gunit/fname.gunit b/bashast/gunit/fname.gunit index 79c9270..7785142 100644 --- a/bashast/gunit/fname.gunit +++ b/bashast/gunit/fname.gunit @@ -29,3 +29,18 @@ fname: "hex\xaF" -> (STRING hex \xaF) "ctrlx\cx" -> (STRING ctrlx \cx) "tab\\ttab" -> "(STRING tab \\\t tab)" +"abc[def]" -> (STRING abc (MATCH_PATTERN def)) +"a[]" -> (STRING a [ ]) +"ab[d-h]" -> (STRING ab (MATCH_PATTERN d -h)) +"ab[!d-h]" -> (STRING ab (MATCH_ANY_EXCEPT d -h)) +"ab[^d-h]" -> (STRING ab (MATCH_ANY_EXCEPT d -h)) +"ab[]c]" -> (STRING ab (MATCH_PATTERN ] c)) +"ab[:alpha:]" -> (STRING ab (MATCH_PATTERN : alpha :)) +"ab[=c=]" -> (STRING ab (MATCH_PATTERN = c =)) +"ab[.c.]" -> (STRING ab (MATCH_PATTERN . c .)) +"ab[[:alpha:]]" -> (STRING ab (MATCH_PATTERN (CHARACTER_CLASS alpha))) +"ab[[:alpha:][:digit:]]" -> (STRING ab (MATCH_PATTERN (CHARACTER_CLASS alpha) (CHARACTER_CLASS digit))) +"ab[^[:alpha:]]" -> (STRING ab (MATCH_ANY_EXCEPT (CHARACTER_CLASS alpha))) +"ab[[=c=]]" -> (STRING ab (MATCH_PATTERN (EQUIVALENCE_CLASS c))) +"ab[[.backslash.]]" -> (STRING ab (MATCH_PATTERN (COLLATING_SYMBOL backslash))) +"ab[12[:alpha:]]" -> (STRING ab (MATCH_PATTERN 12 (CHARACTER_CLASS alpha))) |