Beginner help with AST Nodes

SyntaxEditor for Windows Forms Forum

Posted 12 years ago by bm
Avatar
Product Version: SyntaxEditor v4.0.256

I am using the simple language addon code and have a slight disconnect on how to extend that code to include my own classes, objects, methods, ete. A good example of what I would like to do is to include IntelliPrompt member list functionality for my mssql database tables.

Example:
Account objAccount = new Account();
objAccount.name = "test";
objAccount.zip = "30309";

How can I make this happen? I am not sure how to capture what the end user typed in after they type '.'. In this example, how can I capture objAccount and then how can I determine what its assignment is and populate the member list?


Thanks for any help.

Comments (1)

Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Well that is where things can get more complex. Some people just do token parsing by getting a TextStream via Document.GetTextStream and use that to iterate through tokens to provide the context of what is at the caret. In the .NET Languages and Web add-ons, we build an AST of the document and use a combination of token parsing and AST semantic parse data to determine the context at the caret.

In your sample using the way we do things, we token scan to see that we are working with an object named "objAccount". Then we look backwards through statements in the AST to find a declaration of that name. At that declaration we see the type Account and resolve that to a .NET type. Then we know what to populate a member list with.

Hope that helps get you started.


Actipro Software Support

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

Add Comment

Please log in to a validated account to post comments.