Re: Any plans for a 100% wm syntax compatibility?

Jonathan Revusky <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
Daniel Dekany wrote:
> Monday, March 24, 2008, 11:46:39 PM, Jonathan Revusky wrote:
> 
>> Okay, Demetrios, I have a first pass written now. I mostly did this
>> as a technical challenge. I was curious to see how hard it is.
>> (Answer: not very hard, I don't think.)
> [snip]
> 
> What did you done with the semantical differences regarding missing
> variables? 

All the semantics are freemarker semantics. What it does is it uses the 
Velocity parser to build the AST that Velocity builds. Then I have a 
visitor that walks over the Velocity AST and generates a FreeMarker AST.

Then the processing of the template is done with all the FreeMarker 
machinery, so it's the same as what FreeMarker does when it hits an 
undefined variable.

>(I suppose you don't print $noSuchThing (literarily; that's
> how it works in VM) for $noSuchThing.) 

That's the velocity rendering engine that does that kind of silliness. 
This uses the FreeMarker engine, it's just piggy backing off the 
Velocity parser to understand the VTL.

> With the more loose boolean
> logic (e.g. #if $noSuchThing)? 

None of that happens with this. It's all just regular FreeMarker semantics.


> And with the interpolation semantic? As
> you know, VM uses toString(), while we are using localized format by
> default... that can cause 1234 to become 1,234 and like, that can be a
> problem. Oh, and the horror of horrors... with assignments? You know,
> when #set(x = $noSuchThing) just does nothing. Ugh... it would feel
> perverted to emulate this. :)
> 

It all works the way FreeMarker works. Oh, and by the way, I got the 
line number/column information in there too. So, it constructs error 
messages using the location info from the Velocity template.

I think this may have all taken me 4 or 5 hours. I dunno. This Demetrios 
guy had better check this stuff out and test it, or I'll be annoyed... :-)

JR

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.