Skip to content

Commit

Permalink
add support for HarmonyOS app language ArkTs, #795
Browse files Browse the repository at this point in the history
  • Loading branch information
AlDanial committed Nov 23, 2023
1 parent ae0426a commit a4d7a6a
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Unix/cloc
Original file line number Diff line number Diff line change
Expand Up @@ -8279,6 +8279,7 @@ sub set_constants { # {{{1
'ejs' => 'EJS' ,
'erb' => 'ERB' ,
'ERB' => 'ERB' ,
'ets' => 'ArkTs' , # OpenHarmonyOS app language
'yrl' => 'Erlang' ,
'xrl' => 'Erlang' ,
'rebar.lock' => 'Erlang' ,
Expand Down Expand Up @@ -9185,6 +9186,11 @@ sub set_constants { # {{{1
[ 'rm_comments_in_strings', '"', '//', '' ],
[ 'call_regexp_common' , 'C++' ],
],
'ArkTs' => [
[ 'rm_comments_in_strings', '"', '/*', '*/' ],
[ 'rm_comments_in_strings', '"', '//', '' ],
[ 'call_regexp_common' , 'C++' ],
],
'AsciiDoc' => [
[ 'remove_between_general', '////', '////' ],
[ 'remove_matches' , '^\s*\/\/' ],
Expand Down Expand Up @@ -10924,6 +10930,7 @@ sub set_constants { # {{{1
'SQL Data' => 1.00,
'Apex Class' => 1.50,
'APL' => 2.50,
'ArkTs' => 2.50,
'AsciiDoc' => 1.50,
'AspectJ' => 1.36,
'asa' => 1.29,
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 @@ -39,6 +39,11 @@ my @Tests = (
'ref' => '../tests/outputs/send_msg.applescript.yaml',
'args' => '../tests/inputs/send_msg.applescript',
},
{
'name' => 'ArkTs',
'ref' => '../tests/outputs/openharmony.ets.yaml',
'args' => '../tests/inputs/openharmony.ets',
},
{
'name' => 'AsciiDoc',
'ref' => '../tests/outputs/asciidoctor.adoc.yaml',
Expand Down
7 changes: 7 additions & 0 deletions cloc
Original file line number Diff line number Diff line change
Expand Up @@ -8294,6 +8294,7 @@ sub set_constants { # {{{1
'ejs' => 'EJS' ,
'erb' => 'ERB' ,
'ERB' => 'ERB' ,
'ets' => 'ArkTs' , # OpenHarmonyOS app language
'yrl' => 'Erlang' ,
'xrl' => 'Erlang' ,
'rebar.lock' => 'Erlang' ,
Expand Down Expand Up @@ -9200,6 +9201,11 @@ sub set_constants { # {{{1
[ 'rm_comments_in_strings', '"', '//', '' ],
[ 'call_regexp_common' , 'C++' ],
],
'ArkTs' => [
[ 'rm_comments_in_strings', '"', '/*', '*/' ],
[ 'rm_comments_in_strings', '"', '//', '' ],
[ 'call_regexp_common' , 'C++' ],
],
'AsciiDoc' => [
[ 'remove_between_general', '////', '////' ],
[ 'remove_matches' , '^\s*\/\/' ],
Expand Down Expand Up @@ -10939,6 +10945,7 @@ sub set_constants { # {{{1
'SQL Data' => 1.00,
'Apex Class' => 1.50,
'APL' => 2.50,
'ArkTs' => 2.50,
'AsciiDoc' => 1.50,
'AspectJ' => 1.36,
'asa' => 1.29,
Expand Down
21 changes: 21 additions & 0 deletions tests/inputs/openharmony.ets
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// https://github.com/openharmony/docs/blob/master/en/application-dev/quick-start/start-with-ets.md
// index.ets
@Entry
@Component
struct Index {
@State message: string = 'Hello World'

build() {
Row() {
/*
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
*/
}
.height('100%')
}
}
21 changes: 21 additions & 0 deletions tests/outputs/openharmony.ets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
# github.com/AlDanial/cloc
header :
cloc_url : github.com/AlDanial/cloc
cloc_version : 1.99
elapsed_seconds : 0.00846600532531738
n_files : 1
n_lines : 21
files_per_second : 118.119462671435
lines_per_second : 2480.50871610014
report_file : ../outputs/openharmony.ets.yaml
'ArkTs' :
nFiles: 1
blank: 1
comment: 10
code: 10
SUM:
blank: 1
comment: 10
code: 10
nFiles: 1

0 comments on commit a4d7a6a

Please sign in to comment.