Not in the office right now, but something along these lines:
note code is mostly psuedo
function event_Ptr() {
//check if next is a newline -> if so
Ziron_SetTokenType(zirUserIdent, 'ptr');
return true;
//}
return false;
}
function InitPlugin(pointer pGetF) {
Ziron_LoadAll(pGetF); //use framework utility function to load all
//register our keyword
Ziron_RegisterKeyword('ptr', @event_Ptr);
//register your dim keyword etc
return strLoaded;
}
and with your dim event:
function event_Dim() {
//your code
if next token = zirUserIdent and Ziron_GetStringValue = 'ptr' then
...
}
function event_Ptr()
{
//check if next is a newline -> if so
Ziron_ShowMessage('found ptr');
eax = Ziron_IsNextLineBreak();
if (eax) {
Ziron_SetTokenType(zirUserIdent, 'ptr');
return true;
}
return false; // let Ziron handle the line
}
when 'ptr' is the first word in the line Ziron will detect ptr and call event handler , and if 'ptr' is in the middle of line or at end of the line ziron will not detect it.
Seems there was a bug with Ziron_SetTokenType, it was getting address of peeknexttoken in GetFunction, anyhow i've fixed that and 1 other thing. I've re-uploaded the beta and here is a sample:
program WIN32DLL 'PLUGIN';
#include 'zirplug/framework.zir';
//////////////////////////////
const strLoaded = 'Plugin has loaded!';
//////////////////////////////
function token_Ptr() {
eax = Ziron_IsNextLineBreak();
if (eax) {
Ziron_SetTokenType(zirUserIdent, 'ptr');
return true;
}
return false;
}
function event_ABCD() {
eax = Ziron_ExpectNextToken(zirUserIdent);
if (eax <> -1) {
if (strCmp('ptr', strLower(Ziron_GetStringValue())) == True) {;
Ziron_ShowMessage('Found PTR!');
return true;
}
return false;
}
return false;
}
function InitPlugin(pointer pGetF) {
Ziron_LoadAll(pGetF); //use framework utility function to load all
//register token
Ziron_RegisterUserToken('ptr', @token_Ptr);
//register our keyword
Ziron_RegisterKeyword('abcd', @event_ABCD);
return strLoaded;
}
entry function DLLMain(DWord iDLL; DWord iReason; Pointer iResult) {
if (iReason == DLL_PROCESS_ATTACH) {
return true;
}
return false;
}
exports InitPlugin;