Skip to content

Commit

Permalink
Merge pull request #797 from zhangzqs/slint-support
Browse files Browse the repository at this point in the history
add support for Slint, #797
  • Loading branch information
AlDanial authored Dec 8, 2023
2 parents cfa784d + cc1bbcc commit 522246b
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1345,6 +1345,7 @@ yacc (y, yacc)
YAML (clang-format, clang-tidy, gemrc, glide.lock, mir, reek, rviz, sublime-syntax, syntax, yaml, yaml-tmlanguage, yml, yml.mysql)
Zig (zig)
zsh (zsh)
Slint (slint)
</pre>

The above list can be customized by reading language definitions from a
Expand Down
1 change: 1 addition & 0 deletions Unix/AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ https://github.com/kaelig
https://github.com/mwiley
https://github.com/michalmuskala
https://github.com/Inventitech
https://github.com/zhangzqs
8 changes: 8 additions & 0 deletions Unix/cloc
Original file line number Diff line number Diff line change
Expand Up @@ -9048,6 +9048,7 @@ sub set_constants { # {{{1
'yml' => 'YAML' ,
'zig' => 'Zig' ,
'zsh' => 'zsh' ,
'slint' => 'Slint' ,
);
# 1}}}
%{$rh_Language_by_Script} = ( # {{{1
Expand Down Expand Up @@ -10742,6 +10743,11 @@ sub set_constants { # {{{1
[ 'remove_matches' , '^\s*#' ],
[ 'remove_inline' , '#.*$' ],
],
'Slint' => [
[ 'rm_comments_in_strings', '"', '/*', '*/' ],
[ 'rm_comments_in_strings', '"', '//', '' ],
[ 'call_regexp_common' , 'C++' ],
],
);
# 1}}}
%{$rh_EOL_continuation_re} = ( # {{{1
Expand Down Expand Up @@ -10814,6 +10820,7 @@ sub set_constants { # {{{1
'Vyper' => '\\\\$' ,
'X++' => '\\\\$' ,
'zsh' => '\\\\$' ,
'Slint' => '\\\\$' ,
);
# 1}}}
%{$rh_Not_Code_Extension} = ( # {{{1
Expand Down Expand Up @@ -11323,6 +11330,7 @@ sub set_constants { # {{{1
'Verilog-SystemVerilog/Coq' => 1.00,
'MATLAB/Mathematica/Objective-C/MUMPS/Mercury' => 1.00,
'IDL/Qt Project/Prolog/ProGuard' => 1.00,
'Slint' => 1.00,
);
# 1}}}
%{$rh_Known_Binary_Archives} = ( # {{{1
Expand Down
5 changes: 5 additions & 0 deletions Unix/t/00_C.t
Original file line number Diff line number Diff line change
Expand Up @@ -1321,6 +1321,11 @@ my @Tests = (
'ref' => '../tests/outputs/zir_sema.zig.yaml',
'args' => '../tests/inputs/zir_sema.zig',
},
{
'name' => 'Slint',
'ref' => '../tests/outputs/Slint-helloworld.slint.yaml',
'args' => '../tests/inputs/Slint-helloworld.slint',
},
);

my $Verbose = 0;
Expand Down
8 changes: 8 additions & 0 deletions cloc
Original file line number Diff line number Diff line change
Expand Up @@ -9063,6 +9063,7 @@ sub set_constants { # {{{1
'yml' => 'YAML' ,
'zig' => 'Zig' ,
'zsh' => 'zsh' ,
'slint' => 'Slint' ,
);
# 1}}}
%{$rh_Language_by_Script} = ( # {{{1
Expand Down Expand Up @@ -10757,6 +10758,11 @@ sub set_constants { # {{{1
[ 'remove_matches' , '^\s*#' ],
[ 'remove_inline' , '#.*$' ],
],
'Slint' => [
[ 'rm_comments_in_strings', '"', '/*', '*/' ],
[ 'rm_comments_in_strings', '"', '//', '' ],
[ 'call_regexp_common' , 'C++' ],
],
);
# 1}}}
%{$rh_EOL_continuation_re} = ( # {{{1
Expand Down Expand Up @@ -10829,6 +10835,7 @@ sub set_constants { # {{{1
'Vyper' => '\\\\$' ,
'X++' => '\\\\$' ,
'zsh' => '\\\\$' ,
'Slint' => '\\\\$' ,
);
# 1}}}
%{$rh_Not_Code_Extension} = ( # {{{1
Expand Down Expand Up @@ -11338,6 +11345,7 @@ sub set_constants { # {{{1
'Verilog-SystemVerilog/Coq' => 1.00,
'MATLAB/Mathematica/Objective-C/MUMPS/Mercury' => 1.00,
'IDL/Qt Project/Prolog/ProGuard' => 1.00,
'Slint' => 1.00,
);
# 1}}}
%{$rh_Known_Binary_Archives} = ( # {{{1
Expand Down
24 changes: 24 additions & 0 deletions tests/inputs/Slint-helloworld.slint
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
component MyButton inherits Text {
color: black;
// ...
}

export component MyApp inherits Window {
preferred-width: 200px;
preferred-height: 100px;
Rectangle {
width: 200px;
height: 100px;
background: green;

}/* */
MyButton {
x:0;y:0; // hello
text: "hello";
}
MyButton { // world
y:0;
x: 50px;
text: "world";
}
}
20 changes: 20 additions & 0 deletions tests/outputs/Slint-helloworld.slint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
# github.com/AlDanial/cloc
header :
cloc_url : github.com/AlDanial/cloc
cloc_version : 1.99
elapsed_seconds : 0.00504088401794434
n_files : 1
n_lines : 24
files_per_second : 198.377902852008
lines_per_second : 4761.06966844819
'Slint' :
nFiles: 1
blank: 2
comment: 1
code: 21
SUM:
blank: 2
comment: 1
code: 21
nFiles: 1

0 comments on commit 522246b

Please sign in to comment.