1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
|
%{
#include "omega.h"
#include "t6hgame.h"
#include "t6hl.tab.hpp"
%}
%option 8bit
%option noyywrap
%option prefix="t6hl"
%%
\#-?[0-9]+ {
T6H_LOCKEXP *ple = new T6H_LOCKEXP;
ple->SetRef(atoi(t6hltext+1));
t6hllval.ple = ple;
return DBREF;
}
[^:/&|()]+\/[^&|()]+ {
char *p = strchr(t6hltext, '/');
T6H_LOCKEXP *ple1 = new T6H_LOCKEXP;
ple1->SetText(StringCloneLen(t6hltext, p-t6hltext));
T6H_LOCKEXP *ple2 = new T6H_LOCKEXP;
ple2->SetText(StringClone(p+1));
T6H_LOCKEXP *ple3 = new T6H_LOCKEXP;
ple3->SetEval(ple1, ple2);
t6hllval.ple = ple3;
return EVALLIT;
}
[^:/&|()]+:[^&|()]+ {
char *p = strchr(t6hltext, ':');
T6H_LOCKEXP *ple1 = new T6H_LOCKEXP;
ple1->SetText(StringCloneLen(t6hltext, p-t6hltext));
T6H_LOCKEXP *ple2 = new T6H_LOCKEXP;
ple2->SetText(StringClone(p+1));
T6H_LOCKEXP *ple3 = new T6H_LOCKEXP;
ple3->SetAttr(ple1, ple2);
t6hllval.ple = ple3;
return ATTRLIT;
}
\= {
return '=';
}
\+ {
return '+';
}
\@ {
return '@';
}
\$ {
return '$';
}
\& {
return '&';
}
\| {
return '|';
}
\! {
return '!';
}
\( {
return '(';
}
\) {
return ')';
}
[\n\t ]+ /* ignore whitespace */ ;
. { return EOF; }
%%
extern T6H_LOCKEXP *g_t6hKeyExp;
int t6hlparse();
T6H_LOCKEXP *t6hl_ParseKey(char *pKey)
{
delete g_t6hKeyExp;
g_t6hKeyExp = NULL;
YY_BUFFER_STATE bp = t6hl_scan_string(pKey);
t6hl_switch_to_buffer(bp);
T6H_LOCKEXP *ple = NULL;
if (t6hlparse())
{
delete g_t6hKeyExp;
}
else
{
ple = g_t6hKeyExp;
}
t6hl_delete_buffer(bp);
g_t6hKeyExp = NULL;
return ple;
}
|