Skip to content

Commit

Permalink
add support for TOML, issue AlDanial#211
Browse files Browse the repository at this point in the history
  • Loading branch information
AlDanial committed Aug 11, 2017
1 parent d2ea188 commit 994bfca
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 9 deletions.
5 changes: 5 additions & 0 deletions Unix/t/00_C.t
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,11 @@ my @Tests = (
'ref' => '../tests/outputs/LaTeX.tex.yaml',
'args' => '../tests/inputs/LaTeX.tex',
},
{
'name' => 'TOML',
'ref' => '../tests/outputs/toml_example.toml.yaml',
'args' => '../tests/inputs/toml_example.toml',
},
{
'name' => 'TTCN',
'ref' => '../tests/outputs/clusterConf.ttcn.yaml',
Expand Down
17 changes: 8 additions & 9 deletions cloc
Original file line number Diff line number Diff line change
Expand Up @@ -5910,6 +5910,7 @@ sub set_constants { # {{{1
'tcsh' => 'C Shell' ,
'tk' => 'Tcl/Tk' ,
'tex' => 'TeX' , # TeX, LaTex, MikTex, ..
'toml' => 'TOML' ,
'sty' => 'TeX' ,
# 'cls' => 'TeX' ,
'dtx' => 'TeX' ,
Expand Down Expand Up @@ -6800,8 +6801,9 @@ sub set_constants { # {{{1
[ 'remove_inline' , '//.*$' ],
[ 'remove_between_regex', '/[^/]', '[^/]/' ],
],
'Twig' => [
[ 'remove_between_general', '{#', '#}' ],
'TOML' => [
[ 'remove_matches' , '^\s*#' ],
[ 'remove_inline' , '#.*$' ],
],
'TTCN' => [
[ 'call_regexp_common' , 'C++' ],
Expand All @@ -6811,6 +6813,9 @@ sub set_constants { # {{{1
[ 'remove_html_comments', ],
[ 'call_regexp_common' , 'HTML' ],
],
'Twig' => [
[ 'remove_between_general', '{#', '#}' ],
],
'TypeScript' => [
# [ 'remove_matches' , '^\s*//' ],
[ 'remove_inline' , '//.*$' ],
Expand Down Expand Up @@ -7714,21 +7719,15 @@ sub set_constants { # {{{1
'telon' => 5.00,
'tessaract' => 2.00,
'the twin' => 13.33,
'themis' => 6.15,
'tiief' => 5.71,
'Titanium Style Sheet' => 2.00,
'topspeed c++' => 2.76,
'TOML' => 2.76,
'transform' => 5.33,
'translisp plus' => 1.43,
'treet' => 1.25,
'treetran' => 1.25,
'trs80 basic' => 0.63,
'true basic' => 1.25,
'turbo c' => 0.63,
'turbo expert' => 1.63,
'turbo pascal >5' => 1.63,
'turbo pascal 14' => 1.00,
'turbo pascal 45' => 1.13,
'turing' => 1.00,
'tutor' => 1.51,
'twaice' => 1.63,
Expand Down
34 changes: 34 additions & 0 deletions tests/inputs/toml_example.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# https://github.com/toml-lang/toml#example
# This is a TOML document.

title = "TOML Example"

[owner]
name = "Tom Preston-Werner"
dob = 1979-05-27T07:32:00-08:00 # First class dates

[database]
server = "192.168.1.1"
ports = [ 8001, 8001, 8002 ]
connection_max = 5000
enabled = true

[servers]

# Indentation (tabs and/or spaces) is allowed but not required
[servers.alpha]
ip = "10.0.0.1"
dc = "eqdc10"

[servers.beta]
ip = "10.0.0.2"
dc = "eqdc10"

[clients]
data = [ ["gamma", "delta"], [1, 2] ]

# Line breaks are OK when inside arrays
hosts = [
"alpha",
"omega"
]
21 changes: 21 additions & 0 deletions tests/outputs/toml_example.toml.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.73
elapsed_seconds : 0.00557589530944824
n_files : 1
n_lines : 34
files_per_second : 179.343395903707
lines_per_second : 6097.67546072604
report_file : ../outputs/toml_example.toml.yaml
TOML :
nFiles: 1
blank: 8
comment: 4
code: 22
SUM:
blank: 8
comment: 4
code: 22
nFiles: 1

0 comments on commit 994bfca

Please sign in to comment.