From 34900a00b81605da59771006b6f22f63db66bdb5 Mon Sep 17 00:00:00 2001 From: Kelvin Sherlock Date: Sat, 23 Jul 2016 12:58:01 -0400 Subject: [PATCH] clean up must_quote a little bit, --- mpw-shell-quote.rl | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/mpw-shell-quote.rl b/mpw-shell-quote.rl index 602175f..d85d16a 100644 --- a/mpw-shell-quote.rl +++ b/mpw-shell-quote.rl @@ -7,31 +7,19 @@ bool must_quote(const std::string &s){ alphtype unsigned char; quotable = ( - [ \t\r\n] - | - 0x00 - | - [0x80-0xff] - | - [+#;&|()'"/\\{}`?*<>] - | - '-' - | - '[' - | - ']' + [ \t\r\n] + | 0x00 + | [0x80-0xff] + | [+#;&|()'"/\\{}`?*<>] + | '-' + | '[' + | ']' ); #simpler just to say what's ok. normal = [A-Za-z0-9_.:]; - main := - ( - normal - | - (any-normal) ${return true;} - )* - ; + main := normal*; }%% %%write data; @@ -43,7 +31,8 @@ bool must_quote(const std::string &s){ %%write init; %%write exec; - return false; + + return cs == must_quote_error; } #if 0