diff options
author | maxfl <gmaxfl@gmail.com> | 2012-07-02 11:52:18 +0800 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2012-07-05 14:17:25 -0700 |
commit | 01d8490255764855fbf4d3e39995d061b3e69bfe (patch) | |
tree | 6be769acf5c7b48bab2f0837083f2dad677513db /parse_util.cpp | |
parent | ea4b37d5c57a5f7377a605ea87411ca1e033f61a (diff) |
Return the previous logic for '\\'.
The following expression now works:
```sh
switch '\\'
case '\\'
echo 1
end
```
Due to ambiguity, the following expression also works:
```sh
switch '\a'
case '\\a'
echo 1
end
```
By the way, the following expression now doesn't work, which was not the
case before, because of wrong escaping:
```sh
switch 'nn'
case '\n'
echo 1
end
```
Diffstat (limited to 'parse_util.cpp')
-rw-r--r-- | parse_util.cpp | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/parse_util.cpp b/parse_util.cpp index c9c7f548..e474b4df 100644 --- a/parse_util.cpp +++ b/parse_util.cpp @@ -660,11 +660,28 @@ wchar_t *parse_util_unescape_wildcards( const wchar_t *str ) { case L'\\': { - if( *(in+1) ) - { - in++; - *(out++)=*in; - } + switch ( *(in + 1) ) + { + case L'*': + case L'?': + { + in++; + *(out++)=*in; + break; + } + case L'\\': + { + in++; + *(out++)=L'\\'; + *(out++)=L'\\'; + break; + } + default: + { + *(out++)=*in; + break; + } + } break; } |