Language Designer Custom AST Node Simple Types

SyntaxEditor for WPF Forum

The latest build of this product (v25.1.3) was released 1 month ago, which was before this thread was created.
Posted 5 days ago by Rick - Developer, Visual Software Systems LLC
Avatar

I've created a grammer for SOQL, a SQL-like language.  I validate all the fields throughout the entire query in my grammer class and want to store a reference to their database schema field on the custom AST node I created for fields. 

It would be very helpful if Object was an available Type on a custom AST node property when its PropertyType is set to Simple or SimpleList. With this option, I could store the schema field references that will be needed later, say by a QuickInfo provider, rather than having to rediscover them.

Right now, I've created a simple property as a string and then manually change it to Object in the generated AST Node class.  But it would be preferrable to have the property generated as Object natively.

Thanks, Rick

[Modified 4 days ago]

Comments (2)

Posted 4 days ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Rick,

What we do now when you want to extend an AST node type is simply add another partial class file.  Every AST node should be generated as a partial already to support that design.

Currently the Language Designer will output code like this in a "Foo.g.cs" file:

public partial class Foo : AstNodeBase {

You would need to add a "Foo.cs" file (so it doesn't have a ".g.cs" extension marking generated) with contents like:

public partial class Foo {

	public SchemaType Schema { get; set; }

}

That way, you have the property added with its actual Type that doesn't need casting from Object, and future code generation from the Language Designer won't overwrite your file.  That's the concept we use in our own premium language add-ons and it works great.


Actipro Software Support

Posted 4 days ago by Rick - Developer, Visual Software Systems LLC
Avatar

OK, I don't know why I didn't think of that myself.  Probably because I was focused on the Language Designer UI and creating the property there. I will, of course, implement as you suggest.  Thanks!

Add Comment

Please log in to a validated account to post comments.