From b1e16edd5ae31fd60f5dec9f96e14859ddfcae37 Mon Sep 17 00:00:00 2001 From: Oleksandr Sidko Date: Fri, 17 Mar 2017 16:14:37 +0200 Subject: [PATCH] Ticket #3794: syntax: TypeScript support (closes MidnightCommander/mc#122) Signed-off-by: Oleksandr Sidko Signed-off-by: Yury V. Zaytsev --- misc/syntax/Syntax.in | 3 + misc/syntax/ts.syntax | 229 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 232 insertions(+) create mode 100644 misc/syntax/ts.syntax diff --git a/misc/syntax/Syntax.in b/misc/syntax/Syntax.in index 06392e631..1e3b427b9 100644 --- a/misc/syntax/Syntax.in +++ b/misc/syntax/Syntax.in @@ -127,6 +127,9 @@ include cs.syntax file ..\*\\.(js|JS)$ JavaScript\sProgram ^#!.\*[\s/](node|nodejs)\\b include js.syntax +file ..\*\\.(ts|TS)$ TypeScript\sProgram +include ts.syntax + file ..\*\\.(as|AS)$ ActionScript\sProgram include as.syntax diff --git a/misc/syntax/ts.syntax b/misc/syntax/ts.syntax new file mode 100644 index 000000000..4d954c94b --- /dev/null +++ b/misc/syntax/ts.syntax @@ -0,0 +1,229 @@ +# +# TypeScript syntax highlighting +# for MC Editor/CoolEdit +# +# Author: Oleksandr Sidko +# Based on js.syntax +# + +context default + + + #========================= + # Keywords + keyword whole abstract yellow + keyword whole arguments yellow + keyword whole as yellow + keyword whole break yellow + keyword whole caller yellow + keyword whole case yellow + keyword whole catch yellow + keyword whole class yellow + keyword whole const yellow + keyword whole constructor yellow + keyword whole continue yellow + keyword whole declare yellow + keyword whole else yellow + keyword whole enum yellow + keyword whole extends yellow + keyword whole export yellow + keyword whole default yellow + keyword whole delete yellow + keyword whole for yellow + keyword whole from yellow + keyword whole function yellow + keyword whole get yellow + keyword whole if yellow + keyword whole import yellow + keyword whole implements yellow + keyword whole in yellow + keyword whole instanceof yellow + keyword whole interface yellow + keyword whole let yellow + keyword whole module yellow + keyword whole namespace yellow + keyword whole new yellow + keyword whole of yellow + keyword whole private yellow + keyword whole protected yellow + keyword whole prototype yellow + keyword whole public yellow + keyword whole readonly yellow + keyword whole return yellow + keyword whole set yellow + keyword whole static yellow + keyword whole switch yellow + keyword whole this yellow + keyword whole throw yellow + keyword whole try yellow + keyword whole typeof yellow + keyword whole var yellow + keyword whole while yellow + keyword whole with yellow + keyword whole yield yellow + + #========================= + # Basic Types + keyword whole string cyan + keyword whole number cyan + keyword whole boolean cyan + keyword whole any cyan + keyword whole void cyan + keyword whole T cyan + + #========================= + # Objects + keyword whole ActiveXObject yellow + keyword whole Array yellow + keyword whole Boolean yellow + keyword whole Date yellow + keyword whole Dictionary yellow + keyword whole Enumerator yellow + keyword whole FileSystemObject yellow + keyword whole Function yellow + keyword whole Global yellow + keyword whole Image yellow + keyword whole Math yellow + keyword whole Map yellow + keyword whole Number yellow + keyword whole Object yellow + keyword whole Promise yellow + keyword whole Proxy yellow + keyword whole Reflect yellow + keyword whole Set yellow + keyword whole String yellow + keyword whole Symbol yellow + keyword whole TextStream yellow + keyword whole RegExp yellow + keyword whole VBArray yellow + keyword whole WeakMap yellow + keyword whole WeakSet yellow + + #========================= + # Most common functions + keyword whole alert yellow + keyword whole escape yellow + keyword whole eval yellow + keyword whole indexOf yellow + keyword whole isNaN yellow + keyword whole toString yellow + keyword whole unescape yellow + keyword whole valueOf yellow + + #========================= + # Constants + keyword whole false brightgreen + keyword whole null brightgreen + keyword whole true brightgreen + keyword whole undefined yellow + + #========================= + # Comments + keyword /\* brown + keyword \*/ brown + keyword // brown + + #========================= + # Numbers + wholechars abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_. + + keyword whole 0\{xX\}\{0123456789abcdefABCDEF\}\[0123456789abcdefABCDEF\] brightgreen + keyword whole \{0123456789\}\[0123456789\] brightgreen + keyword whole \[0123456789\]\.\{0123456789\}\[0123456789\] brightgreen + keyword whole \{0123456789\}\[0123456789\]\.\[0123456789\] brightgreen + keyword whole \{0123456789\}\[0123456789\]\{eE\}\{0123456789\}\[0123456789\] brightgreen + keyword whole \{0123456789\}\[0123456789\]\{eE\}\{\-\+\}\{0123456789\}\[0123456789\] brightgreen + keyword whole \{0123456789\}\[0123456789\]\.\{0123456789\}\[0123456789\]\{eE\}\{0123456789\}\[0123456789\] brightgreen + keyword whole \{0123456789\}\[0123456789\]\.\{0123456789\}\[0123456789\]\{eE\}\{\-\+\}\{0123456789\}\[0123456789\] brightgreen + + #========================= + # Special symbols + keyword <+> cyan + keyword => brightcyan + keyword \. yellow + keyword \* yellow + keyword \+ yellow + keyword - yellow + keyword / yellow + keyword % yellow + keyword = yellow + keyword ! yellow + keyword & yellow + keyword | yellow + keyword ^ yellow + keyword ~ yellow + keyword > yellow + keyword < yellow + keyword wholeright @+ cyan + + #========================= + # Separators + keyword { brightcyan + keyword } brightcyan + keyword ( brightcyan + keyword ) brightcyan + keyword [ brightcyan + keyword ] brightcyan + keyword , brightcyan + keyword ? brightcyan + keyword : brightcyan + keyword ; brightmagenta + +# Function return type +context exclusive wholeright ): \n cyan + keyword ; brightmagenta + keyword { brightcyan + +#============================= +# Comments + +context exclusive /\* \*/ brown + spellcheck + keyword whole BUG brightred + keyword whole FixMe brightred + keyword whole FIXME brightred + keyword whole Note brightred + keyword whole NOTE brightred + keyword whole ToDo brightred + keyword whole TODO brightred + keyword !!\[!\] brightred + keyword ??\[?\] brightred + + +context exclusive // \n brown + spellcheck + keyword whole BUG brightred + keyword whole FixMe brightred + keyword whole FIXME brightred + keyword whole Note brightred + keyword whole NOTE brightred + keyword whole ToDo brightred + keyword whole TODO brightred + keyword !!\[!\] brightred + keyword ??\[?\] brightred + + +#============================= +# Strings + +context " " green + spellcheck + keyword \\\{\\'"abtnvfr\} brightgreen + keyword \\\{0123\}\{01234567\}\{01234567\} brightgreen + + keyword ' brightgreen + +context ' ' green + spellcheck + keyword \\\{\\'"abtnvfr\} brightgreen + keyword \\\{0123\}\{01234567\}\{01234567\} brightgreen + + keyword " brightgreen + +context ` ` green + spellcheck + keyword \\\{\\'"abtnvfr\} brightgreen + keyword \\\{0123\}\{01234567\}\{01234567\} brightgreen + keyword ${*} yellow + +