[il-antlr-interest: 34141] Re: [antlr-interest] CommonTree vs CommonAST

2011-09-25 Thread Martijn Reuvers
Hey Ter, New name sounds good to me to distinguish. Yes it will break things, but well if you go to v4 that can be expected anyway - as it's a major release. =) Martijn On Sat, Sep 24, 2011 at 6:36 PM, Terence Parr pa...@cs.usfca.edu wrote: Hi. I'm working on the v4 runtime and, since I have

[il-antlr-interest: 32101] Re: [antlr-interest] Changing root node lable

2011-04-06 Thread Martijn Reuvers
Hello, You could override toString() and do it yourself (rendering it and its children the way you like) or add an additional method to CommonTree to do what you want. Martijn On Wed, Apr 6, 2011 at 9:39 AM, Wilson Urdaneta aki...@gmail.com wrote: On Wed, Apr 6, 2011 at 3: Hi everyone, This

[il-antlr-interest: 32099] Re: [antlr-interest] to stop walking into a subtree

2011-04-05 Thread Martijn Reuvers
Hello, I personally prefer a manual tree-visitor (which walks the AST), that way you can just evaluate a node and based on the result take appropriate action, it also allows more control (e.g. multi-phases if needed). The main reason I do it that way is I don't want any of my grammars getting

[il-antlr-interest: 30657] Re: [antlr-interest] Reading all text to end-of-line in a rule

2010-11-26 Thread Martijn Reuvers
Hello Bill, The grammar below does the trick for your command (I stripped it somewhat, to quickly get it working). See the SHELL_COMMAND token, notice the options part with the greedy identifier. It reads until it encounters the newline stuff. You need to have something in front of it, like SHELL

[il-antlr-interest: 30661] Re: [antlr-interest] Reading all text to end-of-line in a rule

2010-11-26 Thread Martijn Reuvers
, Bill Lear r...@zopyra.com wrote: On Friday, November 26, 2010 at 19:23:24 (+0100) Martijn Reuvers writes: Hello Bill, The grammar below does the trick for your command (I stripped it somewhat, to quickly get it working). See the SHELL_COMMAND token, notice the options part with the greedy

[il-antlr-interest: 30598] Re: [antlr-interest] Tree Grammars Conditional Execution

2010-11-22 Thread Martijn Reuvers
Hello Simon, You might want to check out the documentation on BufferedTreeNodeStream, you could use methods like seek(..), index() etc. A long time ago on the Java side there was a bug in it, I do not know what the current state is (let alone the C target). Another way is to walk the AST

[il-antlr-interest: 30497] Re: [antlr-interest] C preprocessor

2010-11-08 Thread Martijn Reuvers
Hello Maurizio, By not seeing the whole grammar it's a bit difficult to guess, but adding WS at your #define statement will cause trouble (assuming you either write the WS to the hidden channel or skip() it). If not you'd have other issues I expect. You don't need the space there for what I can

[il-antlr-interest: 29502] Re: [antlr-interest] Custom AST nodes - attempt #2

2010-07-23 Thread Martijn Reuvers
Hey Bill, It seems so, but its not hard. Roughly you should create the adaptor below this email, where you implement your own ASTNodes. And then set it on the parser you are using, e.g: SimpleParser parser = new SimpleParser(new CommonTokenStream(createLexer(value)));

[il-antlr-interest: 29369] Re: [antlr-interest] Determine / check validity of type

2010-07-10 Thread Martijn Reuvers
. There is quite a bit of work involved but it is very orthogonal and so not difficult when you see the pattern. Jim -Original Message- From: antlr-interest-boun...@antlr.org [mailto:antlr-interest- boun...@antlr.org] On Behalf Of Martijn Reuvers Sent: Friday, July 09, 2010 2:20

[il-antlr-interest: 29357] [antlr-interest] Determine / check validity of type

2010-07-09 Thread Martijn Reuvers
Hello everyone, I have a question related to determining the type returned from an expression on 'compile' time (not runtime!). For example take the following code: *** function someFunction(int a) return string { return a string! } int finalValue = (100+5)*2 +