From ddd37ca033a3544860f5e5cbde383866d4aced4b Mon Sep 17 00:00:00 2001 From: Paul Horn Date: Fri, 14 Feb 2025 13:42:00 +0100 Subject: [PATCH 1/2] Add support for Zig syntax --- .../syntax_highlight/Zig.sublime-syntax | 320 ++++++++++++++++++ src/site/markdown/syntax_highlight/mod.rs | 4 + .../syntax_highlight/syntax_themes.themedump | Bin 401916 -> 404516 bytes 3 files changed, 324 insertions(+) create mode 100644 src/site/markdown/syntax_highlight/Zig.sublime-syntax diff --git a/src/site/markdown/syntax_highlight/Zig.sublime-syntax b/src/site/markdown/syntax_highlight/Zig.sublime-syntax new file mode 100644 index 00000000..c0495488 --- /dev/null +++ b/src/site/markdown/syntax_highlight/Zig.sublime-syntax @@ -0,0 +1,320 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/3/syntax.html +# Original source: https://github.com/aidenfoxivey/sublime-zig-unofficial/blob/96e22bb9a7b8368a32b10bc21b22e3b0b70201ee/Syntaxes/Zig.sublime-syntax +#The MIT License (Expat) +# +#Copyright (c) 2018 Jeff Fowler +#Copyright (c) 2024 Aiden Fox Ivey +# +#Permission is hereby granted, free of charge, to any person obtaining a copy +#of this software and associated documentation files (the "Software"), to deal +#in the Software without restriction, including without limitation the rights +#to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +#copies of the Software, and to permit persons to whom the Software is +#furnished to do so, subject to the following conditions: +# +#The above copyright notice and this permission notice shall be included in +#all copies or substantial portions of the Software. +# +#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +#FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +#AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +#LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +#OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +#THE SOFTWARE. +name: Zig +file_extensions: + - zig +scope: source.zig +contexts: + main: + - include: label + - include: function_type + - include: punctuation + - include: storage_modifier + - include: container_decl + - include: constants + - include: comments + - include: strings + - include: test + - include: storage + - include: keywords + - include: operators + - include: support + - include: field_decl + - include: block + - include: function_def + - include: function_call + - include: enum_literal + - include: variables + block: + - match: '([a-zA-Z_][\w.]*|@\".+\")?\s*(\{)' + captures: + 1: storage.type.zig + 2: punctuation.section.braces.begin.zig + push: + - match: '(\})' + captures: + 1: punctuation.section.braces.end.zig + pop: true + - include: main + character_escapes: + - match: \\n + scope: constant.character.escape.newline.zig + - match: \\r + scope: constant.character.escape.carrigereturn.zig + - match: \\t + scope: constant.character.escape.tabulator.zig + - match: \\\\ + scope: constant.character.escape.backslash.zig + - match: \\' + scope: constant.character.escape.single-quote.zig + - match: \\\" + scope: constant.character.escape.double-quote.zig + - match: '\\x[a-fA-F\d]{2}' + scope: constant.character.escape.hexidecimal.zig + - match: '\\u\{[a-fA-F\d]{1,6}\}' + scope: constant.character.escape.hexidecimal.zig + comments: + - match: /// + push: + - meta_scope: comment.line.documentation.zig + - match: $\n? + pop: true + - match: '//[^/]\s*TODO' + push: + - meta_scope: comment.line.todo.zig + - match: $\n? + pop: true + - match: "//[^/]*" + push: + - meta_scope: comment.line.zig + - match: $\n? + pop: true + constants: + - match: \b(null|undefined|true|false)\b + scope: constant.language.zig + - match: '\b(-?[\d_]+)(?!\.)\b' + scope: constant.numeric.integer.zig + - match: '\b(0x[a-fA-F\d_]+)(?!\.)\b' + scope: constant.numeric.integer.hexadecimal.zig + - match: '\b(0o[0-7_]+)(?!\.)\b' + scope: constant.numeric.integer.octal.zig + - match: '\b(0b[01_]+)(?!\.)\b' + scope: constant.numeric.integer.binary.zig + - match: '(-?\b[\d_]+(?:\.[\d_]+)?(?:[eE][+-]?[\d_]+)?)(?!\.)\b' + scope: constant.numeric.float.zig + - match: '(-?\b0x[a-fA-F\d_]+(?:\.[a-fA-F\d_]+)?[pP]?(?:[+-]?[\d_]+)?)(?!\.)\b' + scope: constant.numeric.float.hexadecimal.zig + container_decl: + - match: '\b(?!\d)([a-zA-Z_]\w*|@\".+\")?(?=\s*=\s*(?:extern|packed)?\b\s*(?:union)\s*[(\{])' + scope: entity.name.class.union.zig + - match: '\b(?!\d)([a-zA-Z_]\w*|@\".+\")?(?=\s*=\s*(?:extern|packed)?\b\s*(?:struct)\s*[(\{])' + scope: entity.name.class.struct.zig + - match: '\b(?!\d)([a-zA-Z_]\w*|@\".+\")?(?=\s*=\s*(?:extern|packed)?\b\s*(?:enum)\s*[(\{])' + scope: entity.name.class.enum.zig + - match: '\b(?!\d)([a-zA-Z_]\w*|@\".+\")?(?=\s*=\s*(?:error)\s*[(\{])' + scope: entity.name.class.error.zig + - match: '\b(error)(\.)([a-zA-Z_]\w*|@\".+\")' + captures: + 1: storage.type.error.zig + 2: punctuation.accessor.zig + 3: constant.other.error.zig + enum_literal: + - match: '(^|\s+)(\.(?:[a-zA-Z_]\w*\b|@\"[^\"]*\"))(?!\(|\s*=[^=>])' + scope: constant.language.enum + field_decl: + - match: '([a-zA-Z_]\w*|@\".+\")\s*(:)\s*' + captures: + 1: variable.other.member.zig + 2: punctuation.separator.zig + push: + - match: '([a-zA-Z_][\w.]*|@\".+\")?\s*(?:(,)|(=)|$)' + captures: + 1: storage.type.zig + 2: punctuation.separator.zig + 3: keyword.operator.assignment.zig + pop: true + - include: main + function_call: + - match: '\b([a-zA-Z_]\w*|@\".+\")(?=\s*\()' + scope: meta.function-call.zig variable.function.zig + function_def: + - match: '\b(fn)\s+([a-zA-Z_]\w*|@\".+\")(\()' + captures: + 1: keyword.declaration.function.zig + 2: entity.name.function + 3: punctuation.section.parens.begin.zig + push: + - include: label + - include: param_list + - match: '([a-zA-Z_][\w.]*|@\".+\")' + scope: storage.type.zig + - match: '\)' + scope: punctuation.section.parens.end.zig + set: function_def_after_params + - include: main + function_def_after_params: + # TODO: be more precise here + - match: '\s*([a-zA-Z_][\w.]*|@\".+\")?(!)?\s*(?:([a-zA-Z_][\w.]*|@\".+\")\b(?!\s*\())?' + captures: + 1: storage.type.zig + 2: keyword.operator.zig + 3: storage.type.zig + pop: true + # Bailout if we don't find what we want + - match: (?=.) + pop: true + function_type: + - match: \b(fn)\s*(\() + captures: + 1: keyword.declaration.function.zig + 2: punctuation.section.parens.begin.zig + push: + - meta_content_scope: meta.function.parameters.zig + - include: label + - include: param_list + - match: '([a-zA-Z_][\w.]*|@\".+\")' + scope: storage.type.zig + - match: '\)' + scope: punctuation.section.parens.end.zig + set: function_type_after_params + - include: main + function_type_after_params: + # TODO: Can we merge with function_def_after_params ? It seems similar. + - match: '\s*([a-zA-Z_][\w.]*|@\".+\")?\s*(!)?\s*([a-zA-Z_][\w.]*|@\".+\")' + captures: + 1: storage.type.zig + 2: keyword.operator.zig + 3: storage.type.zig + pop: true + - match: (?=.) + pop: true + keywords: + - match: \b(while|for|break|return|continue|asm|defer|errdefer|unreachable)\b + scope: keyword.control.zig + - match: \b(async|await|suspend|nosuspend|resume)\b + scope: keyword.control.async.zig + - match: \b(if|else|switch|try|catch|orelse)\b + scope: keyword.control.conditional.zig + - match: (@import|@cImport|@cInclude)\b + scope: keyword.control.import.zig + - match: \b(usingnamespace)\b + scope: keyword.other.usingnamespace.zig + label: + - match: '\b(break|continue)\s*:\s*([a-zA-Z_]\w*|@\".+\")\b|\b(?!\d)([a-zA-Z_]\w*|@\".+\")\b(?=\s*:\s*(?:\{|while\b))' + captures: + 1: keyword.control.zig + 2: entity.name.label.zig + 3: entity.name.label.zig + operators: + - match: \b!\b + scope: keyword.operator.zig + - match: '((?:(?:\+|-|\*)%?|/|%|<<|>>|&|\|(?=[^\|])|\^)=)' + scope: keyword.operator.assignment.zig + # The => is for switch expression, I'm not sure this is the best scope. + - match: '=>' + scope: keyword.operator.assignment.zig + - match: (==|(?:!|>|<)=?) + scope: keyword.operator.logical.zig + - match: '=' + scope: keyword.operator.assignment.zig + - match: \b(and|or)\b + scope: keyword.operator.word.zig + - match: ((?:\+|-|\*)\%?|/(?!/)|%) + scope: keyword.operator.arithmetic.zig + - match: '(<<|>>|&(?=[a-zA-Z_]|@\")|\|(?=[^\|])|\^|~)' + scope: keyword.operator.bitwise.zig + - match: '(\+\+|\*\*|->|\.\?|\.\*|&(?=[a-zA-Z_]|@\")|\?|\|\||\.{2,3})' + scope: keyword.operator.other.zig + param_list: + - match: '([a-zA-Z_]\w*|@\".+\")\s*(:)\s*' + captures: + 1: variable.parameter.zig + 2: punctuation.separator.zig + push: + # Don't consume the closing ')' + - match: '([a-zA-Z_][\w.]*|@\".+\")?\s*(,|(?=\)))' + captures: + 1: storage.type.zig + 2: punctuation.separator.zig + 3: punctuation.section.parens.end.zig + pop: true + - include: main + - match: '([a-zA-Z_][\w.]*|@\".+\")' + scope: storage.type.zig + punctuation: + - match: "," + scope: punctuation.separator.zig + - match: ; + scope: punctuation.terminator.zig + - match: (\() + scope: punctuation.section.parens.begin.zig + - match: (\)) + scope: punctuation.section.parens.end.zig + storage: + - match: '\b(anyframe)\b\s*(->)?\s*(?:([a-zA-Z_][\w.]*|@\".+\")\b(?!\s*\())?' + captures: + 1: keyword.declaration.anyframe.zig + 2: keyword.operator.zig + 3: keyword.declaration.zig + - match: \btest\b + scope: keyword.declaration.test.zig + - match: \bstruct\b + scope: keyword.declaration.struct.zig + - match: \benum\b + scope: keyword.declaration.enum.zig + - match: \bunion\b + scope: keyword.declaration.union.zig + - match: \berror\b + scope: keyword.declaration.error.zig + storage_modifier: + - match: \b(const|var|extern|packed|export|pub|noalias|inline|noinline|comptime|volatile|align|linksection|threadlocal|allowzero)\b + scope: storage.modifier.zig + strings: + - match: \' + push: + - meta_scope: string.quoted.single.zig + - match: \' + pop: true + - include: character_escapes + - match: '\\[^\''][^\'']*?' + scope: invalid.illegal.character.zig + - match: c?\" + push: + - meta_scope: string.quoted.double.zig + - match: \" + pop: true + - include: character_escapes + - match: '\\[^\''][^\'']*?' + scope: invalid.illegal.character.zig + - match: c?\\\\ + push: + - meta_scope: string.quoted.other.zig + - match: $\n? + pop: true + support: + - match: '@[^\"\d][a-zA-Z_]\w*\b' + scope: support.function.zig + variables: + - match: '\b[_A-Z][_A-Z0-9]+\b' + scope: variable.constant.zig + + - match: '\b[_a-zA-Z][_a-zA-Z0-9]*_t\b' + scope: storage.type.zig + + - match: '\b[A-Z][a-zA-Z0-9]*\b' + scope: storage.type.zig + + - match: '\b[_a-zA-Z][_a-zA-Z0-9]*\b' + scope: variable.zig + + test: + - match: \b(test)\b\s+(\")(.*)(\") + captures: + 0: entity.name.function.test.zig + 1: keyword.declaration.test.zig + 2: punctuation.string.start.zig + 4: punctuation.string.end.zig diff --git a/src/site/markdown/syntax_highlight/mod.rs b/src/site/markdown/syntax_highlight/mod.rs index 10af926e..b99c10ff 100644 --- a/src/site/markdown/syntax_highlight/mod.rs +++ b/src/site/markdown/syntax_highlight/mod.rs @@ -58,14 +58,18 @@ pub fn dump_syntax_themes() -> Result<()> { std::fs::read_to_string("./src/site/markdown/syntax_highlight/TOML.sublime-syntax")?; let ts_syntax_file = std::fs::read_to_string("./src/site/markdown/syntax_highlight/TypeScript.sublime-syntax")?; + let zig_syntax_file = + std::fs::read_to_string("./src/site/markdown/syntax_highlight/Zig.sublime-syntax")?; let timer = Instant::now(); let toml_syntax = SyntaxDefinition::load_from_str(&toml_syntax_file, true, Some("toml")).unwrap(); let ts_syntax = SyntaxDefinition::load_from_str(&ts_syntax_file, true, Some("typescript")).unwrap(); + let zig_syntax = SyntaxDefinition::load_from_str(&zig_syntax_file, true, Some("zig")).unwrap(); let mut ps_builder = SyntaxSet::load_defaults_newlines().into_builder(); ps_builder.add(toml_syntax); ps_builder.add(ts_syntax); + ps_builder.add(zig_syntax); let ps = ps_builder.build(); syntect::dumps::dump_to_uncompressed_file( &ps, diff --git a/src/site/markdown/syntax_highlight/syntax_themes.themedump b/src/site/markdown/syntax_highlight/syntax_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5b9;^+ za!Uv-6r^rcE)onac`D+pa_XSEFo-fBnC)wLr-tAICpw1|-x1dzx_RBqlu9&8LnDcc znxJL;?`nBkPIT#nNKtGzja`_7(K1@NeS{6&=zo$wE$Ptk3jV?S>$iKq`K+ndCpL0^ zhV#Fz1Zfe)$|QC;Jkv7p?p%rUFNzK1w^x76Y0LjnlsDfQ<~D}yLG>8~$~u|ABYXt23fEE!|^kAI-Sx+7RrPuSV$Dzcd|xS~5lJf-Y1s< z5PwQRv=10ey5W}ty(j^aZVu)gkNfNtbr zczKa|2ae7mS01`PEOqeK^)El6z}Kd81Akh`(NFJgaBL;{JV6!93J0{z)9o(zX@IJ0 zA?7F}vAoYLbEpjJw5c3 zzX$Cf`n%HyhHN2b8^uL+taDhYTKn{dAhrfv9INrcRep}wOQ1NU8{w=~u$6;76er4n V{sV|O(Ys2Qa32OCw~Y@5ZxW9632y)Z delta 43 xcmZ2-L*mb22}a*W##TlkVrpe%Ze?U?Wn|sT$d<*==rx^Dl}&N`R!O#eApjan3t0dF From 622c0b6c45ef24421cbdd7c1c7c4cc9de2339690 Mon Sep 17 00:00:00 2001 From: Paul Horn Date: Fri, 14 Feb 2025 14:32:59 +0100 Subject: [PATCH 2/2] Add support for Zon syntax --- .../syntax_highlight/Zon.sublime-syntax | 302 ++++++++++++++++++ src/site/markdown/syntax_highlight/mod.rs | 4 + .../syntax_highlight/syntax_themes.themedump | Bin 404516 -> 407148 bytes 3 files changed, 306 insertions(+) create mode 100644 src/site/markdown/syntax_highlight/Zon.sublime-syntax diff --git a/src/site/markdown/syntax_highlight/Zon.sublime-syntax b/src/site/markdown/syntax_highlight/Zon.sublime-syntax new file mode 100644 index 00000000..e4c37f93 --- /dev/null +++ b/src/site/markdown/syntax_highlight/Zon.sublime-syntax @@ -0,0 +1,302 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/syntax.html +# Original source: https://github.com/aidenfoxivey/sublime-zig-unofficial/blob/96e22bb9a7b8368a32b10bc21b22e3b0b70201ee/Syntaxes/Zon.sublime-syntax +#The MIT License (Expat) +# +#Copyright (c) 2018 Jeff Fowler +#Copyright (c) 2024 Aiden Fox Ivey +# +#Permission is hereby granted, free of charge, to any person obtaining a copy +#of this software and associated documentation files (the "Software"), to deal +#in the Software without restriction, including without limitation the rights +#to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +#copies of the Software, and to permit persons to whom the Software is +#furnished to do so, subject to the following conditions: +# +#The above copyright notice and this permission notice shall be included in +#all copies or substantial portions of the Software. +# +#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +#FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +#AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +#LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +#OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +#THE SOFTWARE. +name: Zon +file_extensions: + - zon +scope: source.zon +contexts: + main: + - include: dummy_main + block: + - match: '([a-zA-Z_][\w.]*|@\".+\")?\s*(\{)' + captures: + 1: storage.type.zon + 2: punctuation.section.braces.begin.zon + push: + - match: '(\})' + captures: + 1: punctuation.section.braces.end.zon + pop: true + - include: dummy_main + character_escapes: + - match: \\n + scope: constant.character.escape.newline.zon + - match: \\r + scope: constant.character.escape.carrigereturn.zon + - match: \\t + scope: constant.character.escape.tabulator.zon + - match: \\\\ + scope: constant.character.escape.backslash.zon + - match: \\' + scope: constant.character.escape.single-quote.zon + - match: \\\" + scope: constant.character.escape.double-quote.zon + - match: '\\x[a-fA-F\d]{2}' + scope: constant.character.escape.hexidecimal.zon + - match: '\\u\{[a-fA-F\d]{1,6}\}' + scope: constant.character.escape.hexidecimal.zon + comments: + - match: /// + push: + - meta_scope: comment.line.documentation.zon + - match: $\n? + pop: true + - match: '//[^/]\s*TODO' + push: + - meta_scope: comment.line.todo.zon + - match: $\n? + pop: true + - match: '//[^/]*' + push: + - meta_scope: comment.line.zon + - match: $\n? + pop: true + constants: + - match: \b(null|undefined|true|false)\b + scope: constant.language.zon + - match: '\b(?])' + scope: constant.language.enum + field_decl: + - match: '([a-zA-Z_]\w*|@\".+\")\s*(:)\s*' + captures: + 1: variable.other.member.zon + 2: punctuation.separator.zon + push: + - match: '([a-zA-Z_][\w.]*|@\".+\")?\s*(?:(,)|(=)|$)' + captures: + 1: storage.type.zon + 2: punctuation.separator.zon + 3: keyword.operator.assignment.zon + pop: true + - include: dummy_main + function_call: + - match: '(?|<)=?) + scope: keyword.operator.logical.zon + - match: \b(and|or)\b + scope: keyword.operator.word.zon + - match: '((?:(?:\+|-|\*)\%?|/|%|<<|>>|\|(?=[^\|])|\^)?=)' + scope: keyword.operator.assignment.zon + - match: ((?:\+|-|\*)\%?|/(?!/)|%) + scope: keyword.operator.arithmetic.zon + - match: '(<<|>>|\|(?=[^\|])|\^|~)' + scope: keyword.operator.bitwise.zon + - match: '(\+\+|\*\*|->|\.\?|\.\*|\?|\|\||\.{2,3})' + scope: keyword.operator.other.zon + param_list: + - match: '([a-zA-Z_]\w*|@\".+\")\s*(:)\s*' + captures: + 1: variable.parameter.zon + 2: punctuation.separator.zon + push: + - match: '([a-zA-Z_][\w.]*|@\".+\")?\s*(?:(,)|(\)))' + captures: + 1: storage.type.zon + 2: punctuation.separator.zon + 3: punctuation.section.parens.end.zon + pop: true + - include: dummy_main + - match: '([a-zA-Z_][\w.]*|@\".+\")' + scope: storage.type.zon + punctuation: + - match: ',' + scope: punctuation.separator.zon + - match: ; + scope: punctuation.terminator.zon + - match: (\() + scope: punctuation.section.parens.begin.zon + - match: (\)) + scope: punctuation.section.parens.end.zon + storage: + - match: \b(bool|void|noreturn|type|anyerror|anytype)\b + scope: storage.type.zon + - match: '\b(?)?\s*(?:([a-zA-Z_][\w.]*|@\".+\")\b(?!\s*\())?' + captures: + 1: storage.type.zon + 2: keyword.operator.zon + 3: storage.type.zon + - match: \bfn\b + scope: storage.type.function.zon + - match: \btest\b + scope: storage.type.test.zon + - match: \bstruct\b + scope: storage.type.struct.zon + - match: \benum\b + scope: storage.type.enum.zon + - match: \bunion\b + scope: storage.type.union.zon + - match: \berror\b + scope: storage.type.error.zon + storage_modifier: + - match: \b(const|var|extern|packed|export|pub|noalias|inline|noinline|comptime|volatile|align|linksection|threadlocal|allowzero)\b + scope: storage.modifier.zon + strings: + - match: \' + push: + - meta_scope: string.quoted.single.zon + - match: \' + pop: true + - include: character_escapes + - match: '\\[^\''][^\'']*?' + scope: invalid.illegal.character.zon + - match: c?\" + push: + - meta_scope: string.quoted.double.zon + - match: \" + pop: true + - include: character_escapes + - match: '\\[^\''][^\'']*?' + scope: invalid.illegal.character.zon + - match: c?\\\\ + push: + - meta_scope: string.quoted.other.zon + - match: $\n? + pop: true + support: + - match: '(? Result<()> { std::fs::read_to_string("./src/site/markdown/syntax_highlight/TypeScript.sublime-syntax")?; let zig_syntax_file = std::fs::read_to_string("./src/site/markdown/syntax_highlight/Zig.sublime-syntax")?; + let zon_syntax_file = + std::fs::read_to_string("./src/site/markdown/syntax_highlight/Zon.sublime-syntax")?; let timer = Instant::now(); let toml_syntax = SyntaxDefinition::load_from_str(&toml_syntax_file, true, Some("toml")).unwrap(); let ts_syntax = SyntaxDefinition::load_from_str(&ts_syntax_file, true, Some("typescript")).unwrap(); let zig_syntax = SyntaxDefinition::load_from_str(&zig_syntax_file, true, Some("zig")).unwrap(); + let zon_syntax = SyntaxDefinition::load_from_str(&zon_syntax_file, true, Some("zon")).unwrap(); let mut ps_builder = SyntaxSet::load_defaults_newlines().into_builder(); ps_builder.add(toml_syntax); ps_builder.add(ts_syntax); ps_builder.add(zig_syntax); + ps_builder.add(zon_syntax); let ps = ps_builder.build(); syntect::dumps::dump_to_uncompressed_file( &ps, diff --git a/src/site/markdown/syntax_highlight/syntax_themes.themedump b/src/site/markdown/syntax_highlight/syntax_themes.themedump index f7015a64634b0e6080fb91c7c248ec02c191e180..3f0f20b6e98da94673bb14318e26e0fc1a32bc81 100644 GIT binary patch delta 2695 zcmV;23V8LT*cj~W7y(a#0fhkpg#iME0Rx2r1cdz286y|ix)pUE5?pih7KBZg9?w=Lt#tw4rp^Ypz=X^c8uNEm|&x#y)u+ccD zy^-D5A#z0BF5DY8?4(5c7?n_~Yv(Lk+Z#$s*fYLoJ!6ar*KR**c z$FrHAn{h)J>N_)V%#oX0Xp{QTlKficLQ+AYEq~*K#)y_VYX06Vt49w}GS&JBTn2?Y z@@)Ow_pZ@y1Yfk;WkF||8|f~1f^Pd(Ox{v-fZ|18=0&GUX!WKCFEqpJu`kznE^9I_ zk#GA~0scS+{v&W}=WB=d@0*?TZ#(}S4*JGiAGGlsqp5EjO|55y?N;xg^-9C7F8ojU zNSAIXlYvS%JjFYQinu!m6)QgHo4Ax`x9PIn|0Px z$2!eZ>gH)#;5|i=snbP4Pr@&PwJIctrGL5nV__~a#HGraBp!OM2>MQ|XRD9cyM~jNz{3*qMC>7t2PJc4u zD_pjh6+Zn)LQ5{1orZoKSWK78OLZ5e;CXyhMO=VvEacS2MefYkexx(MsPN4!i5#Jc zlEgOn>V%bj|QYDcVa4)~*FhgIFhVDz$XY#R1c>A_aWF z0N;b zJGFjZj1Ko%&;Hw;0r>6TzyI$0T8v@W!-k=2txm6R*u%lLM)G%^gM1=FLe&HX zj-@+ZgeFMzs748SH@7tzeya{248oKf#FH{FzrWl0m5fcZj*V|cB?e_R?T-4pdoujz zb@(I4GlMgM!692A=`0wdbblToB{cMGN_z0pN538Pw>twmO}&x?k5m$jUEhoZ#($D9 zE>2V`06%lR{_M|#M3zc9eo-xldOGQoXL@4dRKfxpMQ_I&*Y*aQ>ey1)Tm6-@f`(yh z`KoWs`Q34^3(=#Srt|1MgftJ&V5LAdqywY0Ird<|CR?*UWCsIHbbnje);rM|3~q|_ zgj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