AST nodes / header code optimization

SyntaxEditor .NET Languages Add-on for Windows Forms Forum

Posted 10 years ago by Richard Kisic
Avatar
Hello,

Is it possible to remove a node (and all of its children) from the AST, then insert the node elsewhere (either in a new AST instance, or the same AST at a later time)? If this is possible, is there a way to serialize the AST content (preferably a node)?

I ask this because we are in need of building the IntelliPrompt for our custom objects, and the code for these objects is currently being placed in the document's header text. I thought a direct-injection of code (deserialized from a file) may be faster, as this would eliminate a parse. Do you have any suggestions for optimizing this process?

Thanks,
Rich

[Modified at 09/28/2009 07:40 AM]

Comments (1)

Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Richard,

Sure, you can modify the AST mode as you see it. We don't currently have anything in that allows for automatic serialization however you could probably add this yourself via a visitor, or by making your base node class serializable.

While you could possibly reuse an AST node branch for your header, keep in mind that all AST nodes keep a pointer to their parent. So you may run into issues if you reuse and inject the same AST node branch into multiple compilation units.

What about using partial classes instead, where you would have your other code already stored via SourceProjectContent and the user code would be merged with that?


Actipro Software Support

The latest build of this product (v2018.1 build 0341) was released 9 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.