|
|
|
|
Re: jsp editor [message #723960 is a reply to message #723910] |
Sat, 10 September 2011 02:10 |
Henrik Lindberg Messages: 2509 Registered: July 2009 |
Senior Member |
|
|
On 9/9/11 10:36 PM, Christian Dietrich wrote:
> Hi,
>
> you can find the b3 grammar here
> http://git.eclipse.org/c/b3/b3.git/tree/org.eclipse.b3.beelang/src/org/eclipse/b3/BeeLang.xtext
>
>
> ~Christian
In b3, it is possible to write a template within « », and it is possible
to switch to expressions mode within the template to interpolate the
value of the expression. The tricky thing was to express the terminals
for this. (I got help from Sebastian ;).
Since the «» are not used for anything else in the grammar, it was quite
straight forward.
In Geppeto (IDE for Puppet manifests), the template possibilities are
much more complicated to lex due to excessive syntactic sugar coating.
Basically a template is a double quoted string "", and expression
interpolations are $var, or ${expression} (with some additional
variations). In Geppetto, I use an external lexer (primarily to overcome
other lexing issues, but it helps with strings and templates as well).
The geppetto code is found at github cloudsmith/geppetto.
If I were to implement something jsp like and I could not reserve some
characters like «» (or distinct operators like '${' '}$') for templates,
I would strongly recommend using an external lexer to enable more
complex lexing logic to recognize the templates. The same goes for
templates that are base on initial magic marker on a line (like %) to
end of line and the marker char is also an operator, or if the logic
requires understanding of "indents from margin".
Regards
- henrik
|
|
|
Powered by
FUDForum. Page generated in 0.05148 seconds