Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Make (push) Successful in 2h58m1s
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-CMake (push) Failing after 2h57m59s
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Meson (push) Successful in 2h57m59s
Prepare Build and Testing executable binary / Archlinux-package (push) Has been cancelled
127 lines
2.9 KiB
C
127 lines
2.9 KiB
C
#ifndef EDITOR_SYNTAX_H
|
||
#define EDITOR_SYNTAX_H
|
||
|
||
#include <hl_extensions.h>
|
||
#include <hl_keywords.h>
|
||
|
||
#define HL_HIGHLIGHT_NUMBERS (1 << 0)
|
||
#define HL_HIGHLIGHT_STRINGS (1 << 1)
|
||
|
||
struct editor_syntax {
|
||
// file_type field is the name of the filetype that will be displayed
|
||
// to the user in the status bar.
|
||
char* file_type;
|
||
// file_match is an array of strings, where each string contains a
|
||
// pattern to match a filename against. If the filename matches,
|
||
// then the file will be recognized as having that filetype.
|
||
char** file_match;
|
||
// This will be a NULL-terminated array of strings, each string containing
|
||
// a keyword. To differentiate between the two types of keywords,
|
||
// we’ll terminate the second type of keywords with a pipe (|)
|
||
// character (also known as a vertical bar).
|
||
char** keywords;
|
||
// We let each language specify its own single-line comment pattern.
|
||
char* singleline_comment_start;
|
||
// flags is a bit field that will contain flags for whether to
|
||
// highlight numbers and whether to highlight strings for that
|
||
// filetype.
|
||
char* multiline_comment_start;
|
||
char* multiline_comment_end;
|
||
int flags;
|
||
};
|
||
|
||
struct editor_syntax HL_DB[] = {
|
||
{
|
||
"c",
|
||
C_HL_extensions,
|
||
C_HL_keywords,
|
||
"//",
|
||
"/*",
|
||
"*/",
|
||
HL_HIGHLIGHT_NUMBERS | HL_HIGHLIGHT_STRINGS
|
||
},
|
||
{
|
||
"java",
|
||
JAVA_HL_extensions,
|
||
JAVA_HL_keywords,
|
||
"//",
|
||
"/*",
|
||
"*/",
|
||
HL_HIGHLIGHT_NUMBERS | HL_HIGHLIGHT_STRINGS
|
||
},
|
||
{
|
||
"python",
|
||
PYTHON_HL_extensions,
|
||
PYTHON_HL_keywords,
|
||
"#",
|
||
"'''",
|
||
"'''",
|
||
HL_HIGHLIGHT_NUMBERS | HL_HIGHLIGHT_STRINGS
|
||
},
|
||
{
|
||
"bash",
|
||
BASH_HL_extensions,
|
||
BASH_HL_keywords,
|
||
"#",
|
||
NULL,
|
||
NULL,
|
||
HL_HIGHLIGHT_NUMBERS | HL_HIGHLIGHT_STRINGS
|
||
},
|
||
{
|
||
"js",
|
||
JS_HL_extensions,
|
||
JS_HL_keywords,
|
||
"//",
|
||
"/*",
|
||
"*/",
|
||
HL_HIGHLIGHT_NUMBERS | HL_HIGHLIGHT_STRINGS
|
||
},
|
||
{
|
||
"php",
|
||
PHP_HL_extensions,
|
||
PHP_HL_keywords,
|
||
"//",
|
||
"/*",
|
||
"*/",
|
||
HL_HIGHLIGHT_NUMBERS | HL_HIGHLIGHT_STRINGS
|
||
},
|
||
{
|
||
"json",
|
||
JSON_HL_extensions,
|
||
JSON_HL_keywords,
|
||
NULL,
|
||
NULL,
|
||
NULL,
|
||
HL_HIGHLIGHT_NUMBERS | HL_HIGHLIGHT_STRINGS
|
||
},
|
||
{
|
||
"xml",
|
||
XML_HL_extensions,
|
||
XML_HL_keywords,
|
||
NULL,
|
||
NULL,
|
||
NULL,
|
||
HL_HIGHLIGHT_NUMBERS | HL_HIGHLIGHT_STRINGS
|
||
},
|
||
{
|
||
"sql",
|
||
SQL_HL_extensions,
|
||
SQL_HL_keywords,
|
||
"--",
|
||
"/*",
|
||
"*/",
|
||
HL_HIGHLIGHT_NUMBERS | HL_HIGHLIGHT_STRINGS
|
||
},
|
||
{
|
||
"ruby",
|
||
RUBY_HL_extensions,
|
||
RUBY_HL_keywords,
|
||
"#",
|
||
"=begin",
|
||
"=end",
|
||
HL_HIGHLIGHT_NUMBERS | HL_HIGHLIGHT_STRINGS
|
||
}
|
||
};
|
||
|
||
#endif // EDITOR_SYNTAX_H
|