diff --git a/.envrc b/.envrc index 3bc1085..01fa47e 100644 --- a/.envrc +++ b/.envrc @@ -1,3 +1,23 @@ +# Copyright (C) 2024 - 2024: +# The Trinitrix Project +# SPDX-License-Identifier: LGPL-3.0-or-later +# +# This file is part of the Trinitry crate for Trinitrix. +# +# Trinitry is free software: you can redistribute it and/or modify +# it under the terms of the Lesser GNU General Public License as +# published by the Free Software Foundation, either version 3 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# and the Lesser GNU General Public License along with this program. +# If not, see . + use flake || use nix watch_file flake.nix diff --git a/.gitignore b/.gitignore index ac4fcba..f6e00b2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,23 @@ +# Copyright (C) 2024 - 2024: +# The Trinitrix Project +# SPDX-License-Identifier: LGPL-3.0-or-later +# +# This file is part of the Trinitry crate for Trinitrix. +# +# Trinitry is free software: you can redistribute it and/or modify +# it under the terms of the Lesser GNU General Public License as +# published by the Free Software Foundation, either version 3 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# and the Lesser GNU General Public License along with this program. +# If not, see . + # build /target /result diff --git a/.licensure.yml b/.licensure.yml index b2722f1..b1e58f1 100644 --- a/.licensure.yml +++ b/.licensure.yml @@ -1,3 +1,23 @@ +# Copyright (C) 2024 - 2024: +# The Trinitrix Project +# SPDX-License-Identifier: LGPL-3.0-or-later +# +# This file is part of the Trinitry crate for Trinitrix. +# +# Trinitry is free software: you can redistribute it and/or modify +# it under the terms of the Lesser GNU General Public License as +# published by the Free Software Foundation, either version 3 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# and the Lesser GNU General Public License along with this program. +# If not, see . + --- # Regexes which if matched by a file path will always be excluded from # getting a license header diff --git a/Cargo.toml b/Cargo.toml index c322ad1..238f1bc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,3 +1,23 @@ +# Copyright (C) 2024 - 2024: +# The Trinitrix Project +# SPDX-License-Identifier: LGPL-3.0-or-later +# +# This file is part of the Trinitry crate for Trinitrix. +# +# Trinitry is free software: you can redistribute it and/or modify +# it under the terms of the Lesser GNU General Public License as +# published by the Free Software Foundation, either version 3 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# and the Lesser GNU General Public License along with this program. +# If not, see . + [package] name = "trinitry" description = "A very simple programming language, used to map functions to commands" @@ -8,8 +28,8 @@ edition = "2021" [dependencies] pest = "2.7.5" -pest_derive = {version = "2.7.5", features = ["grammar-extras"]} +pest_derive = { version = "2.7.5", features = ["grammar-extras"] } # The header imports katex, a js latex parser, into the doc comments [package.metadata.docs.rs] -rustdoc-args = [ "--html-in-header", "./docs/docs-header.html" ] +rustdoc-args = ["--html-in-header", "./docs/docs-header.html"] diff --git a/README.md b/README.md index 0b7cad6..05e5773 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,25 @@ + + # Trinitry > A very simple programming language, used to map functions to commands diff --git a/cog.toml b/cog.toml index 6bc1795..9c8c37d 100644 --- a/cog.toml +++ b/cog.toml @@ -1,3 +1,23 @@ +# Copyright (C) 2024 - 2024: +# The Trinitrix Project +# SPDX-License-Identifier: LGPL-3.0-or-later +# +# This file is part of the Trinitry crate for Trinitrix. +# +# Trinitry is free software: you can redistribute it and/or modify +# it under the terms of the Lesser GNU General Public License as +# published by the Free Software Foundation, either version 3 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# and the Lesser GNU General Public License along with this program. +# If not, see . + tag_prefix = "v" branch_whitelist = ["main", "prime"] ignore_merge_commits = false diff --git a/docs/docs-header.html b/docs/docs-header.html index ba16ddc..ae34e2d 100644 --- a/docs/docs-header.html +++ b/docs/docs-header.html @@ -1,5 +1,7 @@ - diff --git a/flake.nix b/flake.nix index ac08cbc..bde0fca 100644 --- a/flake.nix +++ b/flake.nix @@ -1,3 +1,22 @@ +# Copyright (C) 2024 - 2024: +# The Trinitrix Project +# SPDX-License-Identifier: LGPL-3.0-or-later +# +# This file is part of the Trinitry crate for Trinitrix. +# +# Trinitry is free software: you can redistribute it and/or modify +# it under the terms of the Lesser GNU General Public License as +# published by the Free Software Foundation, either version 3 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# and the Lesser GNU General Public License along with this program. +# If not, see . { description = "A very simple programming language, used to map functions to commands"; @@ -88,6 +107,8 @@ packages = with pkgs; [ cocogitto + yq + rust_default cargo-edit diff --git a/scripts/renew_copyright_header.sh b/scripts/renew_copyright_header.sh index 4f424c3..5899a2e 100755 --- a/scripts/renew_copyright_header.sh +++ b/scripts/renew_copyright_header.sh @@ -1,4 +1,23 @@ #! /usr/bin/env sh +# Copyright (C) 2024 - 2024: +# The Trinitrix Project +# SPDX-License-Identifier: LGPL-3.0-or-later +# +# This file is part of the Trinitry crate for Trinitrix. +# +# Trinitry is free software: you can redistribute it and/or modify +# it under the terms of the Lesser GNU General Public License as +# published by the Free Software Foundation, either version 3 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# and the Lesser GNU General Public License along with this program. +# If not, see . # NOTE: This is the line length of the .licensure.yml header template **plus** the extra # line after the template comment. diff --git a/scripts/update_tests.sh b/scripts/update_tests.sh index 3d66e97..7bd0b34 100755 --- a/scripts/update_tests.sh +++ b/scripts/update_tests.sh @@ -1,5 +1,7 @@ -#!/usr/bin/env sh -# Copyright (C) 2023 The Trinitrix Project +#! /usr/bin/env sh +# Copyright (C) 2024 - 2024: +# The Trinitrix Project +# SPDX-License-Identifier: LGPL-3.0-or-later # # This file is part of the Trinitry crate for Trinitrix. # @@ -17,25 +19,24 @@ # and the Lesser GNU General Public License along with this program. # If not, see . - # This script generates ./src/tests.rs # Library {{{ mktmp() { - ensure_tmp_dir - mktemp -p "$LIB_TEMP_DIR_FOR_SCRIPT" + ensure_tmp_dir + mktemp -p "$LIB_TEMP_DIR_FOR_SCRIPT" } ensure_tmp_dir() { - if ! [ -d "$LIB_TEMP_DIR_FOR_SCRIPT" ]; then - LIB_TEMP_DIR_FOR_SCRIPT="$(mktemp -d)" - export LIB_TEMP_DIR_FOR_SCRIPT - fi + if ! [ -d "$LIB_TEMP_DIR_FOR_SCRIPT" ]; then + LIB_TEMP_DIR_FOR_SCRIPT="$(mktemp -d)" + export LIB_TEMP_DIR_FOR_SCRIPT + fi } remove_tmp_dir() { - # The test is here because some scripts still delete this on their own - if [ -d "$LIB_TEMP_DIR_FOR_SCRIPT" ]; then - rm -r "$LIB_TEMP_DIR_FOR_SCRIPT" - fi + # The test is here because some scripts still delete this on their own + if [ -d "$LIB_TEMP_DIR_FOR_SCRIPT" ]; then + rm -r "$LIB_TEMP_DIR_FOR_SCRIPT" + fi } trap remove_tmp_dir EXIT @@ -45,14 +46,14 @@ ensure_tmp_dir # ensure that the variable has been set, even in subshells tmp="$(mktmp)" curl https://raw.githubusercontent.com/minimaxir/big-list-of-naughty-strings/master/blns.txt | - awk '!/^#/' | - awk '!/^[\s\t]*$/' | - awk -v s="'" '!/.*s.*/' | + awk '!/^#/' | + awk '!/^[\s\t]*$/' | + awk -v s="'" '!/.*s.*/' | - # This entry contains duplicated spaces, just ignore it - awk '!/Power/' | - iconv -c -f utf-8 -t ascii \ - >"$tmp" + # This entry contains duplicated spaces, just ignore it + awk '!/Power/' | + iconv -c -f utf-8 -t ascii \ + >"$tmp" counter=0 @@ -67,10 +68,10 @@ mod test { EOF while read -r name; do - tmp2="$(mktmp)" - printf "%s" "$name" >"$tmp2" - if rg '^[A-Za-z0-9_.-]+$' "$tmp2" -q; then - cat <"$tmp2" + if rg '^[A-Za-z0-9_.-]+$' "$tmp2" -q; then + cat <?!+^@&*~|=,/\\ -]*$' "$tmp2" -q; then - cat <?!+^@&*~|=,/\\ -]*$' "$tmp2" -q; then + cat < +* Copyright (C) 2024 - 2024: +* The Trinitrix Project +* SPDX-License-Identifier: LGPL-3.0-or-later * * This file is part of the Trinitry crate for Trinitrix. * @@ -18,7 +20,6 @@ * If not, see . */ - //! This crate is a parser for the 'Trinitry' (not 'Trinity') language, used to map all sort of //! Functions to a memorable command. //! diff --git a/src/tests.rs b/src/tests.rs index 4a65b94..5651b43 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -1,3 +1,25 @@ +/* +* Copyright (C) 2024 - 2024: +* The Trinitrix Project +* SPDX-License-Identifier: LGPL-3.0-or-later +* +* This file is part of the Trinitry crate for Trinitrix. +* +* Trinitry is free software: you can redistribute it and/or modify +* it under the terms of the Lesser GNU General Public License as +* published by the Free Software Foundation, either version 3 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* and the Lesser GNU General Public License along with this program. +* If not, see . +*/ + // DO NOT EDIT // This file is automatically generated by the 'update.sh' file, with data from: // https://raw.githubusercontent.com/minimaxir/big-list-of-naughty-strings/master/blns.txt @@ -345,7 +367,10 @@ mod test { let p = Trinitry::new(r##"999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999"##).unwrap_or_else(|e| { panic!("{}", e); }); - assert_eq!(r##"999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999"##, &p.to_string()); + assert_eq!( + r##"999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999"##, + &p.to_string() + ); } #[test] fn parse_56() { @@ -433,7 +458,10 @@ mod test { let p = Trinitry::new(r##"123456789012345678901234567890123456789"##).unwrap_or_else(|e| { panic!("{}", e); }); - assert_eq!(r##"123456789012345678901234567890123456789"##, &p.to_string()); + assert_eq!( + r##"123456789012345678901234567890123456789"##, + &p.to_string() + ); } #[test] fn parse_70() { @@ -1029,17 +1057,23 @@ mod test { } #[test] fn parse_184() { - let p = Trinitry::new(r##""##); + let p = Trinitry::new( + r##""##, + ); assert!(p.is_err()); } #[test] fn parse_185() { - let p = Trinitry::new(r##""##); + let p = Trinitry::new( + r##""##, + ); assert!(p.is_err()); } #[test] fn parse_186() { - let p = Trinitry::new(r##""##); + let p = Trinitry::new( + r##""##, + ); assert!(p.is_err()); } #[test] diff --git a/src/trinitry.pest b/src/trinitry.pest index 5495f6f..e42d49d 100644 --- a/src/trinitry.pest +++ b/src/trinitry.pest @@ -1,4 +1,6 @@ -// Copyright (C) 2023 The Trinitrix Project +// Copyright (C) 2024 - 2024: +// The Trinitrix Project +// SPDX-License-Identifier: LGPL-3.0-or-later // // This file is part of the Trinitry crate for Trinitrix. // @@ -16,7 +18,6 @@ // and the Lesser GNU General Public License along with this program. // If not, see . - chars = { ASCII_ALPHANUMERIC | "_" | "-" | "." } // TODO(@soispha): Are these all the valid characters? <2023-11-01> diff --git a/treefmt.nix b/treefmt.nix index 1cbab40..7d726d0 100644 --- a/treefmt.nix +++ b/treefmt.nix @@ -1,3 +1,22 @@ +# Copyright (C) 2024 - 2024: +# The Trinitrix Project +# SPDX-License-Identifier: LGPL-3.0-or-later +# +# This file is part of the Trinitry crate for Trinitrix. +# +# Trinitry is free software: you can redistribute it and/or modify +# it under the terms of the Lesser GNU General Public License as +# published by the Free Software Foundation, either version 3 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# and the Lesser GNU General Public License along with this program. +# If not, see . { treefmt-nix, pkgs, diff --git a/update.sh b/update.sh index b34dabf..b0c2ec5 100755 --- a/update.sh +++ b/update.sh @@ -1,4 +1,23 @@ -#!/usr/bin/env sh +#! /usr/bin/env sh +# Copyright (C) 2024 - 2024: +# The Trinitrix Project +# SPDX-License-Identifier: LGPL-3.0-or-later +# +# This file is part of the Trinitry crate for Trinitrix. +# +# Trinitry is free software: you can redistribute it and/or modify +# it under the terms of the Lesser GNU General Public License as +# published by the Free Software Foundation, either version 3 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# and the Lesser GNU General Public License along with this program. +# If not, see . nix flake update cargo update