1

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.

Preston Guillot
  • 6,493
  • 3
  • 30
  • 40
Nico
  • 12,493
  • 5
  • 42
  • 62

1 Answers1

1

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.

Nico
  • 12,493
  • 5
  • 42
  • 62
  • Did you find a solution to "rebuild" the parsed informations? – inselberg Oct 03 '14 at 15:03
  • 1
    No we did not find a solution for the rebuild, instead what we did was used the tree to rebuild a new statement. This took a bit more time than we hoped but Irony.net did give us the what we wanted in terms of signature.. – Nico Oct 06 '14 at 22:07