On Apr 24, 2007, at 3:05 PM, Esbach, Brandon wrote:
  Fairly said, I'm sure Guillaume would object -
given that it's not
 exactly pure in that sense.
 As to why the error happens for copy-paste, from what I can see this
 removes important linefeeds (if you copy-paste from the same page,
 you'll see this when you paste into a standard ASCII editor, eg
 notepad); the first two lines join and the Groovy parser tries to
 process "def xwiki  def context" as one instruction instead of two
 instructions.
 The only difference now is that the ";" forces the parser to start
 a new
 instruction, so "def xwiki;  def context" is processed as two separate
 instructions.
 IIRC, some platforms treat linefeed differently, so this may not
 even be
 a problem if you use *nix to copy the text.
 Perhaps something could be done to make the {code} put hard breaks
 between lines though? 
I doubt it as the code macro comes from Radeox JAR (we haven't
modified it).
-Vincent
  Then this change (or even the warning) wouldn't
 be needed.
 -----Original Message-----
 From: Vincent Massol [mailto:vincent@massol.net]
 Sent: 24 April 2007 13:28
 To: xwiki-users(a)objectweb.org
 Subject: Re: [xwiki-users] Groovy tutorial in dev guide
 Hi Brandon,
 On Apr 24, 2007, at 10:24 AM, Esbach, Brandon wrote:
  This is a copy-paste problem.  If you copy the
text first to a
 standard text editor (like notepad), you'll see "def xwiki" and "def
 context" are in the same line, unfortunately this is not actually
 allowed by the groovy parser UNLESS you put a ";"
 after
 each line (it's only the first two lines of the class that has this
 problem for the example).
 I'll add some text to the example to highlight this. 
 I see you've modified the page on 
xwiki.org, cool. However I know for
 sure that Groovy purists will not like the change as they consider
 that
 Groovy code shouldn't have any semicolon (";") at all. I know
 Guillaume
 Laforge wouldn't like it for example...
 Thus I think we shouldn't add them, especially as they're not
 necessary.
 I don't understand why a copy paste wouldn't work. In any case I'd
 prefer a warning rather than having to make the code less good.
 WDYT?
 Thanks
 -Vincent
> -----Original Message-----
> From: roopesh(a)digitalglue.in [mailto:roopesh@digitalglue.in]
> Sent: 24 April 2007 08:20
> To: xwiki-users(a)objectweb.org
> Subject: [xwiki-users] Groovy tutorial in dev guide
>
> Hi
>
> I tried to follow the Groovy Tutorial given in the developer guide.
> But
> I couldn't make it run.
> (
http://www.xwiki.org/xwiki/bin/view/DevGuide/
> GroovyClassHelloWorldTutor
> ial)
>
>
> Instantiating groovy class from velocity threw the foll error :
>
> Error number 4001 in 4: Error while parsing velocity page
> Main.HelloWorldFromVelocity Wrapped Exception: Invocation of method
> 'parseGroovyFromPage' in class com.xpn.xwiki.api.XWiki threw
> exception
> com.xpn.xwiki.XWikiException: Error number 14001 in 14: Failed
> compiling groovy script Wrapped Exception: startup failed,
> script1177398554781.groovy: 5: unexpected token: xwiki @ line 5,
> column 5.
>
>
> Instantiating groovy from groovy resulted in the foll error :
>
> Error number 4002 in 4: Error while parsing groovy page
> Groovy.HelloWorldClassTest Wrapped Exception: startup failed,
> Script1.groovy: 3: unexpected token: groovyObject @ line 3, column
> 68.
>
> (While creating the class I have assigned programming rights to the
> user who made the class.) What am I doing wrong.
>
> Thanks and Regards
> Roopesh