Re: FreeMarker support for NetBeans

Daniel Dekany <[email protected]> Sat, 30 May 2015 03:14:39 +0200
Newsgroups gmane.comp.web.freemarker.devel
Message-ID <[email protected]>
[...]
>> possible technically in this case. Like you are saying that you are
>> using FTL.jj. So you re-JavaCC it for some reason? Can't the plugin
>> just use FMParserTokenManager for example?
> I tried that, but in original FTL.jj whitespace is skipped inside FTL 
> expression, so it's not tokenized. In that situation lexer was not 
> working properly, so I have had to modify FTL.jj to treat whitespace as
> tokens.

Though the information about the skipped whitespace sections isn't
lost, because the position of the token's beginning and ending in the
original text is part of the Token object. The gaps between those
positions are the ignored whitespace.

> The freemarker.jar is used only for parsing and marking syntax errors.

So just by replacing freemarker.jar one could avoid false error
markers when using new built-ins/directives/operators. Syntax
highlighting is trickier for sure. New directives generate new tokens
(which is silly... one day I intend to fix that), and new operators
too, obviously. But luckily, new built-ins (the ?something stuff)
don't, and they are the most frequent problem after new releases. For
the new kind of tokens there could be a heuristic token type
categorizer, which makes a guess based on Token.image. Like if you get
Token.image "<#foo", that must be a new directive's start-tag opener.

>> BTW, if you are using the real parser, maybe you aren't far from
>> syntax highlight inside FTL expressions.
> What do you mean? Aren't they already highlighted?

Indeed, now that I'm trying harder, some of them are, like "..." and
() and []. But most things are just black, that's what confused me. I
think operators like "+", "." etc. should be colored differently.

-- 
Thanks,
 Daniel Dekany


------------------------------------------------------------------------------