diff --git a/Unix/cloc b/Unix/cloc index 403a6edb..58bb2eaa 100755 --- a/Unix/cloc +++ b/Unix/cloc @@ -8555,6 +8555,7 @@ sub set_constants { # {{{1 'ixx' => 'C++' , 'tcc' => 'C++' , 'tpp' => 'C++' , + 'cdc' => 'Cadence' , 'ccs' => 'CCS' , 'cfc' => 'ColdFusion CFScript' , 'cfml' => 'ColdFusion' , @@ -9659,17 +9660,17 @@ sub set_constants { # {{{1 [ 'rm_comments_in_strings', '"', '//', '' ], [ 'call_regexp_common' , 'C++' ], ], - 'Chapel' => [ + 'C++' => [ [ 'rm_comments_in_strings', '"', '/*', '*/' ], [ 'rm_comments_in_strings', '"', '//', '' ], [ 'call_regexp_common' , 'C++' ], ], - 'C++' => [ + 'C/C++ Header' => [ [ 'rm_comments_in_strings', '"', '/*', '*/' ], [ 'rm_comments_in_strings', '"', '//', '' ], [ 'call_regexp_common' , 'C++' ], ], - 'C/C++ Header' => [ + 'Cadence' => [ [ 'rm_comments_in_strings', '"', '/*', '*/' ], [ 'rm_comments_in_strings', '"', '//', '' ], [ 'call_regexp_common' , 'C++' ], @@ -9679,6 +9680,11 @@ sub set_constants { # {{{1 [ 'rm_comments_in_strings', '"', '//', '' ], [ 'call_regexp_common' , 'C++' ], ], + 'Chapel' => [ + [ 'rm_comments_in_strings', '"', '/*', '*/' ], + [ 'rm_comments_in_strings', '"', '//', '' ], + [ 'call_regexp_common' , 'C++' ], + ], 'Clean' => [ [ 'rm_comments_in_strings', '"', '/*', '*/' ], [ 'rm_comments_in_strings', '"', '//', '' ], @@ -10182,7 +10188,7 @@ sub set_constants { # {{{1 [ 'call_regexp_common' , 'C++' ], ], 'Java' => [ - [ 'docstring_rm_comments', ], + [ 'docstring_rm_comments', ], [ 'replace_regex', '\\\\$', ' '], # Java seems to have more path globs in strings # than other languages. The variations makes @@ -11408,7 +11414,6 @@ sub set_constants { # {{{1 'asa' => 1.29, 'ASP' => 1.29, 'ASP.NET' => 1.29, - 'CCS' => 5.33, 'Apex Trigger' => 1.4 , 'AppleScript' => 4.0 , 'Arduino Sketch' => 1.00, @@ -11429,13 +11434,14 @@ sub set_constants { # {{{1 'BrightScript' => 2.00, 'builder' => 2.00, 'C' => 0.77, - 'c set 2' => 0.88, 'C#' => 1.36, 'C# Designer' => 1.36, 'C# Generated' => 1.36, 'Cake Build Script' => 1.36, 'C++' => 1.51, + 'Cadence' => 3.00, 'Carbon' => 1.51, + 'CCS' => 5.33, 'ColdFusion' => 4.00, 'ColdFusion CFScript' => 4.00, 'Chapel' => 2.96, diff --git a/Unix/t/00_C.t b/Unix/t/00_C.t index f975198b..ecfbe2b3 100755 --- a/Unix/t/00_C.t +++ b/Unix/t/00_C.t @@ -224,6 +224,11 @@ my @Tests = ( 'ref' => '../tests/outputs/C++-uppercase.CPP.yaml', 'args' => '../tests/inputs/C++-uppercase.CPP', }, + { + 'name' => 'Cadence', + 'ref' => '../tests/outputs/cadence_test.cdc.yaml', + 'args' => '../tests/inputs/cadence_test.cdc', + }, { 'name' => 'Carbon', 'ref' => '../tests/outputs/variable_length.carbon.yaml', diff --git a/cloc b/cloc index 482a3f3d..c10ded53 100755 --- a/cloc +++ b/cloc @@ -8545,6 +8545,7 @@ sub set_constants { # {{{1 'ixx' => 'C++' , 'tcc' => 'C++' , 'tpp' => 'C++' , + 'cdc' => 'Cadence' , 'ccs' => 'CCS' , 'cfc' => 'ColdFusion CFScript' , 'cfml' => 'ColdFusion' , @@ -9649,17 +9650,17 @@ sub set_constants { # {{{1 [ 'rm_comments_in_strings', '"', '//', '' ], [ 'call_regexp_common' , 'C++' ], ], - 'Chapel' => [ + 'C++' => [ [ 'rm_comments_in_strings', '"', '/*', '*/' ], [ 'rm_comments_in_strings', '"', '//', '' ], [ 'call_regexp_common' , 'C++' ], ], - 'C++' => [ + 'C/C++ Header' => [ [ 'rm_comments_in_strings', '"', '/*', '*/' ], [ 'rm_comments_in_strings', '"', '//', '' ], [ 'call_regexp_common' , 'C++' ], ], - 'C/C++ Header' => [ + 'Cadence' => [ [ 'rm_comments_in_strings', '"', '/*', '*/' ], [ 'rm_comments_in_strings', '"', '//', '' ], [ 'call_regexp_common' , 'C++' ], @@ -9669,6 +9670,11 @@ sub set_constants { # {{{1 [ 'rm_comments_in_strings', '"', '//', '' ], [ 'call_regexp_common' , 'C++' ], ], + 'Chapel' => [ + [ 'rm_comments_in_strings', '"', '/*', '*/' ], + [ 'rm_comments_in_strings', '"', '//', '' ], + [ 'call_regexp_common' , 'C++' ], + ], 'Clean' => [ [ 'rm_comments_in_strings', '"', '/*', '*/' ], [ 'rm_comments_in_strings', '"', '//', '' ], @@ -10172,7 +10178,7 @@ sub set_constants { # {{{1 [ 'call_regexp_common' , 'C++' ], ], 'Java' => [ - [ 'docstring_rm_comments', ], + [ 'docstring_rm_comments', ], [ 'replace_regex', '\\\\$', ' '], # Java seems to have more path globs in strings # than other languages. The variations makes @@ -11398,7 +11404,6 @@ sub set_constants { # {{{1 'asa' => 1.29, 'ASP' => 1.29, 'ASP.NET' => 1.29, - 'CCS' => 5.33, 'Apex Trigger' => 1.4 , 'AppleScript' => 4.0 , 'Arduino Sketch' => 1.00, @@ -11419,13 +11424,14 @@ sub set_constants { # {{{1 'BrightScript' => 2.00, 'builder' => 2.00, 'C' => 0.77, - 'c set 2' => 0.88, 'C#' => 1.36, 'C# Designer' => 1.36, 'C# Generated' => 1.36, 'Cake Build Script' => 1.36, 'C++' => 1.51, + 'Cadence' => 3.00, 'Carbon' => 1.51, + 'CCS' => 5.33, 'ColdFusion' => 4.00, 'ColdFusion CFScript' => 4.00, 'Chapel' => 2.96, diff --git a/tests/inputs/cadence_test.cdc b/tests/inputs/cadence_test.cdc new file mode 100644 index 00000000..e83230c0 --- /dev/null +++ b/tests/inputs/cadence_test.cdc @@ -0,0 +1,45 @@ +/* https://cadence-lang.org/docs/testing-framework +*/ +// A `setup` function that always runs before the rest of the test cases. +// Can be used to initialize things that would be used across the test cases. +// e.g: initialling a blockchain backend, initializing a contract, etc. +access(all) +fun setup() { +} + +// The `beforeEach` function runs before each test case. Can be used to perform +// some state cleanup before each test case, among other things. +access(all) +fun beforeEach() { +} + +// The `afterEach` function runs after each test case. Can be used to perform +// some state cleanup after each test case, among other things. +access(all) +fun afterEach() { +} + +// Valid test functions start with the 'test' prefix. +access(all) +fun testSomething() { +} + +access(all) +fun testAnotherThing() { +} + +access(all) +fun testMoreThings() { +} + +// Test functions cannot have any arguments or return values. +access(all) +fun testInvalidSignature(message: String): Bool { +} + +// A `tearDown` function that always runs at the end of all test cases. +// e.g: Can be used to stop the blockchain back-end used for tests, etc. or any cleanup. +access(all) +fun tearDown() { +} + diff --git a/tests/outputs/cadence_test.cdc.yaml b/tests/outputs/cadence_test.cdc.yaml new file mode 100644 index 00000000..d8d0b359 --- /dev/null +++ b/tests/outputs/cadence_test.cdc.yaml @@ -0,0 +1,21 @@ +--- +# github.com/AlDanial/cloc +header : + cloc_url : github.com/AlDanial/cloc + cloc_version : 2.03 + elapsed_seconds : 0.00456786155700684 + n_files : 1 + n_lines : 45 + files_per_second : 218.920820502114 + lines_per_second : 9851.43692259512 + report_file : ../outputs/cadence_test.cdc.yaml +'Cadence' : + nFiles: 1 + blank: 8 + comment: 13 + code: 24 +SUM: + blank: 8 + comment: 13 + code: 24 + nFiles: 1