MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Strange parsing error.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg84940] Re: Strange parsing error.
  • From: Szabolcs Horvát <szhorvat at gmail.com>
  • Date: Sun, 20 Jan 2008 03:38:59 -0500 (EST)
  • References: <fmsllk$lb6$1@smc.vnet.net>

Nasser Abbasi wrote:
>  Why is
>                                "Module                        ["
> ok, but
> 
> "Module
> ["
> 
> is not?
> 
> spaces and new lines should not make a difference. They don't seem to make 
> different for everything else, so why for the opening "[" of Module? (this 
> apply to opening "[" of anything else in Mathematica btw, such as If[, 
> Which[, etc.. The opening "[" has to be on the same line. It can be 
> separated by many spaces, but only by spaces, not even tabs are allowed !


It wasn't difficult to guess which one is incorrect---spaces and 
newlines are not the same thing.  A newline can terminate a command, a 
space cannot (the space will be interpreted as multiplication).  When 
the parser sees the newline after "Module", it assumes that the 
expression ends there, and "[" at the beginning of the expression is a 
syntax error.

-- 
Szabolcs


  • Prev by Date: Re: Mathematica commenting of code using (* *) can't
  • Next by Date: Re: Findfit in C++
  • Previous by thread: Strange parsing error.
  • Next by thread: Tracing a Cycloid