Re: [9fans] equality sign in Rc

2017-05-16 Thread Giacomo


Il 16 Maggio 2017 19:11:33 CEST, Kurt H Maier  ha scritto:
>On Mon, May 15, 2017 at 03:32:09PM -0400, s...@9front.org wrote:
>> Honestly, the equality sign is never a problem for me.
>> What is the purpose again of making this change?
>> 
>> sl
>
>Why won't anyone answer this question?  

Rc run commands ;-)


Giacomo



Re: [9fans] equality sign in Rc

2017-05-16 Thread hiro
imo instead of changing = behavior * and ? should give errors like
following if unmatched.

rc: #d/0: token '*': syntax error
rc: #d/0: token '?': syntax error



Re: [9fans] equality sign in Rc

2017-05-16 Thread Kurt H Maier
On Mon, May 15, 2017 at 03:32:09PM -0400, s...@9front.org wrote:
> Honestly, the equality sign is never a problem for me.
> What is the purpose again of making this change?
> 
> sl

Why won't anyone answer this question?  

Is bikeshedding a minor inconvenience worth this kind of complexity?

khm



Re: [9fans] equality sign in Rc

2017-05-16 Thread Giacomo Tesio
Tonight I've tried this little hack, but I do not have a comprehensive test
suite (does any exists?)

https://github.com/JehanneOS/jehanne/commit/003141901af25f0bb3556be40b7ff963f57ced32

I thought that there's no reason to mimic sh for this since if you need sh
to run a script rc won't work anyway.
So this is just a little syntactic sugar, that for the joy of sl is not
compatible with sh, but imho it can also increases the readability of
scripts. Indeed I agree with sl that expliitness is an advantage of the
current quotation rules.

The idea is to use a single $ to mark the end of variable declarations, so
that what's left can't do assignments, and equality is always quoted.

Here some examples:

% a=1 echo b=$a
rc: #d/0: token '=': syntax error
% a=1 $ echo b=$a
b=1
% $ eval prefix=$home/foo && echo $prefix
/usr/glenda/foo
% $ eval prefix=$home/foo; echo ./configure --prefix=$prefix
rc: #d/0: token '=': syntax error
% $ eval prefix=$home/foo; $ echo ./configure --prefix=$prefix
./configure --prefix=/usr/glenda/foo
% inf=/dev/random out=/dev/null $ echo dd if=$inf of=$out
dd if=/dev/random of=/dev/null


The mini-syntax should extend till the end of a single command: ; & && and
|| should stop it.

Note that it's the first time I use yacc, so probably there is a better way
to code this and there are probably bugs.
For example I was unable to make this works:

% $ echo ./configure --prefix=`{cat /env/prefix}


Giacomo



2017-05-16 17:59 GMT+02:00 Erik Quanstrom :

> by doing it in the grammar, the redirection issue is avoided.
>
> - erik
>
>
> On May 16, 2017 2:24 AM, Charles Forsyth 
> wrote:
>
>
> On 15 May 2017 at 17:44, trebol  wrote:
>
> > = is part of rc syntax, like {} and (), and it interprets it, not the
>
>
> i'd forgotten about the = in >[2=1], so you'd need another exception ...
> rc would interpret that, but then in [a-b=] it presumably wouldn't again...
>
>
>


Re: [9fans] equality sign in Rc

2017-05-16 Thread Erik Quanstrom
by doing it in the grammar, the redirection issue is avoided.- erikOn May 16, 2017 2:24 AM, Charles Forsyth  wrote:On 15 May 2017 at 17:44, trebol  wrote:> = is part of rc syntax, like {} and (), and it interprets it, not thei'd forgotten about the = in >[2=1], so you'd need another exception ...rc would interpret that, but then in [a-b=] it presumably wouldn't again...



Re: [9fans] equality sign in Rc

2017-05-16 Thread Charles Forsyth
On 15 May 2017 at 17:44, trebol  wrote:

> > = is part of rc syntax, like {} and (), and it interprets it, not the


i'd forgotten about the = in >[2=1], so you'd need another exception ...
rc would interpret that, but then in [a-b=] it presumably wouldn't again...