Home Download Buy Blog Forum Support

Syntax matching

Syntax matching

Postby Adagioklez on Fri Mar 11, 2011 8:49 pm

Hello All.

I have started to work on a PL/1 syntax bundle for ST, and in that regard I would like to hear what to proper technique for matching this:

NiceProc proc(.....)
.....
end NiceProc;

How do I match such that a part of the begin also is contained in part of the end?
Adagioklez
 
Posts: 15
Joined: Fri Feb 25, 2011 1:03 pm

Re: Syntax matching

Postby Anomareh on Fri Mar 11, 2011 9:02 pm

You don't :/

If you really wanted to, the only way to accomplish such a thing would be to create a separate definition for each case. Generally you just match for the list of valid keywords in the beginning and the end. There's no way currently afaik to enforce whichever is found at the beginning is the same at the end unless as I said you create a separate definition for each case.
Anomareh
 
Posts: 222
Joined: Thu Oct 01, 2009 7:32 pm

Re: Syntax matching

Postby Adagioklez on Fri Mar 11, 2011 9:23 pm

Okay I see. I will find a way around, can I at the same time asking how to define symbols in a language.
For instance I would like a variable to be a symbol, right now my definition is as follows:

{ "match": "(dcl)(\\s*)([A-Za-z0-9_]*)(\\s*)(.*)",
"name": "variable.parameter.pli",
"captures": {
"1": { "name": "variable.parameter.pli" },
"3": { "name": "entity.name.function.pli" },
"5": { "name": "string.pli" }
},
"comment": "Markup of dcl statements"
}
Adagioklez
 
Posts: 15
Joined: Fri Feb 25, 2011 1:03 pm


Return to Technical Support

Who is online

Users browsing this forum: Exabot [Bot] and 18 guests