Thank you. Daniel Dekany <daniel.dek...@gmail.com> schrieb am Do., 22. Okt. 2020, 18:51:
> You parse the text to Template, and then call Template.getRootTreeNode(). > Actually, you may need to do this with incomplete templates, in which case > there's no API for that, but the things you linked weren't about that, but > this AST thing, I believe. > > On Thu, Oct 22, 2020 at 4:36 PM Christoph Rüger <c.rue...@synesty.com> > wrote: > > > can you point me to a starting class? > > > > Daniel Dekany <daniel.dek...@gmail.com> schrieb am Do., 22. Okt. 2020, > > 16:34: > > > > > No, AST, for Abstract Syntax Tree, is when you see the template as a > > > tree. TemplateObject and its subclasses. > > > > > > On Thu, Oct 22, 2020 at 3:59 PM Christoph Rüger <c.rue...@synesty.com> > > > wrote: > > > > > > > Thanks. > > > > Just to be clear: When you say "AST API that we have", are referring > to > > > > doing something like this? > > > > > > > > package freemarker.core;public class FMParserTest { public static > > > void > > > > main(String[] args) { FMParser fmParser = > new > > > > FMParser("<#if a == > > > > b>true</#if>"); Token nextToken = > > > > fmParser.getNextToken(); > System.out.println(nextToken); > > > > }} > > > > > > > > > > > > Am Do., 22. Okt. 2020 um 13:43 Uhr schrieb Daniel Dekany < > > > > daniel.dek...@gmail.com>: > > > > > > > > > I think at this point you might as well use the AST API that we > have. > > > > > Generally (didn't check the thread) my concern was that if the AST > > > API-s > > > > > are published, then they can't be refactored. But, they won't be in > > 2.x > > > > > anyway. I didn't even dare to do basic clean up there (like just > > rename > > > > > classes to have more helpful names), because someone might depends > on > > > the > > > > > classes that are public, but are documented to be internal API-s. > > > > > > > > > > On Thu, Oct 22, 2020 at 10:38 AM Christoph Rüger < > > c.rue...@synesty.com > > > > > > > > > wrote: > > > > > > > > > > > Hi, > > > > > > i found this discussion > > > > > > https://sourceforge.net/p/freemarker/mailman/message/34258954/ > and > > > > this > > > > > > repo https://github.com/cwong15/freemarker-introspection > > > > > > > > > > > > I wanted to ask the following things: > > > > > > > > > > > > 1. Where did this discussion go? Is there already something where > > one > > > > can > > > > > > get the AST for a template? > > > > > > > > > > > > We are currently investigating how we can access the AST to > build a > > > > > > graphical visualization of an IF/ELSE Statement. > > > > > > > > > > > > Example: > > > > > > Imagine the user can enter something like "<#if (product.category > > == > > > > > "foo" > > > > > > && product.price < 100)>true<#else>false</#if> > > > > > > We would like to extract the used variables and the operators to > > > > display > > > > > > this in a more visual way. > > > > > > > > > > > > I am looking for some kind of starting point for this. > > > > > > > > > > > > Thanks for hints, > > > > > > Christoph > > > > > > > > > > > > -- > > > > > > Synesty GmbH > > > > > > Moritz-von-Rohr-Str. 1a > > > > > > 07745 Jena > > > > > > Tel.: +49 3641 > > > > > > 5596493Internet: https://synesty.com <https://synesty.com> > > > > > > Informationen > > > > > > zum Datenschutz: https://synesty.com/datenschutz > > > > > > <https://synesty.com/datenschutz> > > > > > > > > > > > > Geschäftsführer: Christoph Rüger > > > > > > Unternehmenssitz: Jena > > > > > > Handelsregister B beim Amtsgericht: Jena > > > > > > Handelsregister-Nummer: HRB 508766 > > > > > > Ust-IdNr.: DE287564982 > > > > > > > > > > > > > > > > > > > > > -- > > > > > Best regards, > > > > > Daniel Dekany > > > > > > > > > > > > > > > > > -- > > > > Christoph Rüger, Geschäftsführer > > > > Synesty <https://synesty.com/> - Anbinden und Automatisieren ohne > > > > Programmieren > > > > > > > > -- > > > > Synesty GmbH > > > > Moritz-von-Rohr-Str. 1a > > > > 07745 Jena > > > > Tel.: +49 3641 > > > > 5596493Internet: https://synesty.com <https://synesty.com> > > > > Informationen > > > > zum Datenschutz: https://synesty.com/datenschutz > > > > <https://synesty.com/datenschutz> > > > > > > > > Geschäftsführer: Christoph Rüger > > > > Unternehmenssitz: Jena > > > > Handelsregister B beim Amtsgericht: Jena > > > > Handelsregister-Nummer: HRB 508766 > > > > Ust-IdNr.: DE287564982 > > > > > > > > > > > > > -- > > > Best regards, > > > Daniel Dekany > > > > > > > -- > > Synesty GmbH > > Moritz-von-Rohr-Str. 1a > > 07745 Jena > > Tel.: +49 3641 > > 5596493Internet: https://synesty.com <https://synesty.com> > > Informationen > > zum Datenschutz: https://synesty.com/datenschutz > > <https://synesty.com/datenschutz> > > > > Geschäftsführer: Christoph Rüger > > Unternehmenssitz: Jena > > Handelsregister B beim Amtsgericht: Jena > > Handelsregister-Nummer: HRB 508766 > > Ust-IdNr.: DE287564982 > > > > > -- > Best regards, > Daniel Dekany > -- Synesty GmbH Moritz-von-Rohr-Str. 1a 07745 Jena Tel.: +49 3641 5596493Internet: https://synesty.com <https://synesty.com> Informationen zum Datenschutz: https://synesty.com/datenschutz <https://synesty.com/datenschutz> Geschäftsführer: Christoph Rüger Unternehmenssitz: Jena Handelsregister B beim Amtsgericht: Jena Handelsregister-Nummer: HRB 508766 Ust-IdNr.: DE287564982