Added Python support.

This commit is contained in:
GrenderG committed 2017-04-08 02:46:17 +02:00
1 parent 4bacffa679
commit 78fb01186a
1 file changed
+25 -7
+25 -7
View File
@@ -51,7 +51,7 @@
// Version code
#define TTE_VERSION "0.0.1"
// Length of a tab stop
#define TTE_TAB_STOP 8
#define TTE_TAB_STOP 4
// Times to press Ctrl-Q before exiting
#define TTE_QUIT_TIMES 3
// Highlight flags
@@ -146,15 +146,17 @@ enum editor_highlight {
/*** Filetypes ***/
char* C_HL_extensions[] = {".c", ".h", ".cpp", NULL}; // Array must be terminated with NULL.
char* JAVA_HL_extensions[] = {".java", NULL};
char* PYTHON_HL_extensions[] = {".py", NULL};
char* C_HL_keywords[] = {
"switch", "if", "while", "for", "break", "continue", "return", "else",
"struct", "union", "typedef", "static", "enum", "class", "case", "#include",
"#define",
"int|", "long|", "double|", "float|", "char|", "unsigned|", "signed|",
"void|", NULL
"switch", "if", "while", "for", "break", "continue", "return", "else",
"struct", "union", "typedef", "static", "enum", "class", "case", "#include",
"#define",
"int|", "long|", "double|", "float|", "char|", "unsigned|", "signed|",
"void|", NULL
};
char* JAVA_HL_extensions[] = {".java", NULL};
char* JAVA_HL_keywords[] = {
"switch", "if", "while", "for", "break", "continue", "return", "else",
"in", "public", "private", "protected", "static", "final", "abstract",
@@ -166,6 +168,13 @@ char* JAVA_HL_keywords[] = {
"boolean|", NULL
};
char* PYTHON_HL_keywords[] = {
"and", "as", "assert", "break", "class", "continue", "def", "del", "elif",
"else", "except", "exec", "finally", "for", "from", "global", "if", "import",
"in", "is", "lambda", "not", "or", "pass", "print", "raise", "return", "try",
"while", "with", "yield", NULL
};
struct editor_syntax HL_DB[] = {
{
"c",
@@ -185,6 +194,15 @@ struct editor_syntax HL_DB[] = {
"*/",
HL_HIGHLIGHT_NUMBERS | HL_HIGHLIGHT_STRINGS
},
{
"python",
PYTHON_HL_extensions,
PYTHON_HL_keywords,
"#",
"'''",
"'''",
HL_HIGHLIGHT_NUMBERS | HL_HIGHLIGHT_STRINGS
},
};
// Size of the "Hightlight Database" (HL_DB).