Posted by Chung Leong on 05/29/06 03:44
Norman Peelman wrote:
> So, what would you want to happen? Should the parser go through each
> entire string looking for math equations first then string everything
> together after. I'm thinking that the problem is probably the loose type
> casting of the language. I'm thinking that under normal circumstances math
> is not normally done within a string.
I have been saying the same thing and you keep missing it: the concat
operator should have its own precedence, lower than that of addition
and subtraction. What it involves is changing the line in the parser
definition from
%left '+' '-' '.'
to
%left '.'
%left '+' '-'
Now when the parser encounters "two plus two makes" . 2 + 2, it'll see
that the plus sign has higher precedence than the period (it's lower in
the definition) and will thus process it first.
Got it?
[Back to original message]
|