Hi Jared,
this could be a good and elegant solution :)
I think you mean the TokenStreamRewriteEngine? There, I can add a
String before and after a hidden token. But how can I access the
String which is produced by a specific template? And how can I map the
template output to the hidden tok
Hi Gavin,
in general, a good idea. This would simplify the parser. But what's
about the walker? After splicing the ASTs, the walker has to expect an
^(comment ...) subtree everywhere (or at least after / before every
statement).
Is it possible to let the walker walk two ASTs? Synchronizatio
Hi all,
after a longer search, I don't found a good way to write comments
from the source file to template output. My workflow is the following:
Lexer (which puts comments into the hidden channel) -> parser (which
creates an AST) -> walker (which writes output using StringTemplate)
Hi Gavin,
> All the functions that ANTLR itself uses to
> construct ASTs are available to your code.
The following helper method works great, thanks a lot!
private CommonTree createTreeByGlobals(List symbols) {
CommonTree globalTree = null;
if (newGlobals.size() > 0) {
Hi all,
After a long research, I ask you because I have no idea how to write
directly to the AST-Stream from within an action. My parser remembers
token-names in an ArrayList which must be written to the AST in an
other rule. Here's my rule "program", where the names are ready to
write to
Hi Leon,
thank you very much! Your patch works fine. Now, I can test my grammars
and templates in an convenient way :)
Kind regards,
Chris
> Thanks for pointing out this issue. I think it's a bug of testing a
> tree grammar's template output in gUnit-1.0.2.
> I just uploaded an intermediate rel
Hello all,
simple question: Is it possible to test a tree walkers template output
using
gUnit? In my tree grammar I put the following into the starting rule:
@init {
try {
FileReader groupFileR = new FileReader("path/to/group.stg");
StringTemplateGroup templates = new
S
sophisticated solution for my three problems?
Thank you very much in advance.
Kind regards,
Chris Sekszczynska
Student of computer engineering
at University of Applied Sciences Bremen, Germany
[1]
http://www.antlr.org/article/preserving.token.order/preserving.token.order.tml
List: htt