[il-antlr-interest: 20639] Re: [antlr-interest] Write comments to templates

2008-11-24 Thread Chris Sekszczynska
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

[il-antlr-interest: 20603] Re: [antlr-interest] Write comments to templates

2008-11-23 Thread Chris Sekszczynska
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

[il-antlr-interest: 20594] [antlr-interest] Write comments to templates

2008-11-22 Thread Chris Sekszczynska
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)

[il-antlr-interest: 20426] Re: [antlr-interest] Write a token to the AST within an action

2008-11-11 Thread Chris Sekszczynska
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) {

[il-antlr-interest: 20380] [antlr-interest] Write a token to the AST within an action

2008-11-09 Thread Chris Sekszczynska
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

[il-antlr-interest: 20309] Re: [antlr-interest] gUnit: I s it possible to test StringTemplate output?

2008-11-02 Thread Chris Sekszczynska
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

[il-antlr-interest: 20292] [antlr-interest] gUnit: Is it possible to test StringTemplate output?

2008-11-01 Thread Chris Sekszczynska
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

[il-antlr-interest: 20138] [antlr-interest] How to pass-through comments and complete sentences in ANTLR3.1

2008-10-25 Thread Chris Sekszczynska
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