I have an application that uses the Windows Forms Actipro syntax editor for having the user write script in our own custom language. Our langauge is a compiled, scripting language which allows the creation of a hard-coded list of object types. We are currently adding in support for defining structures in the scripting language, which is essentially the same as supporting user-defined objects in script.
A sample of what the script looks like for this is below:
Struct MyStructure; Variable v1; End; MyStructure m; m.v1 = 3;
In this, I want MyStructure to be identified as an IDENTIFIER token type on the "Struct MyStructure;" line, and an OBJECT_TYPE_IDENTIFIER on the "MyStructure m;" line.
My initial approach was to, when parsing the "Struct MyStructure" line, add "MyStructure" as a new LexicalPattern to the OBJECT_TYPE_IDENTIFIER LexicalPatternGroup. However, it seems like language updates need to be done on the main UI thread, and the overall affect is to the force a redraw / parse that then makes the MyStructure token on the "Struct MyStructure;" line a OBJECT_TYPE_IDENTIFIER (when I want it as a IDENTIFIER).
We are using a xml language definition, and so with that, is it possible to do what I want here, or do I need to wrtite a custom lexer? Also, can you point to any good samples / examples that I can reference?