Minor syntax highlighting style adjustments...

This commit is contained in:
Ognjen Milan Robovic 2023-11-17 09:38:52 -05:00
parent 2123c3d2eb
commit 8543377928
2 changed files with 28 additions and 84 deletions

View File

@ -76,13 +76,13 @@ static void syntax_delete (void) {
syntax_end [offset] = deallocate (syntax_end [offset]);
}
syntax_enrange = deallocate (syntax_enrange);
syntax_derange = deallocate (syntax_derange);
syntax_begin = deallocate (syntax_begin);
syntax_end = deallocate (syntax_end);
syntax_escape = deallocate (syntax_escape);
syntax_colour = deallocate (syntax_colour);
syntax_effect = deallocate (syntax_effect);
syntax_enrange = deallocate (syntax_enrange);
syntax_derange = deallocate (syntax_derange);
syntax_begin = deallocate (syntax_begin);
syntax_end = deallocate (syntax_end);
syntax_escape = deallocate (syntax_escape);
syntax_colour = deallocate (syntax_colour);
syntax_effect = deallocate (syntax_effect);
syntax_active = FALSE;
syntax_count = 0;
@ -184,73 +184,7 @@ static int syntax_select (char * string, int * length) {
return (select);
}
/*
static int syntax_select (char * string, int * length) {
int offset = 0;
int select = 0;
fatal_failure (syntax_active == FALSE, "syntax_select: Syntax is not active.");
fatal_failure (string == NULL, "syntax_select: String is null.");
fatal_failure (length == NULL, "syntax_select: Length is null.");
do {
if (syntax_enrange [select] == 0) {
if (string_compare (string, syntax_begin [select]) == TRUE) {
if (syntax_derange [select] == 0) {
break;
} else {
if (character_compare_array (string [string_length (syntax_begin [select])], syntax_end [select]) != 0) {
break;
}
}
}
} else {
int subset = 0;
do {
if (string [offset] == syntax_begin [select] [subset]) {
goto selected;
}
} while (++subset != (int) string_length (syntax_begin [select]));
}
} while (++select != syntax_count);
selected:
if (select == syntax_count) {
* length = 1;
return (syntax_count);
}
do {
++offset;
if (string [offset] == syntax_escape [select]) {
++offset;
continue;
}
if (syntax_derange [select] == 0) {
if (string_compare (& string [offset], syntax_end [select]) == TRUE) {
* length = offset + string_length (syntax_end [select]);
return (select);
}
} else {
int subset = 0;
if (string_compare (syntax_end [select], "") != 0) {
break;
} do {
if (string [offset] == syntax_end [select] [subset]) {
* length = offset;
return (select);
}
} while (++subset != (int) string_length (syntax_end [select]));
}
} while (string [offset - 1] != '\0');
return (select);
}
*/
static void syntax_highlight_c (void) {
char * separators = ".,:;<=>+*-/%!&~^?|()[]{}'\" \t\r\n";
@ -263,22 +197,23 @@ static void syntax_highlight_c (void) {
int word;
syntax_define (FALSE, FALSE, "/*", "*/", '\0', COLOUR_GREY, EFFECT_BOLD);
syntax_define (FALSE, FALSE, "//", "\n", '\0', COLOUR_GREY, EFFECT_BOLD);
syntax_define (FALSE, FALSE, "#", "\n", '\\', COLOUR_PINK, EFFECT_NORMAL);
syntax_define (FALSE, FALSE, "'", "'", '\\', COLOUR_PINK, EFFECT_BOLD);
syntax_define (FALSE, FALSE, "\"", "\"", '\\', COLOUR_RED, EFFECT_NORMAL);
syntax_define (FALSE, FALSE, "/*", "*/", '\0', COLOUR_GREY, EFFECT_BOLD);
syntax_define (FALSE, FALSE, "//", "\n", '\0', COLOUR_GREY, EFFECT_BOLD);
syntax_define (FALSE, FALSE, "#", "\n", '\\', COLOUR_YELLOW, EFFECT_ITALIC);
syntax_define (FALSE, FALSE, "'", "'", '\\', COLOUR_PINK, EFFECT_BOLD);
syntax_define (FALSE, FALSE, "\"", "\"", '\\', COLOUR_PINK, EFFECT_NORMAL);
for (word = 0; word != (int) (sizeof (keywords) / sizeof (keywords [0])); ++word) {
syntax_define (FALSE, TRUE, keywords [word], separators, '\0', COLOUR_BLUE, EFFECT_NORMAL);
syntax_define (FALSE, TRUE, keywords [word], separators, '\0', COLOUR_YELLOW, EFFECT_BOLD);
}
syntax_define (TRUE, FALSE, ".,:;<=>+*-/%!&~^?|()[]{}", "", '\0', COLOUR_BLUE, EFFECT_BOLD);
syntax_define (TRUE, FALSE, "()[]{}", "", '\0', COLOUR_BLUE, EFFECT_NORMAL);
syntax_define (TRUE, FALSE, ".,:;<=>+*-/%!&~^?|", "", '\0', COLOUR_CYAN, EFFECT_NORMAL);
syntax_define (TRUE, TRUE, "0123456789", separators, '\0', COLOUR_CYAN, EFFECT_BOLD);
syntax_define (TRUE, TRUE, "0123456789", separators, '\0', COLOUR_PINK, EFFECT_BOLD);
syntax_define (TRUE, TRUE, "abcdefghijklmnopqrstuvwxyz", separators, '\0', COLOUR_WHITE, EFFECT_NORMAL);
syntax_define (TRUE, TRUE, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", separators, '\0', COLOUR_WHITE, EFFECT_BOLD);
syntax_define (TRUE, TRUE, "_", separators, '\0', COLOUR_GREY, EFFECT_BOLD);
syntax_define (TRUE, TRUE, "_", separators, '\0', COLOUR_WHITE, EFFECT_ITALIC);
}
void preview_c_file (char * text_file, int width, int height, int x, int y) {

View File

@ -1,3 +1,10 @@
#include <meme.h>
#include "meme.h"
// ASDF
/* ASDF */
enum {
REGISTER_0_64, REGISTER_1_64, REGISTER_2_64, REGISTER_3_64, REGISTER_4_64, REGISTER_5_64, REGISTER_6_64, REGISTER_7_64,
REGISTER_8_64, REGISTER_9_64, REGISTER_A_64, REGISTER_B_64, REGISTER_C_64, REGISTER_D_64, REGISTER_E_64, REGISTER_F_64,
@ -25,9 +32,11 @@ static void data_echo (void) {
char byte [4] = " ";
int i;
_meme = MEME = meme;
for (i = 0; i != data [0]; ++i) {
byte [0] = "0123456789ABCDEF" [data [i + 1] / 16];
byte [1] = "0123456789ABCDEF" [data [i + 1] % 16];
byte [0] = "0123456789ABCDEF" [data [i + 1] / '\020'];
byte [1] = "0123456789ABCDEF" [data [i + 1] % 'A'];
echo (byte);
}
}