Skip to content

Commit 7106388

Browse files
authored
feat: add slint support (#500)
Fixes #496.
1 parent 5acb76c commit 7106388

File tree

6 files changed

+130
-25
lines changed

6 files changed

+130
-25
lines changed

LANGUAGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ Shell (sh,.tcshrc)
239239
Sieve (sieve)
240240
SKILL (il)
241241
Slang (slang)
242+
Slint (slint)
242243
Smarty Template (tpl)
243244
Snakemake (smk,rules,snakefile)
244245
SNOBOL (sno)

SCC-OUTPUT-REPORT.html

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<th>456</th>
1919
<th>7602</th>
2020
<th>1517</th>
21-
<th>253980</th>
21+
<th>254028</th>
2222
<th>4051</th>
2323
</tr><tr>
2424
<td>processor/formatters.go</td>
@@ -220,16 +220,6 @@
220220
<td>8</td>
221221
<td>2030</td>
222222
<td>52</td>
223-
</tr><tr>
224-
<td>cmd/badges/simplecache_test.go</td>
225-
<td></td>
226-
<td>52</td>
227-
<td>12</td>
228-
<td>0</td>
229-
<td>40</td>
230-
<td>9</td>
231-
<td>1041</td>
232-
<td>30</td>
233223
</tr><tr>
234224
<td>processor/filereader.go</td>
235225
<td></td>
@@ -240,6 +230,16 @@
240230
<td>6</td>
241231
<td>1316</td>
242232
<td>37</td>
233+
</tr><tr>
234+
<td>cmd/badges/simplecache_test.go</td>
235+
<td></td>
236+
<td>52</td>
237+
<td>12</td>
238+
<td>0</td>
239+
<td>40</td>
240+
<td>9</td>
241+
<td>1041</td>
242+
<td>30</td>
243243
</tr><tr>
244244
<td>processor/cocomo.go</td>
245245
<td></td>
@@ -250,16 +250,6 @@
250250
<td>0</td>
251251
<td>2209</td>
252252
<td>35</td>
253-
</tr><tr>
254-
<td>processor/bloom.go</td>
255-
<td></td>
256-
<td>37</td>
257-
<td>7</td>
258-
<td>12</td>
259-
<td>18</td>
260-
<td>2</td>
261-
<td>1062</td>
262-
<td>29</td>
263253
</tr><tr>
264254
<td>processor/cocomo_test.go</td>
265255
<td></td>
@@ -270,6 +260,16 @@
270260
<td>6</td>
271261
<td>686</td>
272262
<td>23</td>
263+
</tr><tr>
264+
<td>processor/bloom.go</td>
265+
<td></td>
266+
<td>37</td>
267+
<td>7</td>
268+
<td>12</td>
269+
<td>18</td>
270+
<td>2</td>
271+
<td>1062</td>
272+
<td>29</td>
273273
</tr><tr>
274274
<td>processor/helpers_test.go</td>
275275
<td></td>
@@ -318,7 +318,7 @@
318318
<td>0</td>
319319
<td>4</td>
320320
<td>0</td>
321-
<td>22757</td>
321+
<td>22805</td>
322322
<td>5</td>
323323
</tr></tbody>
324324
<tfoot><tr>
@@ -329,7 +329,7 @@
329329
<th>456</th>
330330
<th>7602</th>
331331
<th>1517</th>
332-
<th>253980</th>
332+
<th>254028</th>
333333
<th>4051</th>
334334
</tr>
335335
<tr>

examples/language/slint.slint

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
// an example from https://releases.slint.dev/1.7.2/docs/slint/src/recipes/recipes#custom-table-view
2+
// 2 comments 5 blanks 9 Complexity 65 code
3+
4+
import { VerticalBox, ListView } from "std-widgets.slint";
5+
6+
component TableView inherits Rectangle {
7+
in property <[string]> columns;
8+
in property <[[string]]> values;
9+
10+
private property <length> e: self.width / root.columns.length;
11+
private property <[length]> column_sizes: [
12+
root.e, root.e, root.e, root.e, root.e, root.e, root.e, root.e, root.e, root.e, root.e, root.e, root.e, root.e, root.e, root.e, root.e, root.e, root.e, root.e, root.e, root.e,
13+
root.e, root.e, root.e, root.e, root.e, root.e, root.e, root.e, root.e, root.e, root.e, root.e, root.e, root.e, root.e, root.e, root.e, root.e, root.e, root.e, root.e, root.e,
14+
root.e, root.e, root.e, root.e, root.e, root.e, root.e, root.e, root.e, root.e, root.e, root.e, root.e, root.e, root.e, root.e, root.e, root.e, root.e, root.e, root.e, root.e,
15+
];
16+
17+
VerticalBox {
18+
padding: 5px;
19+
HorizontalLayout {
20+
padding: 5px; spacing: 5px;
21+
vertical-stretch: 0;
22+
for title[idx] in root.columns : HorizontalLayout {
23+
width: root.column_sizes[idx];
24+
Text { overflow: elide; text: title; }
25+
Rectangle {
26+
width: 1px;
27+
background: gray;
28+
TouchArea {
29+
width: 10px;
30+
x: (parent.width - self.width) / 2;
31+
property <length> cached;
32+
pointer-event(event) => {
33+
if (event.button == PointerEventButton.left && event.kind == PointerEventKind.down) {
34+
self.cached = root.column_sizes[idx];
35+
}
36+
}
37+
moved => {
38+
if (self.pressed) {
39+
root.column_sizes[idx] += (self.mouse-x - self.pressed-x);
40+
if (root.column_sizes[idx] < 0) {
41+
root.column_sizes[idx] = 0;
42+
}
43+
}
44+
}
45+
mouse-cursor: ew-resize;
46+
}
47+
}
48+
}
49+
}
50+
ListView {
51+
for r in root.values : HorizontalLayout {
52+
padding: 5px;
53+
spacing: 5px;
54+
for t[idx] in r : HorizontalLayout {
55+
width: root.column_sizes[idx];
56+
Text { overflow: elide; text: t; }
57+
}
58+
}
59+
}
60+
}
61+
}
62+
63+
export component Example inherits Window {
64+
TableView {
65+
columns: ["Device", "Mount Point", "Total", "Free"];
66+
values: [
67+
["/dev/sda1", "/", "255GB", "82.2GB"] ,
68+
["/dev/sda2", "/tmp", "60.5GB", "44.5GB"] ,
69+
["/dev/sdb1", "/home", "255GB", "32.2GB"] ,
70+
];
71+
}
72+
}

languages.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7480,6 +7480,38 @@
74807480
}
74817481
]
74827482
},
7483+
"Slint": {
7484+
"complexitychecks": [
7485+
"for ",
7486+
"if ",
7487+
"if(",
7488+
"states ",
7489+
"states[",
7490+
"else ",
7491+
"|| ",
7492+
"&& ",
7493+
"!= ",
7494+
"== "
7495+
],
7496+
"extensions": [
7497+
"slint"
7498+
],
7499+
"line_comment": [
7500+
"//"
7501+
],
7502+
"multi_line": [
7503+
[
7504+
"/*",
7505+
"*/"
7506+
]
7507+
],
7508+
"quotes": [
7509+
{
7510+
"end": "\"",
7511+
"start": "\""
7512+
}
7513+
]
7514+
},
74837515
"Smarty Template": {
74847516
"complexitychecks": [
74857517
"for ",

processor/constants.go

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

test-all.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,7 @@ else
915915
fi
916916

917917
# Try out specific languages
918-
for i in 'Bosque ' 'Flow9 ' 'Bitbucket Pipeline ' 'Docker ignore ' 'Q# ' 'Futhark ' 'Alloy ' 'Wren ' 'Monkey C ' 'Alchemist ' 'Luna ' 'ignore ' 'XML Schema ' 'Web Services' 'Go ' 'Java ' 'Boo ' 'License ' 'BASH ' 'C Shell ' 'Korn Shell ' 'Makefile ' 'Shell ' 'Zsh ' 'Rakefile ' 'Gemfile ' 'Dockerfile ' 'Yarn ' 'Sieve ' 'F# ' 'Elm ' 'Terraform ' 'Clojure ' 'C# ' 'LLVM IR ' 'HAML ' 'FXML ' 'DM ' 'Nushell ' 'R ' 'Racket ' 'DOT ' 'YAML ' 'Teal ' 'FSL ' 'INI ' 'Hare ' 'Templ ' 'Cuda ' 'GraphQL ' 'Bicep ' 'Pkl ' 'TypeSpec ' 'LALRPOP ' 'Snakemake ' 'OpenQASM ' 'Typst ' 'ZoKrates ' 'Chapel ' 'Slang ' 'Circom ' 'Proto ' 'wenyan ' 'Cangjie ' 'Clipper '
918+
for i in 'Bosque ' 'Flow9 ' 'Bitbucket Pipeline ' 'Docker ignore ' 'Q# ' 'Futhark ' 'Alloy ' 'Wren ' 'Monkey C ' 'Alchemist ' 'Luna ' 'ignore ' 'XML Schema ' 'Web Services' 'Go ' 'Java ' 'Boo ' 'License ' 'BASH ' 'C Shell ' 'Korn Shell ' 'Makefile ' 'Shell ' 'Zsh ' 'Rakefile ' 'Gemfile ' 'Dockerfile ' 'Yarn ' 'Sieve ' 'F# ' 'Elm ' 'Terraform ' 'Clojure ' 'C# ' 'LLVM IR ' 'HAML ' 'FXML ' 'DM ' 'Nushell ' 'R ' 'Racket ' 'DOT ' 'YAML ' 'Teal ' 'FSL ' 'INI ' 'Hare ' 'Templ ' 'Cuda ' 'GraphQL ' 'Bicep ' 'Pkl ' 'TypeSpec ' 'LALRPOP ' 'Snakemake ' 'OpenQASM ' 'Typst ' 'ZoKrates ' 'Chapel ' 'Slang ' 'Circom ' 'Proto ' 'wenyan ' 'Cangjie ' 'Clipper ' 'Slint '
919919
do
920920
if ./scc "examples/language/" | grep -q "$i "; then
921921
echo -e "${GREEN}PASSED $i Language Check"

0 commit comments

Comments
 (0)