Skip to content

Commit

Permalink
Refactoring naming
Browse files Browse the repository at this point in the history
  • Loading branch information
SAKryukov committed Dec 20, 2024
1 parent 9c0fbdc commit a4de3ea
Show file tree
Hide file tree
Showing 17 changed files with 242 additions and 214 deletions.
85 changes: 50 additions & 35 deletions highlight-utility/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,28 +33,35 @@
color: green;
}

pre span.comment.block.pascal.highlighter {
pre span.comment.pascal.highlighter {
color: #367
}
pre span.pascal.part.highlighter {
color: saddlebrown;
letter-spacing: 0.1em;
}
pre span.assignment.highlighter {
color: darkmagenta;
}


pre span.keyword.highlighter,
pre span.selector.highlighter,
pre span.storage.module.highlighter,
pre span.storage.class.highlighter,
pre span.storage.function.highlighter {
pre span.storage.modifier.highlighter {
color: blue;
font-weight: normal;
}
pre span.type.keyword.highlighter {
color: brown;
}

pre span._custom-word_.highlighter {
color: slateBlue;
color: darkslateblue;
}

pre span.literal.keyword.highlighter {
color: darkviolet;
}

pre span.literal.keyword.highlighter,
pre span.constant.value.numeric.highlighter,
pre span.constant.value.character.highlighter,
pre span.unit.highlighter {
Expand All @@ -68,11 +75,17 @@
background-color: red;
}

pre span.annotation.highlighter,
pre span.preprocessor.signature.highlighter,
pre span.preprocessor.keyword.highlighter {
color: steelBlue;
font-weight: bold
}

pre span.meta.preprocessor.highlighter {
color: rebeccaPurple;
}


pre span.preprocessor.value.highlighter {
color: sandybrown;
font-weight: bold
Expand All @@ -94,10 +107,11 @@
font-weight: bold
}

pre span.keyword.namespace.highlighter,
pre span.entity.name.class.highlighter {
pre span.name.namespace.highlighter {
color: blue;
}
pre span.name.class.highlighter {
color: #B06;
font-weight: bold
}

pre span.literal.string.highlighter,
Expand All @@ -124,21 +138,33 @@
color: #33B
}

pre span.entity.name.function.highlighter {
pre span.name.function.highlighter {
color: #06B;
font-weight: bold
}
pre span.support.tag.highlighter,
pre span.support.tag-name.highlighter,
pre span.entity.tag.script.highlighter,
pre span.entity.tag.style.highlighter {
color: #070


pre span.xmltag.all.highlighter,
pre span.xmltag.close.highlighter
{
color: darkgreen;
}

pre span.support.attribute.highlighter {
color: #007;
font-style: italic
pre span.xmltag.attribute.highlighter {
color: purple;
font-style: italic;
}
pre span.xmltag.operator.highlighter {
color: blue;
font-weight: semibold;
}
pre span.source.style.highlighter,
pre span.xmltag.style.tag,
pre span.xmltag.style.open,
pre span.xmltag.style.close,
pre span.xmltag.style.name,
pre span.xmltag.style.attribute
{
color: green;
}

pre span.entity.name.tag.highlighter,
Expand All @@ -156,22 +182,11 @@
pre span.entity.function.highlighter,
pre span.support.magic.highlighter {
color: #C00;
font-weight: bold
}

pre span.preprocessor.highlighter,
pre span.meta.preprocessor.highlighter {
color: rebeccaPurple;
font-weight: bold
}

pre span.pascal.assignment.highlighter {
color: blue;
font-weight: bold
}
}
</style>
<style>
* { font-family: sans-serif; }
pre, pre span { font-family: monospace; letter-spacing: 0; }
textarea { width: 100%; height: 20em; }
label { width: 100%; display: flex; flex-direction: row; align-items: center; justify-content: space-between; }
input { width: 100%; }
Expand Down
2 changes: 1 addition & 1 deletion highlighter/language/base.apostrophe-string.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @Sergey A Kryukov
* @author Sergey A Kryukov
*/
RuleSet.extend("base.apostrophe-string", [
{
Expand Down
2 changes: 1 addition & 1 deletion highlighter/language/base.apostrophe.character.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @Sergey A Kryukov
* @author Sergey A Kryukov
*/
RuleSet.extend("base.apostrophe.character", [
{
Expand Down
2 changes: 1 addition & 1 deletion highlighter/language/base.comment-block-c.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @Sergey A Kryukov
* @author Sergey A Kryukov
*/
RuleSet.extend("base.comment-block-c", [
{
Expand Down
2 changes: 1 addition & 1 deletion highlighter/language/base.comment-c.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @Sergey A Kryukov
* @author Sergey A Kryukov
*/
RuleSet.extend("base.comment-c", [
{
Expand Down
2 changes: 1 addition & 1 deletion highlighter/language/base.comment-number-sign.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @Sergey A Kryukov
* @author Sergey A Kryukov
*/
RuleSet.extend("base.comment-number-sign", [
{
Expand Down
4 changes: 2 additions & 2 deletions highlighter/language/base.numeric.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* @Sergey A Kryukov
* @author Sergey A Kryukov
*/
RuleSet.extend("base.numeric", [
{
name: 'constant.value.numeric',
name: namingScheme.literal.numeric,
pattern: /\b(\d+(\.\d+)?(e(\+|\-)?\d+)?(f|d)?|0x[\da-f]+)\b/gi
},
]);
2 changes: 1 addition & 1 deletion highlighter/language/base.string-c.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @Sergey A Kryukov
* @author Sergey A Kryukov
*/
RuleSet.extend("base.string-c", [
{
Expand Down
46 changes: 10 additions & 36 deletions highlighter/language/c.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,59 +7,33 @@
*/
RuleSet.extend('c', [
{
name: 'preprocessor.keyword',
pattern: /#(define|elif|else|endif|error|if|ifdef|ifndef|import|include|line|pragma|undef|using)\b/g
},
{
name: 'meta.preprocessor',
matches: {
1: [
{
matches: {
1: 'keyword.define',
2: 'entity.name'
},
pattern: /(\w+)\s(\w+)\b/g
},
{
name: 'keyword.define',
pattern: /endif/g
},
{
name: 'constant.numeric',
pattern: /\d+/g
},
{
matches: {
1: 'keyword.include',
2: 'string'
},
pattern: /(include)\s(.*?)$/g
}
]
1: namingScheme.preprocessor.signature,
2: namingScheme.preprocessor.keyword,
3: namingScheme.preprocessor.value,
},
pattern: /\#([\S\s]*?)$/gm
pattern: /(#)(include|define|elif|else|endif|error|ifdef|ifndef|if|import|line|pragma|undef|using)(.*?)$/gm
},
{
name: namingScheme.keyword,
pattern: /\b(do|goto|typedef|struct|union|enum)\b/g
pattern: /\b(alignas|alignof|auto|bool|break|case|char|const|constexpr|continue|default|do|double|else|enum|extern|false|float|for|goto|if|inline|int|long|nullptr|register|restrict|return|short|signed|sizeof|static|static_assert|struct|switch|thread_local|true|typedef|typeof|typeof_unqual|union|unsigned|void|volatile|while|_Alignas|_Alignof|_Atomic|_BitInt|_Bool|_Complex|_Decimal128|_Decimal32|_Decimal64|_Generic (C11)|_Imaginary|_Noreturn|_Static_assert|_Th)\b/g
},
{
matches: {
1: 'storage.type',
3: 'storage.type',
4: 'entity.name.function'
1: namingScheme.type.keyword,
3: namingScheme.type.keyword,
4: namingScheme.name.function
},
pattern: /\b((un)?signed|const)? ?(void|char|short|int|long|float|double)\*? +((\w+)(?= ?\())?/g
},
{
matches: {
2: 'entity.name.function'
2: namingScheme.name.function
},
pattern: /(\w|\*) +((\w+)(?= ?\())/g
},
{
name: 'storage.modifier',
name: namingScheme.storage.modifier,
pattern: /\b(static|extern|auto|register|volatile|inline)\b/g
},
], ["base.comment-block-c", "base.comment-c", "base.string-c"]);
14 changes: 9 additions & 5 deletions highlighter/language/cpp.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
/**
* C++ patterns
*
* @author Sergey A Kryukov
* @author Sergey A Kryukov
*/
RuleSet.extend('cpp', [
RuleSet.extend("cpp", [
{
name: 'keyword',
name: namingScheme.keyword,
pattern: /\b(final|override|transaction_safe|transaction_safe_dynamic|import|module|alignas|alignof|and|and_eq|asm|atomic_cancel|atomic_commit|atomic_noexcept|auto|bitand|bitor|bool|break|case|catch|char|char8_t|char16_t|char32_t|class|compl|concept|const|consteval|constexpr|constinit|const_cast|continue|co_await|co_return|co_yield|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|false|float|for|friend|goto|if|inline|int|long|mutable|namespace|new|noexcept|not|not_eq|nullptr|operator|or|or_eq|private|protected|public|reflexpr|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|synchronized|template|this|thread_local|throw|true|try|typedef|typeid|typename|union|unsigned|using|virtual|void|volatile|wchar_t|while|xor|xor_eq)\b/g
},
{
name: 'preprocessor.keyword',
pattern: /#(if|elif|else|endif|ifdef|ifndef|elifdef|elifndef|define|undef|include|line|error|warning|pragma|defined|__has_include|__has_cpp_attribute|export|import|module)\b/g
matches: {
1: namingScheme.preprocessor.signature,
2: namingScheme.preprocessor.keyword,
3: namingScheme.preprocessor.value,
},
pattern: /(#)(if|elif|else|endif|ifdef|ifndef|elifdef|elifndef|define|undef|include|line|error|warning|pragma|defined|__has_include|__has_cpp_attribute|export|import|module)(.*?)$/gm
},
], ["c"]);
9 changes: 5 additions & 4 deletions highlighter/language/csharp.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
*
* @author Sergey A Kryukov
*/
RuleSet.extend('csharp', [
RuleSet.extend("csharp", [
{
matches: {
1: "preprocessor.keyword",
2: "preprocessor.value"
1: namingScheme.preprocessor.signature,
2: namingScheme.preprocessor.keyword,
3: namingScheme.preprocessor.value,
},
pattern: /^\s*(#nullable|#if|#elif|#else|#endif|#define|#undef|#region|#endregion)(.*?)$/gm
pattern: /(#)(nullable|if|elif|else|endif|define|undef|region|endregion)(.*?)$/gm
},
{
name: namingScheme.keyword,
Expand Down
Loading

0 comments on commit a4de3ea

Please sign in to comment.