From 6d782c199c4566ee4684fb61f3f64729eaee68ca Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Sun, 12 Apr 2020 14:43:48 +0200 Subject: add Turtle syntax highlighting for mc --- mc/syntax/Syntax.diff | 11 +++++ mc/syntax/turtle.syntax | 120 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 131 insertions(+) create mode 100644 mc/syntax/Syntax.diff create mode 100644 mc/syntax/turtle.syntax (limited to 'mc') diff --git a/mc/syntax/Syntax.diff b/mc/syntax/Syntax.diff new file mode 100644 index 0000000..dd0904d --- /dev/null +++ b/mc/syntax/Syntax.diff @@ -0,0 +1,11 @@ +--- a/Syntax ++++ b/Syntax +@@ -301,5 +301,8 @@ + file ..\*\\.(?i:yab)$ Yabasic\s(Yet\sAnother\sBASIC) + include markdown.syntax + ++file ..\*\\.ttl$ Turtle/RDF\sFile ++include turtle.syntax ++ + file .\* unknown + include unknown.syntax diff --git a/mc/syntax/turtle.syntax b/mc/syntax/turtle.syntax new file mode 100644 index 0000000..8e08933 --- /dev/null +++ b/mc/syntax/turtle.syntax @@ -0,0 +1,120 @@ +# +# Turtle syntax highlighting +# for MC Editor/CoolEdit +# +# Copyright 2020, Jonas Smedegaard +# +# This program is free software: +# you can redistribute it and/or modify it +# under the terms of the GNU General Public License +# as published by the Free Software Foundation, +# either version 3 of the License, +# or (at your option) any later version. +# +# 2020-04-12 Jonas Smedegaard +# * Initial public release. +# +# Reference: +# https://www.w3.org/TeamSubmission/turtle/ + +context default lightgray + spellcheck + +# declarations + keyword whole @base magenta + keyword whole @prefix magenta + + keyword whole a yellow + + keyword ^^ brightmagenta + +# Collection + keyword ( brightmagenta + keyword ) brightmagenta + +# Shorthand prefix + keyword wholeleft \{abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\}\[\abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-\]: cyan + keyword wholeleft : cyan + +# Anonymous node + keyword wholeleft _: cyan + keyword [ cyan + keyword ] cyan + +# Decimal integers + keyword whole \{0123456789\}\[0123456789\] yellow + keyword whole \{-+\}\{0123456789\}\[0123456789\] yellow + +# Decimal floating point arbitrary precision number + keyword whole \{0123456789\}.\[0123456789\] yellow + keyword whole .\{0123456789\}\[0123456789\] yellow + keyword whole \{-+\}\{0123456789\}.\[0123456789\] yellow + keyword whole \{-+\}.\{0123456789\}\[0123456789\] yellow + +# Decimal floating point double/fixed precision number + keyword whole \{0123456789\}.\[0123456789\]\{eE\}\{0123456789\}\[0123456789\] yellow + keyword whole \{0123456789\}.\[0123456789\]\{-+\}\{eE\}\{0123456789\}\[0123456789\] yellow + keyword whole .\{0123456789\}\[0123456789\]\{eE\}\{0123456789\}\[0123456789\] yellow + keyword whole .\{0123456789\}\[0123456789\]\{-+\}\{eE\}\{0123456789\}\[0123456789\] yellow + keyword whole \{-+\}\{0123456789\}.\[0123456789\]\{eE\}\{0123456789\}\[0123456789\] yellow + keyword whole \{-+\}\{0123456789\}.\[0123456789\]\{-+\}\{eE\}\{0123456789\}\[0123456789\] yellow + keyword whole \{-+\}.\{0123456789\}\[0123456789\]\{eE\}\{0123456789\}\[0123456789\] yellow + keyword whole \{-+\}.\{0123456789\}\[0123456789\]\{-+\}\{eE\}\{0123456789\}\[0123456789\] yellow + +# Boolean + keyword whole true yellow + keyword whole false yellow + +# Language + keyword wholeright @\{abcdefghijklmnopqrstuvwxyz\}\[abcdefghijklmnopqrstuvwxyz0123456789-\]\[abcdefghijklmnopqrstuvwxyz0123456789\] brightmagenta + keyword wholeright @\{abcdefghijklmnopqrstuvwxyz\}\[abcdefghijklmnopqrstuvwxyz0123456789\] brightmagenta + +# Punctuation + keyword , white + keyword ; white +# keyword . black white + keyword . white brightmagenta + +# URL +# keyword whole <*> brightred +context < > brightred + +# TODO: enable when context ending at newline doesn't ruin next context +# syntax violation +# keyword +\n black red + +# String escape + keyword \\u\{0123456789abcdef\}\{0123456789abcdef\}\{0123456789abcdef\}\{0123456789abcdef\} brightgreen + keyword \\U\{0123456789abcdef\}\{0123456789abcdef\}\{0123456789abcdef\}\{0123456789abcdef\}\{0123456789abcdef\}\{0123456789abcdef\}\{0123456789abcdef\}\{0123456789abcdef\} brightgreen + keyword \\\{tnr>\\} brightgreen + +# Single-line literals +context exclusive " " green + spellcheck + +# TODO: enable when context ending at newline doesn't ruin next context +# syntax violation +# keyword +\n black red + +# String escape + keyword \\u\{0123456789abcdef\}\{0123456789abcdef\}\{0123456789abcdef\}\{0123456789abcdef\} brightgreen + keyword \\U\{0123456789abcdef\}\{0123456789abcdef\}\{0123456789abcdef\}\{0123456789abcdef\}\{0123456789abcdef\}\{0123456789abcdef\}\{0123456789abcdef\}\{0123456789abcdef\} brightgreen + keyword \\\{tnr"\\} brightgreen + +# Multi-line literals +context """ """ green + spellcheck + +# String escape + keyword \\u\{0123456789abcdef\}\{0123456789abcdef\}\{0123456789abcdef\}\{0123456789abcdef\} brightgreen + keyword \\U\{0123456789abcdef\}\{0123456789abcdef\}\{0123456789abcdef\}\{0123456789abcdef\}\{0123456789abcdef\}\{0123456789abcdef\}\{0123456789abcdef\}\{0123456789abcdef\} brightgreen + keyword \\\{tnr"\\} brightgreen + +# Comment +context linestart # \n brown + spellcheck + +# Ideally we would have defined comments with "context linestart \[\s\]# ...", +# but contexts can't start with a character class. So we define comments twice. +context linestart \s\[\s\]# \n brown + spellcheck -- cgit v1.2.3