From 56f945ce292bc4bfe2b3bf6fe9dcf9079dd63d66 Mon Sep 17 00:00:00 2001 From: Kelvin Sherlock Date: Thu, 28 Jul 2016 16:30:17 -0400 Subject: [PATCH] simplify argv0 lookup a little bit. --- phase2.rl | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/phase2.rl b/phase2.rl index b5ab4ca..82b9f49 100644 --- a/phase2.rl +++ b/phase2.rl @@ -127,7 +127,7 @@ alphtype unsigned char; action push { argv0.push_back(tolower(fc)); } - + action break { fbreak; } escape = 0xb6; ws = [ \t]; @@ -151,13 +151,15 @@ dchar = esc_seq | (any-escape-["]) $push; dstring = ["] dchar** ["]; + # mpw doesn't handle quotes at this point, + # so simplify and stop if we see anything invalid. main := ( - ws ${ fbreak; } - | [{`] ${ argv0.clear(); fbreak; } - | sstring - | dstring - | esc_seq - | (any-escape-['"]) $push + ws $break + | [|<>] $break + | 0xb7 $break + | 0xb3 $break + | [^a-zA-Z] ${ return COMMAND; } + | any $push )**; }%%