Adam Shelly
8/1/2008 8:33:00 PM
On 8/1/08, Patrick Li <patrickli_2001@hotmail.com> wrote:
> Nope. that's not quite it. i'm really quite stumped.
>
> syntax error, unexpected tSYMBEG, expecting ')' (SyntaxError)
> if(FieldTypes.key? field && FieldTypes[field].respond_to? :select)
> ^ from
> -e:1
Apparently the parser just can't recognize function calls inside
conditions unless they have the parens:
irb(main):013:0> if (true && p 1)
irb(main):014:1> p :hi; end
SyntaxError: compile error
(irb):13: syntax error, unexpected tINTEGER, expecting kDO or '{' or '('
if (true && p 1)
^
irb(main):015:0> while (true && "s".index 's')
irb(main):016:1> p :loop
irb(main):017:1> end
SyntaxError: compile error
(irb):15: syntax error, unexpected tSTRING_BEG, expecting ')'
while (true && "s".index 's')
^