Create a new parsetree node

Oct 10, 2013 at 12:04 PM
Hi there,

I am using SQLGrammar to parse sql statements. My goal is to add where clauses to the original statement. After parsing successfully the original sql, how can i add new parsetree nodes?

Regards,
c3f8
Coordinator
Oct 10, 2013 at 5:56 PM
you just take the result parse tree, search for "WHERE" node and modify the tree (add/remove children) the way you want. Look at the code that 'displays' the tree in the treeView in Grammar Explorer - it is very simple to iterate; and to modify it is not a problem - all child lists are open for add/remove
Oct 10, 2013 at 6:01 PM
Thanks for the help.

Regards.
Oct 11, 2013 at 10:30 AM
Hi again,

Is there any tutorial for the operation i want to do?

My problem now is what i need to create, a new Token?

Can you please tell me where i can search for "examples"?

Regards
Coordinator
Oct 15, 2013 at 6:12 PM
I don't think there're any examples or tutorials, but basically, you're free to do what you want, construct nodes with terminals/nonterminals inside, using available constructors. Once parsing is done, Irony parser produces the tree and you can do whatever you want there.