[Asterisk-Users] Re: Gogoif with variables acting funny?

Steve Murphy murf at e-tools.com
Mon Jul 12 23:13:59 MST 2004


Andrew Kohlsmith wrote:
> On Monday 12 July 2004 18:44, Ed Pringle wrote:
> >  $[expr1 operator expr2]
> >
> >  Spaces (and lack of spaces) are important. There is no space
> between the
> > opening [ and expr1, or between expr2 and the closing ]. But you do
> need
> > spaces separating expr1 from operator, and separating operator from
> expr2.
> 
> Any particular reason why it's so picky about spaces, especially
> between the 
> [] and exprs?  Seems like a minor bug to me.
> 
> -A.

I added code to improve the parser, to a degree, a number of weeks ago.
It is in CVS right now. Basically, it made it so it didn't care how many
spaces were between tokens (as long as there is at least one), or at the
beginning or end of the string to be evaluated. It also improved the
error messages that are sent to the log (see
/var/log/asterisk/messages). And, I made it use double quotes to force a
string token... even if the string contains spaces.

It's all documented in the asterisk/doc/README.variables.

I was very tempted to change it so that it used a lexer-- like lex,
perfect hash, etc, etc.... but just didn't have the time. It'd be a big
change. The lexical analysis is real simple. it uses a space, basically,
to separate tokens. And that's it! No space? it's all one token.

murf





More information about the asterisk-users mailing list