From 1eadd67c878525e991e195d82f6b9c2a9082dee5 Mon Sep 17 00:00:00 2001 From: GrenderG Date: Sat, 8 Apr 2017 03:06:27 +0200 Subject: [PATCH] Added JavaScript support. --- tte.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/tte.c b/tte.c index b898250..5bacd5b 100644 --- a/tte.c +++ b/tte.c @@ -149,6 +149,7 @@ char* C_HL_extensions[] = {".c", ".h", ".cpp", NULL}; // Array must be terminate char* JAVA_HL_extensions[] = {".java", NULL}; char* PYTHON_HL_extensions[] = {".py", NULL}; char* BASH_HL_extensions[] = {".sh", NULL}; +char* JS_HL_extensions[] = {".js", ".jsx", NULL}; char* C_HL_keywords[] = { "switch", "if", "while", "for", "break", "continue", "return", "else", @@ -177,7 +178,7 @@ char* PYTHON_HL_keywords[] = { "else", "except", "exec", "finally", "for", "from", "global", "if", "import", "in", "is", "lambda", "not", "or", "pass", "print", "raise", "return", "try", "while", "with", "yield", - + "buffer|", "bytearray|", "complex|", "False|", "float|", "frozenset|", "int|", "list|", "long|", "None|", "set|", "str|", "tuple|", "True|", "type|", "unicode|", "xrange|", NULL @@ -193,6 +194,21 @@ char* BASH_HL_keywords[] = { "typeset", "ulimit", "umask", "unalias", "unset", "wait", "printf", NULL }; +char* JS_HL_keywords[] = { + "break", "case", "catch", "class", "const", "continue", "debugger", "default", + "delete", "do", "else", "enum", "export", "extends", "finally", "for", "function", + "if", "implements", "import", "in", "instanceof", "interface", "let", "new", + "package", "private", "protected", "public", "return", "static", "super", "switch", + "this", "throw", "try", "typeof", "var", "void", "while", "with", "yield", "true", + "false", "null", "NaN", "global", "window", "prototype", "constructor", "document", + "isNaN", "arguments", "undefined", + + "Infinity|", "Array|", "Object|", "Number|", "String|", "Boolean|", "Function|", + "ArrayBuffer|", "DataView|", "Float32Array|", "Float64Array|", "Int8Array|", + "Int16Array|", "Int32Array|", "Uint8Array|", "Uint8ClampedArray|", "Uint32Array|", + "Date|", "Error|", "Map|", "RegExp|", "Symbol|", "WeakMap|", "WeakSet|", "Set|", NULL +}; + struct editor_syntax HL_DB[] = { { "c", @@ -230,6 +246,15 @@ struct editor_syntax HL_DB[] = { NULL, HL_HIGHLIGHT_NUMBERS | HL_HIGHLIGHT_STRINGS }, + { + "js", + JS_HL_extensions, + JS_HL_keywords, + "//", + "/*", + "*/", + HL_HIGHLIGHT_NUMBERS | HL_HIGHLIGHT_STRINGS + }, }; // Size of the "Hightlight Database" (HL_DB).