Skip to content

Commit

Permalink
add support for Nickel, #812
Browse files Browse the repository at this point in the history
  • Loading branch information
AlDanial committed Feb 24, 2024
1 parent c9b0bf3 commit d9ac9b5
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 2 deletions.
8 changes: 7 additions & 1 deletion Unix/cloc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
# <http://www.gnu.org/licenses/gpl.txt>.
#
# 1}}}
my $VERSION = "2.00"; # odd number == beta; even number == stable
my $VERSION = "2.01"; # odd number == beta; even number == stable
my $URL = "github.com/AlDanial/cloc"; # 'https://' pushes header too wide
require 5.10.0;
# use modules {{{1
Expand Down Expand Up @@ -8653,6 +8653,7 @@ sub set_constants { # {{{1
'n' => 'Nemerle' ,
'nlogo' => 'NetLogo' ,
'nls' => 'NetLogo' ,
'ncl' => 'Nickel' ,
'nims' => 'Nim' ,
'nimrod' => 'Nim' ,
'nimble' => 'Nim' ,
Expand Down Expand Up @@ -10074,6 +10075,10 @@ sub set_constants { # {{{1
'Mustache' => [
[ 'remove_between_general', '{{!', '}}' ],
],
'Nickel' => [
[ 'remove_matches' , '^\s*#' ],
[ 'remove_inline' , '#.*$' ],
],
'Nim' => [
[ 'remove_between_general', '#[', ']#' ],
[ 'remove_matches' , '^\s*#' ],
Expand Down Expand Up @@ -11230,6 +11235,7 @@ sub set_constants { # {{{1
'Nastran' => 1.13,
'Nemerle' => 2.50,
'NetLogo' => 4.00,
'Nickel' => 2.00,
'Nim' => 2.00,
'Nix' => 2.70,
'Nunjucks' => 1.5 ,
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 @@ -746,6 +746,11 @@ my @Tests = (
'ref' => '../tests/outputs/vinos.nlogo.yaml',
'args' => '../tests/inputs/vinos.nlogo',
},
{
'name' => 'Nickel',
'ref' => '../tests/outputs/fibonacci.ncl.yaml',
'args' => '../tests/inputs/fibonacci.ncl',
},
{
'name' => 'Nim',
'ref' => '../tests/outputs/statcsv.nim.yaml',
Expand Down
8 changes: 7 additions & 1 deletion cloc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
# <http://www.gnu.org/licenses/gpl.txt>.
#
# 1}}}
my $VERSION = "2.00"; # odd number == beta; even number == stable
my $VERSION = "2.01"; # odd number == beta; even number == stable
my $URL = "github.com/AlDanial/cloc"; # 'https://' pushes header too wide
require 5.10.0;
# use modules {{{1
Expand Down Expand Up @@ -8668,6 +8668,7 @@ sub set_constants { # {{{1
'n' => 'Nemerle' ,
'nlogo' => 'NetLogo' ,
'nls' => 'NetLogo' ,
'ncl' => 'Nickel' ,
'nims' => 'Nim' ,
'nimrod' => 'Nim' ,
'nimble' => 'Nim' ,
Expand Down Expand Up @@ -10089,6 +10090,10 @@ sub set_constants { # {{{1
'Mustache' => [
[ 'remove_between_general', '{{!', '}}' ],
],
'Nickel' => [
[ 'remove_matches' , '^\s*#' ],
[ 'remove_inline' , '#.*$' ],
],
'Nim' => [
[ 'remove_between_general', '#[', ']#' ],
[ 'remove_matches' , '^\s*#' ],
Expand Down Expand Up @@ -11245,6 +11250,7 @@ sub set_constants { # {{{1
'Nastran' => 1.13,
'Nemerle' => 2.50,
'NetLogo' => 4.00,
'Nickel' => 2.00,
'Nim' => 2.00,
'Nix' => 2.70,
'Nunjucks' => 1.5 ,
Expand Down
14 changes: 14 additions & 0 deletions tests/inputs/fibonacci.ncl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# https://raw.githubusercontent.com/tweag/nickel/master/examples/fibonacci/fibonacci.ncl
# test = 'pass'

# This is the naive, exponential version of fibonacci: don't call it on a big
# value!
let rec fibonacci = fun n =>
if n == 0 then
0
else if n == 1 then
1
else
fibonacci (n - 1) + fibonacci (n - 2)
in
fibonacci 10
21 changes: 21 additions & 0 deletions tests/outputs/fibonacci.ncl.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 : 2.01
elapsed_seconds : 0.00243306159973145
n_files : 1
n_lines : 14
files_per_second : 411.004801567859
lines_per_second : 5754.06722195002
report_file : ../outputs/fibonacci.ncl.yaml
'Nickel' :
nFiles: 1
blank: 1
comment: 4
code: 9
SUM:
blank: 1
comment: 4
code: 9
nFiles: 1

0 comments on commit d9ac9b5

Please sign in to comment.