Branch: refs/heads/master Author: Jiří Techet techet@gmail.com Committer: GitHub noreply@github.com Date: Wed, 15 Jan 2025 14:12:52 UTC Commit: 49b3bdc6a7d9009b61c80cfde6222d7767006331 https://github.com/geany/geany/commit/49b3bdc6a7d9009b61c80cfde6222d77670063...
Log Message: ----------- Merge pull request #4095 from techee/scss
Add support for SCSS/LESS
Modified Paths: -------------- ctags/Makefile.am ctags/optlib/scss.c data/Makefile.am data/filedefs/filetypes.LESS.conf data/filedefs/filetypes.SCSS.conf data/filetype_extensions.conf meson.build src/tagmanager/tm_parser.c src/tagmanager/tm_parser.h src/tagmanager/tm_parsers.h tests/ctags/Makefile.am tests/ctags/simple.scss tests/ctags/simple.scss.tags tests/meson.build
Modified: ctags/Makefile.am 1 lines changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -13,6 +13,7 @@ noinst_LTLIBRARIES = libctags.la parsers = \ optlib/forth.c \ optlib/meson.c \ + optlib/scss.c \ parsers/cxx/cxx.c \ parsers/cxx/cxx_debug.c \ parsers/cxx/cxx_debug.h \
Modified: ctags/optlib/scss.c 212 lines changed, 212 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,212 @@ +/* + * Generated by ./misc/optlib2c from optlib/scss.ctags, Don't edit this manually. + */ +#include "general.h" +#include "parse.h" +#include "routines.h" +#include "field.h" +#include "xtag.h" + + +static void initializeSCSSParser (const langType language) +{ + + addLanguageRegexTable (language, "toplevel"); + addLanguageRegexTable (language, "comment"); + addLanguageRegexTable (language, "interp"); + addLanguageRegexTable (language, "args"); + addLanguageRegexTable (language, "map"); + addLanguageRegexTable (language, "strs"); + addLanguageRegexTable (language, "strd"); + + addLanguageTagMultiTableRegex (language, "toplevel", + "^//[^\n]*\n?", + "", "", "", NULL); + addLanguageTagMultiTableRegex (language, "toplevel", + "^/\*", + "", "", "{tenter=comment}", NULL); + addLanguageTagMultiTableRegex (language, "toplevel", + "^#\{", + "", "", "{tenter=interp}", NULL); + addLanguageTagMultiTableRegex (language, "toplevel", + "^'", + "", "", "{tenter=strs}", NULL); + addLanguageTagMultiTableRegex (language, "toplevel", + "^"", + "", "", "{tenter=strd}", NULL); + addLanguageTagMultiTableRegex (language, "toplevel", + "^[ \t]([A-Za-z0-9_-]+)[ \t]*:[^\n]*\n?", + "", "", "", NULL); + addLanguageTagMultiTableRegex (language, "toplevel", + "^@mixin[ \t]+([A-Za-z0-9_-]+)", + "\1", "m", "{tenter=args}", NULL); + addLanguageTagMultiTableRegex (language, "toplevel", + "^@function[ \t]+([A-Za-z0-9_-]+)", + "\1", "f", "{tenter=args}", NULL); + addLanguageTagMultiTableRegex (language, "toplevel", + "^@each[ \t]+\$([A-Za-z0-9_-]+)[ \t]in[ \t]+", + "\1", "v", "", NULL); + addLanguageTagMultiTableRegex (language, "toplevel", + "^@for[ \t]+\$([A-Za-z0-9_-]+)[ \t]from[ \t]+.*[ \t]+(to|through)[ \t]+[^{]+", + "\1", "v", "", NULL); + addLanguageTagMultiTableRegex (language, "toplevel", + "^@[^\n]+\n?", + "", "", "", NULL); + addLanguageTagMultiTableRegex (language, "toplevel", + "^:[^{;]+;\n?", + "", "", "", NULL); + addLanguageTagMultiTableRegex (language, "toplevel", + "^:[^\n;{]+\n", + "", "", "", NULL); + addLanguageTagMultiTableRegex (language, "toplevel", + "^::?([A-Za-z0-9_-]+)[ \t]*[,({]", + "", "", "", NULL); + addLanguageTagMultiTableRegex (language, "toplevel", + "^:[^\n{]+[;{]\n?", + "", "", "", NULL); + addLanguageTagMultiTableRegex (language, "toplevel", + "^\$([A-Za-z0-9_-]+)[ \t]*:[ \t]*\(", + "\1", "v", "{tenter=map}", NULL); + addLanguageTagMultiTableRegex (language, "toplevel", + "^\$([A-Za-z0-9_-]+)[ \t]*:[^\n]*\n?", + "\1", "v", "", NULL); + addLanguageTagMultiTableRegex (language, "toplevel", + "^[.]([A-Za-z0-9_-]+)", + "\1", "c", "", NULL); + addLanguageTagMultiTableRegex (language, "toplevel", + "^%([A-Za-z0-9_-]+)", + "\1", "P", "", NULL); + addLanguageTagMultiTableRegex (language, "toplevel", + "^#([A-Za-z0-9_-]+)", + "\1", "i", "", NULL); + addLanguageTagMultiTableRegex (language, "toplevel", + "^.", + "", "", "", NULL); + addLanguageTagMultiTableRegex (language, "comment", + "^\*/", + "", "", "{tleave}", NULL); + addLanguageTagMultiTableRegex (language, "comment", + "^.", + "", "", "", NULL); + addLanguageTagMultiTableRegex (language, "interp", + "^\}", + "", "", "{tleave}", NULL); + addLanguageTagMultiTableRegex (language, "interp", + "^.", + "", "", "", NULL); + addLanguageTagMultiTableRegex (language, "args", + "^\{", + "", "", "{tleave}", NULL); + addLanguageTagMultiTableRegex (language, "args", + "^#\{", + "", "", "{tenter=interp}", NULL); + addLanguageTagMultiTableRegex (language, "args", + "^\$([A-Za-z0-9_-]+)[ \t]*(:([ \t]*\$)?|[,)])", + "\1", "z", "", NULL); + addLanguageTagMultiTableRegex (language, "args", + "^.", + "", "", "", NULL); + addLanguageTagMultiTableRegex (language, "map", + "^//[^\n]*\n?", + "", "", "", NULL); + addLanguageTagMultiTableRegex (language, "map", + "^/\*", + "", "", "{tenter=comment}", NULL); + addLanguageTagMultiTableRegex (language, "map", + "^#\{", + "", "", "{tenter=interp}", NULL); + addLanguageTagMultiTableRegex (language, "map", + "^\)", + "", "", "{tleave}", NULL); + addLanguageTagMultiTableRegex (language, "map", + "^([A-Za-z0-9_-]+)[ \t]*:", + "\1", "v", "", NULL); + addLanguageTagMultiTableRegex (language, "map", + "^'", + "", "", "{tenter=strs}", NULL); + addLanguageTagMultiTableRegex (language, "map", + "^"", + "", "", "{tenter=strd}", NULL); + addLanguageTagMultiTableRegex (language, "map", + "^.", + "", "", "", NULL); + addLanguageTagMultiTableRegex (language, "strs", + "^'", + "", "", "{tleave}", NULL); + addLanguageTagMultiTableRegex (language, "strs", + "^#\{", + "", "", "{tenter=interp}", NULL); + addLanguageTagMultiTableRegex (language, "strs", + "^[^'#\\]+", + "", "", "", NULL); + addLanguageTagMultiTableRegex (language, "strs", + "^\\?.", + "", "", "", NULL); + addLanguageTagMultiTableRegex (language, "strd", + "^"", + "", "", "{tleave}", NULL); + addLanguageTagMultiTableRegex (language, "strd", + "^#\{", + "", "", "{tenter=interp}", NULL); + addLanguageTagMultiTableRegex (language, "strd", + "^[^"#\\]+", + "", "", "", NULL); + addLanguageTagMultiTableRegex (language, "strd", + "^\\?.", + "", "", "", NULL); +} + +extern parserDefinition* SCSSParser (void) +{ + static const char *const extensions [] = { + "scss", + NULL + }; + + static const char *const aliases [] = { + NULL + }; + + static const char *const patterns [] = { + NULL + }; + + static kindDefinition SCSSKindTable [] = { + { + true, 'm', "mixin", "mixins", + }, + { + true, 'f', "function", "functions", + }, + { + true, 'v', "variable", "variables", + }, + { + true, 'c', "class", "classes", + }, + { + true, 'P', "placeholder", "placeholder classes", + }, + { + true, 'i', "id", "identities", + }, + { + true, 'z', "parameter", "function parameters", + }, + }; + + parserDefinition* const def = parserNew ("SCSS"); + + def->versionCurrent= 0; + def->versionAge = 0; + def->enabled = true; + def->extensions = extensions; + def->patterns = patterns; + def->aliases = aliases; + def->method = METHOD_NOT_CRAFTED|METHOD_REGEX; + def->kindTable = SCSSKindTable; + def->kindCount = ARRAY_SIZE(SCSSKindTable); + def->initialize = initializeSCSSParser; + + return def; +}
Modified: data/Makefile.am 2 lines changed, 2 insertions(+), 0 deletions(-) =================================================================== @@ -51,6 +51,7 @@ filetypes_dist = \ filedefs/filetypes.julia \ filedefs/filetypes.JSON.conf \ filedefs/filetypes.latex \ + filedefs/filetypes.LESS.conf \ filedefs/filetypes.lisp \ filedefs/filetypes.lua \ filedefs/filetypes.Kotlin.conf \ @@ -74,6 +75,7 @@ filetypes_dist = \ filedefs/filetypes.ruby \ filedefs/filetypes.rust \ filedefs/filetypes.Scala.conf \ + filedefs/filetypes.SCSS.conf \ filedefs/filetypes.sh \ filedefs/filetypes.smalltalk \ filedefs/filetypes.sql \
Modified: data/filedefs/filetypes.LESS.conf 17 lines changed, 17 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,17 @@ +# 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 +#tag_parser=SCSS +# default extension used when saving files +extension=less + +# LESS has single-line comments in addition to CSS multi-line ones +comment_single=//
Modified: data/filedefs/filetypes.SCSS.conf 23 lines changed, 23 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,23 @@ +# 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=SCSS +# default extension used when saving files +extension=scss + +# SCSS has single-line comments in addition to CSS multi-line ones +comment_single=// + +[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"
Modified: data/filetype_extensions.conf 2 lines changed, 2 insertions(+), 0 deletions(-) =================================================================== @@ -50,6 +50,7 @@ JSON=*.json; Julia=*.jl; Kotlin=*.kt;*.kts; LaTeX=*.tex;*.sty;*.idx;*.ltx;*.latex;*.aux; +LESS=*.less; Lisp=*.lisp;*.el; Lua=*.lua; Make=*.mak;*.mk;GNUmakefile;makefile;Makefile;makefile.*;Makefile.*; @@ -73,6 +74,7 @@ Raku=*.p6;*.pl6;*.pm6;*.t6;*.raku;*.rakumod;*.rakutest; Rust=*.rs; Ruby=*.rb;*.rhtml;*.ruby;*.gemspec;Gemfile;rakefile;Rakefile; Scala=*.scala;*.scl; +SCSS=*.scss; Sh=*.sh;configure;configure.in;configure.in.in;configure.ac;*.ksh;*.mksh;*.zsh;*.ash;*.bash;.bashrc;bash.bashrc;.bash_*;bash_*;*.m4;PKGBUILD;*profile; Smalltalk=*.st; SQL=*.sql;
Modified: meson.build 1 lines changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -606,6 +606,7 @@ ctags = static_library('ctags', 'ctags/main/xtag_p.h', 'ctags/optlib/forth.c', 'ctags/optlib/meson.c', + 'ctags/optlib/scss.c', 'ctags/parsers/abaqus.c', 'ctags/parsers/abc.c', 'ctags/parsers/ada.c',
Modified: src/tagmanager/tm_parser.c 19 lines changed, 19 insertions(+), 0 deletions(-) =================================================================== @@ -1242,6 +1242,24 @@ static TMParserMapGroup group_MESON[] = { {N_("Tests"), TM_ICON_NONE, tm_tag_field_t}, };
+static TMParserMapEntry map_SCSS[] = { + {'m', tm_tag_macro_t}, // mixin + {'f', tm_tag_function_t}, // function + {'v', tm_tag_member_t}, // variable + {'c', tm_tag_class_t}, // class + {'P', tm_tag_enum_t}, // placeholder + {'i', tm_tag_variable_t}, // id + {'z', tm_tag_local_var_t}, // parameter +}; +static TMParserMapGroup group_SCSS[] = { + {N_("Mixins"), TM_ICON_MACRO, tm_tag_macro_t}, + {N_("Functions"), TM_ICON_METHOD, tm_tag_function_t}, + {N_("Variables"), TM_ICON_MEMBER, tm_tag_member_t}, + {N_("Classes"), TM_ICON_CLASS, tm_tag_class_t}, + {N_("Placeholders"), TM_ICON_OTHER, tm_tag_enum_t}, + {N_("ID Selectors"), TM_ICON_VAR, tm_tag_variable_t | tm_tag_local_var_t}, +}; + typedef struct { TMParserMapEntry *entries; @@ -1320,6 +1338,7 @@ static TMParserMap parser_map[] = { MAP_ENTRY(FORTH), MAP_ENTRY(MESON), MAP_ENTRY(SYSVERILOG), + MAP_ENTRY(SCSS), }; /* make sure the parser map is consistent and complete */ G_STATIC_ASSERT(G_N_ELEMENTS(parser_map) == TM_PARSER_COUNT);
Modified: src/tagmanager/tm_parser.h 1 lines changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -145,6 +145,7 @@ enum TM_PARSER_FORTH, TM_PARSER_MESON, TM_PARSER_SYSVERILOG, + TM_PARSER_SCSS, TM_PARSER_COUNT };
Modified: src/tagmanager/tm_parsers.h 3 lines changed, 2 insertions(+), 1 deletions(-) =================================================================== @@ -79,6 +79,7 @@ LdScriptParser, \ ForthParser, \ MesonParser, \ - SystemVerilogParser + SystemVerilogParser, \ + SCSSParser
#endif
Modified: tests/ctags/Makefile.am 1 lines changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -327,6 +327,7 @@ test_sources = \ simple.raku \ simple.rb \ simple.rst \ + simple.scss \ simple.sh \ simple.tcl \ simple.ts \
Modified: tests/ctags/simple.scss 89 lines changed, 89 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,89 @@ +// _library.scss +$black: #000 !default; +$border-radius: 0.25rem !default; +$box-shadow: 0 0.5rem 1rem rgba($black, 0.15) !default; + +code { + border-radius: $border-radius; + box-shadow: $box-shadow; +} + +.button { + padding: 3px 10px; + font-size: 12px; + border-radius: 3px; + border: 1px solid #e1e4e8; +} + +@mixin prefix($property, $value, $prefixes) { + @each $prefix in $prefixes { + -#{$prefix}-#{$property}: $value; + } + #{$property}: $value; +} + +.gray { + @include prefix(filter, grayscale(50%), moz webkit); +} + +.enlarge { + font-size: 14px; + transition: { + property: font-size; + duration: 4s; + delay: 2s; + } + + &:hover { font-size: 36px; } +} + +%toolbelt { + box-sizing: border-box; + border-top: 1px rgba(#000, .12) solid; + padding: 16px 0; + width: 100%; + + &:hover { border: 2px rgba(#000, .5) solid; } +} + +.action-buttons { + @extend %toolbelt; + color: #4285f4; +} + +.reset-buttons { + @extend %toolbelt; + color: #cddc39; +} + +@use "sass:list"; +@use "sass:meta"; +@use "sass:string"; + +/// Return a copy of $list with all elements for which $condition returns `true` +/// removed. +@function remove-where($list, $condition) { + $new-list: (); + $separator: list.separator($list); + @each $element in $list { + @if not meta.call($condition, $element) { + $new-list: list.append($new-list, $element, $separator: $separator); + } + } + @return $new-list; +} + +$fonts: Tahoma, Geneva, "Helvetica Neue", Helvetica, Arial, sans-serif; + +.content { + @function contains-helvetica($string) { + @return string.index($string, "Helvetica"); + } + font-family: remove-where($fonts, meta.get-function("contains-helvetica")); +} + +#para1 { + text-align: center; + color: red; +} +
Modified: tests/ctags/simple.scss.tags 38 lines changed, 38 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,38 @@ +action-buttons�1�0 +class: action-buttons +black�64�0 +member: black +border-radius�64�0 +member: border-radius +box-shadow�64�0 +member: box-shadow +button�1�0 +class: button +contains-helvetica�16�0 +function: contains-helvetica +content�1�0 +class: content +element�64�0 +member: element +enlarge�1�0 +class: enlarge +fonts�64�0 +member: fonts +gray�1�0 +class: gray +new-list�64�0 +member: new-list +para1�16384�0 +variable: para1 +prefix�64�0 +member: prefix +prefix�65536�0 +macro: prefix +remove-where�16�0 +function: remove-where +reset-buttons�1�0 +class: reset-buttons +separator�64�0 +member: separator +toolbelt�2�0 +enum: toolbelt
Modified: tests/meson.build 1 lines changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -324,6 +324,7 @@ ctags_tests = [ 'ctags/simple.raku.tags', 'ctags/simple.rb.tags', 'ctags/simple.rst.tags', + 'ctags/simple.scss.tags', 'ctags/simple.sh.tags', 'ctags/simple.tcl.tags', 'ctags/simple.ts.tags',
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).