Irek, I attached a patch which fixes this problem and simplifies the
output for printf %q and similar code paths.

David, Glenn, what do you think about this patch? The goal is to make
parsing easier and avoid that multiple different quoting rules are
executed in the same string, i.e. it makes no sense for humans to use
both \... and '...' quoting methods in one string literal.

Olga

On Thu, May 13, 2010 at 11:44 AM, I. Szczesniak <[email protected]> wrote:
> While working on a python interface to parse ksh compound variables we
> came across this quoting syntax:
> ksh -c 'compound x=( z="a=b c" ) ; print -v x'
> (
>        z=a\='b c'
> )
>
> I mean, why? This syntax is IMO (and in the opinion of others, too) a
> bit inconsistent and confusing.
> z='a=b c' would be OK.
> z=a\=b\ c would be less preferred but at least consistent.
> But z=a\='b c' is a mixture of two different quoting concepts and
> tricky to handle.
>
> We would appreciate to pick one consistent concept and stick with it.
>
> Irek
> _______________________________________________
> ast-users mailing list
> [email protected]
> https://mailman.research.att.com/mailman/listinfo/ast-users
>



-- 
      ,   _                                    _   ,
     { \/`o;====-    Olga Kryzhanovska   -====;o`\/ }
.----'-/`-/     [email protected]   \-`\-'----.
 `'-..-| /       http://twitter.com/fleyta     \ |-..-'`
      /\/\     Solaris/BSD//C/C++ programmer   /\/\
      `--`                                      `--`
Index: common/sh/string.c
===================================================================
--- common/sh/string.c  (revision 2119)
+++ common/sh/string.c  (working copy)
@@ -320,19 +320,6 @@
 #endif
                if(c==0)
                        return((char*)string);
-               if(c=='=')
-               {
-                       if(*cp==0)
-                               return((char*)string);
-                       c = cp - string;
-                       stakwrite(string,c);
-                       string = cp;
-#if SHOPT_MULTIBYTE
-                       c = mbchar(cp);
-#else
-                       c = *(unsigned char*)cp++;
-#endif
-               }
        }
        if(c==0 || c=='#' || c=='~')
                state = 1;
@@ -348,7 +335,7 @@
                if(c=='\'' || !isprint(c))
 #endif /* SHOPT_MULTIBYTE */
                        state = 2;
-               else if(c==']' || (c!=':' && c<=0xff && 
(c=sh_lexstates[ST_NORM][c]) && c!=S_EPAT))
+               else if(c==']' || c=='=' || (c!=':' && c<=0xff && 
(c=sh_lexstates[ST_NORM][c]) && c!=S_EPAT))
                        state |=1;
        }
        if(state<2)
_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users

Reply via email to