From 7d6a248f2c68d70f58387afc69e73e695c3d940c Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Mon, 4 May 2020 23:20:08 -0400 Subject: rc: move free carat handling into parser This fixes at least one shell script (printfont) that expected 'x'`{y}'z' to mean 'x'^`{y}^'z' as it now does. Before it meant: 'x'^`{y} 'z' One surprise is that adjacent lists get a free carat: (x y z)(1 2 3) is (x1 y2 z3) This doesn't affect any rc script in Plan 9 or plan9port. --- src/cmd/rc/lex.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/cmd/rc/lex.c') diff --git a/src/cmd/rc/lex.c b/src/cmd/rc/lex.c index 58338479..48bd70de 100644 --- a/src/cmd/rc/lex.c +++ b/src/cmd/rc/lex.c @@ -202,7 +202,7 @@ yylex(void) * if the next character is the first character of a simple or compound word, * we insert a `^' before it. */ - if(lastword){ + if(lastword && flag['Y']){ lastword = 0; if(d=='('){ advance(); @@ -215,8 +215,8 @@ yylex(void) } } inquote = 0; - if(skipwhite() && flag['Z']) - return SP; + if(skipwhite() && !flag['Y']) + return ' '; switch(c = advance()){ case EOF: lastdol = 0; -- cgit v1.2.3