diff options
Diffstat (limited to 'src-qt5/desktop-utils')
-rw-r--r-- | src-qt5/desktop-utils/lumina-textedit/syntax_rules/README.md | 38 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-textedit/syntax_rules/cpp.syntax | 67 |
2 files changed, 105 insertions, 0 deletions
diff --git a/src-qt5/desktop-utils/lumina-textedit/syntax_rules/README.md b/src-qt5/desktop-utils/lumina-textedit/syntax_rules/README.md new file mode 100644 index 00000000..aaf134aa --- /dev/null +++ b/src-qt5/desktop-utils/lumina-textedit/syntax_rules/README.md @@ -0,0 +1,38 @@ +Information about the syntax highlighting rules: + +# General File format +The bulk of the file is a JSON text structure, with the exception of a small comments section at the top where every line starts with a "#". + +# Comments +A small comment section may be placed at the top of the file where every line starts with a "#". This is not a part of the JSON format, but instead something that the Lumina text editor will scan for and remove prior to loading the rest of the file as a JSON document. + +# Requirements +1. A "meta" object containing the following variables (meta information about the rules): + 1. "name" : The name that will be shown to the user for this set of syntax rules. + 2. "file_suffix" : An array of suffixes for identifying which files this rule set supports. +2. A "format" object containing the following variables (file-wide formatting): + 1. "columns_per_line" : (integer, optional) For file formats with line-length restrictions, this will automatically highlight/flag any "overage" of the designated limit. + 2. "font_type" : One of the following ["fixed-width", "all", "monospace"]. This is for assisting with file formats that need characters to line up within the file (all columns are in the same place per line, etc). + 3. "line_wrap" : (boolian, optional) Automatically enable/disable line wrapping for this type of file +3. A "rules" object containing each of the individual rules, with the name of the rules objects being a number which corresponds to when the rule should be applied (lower numbers are applied before higher numbers). The required fields are: + 1. "name" : Not directly used by LTE (yet) - but is useful for noting what each rule is for + 2. Exactly **one** of the following fields must also be included: + 1. "words" : Array of exact words/text which should be matched (automatically converted to a regular expression with a break on either side of the word) + 2. "regex" : single-line regular expression to be used for finding matching text + 3. "regex_start" **and** "regex_end" : multi-line regular expression. Everything between the start/end matches will be highlighted. + 3. At least **one** of the following fields should also be supplied (format of any text matches) + 1. "foreground" : Font color of the matching text (see the Colors section for additional information) + 2. "background" : Highlighting color of the matching text (see the Colors section for additional information) + 3. "font-weight" : One of the following ["bold","normal", "light"]. Changes the thickness of the font for the matching text + +# Colors +There are a number of built-in colors which may be defined by the user, and these can be used by passing in the following: +`"colors/[name of color]"` +The currently-valid colors are: ["keyword", "altkeyword", "class", "text", "function", "comment", "bracket-found", "bracket-missing"]. + +Alternatively, an RGB (0-255)or Hex color code may be used instead (please limit this though - it can conflict with the user's preferred color scheme quite badly) + +Examples: + `"foreground" : "rgb(10,10,15)"` + `"background" : "colors/text"` + `"foreground" : "#0F0F0F"` diff --git a/src-qt5/desktop-utils/lumina-textedit/syntax_rules/cpp.syntax b/src-qt5/desktop-utils/lumina-textedit/syntax_rules/cpp.syntax new file mode 100644 index 00000000..d5a5e4d9 --- /dev/null +++ b/src-qt5/desktop-utils/lumina-textedit/syntax_rules/cpp.syntax @@ -0,0 +1,67 @@ +# Syntax support file for the Lumina Text Editor +# =================================== +# C++ language support rules +# Written by Ken Moore <ken@ixsystems.com> +# Released under the 2-clause BSD license +# =================================== + +{ + "meta" : { + "name" : "C++", + "file_suffix" : ["cpp","hpp","c", "h" ] + }, + "format" : { + "columns_per_line" : -1, + "font_type" : "fixed-width", + "line_wrap" : false + }, + "rules" : { + "1" : { + "name" : "multi-line comment", + "regex_start" : "/\\*", + "regex_end" : "\\*/", + "foreground" : "colors/comment" + }, + "2" : { + "name" : "single-line comment", + "regex" : "//[^\n]*", + "foreground" : "colors/comment", + }, + "3" : { + "name" : "keywords", + "words" : ["char", "class", "const", "double", "enum", "explicit", "extern", "float", "friend", "inline", "int", "long", "namespace", "operator", "private", "protected", "public" , "short", "signals", "signed", "slots", "static", "struct", "template", "typedef", "typename", "union", "unsigned", "virtual", "void", "volatile", "true", "false", "bool"], + "foreground" : "colors/keyword", + "background" : "none", + "font_weight" : "bold" + }, + "4" : { + "name" : "alternate keywords", + "words" : ["for", "while", "switch", "case", "continue", "break", "if", "else", "return", "exit"], + "foreground" : "colors/altkeyword", + "background" : "none", + "font_weight" : "bold" + }, + "5" : { + "name" : "class names", + "regex" : "\\b[A-Za-z0-9_-\\.]+(?=::)\\b", + "foreground" : "colors/class", + "font_weight" : "bold" + }, + "6" : { + "name" : "function names", + "regex" : "\\b[A-Za-z0-9_]+(?=\\()", + "foreground" : "colors/function" + }, + "7" : { + "name" : "text", + "regex" : "\"[^\"\\\\]*(\\\\(.|\\n)[^\"\\\\]*)*\"|'[^'\\\\]*(\\\\(.|\\n)[^'\\\\]*)*'", + "foreground" : "colors/text" + }, + "8" : { + "name" : "preprocessor", + "regex" : "^[\\s]*#[^\n]*", + "foreground" : "colors/preprocessor" + } + + } +} |