Question

I am working with Irony.Net (https://irony.codeplex.com/) and have been working with the SQL Grammar. Now I have the parser and items working to get my statements correctly parsed. ( I had to add parameter support to the default grammar).

Now my question is simple. After I have manipulated the ParseTree I then want to rebuild the statement against the ParseTree.

Does Irony have a method of Rebuilding the original parsed text against the tree or do I need to write my own system for this?

I am fine writing my own system, but if it is already in place I would rather use that.

Was it helpful?

Solution

After quite some time working with the Irony.Net parser it seems relatively difficult to rebuild the original parsed string after you have manipulated the ParseTree.

The reason for this is unless you preserve the white spaces, and allotted punctuation the parse tree removes those entries automatically.

Now part of the parse tree does give you the "span" of the characters where the token \ term existed in the original string.

Given the span details you could essentially rebuild the statement by removing characters in the original statement at the span markers.

After much discussion it was found that although the Irony.Net project is fantastic at parsing your statements into AST's the project is not well suited for manipulation of the parsed tree.

With that being said we are still using the Irony.Net project for other problems.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top