actually embrace new syntaxes

This commit is contained in:
anon 2023-12-18 23:20:30 +01:00
parent 13e8120fc4
commit 68155d652a
4 changed files with 14 additions and 3 deletions

View File

@ -12,3 +12,4 @@ applying simple syntax highlighting rules.
### Supported languages: ### Supported languages:
+ Ada + Ada
+ C/C++ + C/C++
+ Fasm

View File

@ -140,8 +140,12 @@ void on_message_timeout(int unused) {
static static
language_t translate_language(const char * const language) { language_t translate_language(const char * const language) {
if (!strcmp(language, "C") || !strcmp(language, "C++")) { if (!strcmp(language, "C")) {
return C; return C;
} else if (!strcmp(language, "C++") || !strcmp(language, "CPP")) {
return CPP;
} else if (!strcmp(language, "ASM") || !strcmp(language, "FASM") || !strcmp(language, "ASSEMBLY")) {
return ASM;
} else if (!strcmp(language, "ADA")) { } else if (!strcmp(language, "ADA")) {
return ADA; return ADA;
} }

View File

@ -9,6 +9,8 @@ char * port;
typedef enum { typedef enum {
C, C,
CPP,
ASM,
ADA, ADA,
} language_t; } language_t;
@ -22,6 +24,8 @@ typedef void (*syntax_setter_t)(void);
syntax_setter_t syntax_functions[] = { syntax_setter_t syntax_functions[] = {
[C] = &syntax_c, [C] = &syntax_c,
[CPP] = &syntax_cpp,
[ASM] = &syntax_fasm,
[ADA] = &syntax_ada, [ADA] = &syntax_ada,
}; };

View File

@ -14,8 +14,10 @@
#define COLOUR_PINK ("13") #define COLOUR_PINK ("13")
#define COLOUR_GREY ("14") #define COLOUR_GREY ("14")
extern void syntax_c (void); extern void syntax_c (void);
extern void syntax_ada (void); extern void syntax_ada (void);
extern void syntax_cpp (void);
extern void syntax_fasm (void);
extern char * syntax_highlight (char * string); extern char * syntax_highlight (char * string);