//check whether the searched position doesn't overlap the token boundaries
return null;
}
Token<LatteTopTokenId> t = ts.token();
if(t.id() == LatteTopTokenId.LATTE) { // process only latte
Syntax syntax = (Syntax) t.getProperty("syntax");
TokenSequence<LatteTokenId> ts2 = LexUtils.getSequence(t);
/*ts2.move(searchOffset-ts.offset());
matches.addAll(findBrackets(ts2));*/
if(!syntax.isOpening(t.text().toString())) { // process only macros
return null;
}
int LDlength = 1;
ts2.moveStart();
int i = 0; // used to check end macro slash position
while(ts2.moveNext() && i < 3) {
Token<LatteTokenId> t2 = ts2.token();
// macro has name
if(t2.id() == LatteTokenId.LD) {
LDlength = t2.toString().trim().length();
}
if(t2.id() == LatteTokenId.MACRO) { // it has macro name
macroName = t2.toString();
mStart = ts.offset();
mLength = t.length();
/*Collections.addAll(matches,*/ return new int[] {
ts.offset(), ts.offset() + t.length(), //whole area
ts.offset(), ts.offset() + ts2.offset() + t2.length(), //left delimiter + macro
ts.offset() + t.length() - syntax.closing().length(), ts.offset() + t.length() //right delimiter
}/*)*/;
//return matches.toArray();
}
if(t2.id() == LatteTokenId.END_SLASH && i == 1) { // it is end macro
isEndMacro = true; // set bool to true!
}
i++;
}
// macro doesn't have name, hi-light just delimiters
return new int[] {
ts.offset(), ts.offset() + t.length(), //whole area
ts.offset(), ts.offset() + LDlength, //left delimiter
ts.offset() + t.length() - syntax.closing().length(), ts.offset() + t.length() //right delimiter
};
}
}
return null;