EXPLANATION OF LEAVE STATE

Hi Andrew, I'm trying to improve the syntax parsing of our domain-specific language. Specifically, I have an identifier, which should be some colour, but a different colour if it comes right after a separator. I have a syntax graph in a JPG here:
http://www.powersoft.ca/files/images/wp_20180510_14_26_55_pro.jpg
I believe the blue boxes to be different states, and FIELDSEP to have a leave state of IDENT, and FIELD to have a leave state of FIELDSEP, and so on.
I want to do this for correct coloring, but also because I want to inspect the current state when a key is pressed (i.e. I want to know when the user is editing a FIELD).
Is it possible to do this with the Syntax Scheme system?
Many thanks for any hints.
PS: That drawing has some minor errors (like that the number of array digits currently would always be odd). Sloppy, but immaterial to the big picture
Hi,

Could you send us examples of various identifiers/fields with separators, so we can provide an example of syntax scheme for it.
Every syntax structure (like identifier or field in your case), will be associated with its own lexer style, which means that you will be able to get style at the caret position and determine if it's identifier, field or something else.
regards,
Andrew
Here are three examples of code:
field.sub = 4;
message.|Some other Sub field| = 5;
other.|something|[3].|else|[0].final = 6;
field, message and other are idents. sub and the things in pipes are what I call fields. The period is the fieldsep.
In a complete regex, I would write it as:
([A-Za-z_][A-Za-z0-9_]*)((\.)((?:[A-Za-z_][A-Za-z0-9_]*)|(?:\|.+\|))(\[\d+\])?)*
PS: I've got the styles set up, but all my syntax blocks are in the "normal" state. I don't know how to transition to a different state.
Hi,
I have uploaded sample demo should cover your needs:
https://drive.google.com/open?id=1gx9YCOi-DEDkDyQNaU-_LVjFlvKYRpQy
Please try it and let me know whether it was useful.
regards,
Andrew