Last active
July 5, 2023 08:47
-
-
Save Azq2/d8ddcaec6645d19b0768b238beb6ecf1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/data/Makefile.am b/data/Makefile.am | |
| index 6d19397d8..8f44fc3c3 100644 | |
| --- a/data/Makefile.am | |
| +++ b/data/Makefile.am | |
| @@ -80,7 +80,9 @@ filetypes_dist = \ | |
| filedefs/filetypes.vhdl \ | |
| filedefs/filetypes.xml \ | |
| filedefs/filetypes.yaml \ | |
| - filedefs/filetypes.zephir | |
| + filedefs/filetypes.zephir \ | |
| + filedefs/filetypes.SCSS.conf \ | |
| + filedefs/filetypes.LESS.conf | |
| # generated filetypes | |
| filetypes_nodist = \ | |
| diff --git a/data/filedefs/filetypes.LESS.conf b/data/filedefs/filetypes.LESS.conf | |
| new file mode 100644 | |
| index 000000000..f67caf5bd | |
| --- /dev/null | |
| +++ b/data/filedefs/filetypes.LESS.conf | |
| @@ -0,0 +1,19 @@ | |
| +# For complete documentation of this file, please see Geany's main documentation | |
| +[styling=CSS] | |
| +[keywords=CSS] | |
| +[indentation=CSS] | |
| + | |
| +[lexer_properties=CSS] | |
| +lexer.css.less.language=1 | |
| + | |
| +[settings=CSS] | |
| +lexer_filetype=CSS | |
| +tag_parser=CSS | |
| +# default extension used when saving files | |
| +extension=less | |
| + | |
| +# LESS has single-line comments in addition to CSS multi-line ones | |
| +comment_single=// | |
| + | |
| +# MIME type | |
| +mime_type=plain/text | |
| diff --git a/data/filedefs/filetypes.SCSS.conf b/data/filedefs/filetypes.SCSS.conf | |
| new file mode 100644 | |
| index 000000000..2a04ad567 | |
| --- /dev/null | |
| +++ b/data/filedefs/filetypes.SCSS.conf | |
| @@ -0,0 +1,26 @@ | |
| +# For complete documentation of this file, please see Geany's main documentation | |
| +[styling=CSS] | |
| +[keywords=CSS] | |
| +[indentation=CSS] | |
| + | |
| +[lexer_properties=CSS] | |
| +lexer.css.scss.language=1 | |
| + | |
| +[settings=CSS] | |
| +lexer_filetype=CSS | |
| +tag_parser=CSS | |
| +# default extension used when saving files | |
| +extension=scss | |
| + | |
| +# SCSS has single-line comments in addition to CSS multi-line ones | |
| +comment_single=// | |
| + | |
| +# MIME type | |
| +mime_type=plain/text | |
| + | |
| +[build_settings] | |
| +# %f will be replaced by the complete filename | |
| +# %e will be replaced by the filename without extension | |
| +# (use only one of it at one time) | |
| +compiler=sass -c "%f" | |
| +linker=sass --style expanded "%f" "%e.dev.css" | |
| diff --git a/data/filedefs/filetypes.javascript b/data/filedefs/filetypes.javascript | |
| index ed085d73a..847b38cd6 100644 | |
| --- a/data/filedefs/filetypes.javascript | |
| +++ b/data/filedefs/filetypes.javascript | |
| @@ -3,7 +3,7 @@ | |
| [keywords] | |
| # all items must be in one line | |
| -primary=break case catch class const continue debugger default delete do else enum export extends false finally for function get if import in Infinity instanceof let NaN new null return set static super switch this throw true try typeof undefined var void while with yield prototype async await | |
| +primary=break case catch class const continue debugger default delete do else enum export extends false finally for function get if import in Infinity instanceof let NaN new null return set static super switch this throw true try typeof undefined var void while with yield prototype async await from as | |
| secondary=Array Boolean Date Function Math Number Object String RegExp EvalError Error RangeError ReferenceError SyntaxError TypeError URIError constructor prototype decodeURI decodeURIComponent encodeURI encodeURIComponent eval isFinite isNaN parseFloat parseInt | |
| [lexer_properties=C] | |
| diff --git a/data/filetype_extensions.conf b/data/filetype_extensions.conf | |
| index 7c2f74f96..372eaaa29 100644 | |
| --- a/data/filetype_extensions.conf | |
| +++ b/data/filetype_extensions.conf | |
| @@ -23,6 +23,8 @@ COBOL=*.cob;*.cpy;*.cbl;*.cobol; | |
| CoffeeScript=*.coffee;Cakefile;*.Cakefile;*.coffee.erb;*.iced;*.iced.erb; | |
| Conf=*.conf;*.ini;config;*rc;*.cfg;*.desktop;*.properties; | |
| CSS=*.css; | |
| +SCSS=*.scss; | |
| +LESS=*.less; | |
| Cython=*.pyx;*.pxd;*.pxi; | |
| D=*.d;*.di; | |
| Diff=*.diff;*.patch;*.rej; | |
| @@ -40,9 +42,9 @@ Graphviz=*.gv;*.dot; | |
| Groovy=*.groovy;*.gradle; | |
| Haskell=*.hs;*.lhs;*.hs-boot;*.lhs-boot; | |
| Haxe=*.hx; | |
| -HTML=*.htm;*.html;*.shtml;*.hta;*.htd;*.htt;*.cfm;*.tpl; | |
| +HTML=*.htm;*.html;*.shtml;*.hta;*.htd;*.htt;*.cfm;*.tpl;*.tmpl;*.vue; | |
| Java=*.java;*.jsp; | |
| -Javascript=*.js; | |
| +Javascript=*.js;*.cjs;*.mjs; | |
| JSON=*.json; | |
| Julia=*.jl; | |
| Kotlin=*.kt;*.kts; | |
| @@ -86,6 +88,6 @@ None=*; | |
| [Groups] | |
| Programming=Arduino;Clojure;CUDA;Cython;Genie;Groovy;Kotlin;Nim;Scala;Swift; | |
| Script=Graphviz;TypeScript;Meson; | |
| -Markup= | |
| +Markup=SCSS;LESS; | |
| Misc=JSON; | |
| None= | |
| diff --git a/scintilla/lexilla/include/SciLexer.h b/scintilla/lexilla/include/SciLexer.h | |
| index c9a076b96..e0f9431fd 100644 | |
| --- a/scintilla/lexilla/include/SciLexer.h | |
| +++ b/scintilla/lexilla/include/SciLexer.h | |
| @@ -769,6 +769,7 @@ | |
| #define SCE_CSS_EXTENDED_PSEUDOELEMENT 21 | |
| #define SCE_CSS_GROUP_RULE 22 | |
| #define SCE_CSS_VARIABLE 23 | |
| +#define SCE_CSS_INTERPOLATION 24 | |
| #define SCE_POV_DEFAULT 0 | |
| #define SCE_POV_COMMENT 1 | |
| #define SCE_POV_COMMENTLINE 2 | |
| diff --git a/scintilla/lexilla/lexers/1.patch b/scintilla/lexilla/lexers/1.patch | |
| new file mode 100644 | |
| index 000000000..ce8bcfff1 | |
| --- /dev/null | |
| +++ b/scintilla/lexilla/lexers/1.patch | |
| @@ -0,0 +1,143 @@ | |
| +diff --git a/include/SciLexer.h b/include/SciLexer.h | |
| +index e58f6184..c180f6ac 100644 | |
| +--- a/include/SciLexer.h | |
| ++++ b/include/SciLexer.h | |
| +@@ -766,6 +766,7 @@ | |
| + #define SCE_CSS_EXTENDED_PSEUDOELEMENT 21 | |
| + #define SCE_CSS_MEDIA 22 | |
| + #define SCE_CSS_VARIABLE 23 | |
| ++#define SCE_CSS_INTERPOLATION 24 | |
| + #define SCE_POV_DEFAULT 0 | |
| + #define SCE_POV_COMMENT 1 | |
| + #define SCE_POV_COMMENTLINE 2 | |
| +diff --git a/lexers/LexCPP.cxx b/lexers/LexCPP.cxx | |
| +index c7d09a7a..8b46d6c1 100644 | |
| +--- a/lexers/LexCPP.cxx | |
| ++++ b/lexers/LexCPP.cxx | |
| +@@ -796,6 +796,7 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i | |
| + bool isStringInPreprocessor = false; | |
| + bool inRERange = false; | |
| + bool seenDocKeyBrace = false; | |
| ++ bool isJsxTag = false; | |
| + | |
| + Sci_Position lineCurrent = styler.GetLine(startPos); | |
| + if ((MaskActive(initStyle) == SCE_C_PREPROCESSOR) || | |
| +@@ -874,12 +875,12 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i | |
| + lastWordWasUUID = false; | |
| + isIncludePreprocessor = false; | |
| + inRERange = false; | |
| ++ isJsxTag = false; | |
| + if (preproc.IsInactive()) { | |
| + activitySet = inactiveFlag; | |
| + sc.SetState(sc.state | activitySet); | |
| + } | |
| + } | |
| +- | |
| + if (sc.atLineEnd) { | |
| + lineCurrent++; | |
| + lineEndNext = styler.LineEnd(lineCurrent); | |
| +@@ -915,6 +916,16 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i | |
| + switch (MaskActive(sc.state)) { | |
| + case SCE_C_OPERATOR: | |
| + sc.SetState(SCE_C_DEFAULT|activitySet); | |
| ++ | |
| ++ if (sc.chPrev == '<' && (setWordStart.Contains(sc.ch) || (sc.ch == '/' && setWordStart.Contains(sc.chNext)))) { | |
| ++ isJsxTag = true; | |
| ++ | |
| ++ if (sc.ch == '/') | |
| ++ sc.Forward(); | |
| ++ | |
| ++ sc.SetState(SCE_C_IDENTIFIER|activitySet); | |
| ++ } | |
| ++ | |
| + break; | |
| + case SCE_C_NUMBER: | |
| + // We accept almost anything because of hex. and number suffixes | |
| +@@ -939,7 +950,9 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i | |
| + } else { | |
| + sc.GetCurrentLowered(s, sizeof(s)); | |
| + } | |
| +- if (keywords.InList(s)) { | |
| ++ if (isJsxTag) { | |
| ++ sc.ChangeState(SCE_C_STRINGRAW|activitySet); | |
| ++ } else if (keywords.InList(s)) { | |
| + lastWordWasUUID = strcmp(s, "uuid") == 0; | |
| + sc.ChangeState(SCE_C_WORD|activitySet); | |
| + } else if (keywords2.InList(s)) { | |
| +@@ -969,6 +982,7 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i | |
| + // SCE_C_DEFAULT as that allows the raw string start code to run. | |
| + sc.ChangeState(SCE_C_STRINGRAW|activitySet); | |
| + sc.SetState(SCE_C_DEFAULT|activitySet); | |
| ++ isJsxTag = false; | |
| + } else { | |
| + sc.ChangeState(SCE_C_STRING|activitySet); | |
| + } | |
| +@@ -977,9 +991,11 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i | |
| + } | |
| + } else { | |
| + sc.SetState(SCE_C_DEFAULT | activitySet); | |
| ++ isJsxTag = false; | |
| + } | |
| + } else { | |
| + sc.SetState(SCE_C_DEFAULT|activitySet); | |
| ++ isJsxTag = false; | |
| + } | |
| + } | |
| + break; | |
| +@@ -1241,6 +1257,7 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i | |
| + sc.SetState(SCE_C_UUID|activitySet); | |
| + lastWordWasUUID = false; | |
| + } else { | |
| ++ isJsxTag = false; | |
| + sc.SetState(SCE_C_IDENTIFIER|activitySet); | |
| + } | |
| + } else if (sc.Match('/', '*')) { | |
| +diff --git a/lexers/LexCSS.cxx b/lexers/LexCSS.cxx | |
| +index c1a86f53..5f6298b4 100644 | |
| +--- a/lexers/LexCSS.cxx | |
| ++++ b/lexers/LexCSS.cxx | |
| +@@ -89,6 +89,7 @@ static void ColouriseCssDoc(Sci_PositionU startPos, Sci_Position length, int ini | |
| + int lastStateS = -1; // before single-quoted/double-quoted string | |
| + int lastStateVar = -1; // before variable (SCSS) | |
| + int lastStateVal = -1; // before value (SCSS) | |
| ++ int lastStateInterpolation = -1; // before interpolation (SCSS) | |
| + int op = ' '; // last operator | |
| + int opPrev = ' '; // last operator | |
| + bool insideParentheses = false; // true if currently in a CSS url() or similar construct | |
| +@@ -161,6 +162,19 @@ static void ColouriseCssDoc(Sci_PositionU startPos, Sci_Position length, int ini | |
| + if (sc.state == SCE_CSS_COMMENT) | |
| + continue; | |
| + | |
| ++ if (sc.state == SCE_CSS_INTERPOLATION) { | |
| ++ if (sc.ch == '}') { | |
| ++ sc.ChangeState(lastStateInterpolation); | |
| ++ } | |
| ++ continue; | |
| ++ } | |
| ++ | |
| ++ if (sc.Match('#', '{')) { | |
| ++ lastStateInterpolation = sc.state; | |
| ++ sc.SetState(SCE_CSS_INTERPOLATION); | |
| ++ continue; | |
| ++ } | |
| ++ | |
| + if (sc.state == SCE_CSS_DOUBLESTRING || sc.state == SCE_CSS_SINGLESTRING) { | |
| + if (sc.ch != (sc.state == SCE_CSS_DOUBLESTRING ? '\"' : '\'')) | |
| + continue; | |
| +@@ -183,6 +197,7 @@ static void ColouriseCssDoc(Sci_PositionU startPos, Sci_Position length, int ini | |
| + break; | |
| + } | |
| + } | |
| ++ | |
| + switch (op) { | |
| + case '@': | |
| + if (lastState == SCE_CSS_DEFAULT || hasNesting) | |
| +@@ -460,7 +475,7 @@ static void ColouriseCssDoc(Sci_PositionU startPos, Sci_Position length, int ini | |
| + break; | |
| + } | |
| + } | |
| +- | |
| ++ | |
| + if (sc.ch != '.' && sc.ch != ':' && sc.ch != '#' && ( | |
| + sc.state == SCE_CSS_CLASS || sc.state == SCE_CSS_ID || | |
| + (sc.ch != '(' && sc.ch != ')' && ( /* This line of the condition makes it possible to extend pseudo-classes with parentheses */ | |
| diff --git a/scintilla/lexilla/lexers/LexCPP.cxx b/scintilla/lexilla/lexers/LexCPP.cxx | |
| index 050a4b926..41d1d9a54 100644 | |
| --- a/scintilla/lexilla/lexers/LexCPP.cxx | |
| +++ b/scintilla/lexilla/lexers/LexCPP.cxx | |
| @@ -799,6 +799,7 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i | |
| bool isStringInPreprocessor = false; | |
| bool inRERange = false; | |
| bool seenDocKeyBrace = false; | |
| + bool isJsxTag = false; | |
| Sci_Position lineCurrent = styler.GetLine(startPos); | |
| if ((MaskActive(initStyle) == SCE_C_PREPROCESSOR) || | |
| @@ -877,12 +878,12 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i | |
| lastWordWasUUID = false; | |
| isIncludePreprocessor = false; | |
| inRERange = false; | |
| + isJsxTag = false; | |
| if (preproc.IsInactive()) { | |
| activitySet = inactiveFlag; | |
| sc.SetState(sc.state | activitySet); | |
| } | |
| } | |
| - | |
| if (sc.atLineEnd) { | |
| lineCurrent++; | |
| lineEndNext = styler.LineEnd(lineCurrent); | |
| @@ -918,6 +919,16 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i | |
| switch (MaskActive(sc.state)) { | |
| case SCE_C_OPERATOR: | |
| sc.SetState(SCE_C_DEFAULT|activitySet); | |
| + | |
| + if (sc.chPrev == '<' && (setWordStart.Contains(sc.ch) || (sc.ch == '/' && setWordStart.Contains(sc.chNext)))) { | |
| + isJsxTag = true; | |
| + | |
| + if (sc.ch == '/') | |
| + sc.Forward(); | |
| + | |
| + sc.SetState(SCE_C_IDENTIFIER|activitySet); | |
| + } | |
| + | |
| break; | |
| case SCE_C_NUMBER: | |
| // We accept almost anything because of hex. and number suffixes | |
| @@ -942,7 +953,9 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i | |
| } else { | |
| sc.GetCurrentLowered(s, sizeof(s)); | |
| } | |
| - if (keywords.InList(s)) { | |
| + if (isJsxTag) { | |
| + sc.ChangeState(SCE_C_STRINGRAW|activitySet); | |
| + } else if (keywords.InList(s)) { | |
| lastWordWasUUID = strcmp(s, "uuid") == 0; | |
| sc.ChangeState(SCE_C_WORD|activitySet); | |
| } else if (keywords2.InList(s)) { | |
| @@ -972,6 +985,7 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i | |
| // SCE_C_DEFAULT as that allows the raw string start code to run. | |
| sc.ChangeState(SCE_C_STRINGRAW|activitySet); | |
| sc.SetState(SCE_C_DEFAULT|activitySet); | |
| + isJsxTag = false; | |
| } else { | |
| sc.ChangeState(SCE_C_STRING|activitySet); | |
| } | |
| @@ -980,9 +994,11 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i | |
| } | |
| } else { | |
| sc.SetState(SCE_C_DEFAULT | activitySet); | |
| + isJsxTag = false; | |
| } | |
| } else { | |
| sc.SetState(SCE_C_DEFAULT|activitySet); | |
| + isJsxTag = false; | |
| } | |
| } | |
| break; | |
| @@ -1271,6 +1287,7 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i | |
| sc.SetState(SCE_C_UUID|activitySet); | |
| lastWordWasUUID = false; | |
| } else { | |
| + isJsxTag = false; | |
| sc.SetState(SCE_C_IDENTIFIER|activitySet); | |
| } | |
| } else if (sc.Match('/', '*')) { | |
| diff --git a/scintilla/lexilla/lexers/LexCSS.cxx b/scintilla/lexilla/lexers/LexCSS.cxx | |
| index b50fbaf25..1e09c4ee7 100644 | |
| --- a/scintilla/lexilla/lexers/LexCSS.cxx | |
| +++ b/scintilla/lexilla/lexers/LexCSS.cxx | |
| @@ -92,6 +92,7 @@ static void ColouriseCssDoc(Sci_PositionU startPos, Sci_Position length, int ini | |
| int lastStateS = -1; // before single-quoted/double-quoted string | |
| int lastStateVar = -1; // before variable (SCSS) | |
| int lastStateVal = -1; // before value (SCSS) | |
| + int lastStateInterpolation = -1; // before interpolation (SCSS) | |
| int op = ' '; // last operator | |
| int opPrev = ' '; // last operator | |
| bool insideParentheses = false; // true if currently in a CSS url() or similar construct | |
| @@ -164,6 +165,19 @@ static void ColouriseCssDoc(Sci_PositionU startPos, Sci_Position length, int ini | |
| if (sc.state == SCE_CSS_COMMENT) | |
| continue; | |
| + if (sc.state == SCE_CSS_INTERPOLATION) { | |
| + if (sc.ch == '}') { | |
| + sc.ChangeState(lastStateInterpolation); | |
| + } | |
| + continue; | |
| + } | |
| + | |
| + if (sc.Match('#', '{')) { | |
| + lastStateInterpolation = sc.state; | |
| + sc.SetState(SCE_CSS_INTERPOLATION); | |
| + continue; | |
| + } | |
| + | |
| if (sc.state == SCE_CSS_DOUBLESTRING || sc.state == SCE_CSS_SINGLESTRING) { | |
| if (sc.ch != (sc.state == SCE_CSS_DOUBLESTRING ? '\"' : '\'')) | |
| continue; | |
| @@ -186,6 +200,7 @@ static void ColouriseCssDoc(Sci_PositionU startPos, Sci_Position length, int ini | |
| break; | |
| } | |
| } | |
| + | |
| switch (op) { | |
| case '@': | |
| if (lastState == SCE_CSS_DEFAULT || hasNesting) | |
| @@ -463,7 +478,7 @@ static void ColouriseCssDoc(Sci_PositionU startPos, Sci_Position length, int ini | |
| break; | |
| } | |
| } | |
| - | |
| + | |
| if (sc.ch != '.' && sc.ch != ':' && sc.ch != '#' && ( | |
| sc.state == SCE_CSS_CLASS || sc.state == SCE_CSS_ID || | |
| (sc.ch != '(' && sc.ch != ')' && ( /* This line of the condition makes it possible to extend pseudo-classes with parentheses */ | |
| diff --git a/src/highlightingmappings.h b/src/highlightingmappings.h | |
| index b85d7ede1..2001edd21 100644 | |
| --- a/src/highlightingmappings.h | |
| +++ b/src/highlightingmappings.h | |
| @@ -416,6 +416,7 @@ static const HLStyle highlighting_styles_CSS[] = | |
| { SCE_CSS_VARIABLE, "variable", FALSE }, | |
| { SCE_CSS_IMPORTANT, "important", FALSE }, | |
| { SCE_CSS_DIRECTIVE, "directive", FALSE }, | |
| + { SCE_CSS_INTERPOLATION, "media", FALSE }, | |
| { SCE_CSS_IDENTIFIER3, "identifier3", FALSE }, | |
| { SCE_CSS_PSEUDOELEMENT, "pseudoelement", FALSE }, | |
| { SCE_CSS_EXTENDED_IDENTIFIER, "extended_identifier", FALSE }, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment