diff --git a/README.md b/README.md index 1da0fab01..61946ba60 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # Tokei ([時計](https://en.wiktionary.org/wiki/%E6%99%82%E8%A8%88)) + [![Mean Bean CI](https://github.com/XAMPPRocky/tokei/workflows/Mean%20Bean%20CI/badge.svg)](https://github.com/XAMPPRocky/tokei/actions?query=workflow%3A%22Mean+Bean+CI%22) [![Help Wanted](https://img.shields.io/github/issues/XAMPPRocky/tokei/help%20wanted?color=green)](https://github.com/XAMPPRocky/tokei/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) [![Lines Of Code](https://tokei.rs/b1/github/XAMPPRocky/tokei?category=code)](https://github.com/XAMPPRocky/tokei) @@ -6,17 +7,18 @@ ![](https://img.shields.io/crates/d/tokei?label=downloads%20%28crates.io%29) ![](https://img.shields.io/github/downloads/xampprocky/tokei/total?label=downloads%20%28GH%29) ![](https://img.shields.io/homebrew/installs/dy/tokei?color=brightgreen&label=downloads%20%28brew%29) -![Chocolatey Downloads](https://img.shields.io/chocolatey/dt/tokei?label=Downloads%20(Chocolately)) +![Chocolatey Downloads]() [![dependency status](https://deps.rs/repo/github/XAMPPRocky/tokei/status.svg)](https://deps.rs/repo/github/XAMPPRocky/tokei) [![Packaging status](https://repology.org/badge/tiny-repos/tokei.svg)](https://repology.org/project/tokei/versions) - Tokei is a program that displays statistics about your code. Tokei will show the number of files, total lines within those files and code, comments, and blanks grouped by language. ### Translations + - [中文](https://github.com/chinanf-boy/tokei-zh#支持的语言) ## Example + ```console ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Language Files Lines Code Comments Blanks @@ -46,8 +48,8 @@ Tokei is a program that displays statistics about your code. Tokei will show the - [Features](#features) - [Installation](#installation) - - [Package Managers](#package-managers) - - [Manual](#manual) + - [Package Managers](#package-managers) + - [Manual](#manual) - [Configuration](#configuration) - [How to use Tokei](#how-to-use-tokei) - [Options](#options) @@ -89,6 +91,7 @@ Tokei is a program that displays statistics about your code. Tokei will show the ### Package Managers #### Unix + ```console # Alpine Linux (since 3.13) apk add tokei @@ -113,6 +116,7 @@ sudo xbps-install tokei ``` #### macOS + ```console # Homebrew brew install tokei @@ -122,6 +126,7 @@ sudo port install tokei ``` #### Windows + ```console # Winget winget install XAMPPRocky.tokei @@ -132,18 +137,20 @@ scoop install tokei ### Manual #### Downloading + You can download prebuilt binaries in the [releases section](https://github.com/XAMPPRocky/tokei/releases). #### Building + You can also build and install from source (requires the latest stable [Rust] compiler.) + ```console cargo install --git https://github.com/XAMPPRocky/tokei.git tokei ``` [rust]: https://www.rust-lang.org - ## Configuration Tokei has a [configuration] file that allows you to change default behaviour. @@ -165,17 +172,20 @@ $ tokei ./foo [configuration]: ./tokei.example.toml #### Multiple folders + To have tokei report on multiple folders in the same call simply add a comma, or a space followed by another path. ```shell $ tokei ./foo ./bar ./baz ``` + ```shell $ tokei ./foo, ./bar, ./baz ``` #### Excluding folders + Tokei will respect all `.gitignore` and `.ignore` files, and you can use the `--exclude` option to exclude any additional files. The `--exclude` flag has the same semantics as `.gitignore`. @@ -188,6 +198,7 @@ Paths to exclude can also be listed in a `.tokeignore` file, using the same [syntax](https://git-scm.com/docs/gitignore) as .gitignore files. #### Sorting output + By default tokei sorts alphabetically by language name, however using `--sort` tokei can also sort by any of the columns. @@ -198,6 +209,7 @@ $ tokei ./foo --sort code ``` #### Outputting file statistics + By default tokei only outputs the total of the languages, and using `--files` flag tokei can also output individual file statistics. @@ -206,6 +218,7 @@ $ tokei ./foo --files ``` #### Outputting into different formats + Tokei normally outputs into a nice human readable format designed for terminals. There is also using the `--output` option various other formats that are more useful for bringing the data into another program. @@ -225,6 +238,7 @@ tokei with the features flag. ``` **Currently supported formats** + - JSON `--output json` - YAML `--output yaml` - CBOR `--output cbor` @@ -234,6 +248,7 @@ $ tokei ./foo --output json ``` #### Reading in stored formats + Tokei can also take in the outputted formats added in the previous results to its current run. Tokei can take either a path to a file, the format passed in as a value to the option, or from stdin. @@ -280,6 +295,7 @@ ARGS: ``` ## Badges + Tokei has support for badges. For example [![](https://tokei.rs/b1/github/XAMPPRocky/tokei)](https://github.com/XAMPPRocky/tokei). @@ -305,17 +321,21 @@ Example show total lines: The server code hosted on tokei.rs is in [XAMPPRocky/tokei_rs](https://github.com/XAMPPRocky/tokei_rs) ## Dockerized version + Tokei is available in a small `alpine`-based docker image, buildable through [earthly](https://github.com/earthly/earthly): + ```bash earthly +docker ``` Once built, one can run the image with: + ```bash docker run --rm -v /path/to/analyze:/src tokei . ``` Or, to simply analyze the current folder (linux): + ```bash docker run --rm -v $(pwd):/src tokei . ``` @@ -373,7 +393,7 @@ CSharp CShell Css Cuda -CUE +CUE Cython D D2 @@ -506,6 +526,7 @@ Rakefile Razor Renpy ReStructuredText +Roc RON RPMSpecfile Ruby @@ -578,6 +599,7 @@ Zsh ## Common issues ### Tokei says I have a lot of D code, but I know there is no D code! + This is likely due to `gcc` generating `.d` files. Until the D people decide on a different file extension, you can always exclude `.d` files using the `-e --exclude` flag like so @@ -587,6 +609,7 @@ $ tokei . -e *.d ``` ## Canonical Source + The canonical source of this repo is hosted on [GitHub](https://github.com/XAMPPRocky/tokei). If you have a GitHub account, please make your issues, and pull requests there. @@ -597,6 +620,7 @@ please make your issues, and pull requests there. interactive sunburst chart. ## Copyright and License + (C) Copyright 2015 by XAMPPRocky and contributors See [the graph](https://github.com/XAMPPRocky/tokei/graphs/contributors) for a full list of contributors. diff --git a/languages.json b/languages.json index 1e0506f13..4700e88da 100644 --- a/languages.json +++ b/languages.json @@ -53,7 +53,10 @@ "Asn1": { "name": "ASN.1", "line_comment": ["--"], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "multi_line_comments": [["/*", "*/"]], "extensions": ["asn1"] }, @@ -64,7 +67,10 @@ }, "AspNet": { "name": "ASP.NET", - "multi_line_comments": [[""], ["<%--", "-->"]], + "multi_line_comments": [ + [""], + ["<%--", "-->"] + ], "extensions": [ "asax", "ascx", @@ -77,7 +83,10 @@ }, "Assembly": { "line_comment": [";"], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "extensions": ["asm"] }, "AssemblyGAS": { @@ -89,20 +98,21 @@ }, "Astro": { "line_comment": ["//"], - "multi_line_comments": [["/*", "*/"], [""]], + "multi_line_comments": [ + ["/*", "*/"], + [""] + ], "extensions": ["astro"] }, "Ats": { "name": "ATS", "line_comment": ["//"], - "multi_line_comments": [["(*", "*)"], ["/*", "*/"]], + "multi_line_comments": [ + ["(*", "*)"], + ["/*", "*/"] + ], "quotes": [["\\\"", "\\\""]], - "extensions": [ - "dats", - "hats", - "sats", - "atxt" - ] + "extensions": ["dats", "hats", "sats", "atxt"] }, "Autoconf": { "line_comment": ["#", "dnl"], @@ -110,7 +120,10 @@ }, "Autoit": { "line_comment": [";"], - "multi_line_comments": [["#comments-start", "#comments-end"], ["#cs", "#ce"]], + "multi_line_comments": [ + ["#comments-start", "#comments-end"], + ["#cs", "#ce"] + ], "extensions": ["au3"] }, "AutoHotKey": { @@ -131,7 +144,10 @@ "name": "BASH", "shebangs": ["#!/bin/bash"], "line_comment": ["#"], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "env": ["bash"], "extensions": ["bash"] }, @@ -141,8 +157,14 @@ }, "Bazel": { "line_comment": ["#"], - "doc_quotes": [["\\\"\\\"\\\"", "\\\"\\\"\\\""], ["'''", "'''"]], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "doc_quotes": [ + ["\\\"\\\"\\\"", "\\\"\\\"\\\""], + ["'''", "'''"] + ], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "extensions": ["bzl", "bazel", "bzlmod"], "filenames": ["build", "workspace", "module"] }, @@ -151,16 +173,22 @@ "quotes": [["\\\"", "\\\""]], "extensions": ["bean", "beancount"] }, - "Bicep" : { + "Bicep": { "line_comment": ["//"], "multi_line_comments": [["/*", "*/"]], - "quotes": [["'", "'"], ["'''", "'''"]], + "quotes": [ + ["'", "'"], + ["'''", "'''"] + ], "extensions": ["bicep", "bicepparam"] }, "Bitbake": { "name": "Bitbake", "line_comment": ["#"], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "extensions": ["bb", "bbclass", "bbappend", "inc", "conf"] }, "BrightScript": { @@ -184,27 +212,45 @@ "line_comment": ["//"], "multi_line_comments": [["/*", "*/"]], "nested": true, - "quotes": [["\\\"", "\\\""],["\\\"\\\"\\\"", "\\\"\\\"\\\""]], - "verbatim_quotes": [["#\\\"", "\\\"#"],["##\\\"", "\\\"##"],["###\\\"", "\\\"###"], - ["#'", "'#"],["##'", "'##"],["###'", "'###"]], + "quotes": [ + ["\\\"", "\\\""], + ["\\\"\\\"\\\"", "\\\"\\\"\\\""] + ], + "verbatim_quotes": [ + ["#\\\"", "\\\"#"], + ["##\\\"", "\\\"##"], + ["###\\\"", "\\\"###"], + ["#'", "'#"], + ["##'", "'##"], + ["###'", "'###"] + ], "extensions": ["cj"] }, "Cassius": { "line_comment": ["//"], "multi_line_comments": [["/*", "*/"]], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "extensions": ["cassius"] }, "Ceylon": { "line_comment": ["//"], "multi_line_comments": [["/*", "*/"]], - "quotes": [["\\\"", "\\\""], ["\\\"\\\"\\\"", "\\\"\\\"\\\""]], + "quotes": [ + ["\\\"", "\\\""], + ["\\\"\\\"\\\"", "\\\"\\\"\\\""] + ], "extensions": ["ceylon"] }, "Chapel": { "line_comment": ["//"], "multi_line_comments": [["/*", "*/"]], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "extensions": ["chpl"] }, "CHeader": { @@ -260,7 +306,10 @@ "CoffeeScript": { "line_comment": ["#"], "multi_line_comments": [["###", "###"]], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "extensions": ["coffee", "cjsx"] }, "Cogent": { @@ -269,7 +318,10 @@ }, "ColdFusion": { "multi_line_comments": [[""]], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "extensions": ["cfm"] }, "ColdFusionScript": { @@ -302,7 +354,10 @@ "Crystal": { "line_comment": ["#"], "shebangs": ["#!/usr/bin/crystal"], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "env": ["crystal"], "extensions": ["cr"] }, @@ -325,7 +380,10 @@ "name": "CSS", "line_comment": ["//"], "multi_line_comments": [["/*", "*/"]], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "mime": ["text/css"], "extensions": ["css"] }, @@ -349,15 +407,24 @@ }, "Cython": { "line_comment": ["#"], - "doc_quotes": [["\\\"\\\"\\\"", "\\\"\\\"\\\""], ["'''", "'''"]], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "doc_quotes": [ + ["\\\"\\\"\\\"", "\\\"\\\"\\\""], + ["'''", "'''"] + ], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "env": ["cython"], "extensions": ["pyx", "pxd", "pxi"] }, "D": { "line_comment": ["//"], "multi_line_comments": [["/*", "*/"]], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "nested_comments": [["/+", "+/"]], "extensions": ["d"] }, @@ -391,18 +458,24 @@ "quotes": [["\\\"", "\\\""]], "extensions": ["dts", "dtsi"] }, - "Dhall":{ + "Dhall": { "nested": true, "line_comment": ["--"], "multi_line_comments": [["{-", "-}"]], - "quotes": [["\\\"", "\\\""], ["''", "''"]], + "quotes": [ + ["\\\"", "\\\""], + ["''", "''"] + ], "extensions": ["dhall"] }, "Dockerfile": { "line_comment": ["#"], "extensions": ["dockerfile", "dockerignore"], "filenames": ["dockerfile"], - "quotes": [["\\\"", "\\\""], ["'", "'"]] + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ] }, "DotNetResource": { "name": ".NET Resource", @@ -416,7 +489,11 @@ "multi_line_comments": [["/*", "*/"]], "nested": true, "extensions": ["dm", "dme"], - "quotes": [["\\\"", "\\\""], ["{\\\"", "\\\"}"], ["'", "'"]] + "quotes": [ + ["\\\"", "\\\""], + ["{\\\"", "\\\"}"], + ["'", "'"] + ] }, "Dust": { "name": "Dust.js", @@ -425,19 +502,29 @@ }, "Ebuild": { "line_comment": ["#"], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "extensions": ["ebuild", "eclass"] }, "EdgeQL": { "name": "EdgeQL", "line_comment": ["#"], - "quotes": [["'", "'"], ["\\\"", "\\\""], ["$", "$"]], + "quotes": [ + ["'", "'"], + ["\\\"", "\\\""], + ["$", "$"] + ], "extensions": ["edgeql"] }, "ESDL": { "name": "EdgeDB Schema Definition", "line_comment": ["#"], - "quotes": [["'", "'"], ["\\\"", "\\\""]], + "quotes": [ + ["'", "'"], + ["\\\"", "\\\""] + ], "extensions": ["esdl"] }, "Edn": { @@ -467,7 +554,10 @@ }, "Elvish": { "line_comment": ["#"], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "env": ["elvish"], "extensions": ["elv"] }, @@ -478,7 +568,11 @@ }, "Emojicode": { "line_comment": ["💭"], - "multi_line_comments": [["💭🔜", "🔚💭"], ["📗", "📗"], ["📘", "📘"]], + "multi_line_comments": [ + ["💭🔜", "🔚💭"], + ["📗", "📗"], + ["📘", "📘"] + ], "quotes": [["❌🔤", "❌🔤"]], "extensions": ["emojic", "🍇"] }, @@ -487,16 +581,16 @@ "extensions": ["erl", "hrl"] }, "Factor": { - "line_comment": ["!", "#!"], - "multi_line_comments": [["/*", "*/"]], - "extensions": ["factor"] + "line_comment": ["!", "#!"], + "multi_line_comments": [["/*", "*/"]], + "extensions": ["factor"] }, "FEN": { "name": "FEN", "blank": true, "extensions": ["fen"] }, - "Fennel" : { + "Fennel": { "line_comment": [";", ";;"], "quotes": [["\\\"", "\\\""]], "extensions": ["fnl"] @@ -504,7 +598,10 @@ "Fish": { "shebangs": ["#!/bin/fish"], "line_comment": ["#"], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "env": ["fish"], "extensions": ["fish"] }, @@ -540,7 +637,10 @@ "FortranLegacy": { "name": "FORTRAN Legacy", "line_comment": ["c", "C", "!", "*"], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "extensions": ["f", "for", "ftn", "f77", "pfo"] }, "FortranModern": { @@ -601,16 +701,30 @@ "GlimmerJs": { "name": "Glimmer JS", "line_comment": ["//"], - "multi_line_comments": [["/*", "*/"], [""]], - "quotes": [["\\\"", "\\\""], ["'", "'"], ["`", "`"]], + "multi_line_comments": [ + ["/*", "*/"], + [""] + ], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"], + ["`", "`"] + ], "important_syntax": [""]], - "quotes": [["\\\"", "\\\""], ["'", "'"], ["`", "`"]], + "multi_line_comments": [ + ["/*", "*/"], + [""] + ], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"], + ["`", "`"] + ], "important_syntax": [""], ["{{/*", "*/}}"]], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "multi_line_comments": [ + [""], + ["{{/*", "*/}}"] + ], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "extensions": ["gohtml"] }, "Graphql": { "name": "GraphQL", - "quotes": [["\\\"", "\\\""], ["\\\"\\\"\\\"", "\\\"\\\"\\\""]], + "quotes": [ + ["\\\"", "\\\""], + ["\\\"\\\"\\\"", "\\\"\\\"\\\""] + ], "line_comment": ["#"], "extensions": ["gql", "graphql"] }, @@ -660,20 +799,32 @@ }, "Haml": { "line_comment": ["-#"], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "extensions": ["haml"] }, "Hamlet": { "multi_line_comments": [[""]], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "extensions": ["hamlet"] }, "Happy": { "extensions": ["y", "ly"] }, "Handlebars": { - "multi_line_comments": [[""], ["{{!", "}}"]], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "multi_line_comments": [ + [""], + ["{{!", "}}"] + ], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "extensions": ["hbs", "handlebars"] }, "Haskell": { @@ -685,7 +836,10 @@ "Haxe": { "line_comment": ["//"], "multi_line_comments": [["/*", "*/"]], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "extensions": ["hx"] }, "Hcl": { @@ -722,12 +876,15 @@ "line_comment": ["//"], "multi_line_comments": [["/*", "*/"]], "quotes": [["\\\"", "\\\""]], - "extensions": ["HC", "hc","ZC","zc"] + "extensions": ["HC", "hc", "ZC", "zc"] }, "Html": { "name": "HTML", "multi_line_comments": [[""]], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "kind": "html", "important_syntax": [""], ["{% comment %}", "{% endcomment %}"]] + "multi_line_comments": [ + [""], + ["{% comment %}", "{% endcomment %}"] + ] }, "LinguaFranca": { "name": "Lingua Franca", @@ -960,12 +1172,18 @@ "LiveScript": { "line_comment": ["#"], "multi_line_comments": [["/*", "*/"]], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "extensions": ["ls"] }, "LLVM": { "line_comment": [";"], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "extensions": ["ll"] }, "Logtalk": { @@ -984,13 +1202,19 @@ "Lua": { "line_comment": ["--"], "multi_line_comments": [["--[[", "]]"]], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "extensions": ["lua", "luau"] }, "Lucius": { "line_comment": ["//"], "multi_line_comments": [["/*", "*/"]], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "extensions": ["lucius"] }, "M4": { @@ -1034,7 +1258,10 @@ }, "Meson": { "line_comment": ["#"], - "quotes": [["'", "'"], ["'''", "'''"]], + "quotes": [ + ["'", "'"], + ["'''", "'''"] + ], "filenames": ["meson.build", "meson_options.txt"] }, "Metal": { @@ -1078,18 +1305,27 @@ }, "MoonScript": { "line_comment": ["--"], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "extensions": ["moon"] }, "MsBuild": { "name": "MSBuild", "multi_line_comments": [[""]], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "extensions": ["csproj", "vbproj", "fsproj", "props", "targets"] }, "Mustache": { "multi_line_comments": [["{{!", "}}"]], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "extensions": ["mustache"] }, "Nextflow": { @@ -1100,7 +1336,10 @@ }, "Nim": { "line_comment": ["#"], - "quotes": [["\\\"", "\\\""], ["\\\"\\\"\\\"", "\\\"\\\"\\\""]], + "quotes": [ + ["\\\"", "\\\""], + ["\\\"\\\"\\\"", "\\\"\\\"\\\""] + ], "extensions": ["nim"] }, "Nix": { @@ -1113,13 +1352,19 @@ "name": "Not Quite Perl", "line_comment": ["#"], "multi_line_comments": [["=begin", "=end"]], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "extensions": ["nqp"] }, "NuGetConfig": { "name": "NuGet Config", "multi_line_comments": [[""]], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "filenames": ["nuget.config", "packages.config", "nugetdefaults.config"] }, "Nushell": { @@ -1153,19 +1398,28 @@ "extensions": ["odin"], "line_comment": ["//"], "multi_line_comments": [["/*", "*/"]], - "quotes": [["\\\"", "\\\""], ["'", "'"]] + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ] }, "OpenScad": { "name": "OpenSCAD", "extensions": ["scad"], "line_comment": ["//"], "multi_line_comments": [["/*", "*/"]], - "quotes": [["\\\"", "\\\""], ["'", "'"]] + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ] }, "OpenPolicyAgent": { "name": "Open Policy Agent", "line_comment": ["#"], - "quotes": [["\\\"","\\\""], ["`", "`"]], + "quotes": [ + ["\\\"", "\\\""], + ["`", "`"] + ], "extensions": ["rego"] }, "OpenCL": { @@ -1197,18 +1451,27 @@ "PacmanMakepkg": { "name": "Pacman's makepkg", "line_comment": ["#"], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "filenames": ["pkgbuild"] }, "Pan": { "line_comment": ["#"], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "extensions": ["pan", "tpl"] }, "Pascal": { "nested": true, "line_comment": ["//"], - "multi_line_comments": [["{", "}"], ["(*", "*)"]], + "multi_line_comments": [ + ["{", "}"], + ["(*", "*)"] + ], "quotes": [["'", "'"]], "extensions": ["pas"] }, @@ -1216,19 +1479,28 @@ "shebangs": ["#!/usr/bin/perl"], "line_comment": ["#"], "multi_line_comments": [["=pod", "=cut"]], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "extensions": ["pl", "pm"] }, "Pest": { "line_comment": ["//"], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "extensions": ["pest"] }, "Php": { "name": "PHP", "line_comment": ["#", "//"], "multi_line_comments": [["/*", "*/"]], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "extensions": ["php"] }, "PlantUml": { @@ -1239,9 +1511,9 @@ "extensions": ["puml"] }, "Po": { - "name": "PO File", - "line_comment": ["#"], - "extensions": ["po", "pot"] + "name": "PO File", + "line_comment": ["#"], + "extensions": ["po", "pot"] }, "Poke": { "multi_line_comments": [["/*", "*/"]], @@ -1249,7 +1521,10 @@ }, "Polly": { "multi_line_comments": [[""]], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "extensions": ["polly"] }, "Pony": { @@ -1263,7 +1538,10 @@ "name": "PostCSS", "line_comment": ["//"], "multi_line_comments": [["/*", "*/"]], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "extensions": ["pcss", "sss"] }, "PowerShell": { @@ -1301,7 +1579,7 @@ "line_comment": ["//"], "extensions": ["proto"] }, - "Pug" : { + "Pug": { "line_comment": ["//", "//-"], "quotes": [ ["#{\\\"", "\\\"}"], @@ -1312,7 +1590,10 @@ }, "Puppet": { "line_comment": ["#"], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "extensions": ["pp"] }, "PureScript": { @@ -1323,15 +1604,24 @@ }, "Python": { "line_comment": ["#"], - "doc_quotes": [["\\\"\\\"\\\"", "\\\"\\\"\\\""], ["'''", "'''"]], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "doc_quotes": [ + ["\\\"\\\"\\\"", "\\\"\\\"\\\""], + ["'''", "'''"] + ], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "env": ["python", "python2", "python3"], "mime": ["text/x-python"], "extensions": ["py", "pyw", "pyi"] }, "PRQL": { "line_comment": ["#"], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "mime": ["application/prql"], "extensions": ["prql"] }, @@ -1353,7 +1643,10 @@ "name": "QML", "line_comment": ["//"], "multi_line_comments": [["/*", "*/"]], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "extensions": ["qml"] }, "R": { @@ -1370,7 +1663,10 @@ "Rakefile": { "line_comment": ["#"], "multi_line_comments": [["=begin", "=end"]], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "filenames": ["rakefile"], "extensions": ["rake"] }, @@ -1384,7 +1680,10 @@ ["#`「", "」"] ], "nested": true, - "quotes": [["\\\"", "\\\""] , ["'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "verbatim_quotes": [["「", "」"]], "doc_quotes": [ ["#|{", "}"], @@ -1413,7 +1712,11 @@ }, "Razor": { "line_comment": ["//"], - "multi_line_comments": [[""], ["@*", "*@"], ["/*", "*/"]], + "multi_line_comments": [ + [""], + ["@*", "*@"], + ["/*", "*/"] + ], "quotes": [["\\\"", "\\\""]], "verbatim_quotes": [["@\\\"", "\\\""]], "extensions": ["cshtml", "razor"] @@ -1429,7 +1732,11 @@ "Renpy": { "name": "Ren'Py", "line_comment": ["#"], - "quotes": [["\\\"", "\\\""], ["'", "'"], ["`", "`"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"], + ["`", "`"] + ], "extensions": ["rpy"] }, "ReScript": { @@ -1442,6 +1749,15 @@ "blank": true, "extensions": ["rst"] }, + "Roc": { + "line_comment": ["#"], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], + "doc_quotes": [["\\\"\\\"\\\"", "\\\"\\\"\\\""]], + "extensions": ["roc"] + }, "RON": { "name": "Rusty Object Notation", "line_comment": ["//"], @@ -1458,7 +1774,10 @@ "Ruby": { "line_comment": ["#"], "multi_line_comments": [["=begin", "=end"]], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "env": ["ruby"], "extensions": ["rb"] }, @@ -1466,7 +1785,10 @@ "name": "Ruby HTML", "multi_line_comments": [[""]], "important_syntax": [""], ["${", "}"]], + "quotes": [ + ["\\\"", "\\\""], + ["$[", "]"], + ["$<", ">"], + ["${", "}"] + ], "extensions": ["str"] }, "Stylus": { "line_comment": ["//"], "multi_line_comments": [["/*", "*/"]], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "extensions": ["styl"] }, "Svelte": { "multi_line_comments": [[""]], "important_syntax": [""]], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "mime": ["image/svg+xml"], "extensions": ["svg"] }, @@ -1651,12 +2008,21 @@ "Tcl": { "name": "TCL", "line_comment": ["#"], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "extensions": ["tcl"] }, "Tera": { - "multi_line_comments": [[""], ["{#", "#}"]], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "multi_line_comments": [ + [""], + ["{#", "#}"] + ], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "extensions": ["tera"] }, "Tex": { @@ -1673,7 +2039,10 @@ "Thrift": { "line_comment": ["#", "//"], "multi_line_comments": [["/*", "*/"]], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "extensions": ["thrift"] }, "Toml": { @@ -1691,7 +2060,11 @@ "name": "TSX", "line_comment": ["//"], "multi_line_comments": [["/*", "*/"]], - "quotes": [["\\\"", "\\\""], ["'", "'"], ["`", "`"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"], + ["`", "`"] + ], "extensions": ["tsx"] }, "Ttcn": { @@ -1703,14 +2076,24 @@ }, "Twig": { "name": "Twig", - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "extensions": ["twig"], - "multi_line_comments": [[""], ["{#", "#}"]] + "multi_line_comments": [ + [""], + ["{#", "#}"] + ] }, "TypeScript": { "line_comment": ["//"], "multi_line_comments": [["/*", "*/"]], - "quotes": [["\\\"", "\\\""], ["'", "'"], ["`", "`"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"], + ["`", "`"] + ], "extensions": ["ts", "mts", "cts"] }, "Typst": { @@ -1800,7 +2183,10 @@ "line_comment": ["##"], "multi_line_comments": [["#*", "*#"]], "extensions": ["vm"], - "quotes": [["'", "'"], ["\\\"", "\\\""]] + "quotes": [ + ["'", "'"], + ["\\\"", "\\\""] + ] }, "Verilog": { "line_comment": ["//"], @@ -1827,7 +2213,10 @@ "VisualStudioProject": { "name": "Visual Studio Project", "multi_line_comments": [[""]], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "extensions": ["vcproj", "vcxproj"] }, "VisualStudioSolution": { @@ -1838,26 +2227,42 @@ "VimScript": { "name": "Vim Script", "line_comment": ["\\\""], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "extensions": ["vim"] }, "Vue": { "name": "Vue", "line_comment": ["//"], - "multi_line_comments": [[""], ["/*", "*/"]], - "quotes": [["\\\"", "\\\""], ["'", "'"], ["`", "`"]], + "multi_line_comments": [ + [""], + ["/*", "*/"] + ], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"], + ["`", "`"] + ], "important_syntax": [""]], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "extensions": ["xaml"] }, "XcodeConfig": { "name": "Xcode Config", "line_comment": ["//"], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "extensions": ["xcconfig"] }, "Xml": { "name": "XML", "multi_line_comments": [[""]], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "extensions": ["xml"] }, "XSL": { "name": "XSL", "multi_line_comments": [[""]], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "extensions": ["xsl", "xslt"] }, "Xtend": { "line_comment": ["//"], "multi_line_comments": [["/*", "*/"]], - "quotes": [["\\\"", "\\\""], ["'", "'"], ["'''", "'''"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"], + ["'''", "'''"] + ], "extensions": ["xtend"] }, "Yaml": { "name": "YAML", "line_comment": ["#"], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "extensions": ["yaml", "yml"] }, "ZenCode": { "line_comment": ["//", "#"], "multi_line_comments": [["/*", "*/"]], - "quotes": [["\\\"", "\\\""], ["'", "'"]], - "verbatim_quotes": [["@\\\"", "\\\""], ["@'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], + "verbatim_quotes": [ + ["@\\\"", "\\\""], + ["@'", "'"] + ], "extensions": ["zs"] }, "Zig": { @@ -1926,7 +2356,10 @@ "Zsh": { "shebangs": ["#!/bin/zsh"], "line_comment": ["#"], - "quotes": [["\\\"", "\\\""], ["'", "'"]], + "quotes": [ + ["\\\"", "\\\""], + ["'", "'"] + ], "extensions": ["zsh"] }, "GdShader": { diff --git a/tests/data/Roc.roc b/tests/data/Roc.roc new file mode 100644 index 000000000..ab38a6827 --- /dev/null +++ b/tests/data/Roc.roc @@ -0,0 +1,36 @@ +# 36 lines 18 code 10 comments 8 blanks +module [square] +# this is a comment +# this is another comment + +a1 = 1 +a2 = 3.14159 # pi + +expect + # simple check + a1 == 1 + +expect + a2 |> Num.toStr == "3.14159" + +## Compute the square +square = \x -> + s = x * x + + # the line above is blank + s + +expect square 3 == 9 + +## """ +## this is not a multiline string, +## it's a doc comment +## """ +multilineString = + """ + # this line is not a comment, it's actually code + + The line above is not blank, it's actually code + """ + +expect multilineString |> Str.toUtf8 |> List.first == Ok '#'