Sublime Forum

Syntax matching

#1

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?

0 Likes

#2

You don’t :confused:

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.

0 Likes

#3

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”
}

0 Likes