clean up must_quote a little bit,

This commit is contained in:
Kelvin Sherlock 2016-07-23 12:58:01 -04:00
parent da92eb4e36
commit 34900a00b8
1 changed files with 10 additions and 21 deletions

View File

@ -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