Skip to content

Commit ea9dffe

Browse files
authored
Merge pull request #943 from huth-stacks/feat/clarity-support
Add Clarity language support
2 parents c96208a + 868fd9b commit ea9dffe

File tree

5 files changed

+64
-0
lines changed

5 files changed

+64
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,6 +1086,8 @@ Carbon (carbon)
10861086
CCS (ccs)
10871087
Chapel (chpl)
10881088
Circom (circom)
1089+
Civet (civet, cvt, cvtx)
1090+
Clarity (clar)
10891091
Clean (dcl, icl)
10901092
Clojure (boot, cl2, clj, cljs.hl, cljscm, cljx, hic, riemann.config)
10911093
ClojureC (cljc)

Unix/t/00_C.t

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1196,6 +1196,11 @@ my @Tests = (
11961196
'ref' => '../tests/outputs/scheme.sls.yaml',
11971197
'args' => '../tests/inputs/scheme.sls',
11981198
},
1199+
{
1200+
'name' => 'Clarity',
1201+
'ref' => '../tests/outputs/clarityfiles.clar.yaml',
1202+
'args' => '../tests/inputs/clarityfiles.clar',
1203+
},
11991204
{
12001205
'name' => 'SKILL',
12011206
'ref' => '../tests/outputs/ChangeProperties.il.yaml',

cloc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9414,6 +9414,7 @@ sub set_constants { # {{{1
94149414
'rhtml' => 'Ruby HTML' ,
94159415
'circom' => 'Circom' ,
94169416
'cairo' => 'Cairo' ,
9417+
'clar' => 'Clarity' ,
94179418
'rs.in' => 'Rust' ,
94189419
'rs' => 'Rust' ,
94199420
'rst.txt' => 'reStructuredText' ,
@@ -11157,6 +11158,10 @@ sub set_constants { # {{{1
1115711158
[ 'remove_matches' , '^\s*#' ],
1115811159
[ 'call_regexp_common' , 'C++' ],
1115911160
],
11161+
'Clarity' => [
11162+
[ 'remove_matches' , '^\s*;;' ],
11163+
[ 'remove_inline' , ';;.*$' ],
11164+
],
1116011165
'Rust' => [
1116111166
[ 'rm_comments_in_strings', '"', '/*', '*/' ],
1116211167
[ 'rm_comments_in_strings', '"', '//', '' ],
@@ -12165,6 +12170,7 @@ sub set_constants { # {{{1
1216512170
'RobotFramework' => 2.50,
1216612171
'Circom' => 1.00,
1216712172
'Cairo' => 1.00,
12173+
'Clarity' => 1.47,
1216812174
'Rust' => 1.00,
1216912175
'sas' => 1.95,
1217012176
'Scala' => 4.10,

tests/inputs/clarityfiles.clar

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
;; Test fixture for Clarity language
2+
;; This file covers various comment and code patterns
3+
4+
(define-constant TEST_CONSTANT u100)
5+
6+
;; Full line comment before code
7+
(define-read-only (test-function (param uint))
8+
(ok param)
9+
)
10+
11+
;; Another comment
12+
(define-map test-map
13+
uint
14+
bool
15+
)
16+
17+
(define-public (public-function)
18+
;; Inline comment in function
19+
(begin
20+
;; Nested comment
21+
(ok true)
22+
)
23+
)
24+
25+
;; Trailing comment on code line
26+
(define-data-var counter uint u0) ;; end of line comment
27+
28+
;; Multiple blank lines above
29+
30+
(define-constant ANOTHER_CONSTANT u200)
31+
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
# github.com/AlDanial/cloc
3+
header :
4+
cloc_url : github.com/AlDanial/cloc
5+
cloc_version : 2.07
6+
elapsed_seconds : 0.00625514984130859
7+
n_files : 1
8+
n_lines : 31
9+
files_per_second : 159.868272602531
10+
lines_per_second : 4955.91645067846
11+
'Clarity' :
12+
nFiles: 1
13+
blank: 8
14+
comment: 8
15+
code: 15
16+
SUM:
17+
blank: 8
18+
comment: 8
19+
code: 15
20+
nFiles: 1

0 commit comments

Comments
 (0)