Added Xofya highlighting...

This commit is contained in:
Ognjen Milan Robovic 2024-03-02 09:29:09 -05:00
parent db430aa8f2
commit 226c334ee9

View File

@ -323,6 +323,39 @@ static void highlight_shell (void) {
syntax_define (true, true, "_", separators, '\0', colour_white, effect_italic);
}
static void highlight_xofya (void) {
char * separators = ".,:;<=>+-*/%!&~^?|(){}'\" \t\r\n";
char * keywords [] = {
"character", "natural", "integer", "logical", "address", "pointer", "union", "enter",
"array", "iterate", "enumerate", "include", "exclude", "execute", "if", "else",
"match", "for", "break", "cycle", "and", "or", "not", "true",
"false", "nil", "range", "then", "terminate", "procedure", "program", "package"
};
int word;
syntax_define (false, false, "!", "\n", '\0', colour_red, effect_bold);
syntax_define (false, false, "---", "\n", '\0', colour_grey, effect_bold);
syntax_define (false, false, "--!", "!--", '\0', colour_grey, effect_bold);
syntax_define (false, false, "@", "\n", '\0', colour_red, effect_italic);
syntax_define (false, false, "<!>", "\n", '\0', colour_red, effect_normal);
syntax_define (false, false, "\"", "\"", '\\', colour_pink, effect_normal);
syntax_define (false, false, "'", "'", '\\', colour_pink, effect_bold);
for (word = 0; word != (int) (sizeof (keywords) / sizeof (keywords [0])); ++word) {
syntax_define (false, true, keywords [word], separators, '\0', colour_yellow, 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_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_white, effect_italic);
}
int main (int argc, char * * argv) {
int offset = 0;
int select = 0;
@ -353,6 +386,7 @@ int main (int argc, char * * argv) {
echo ("\t -T --flat -- Flat assembly syntax\n");
echo ("\t -F --fortran -- Fortran syntax\n");
echo ("\t -H --shell -- Shell syntax\n");
echo ("\t -X --xofya -- Xofya\n");
exit (log_success);
} else if (string_compare (argv [1], "-C") || string_compare (argv [1], "--c")) {
highlight_c ();
@ -368,6 +402,8 @@ int main (int argc, char * * argv) {
highlight_fortran ();
} else if (string_compare (argv [1], "-H") || string_compare (argv [1], "--shell")) {
highlight_shell ();
} else if (string_compare (argv [1], "-X") || string_compare (argv [1], "--xofya")) {
highlight_xofya ();
} else {
select = file_type (argv [1]);
buffer = file_import (argv [1]);
@ -391,6 +427,8 @@ int main (int argc, char * * argv) {
highlight_flat_assembly ();
} else if (select == file_type_fortran_90) {
highlight_fortran ();
/*} else if (select == file_type_xofya) {
highlight_xofya ();*/
} else {
highlight_common ();
}