Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Arithmetic expression (bug?)



Catching up on some more old stuff:

On Nov 5,  1:40am, Phil Pennock wrote:
} Subject: Re: Arithmetic expression (bug?)
}
} Typing away merrily, Bernd Eggink produced the immortal words:
} > > -----------------------------< cut here >-------------------------------
} > > foo=alpha
} > > print -- ${(l<$[10]><x>)foo}
} > > print -- ${(l<10><x>)foo}
} > > -----------------------------< cut here >-------------------------------
} > > why does the third line produce:
} > > ./testfile: error in flags [3]
} > > ?
} > 
} > I can't reproduce this.

I *can* reproduce this.  I can reproduce it in 3.0.5, too.

The problem is with the parse:

    l<$[10]><x> parses as
    	'l' '<' String Inbrack '1' '0' Outbrack '>' '<' 'x' '>'

    l<10><x> parses as
    	'l' Inang '1' '0' Outang '<' 'x' '>'

Now because (Inang != '<') the error is reported when looking at the <x>
after correctly scanning the <10>.

I'm not fluent enough with the parser to understand why that happens, or
whether the fix is to treat Inang, Inpar, etc. as equal to '<', '(', etc.
in the substitution code, or to actually modify the parser.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



Messages sorted by: Reverse Date, Date, Thread, Author