70 lines
5.1 KiB
C
70 lines
5.1 KiB
C
|
static void highlight_eaxhla (void) {
|
||
|
char * separators = ".,+-[]<> \t\r\n";
|
||
|
|
||
|
char * declarations [] = {
|
||
|
"s8", "s16", "s32", "s64", "u8", "u16", "u32", "u64",
|
||
|
"f32", "f64", "f80", "v0", "s128", "s256", "u128", "u256",
|
||
|
"program", "procedure", "machine", "library", "fast", "unix", "begin", "end",
|
||
|
"if", "then", "else", "repeat", "break", "continue", "until", "exit"
|
||
|
};
|
||
|
|
||
|
char * instructions [] = {
|
||
|
"jnpe", "jpo", "jnpo", "jpe", "jnb", "jae", "jnbe", "ja",
|
||
|
"jna", "jbe", "jnae", "jb", "jnl", "jge", "jnle", "jg",
|
||
|
"jng", "jle", "jnge", "jl", "cmovng", "cmovle", "cmovnge", "cmovl",
|
||
|
"cmovnpe", "cmovpo", "cmovnpo", "cmovpe", "cmovnb", "cmovae", "cmovnbe", "cmova",
|
||
|
"cmovna", "cmovbe", "cmovnae", "cmovb", "cmovnl", "cmovge", "cmovnle", "cmovg",
|
||
|
"setnpe", "setpo", "setnpo", "setpe", "setnb", "setae", "setnbe", "seta",
|
||
|
"setna", "setbe", "setnae", "setb", "setnl", "setge", "setnle", "setg",
|
||
|
"setng", "setle", "setnge", "setl", "enter", "call", "jmp", "mov",
|
||
|
"add", "or", "adc", "sbb", "and", "sub", "xor", "cmp",
|
||
|
"inc", "dec", "not", "neg", "mul", "imul", "div", "idiv",
|
||
|
"fadd", "fmul", "fcom", "fcomp", "fsub", "fsubr", "fdiv", "fdivr",
|
||
|
"rol", "ror", "rcl", "rcr", "sal", "shr", "shl", "sar",
|
||
|
"nop", "retn", "retf", "leave", "popf", "pushf", "in", "out",
|
||
|
"syscall", "cpuid", "fnop", "fchs", "fabs", "ftst", "fxam", "fld1",
|
||
|
"fldl2t", "fldl2e", "fldpi", "fldlg2", "fldln2", "fldz", "f2xm1", "fyl2x",
|
||
|
"fptan", "fpatan", "fxtract", "fprem1", "fdecstp", "fincstp", "fprem", "fyl2xp1",
|
||
|
"fsqrt", "fsincos", "frndint", "fscale", "fsin", "fcos", "pop", "push",
|
||
|
"bswap", "bsf", "bsr", "loop", "loope", "loopne"
|
||
|
};
|
||
|
|
||
|
char * registers [] = {
|
||
|
"rax", "rcx", "rdx", "rbx", "rsp", "rbp", "rsi", "rdi",
|
||
|
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
|
||
|
"eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi",
|
||
|
"r8d", "r9d", "r10d", "r11d", "r12d", "r13d", "r14d", "r15d",
|
||
|
"ax", "cx", "dx", "bx", "sp", "bp", "si", "di",
|
||
|
"r8w", "r9w", "r10w", "r11w", "r12w", "r13w", "r14w", "r15w",
|
||
|
"al", "cl", "dl", "bl", "spl", "bpl", "sil", "dil",
|
||
|
"r8b", "r9b", "r10b", "r11b", "r12b", "r13b", "r14b", "r15b"
|
||
|
};
|
||
|
|
||
|
int word;
|
||
|
|
||
|
syntax_define (false, false, "#", "\n", '\0', (int) 0xff775555, 0);
|
||
|
syntax_define (false, false, "//", "\n", '\0', (int) 0xff777777, 0);
|
||
|
syntax_define (false, false, "'", "'", '\\', (int) 0xff7733cc, 0);
|
||
|
syntax_define (false, false, "\"", "\"", '\\', (int) 0xffcc3377, 0);
|
||
|
|
||
|
for (word = 0; word != (int) (sizeof (declarations) / sizeof (declarations [0])); ++word) {
|
||
|
syntax_define (false, true, declarations [word], separators, '\0', (int) 0xff33ccee, 0);
|
||
|
}
|
||
|
|
||
|
for (word = 0; word != (int) (sizeof (instructions) / sizeof (instructions [0])); ++word) {
|
||
|
syntax_define (false, true, instructions [word], separators, '\0', (int) 0xff55aacc, 0);
|
||
|
}
|
||
|
|
||
|
for (word = 0; word != (int) (sizeof (registers) / sizeof (registers [0])); ++word) {
|
||
|
syntax_define (false, true, registers [word], separators, '\0', (int) 0xffccaa77, 0);
|
||
|
}
|
||
|
|
||
|
syntax_define (true, false, "()[]{}", "", '\0', (int) 0xffee5533, 0);
|
||
|
syntax_define (true, false, ".,+*-/%$<>", "", '\0', (int) 0xffeeaa33, 0);
|
||
|
|
||
|
syntax_define (true, true, "0123456789", separators, '\0', (int) 0xffee33aa, 0);
|
||
|
syntax_define (true, true, "abcdefghijklmnopqrstuvwxyz", separators, '\0', (int) 0xffcccccc, 0);
|
||
|
syntax_define (true, true, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", separators, '\0', (int) 0xffeeeeee, 0);
|
||
|
syntax_define (true, true, "_", separators, '\0', (int) 0xffaaaaaa, 0);
|
||
|
}
|