From dc62584b7c3d0d22423cf1bbd90d6fd67547b5f2 Mon Sep 17 00:00:00 2001 From: Tony Bark <35226681+tonytins@users.noreply.github.com> Date: Fri, 29 Apr 2022 06:39:56 -0400 Subject: [PATCH] Relicensed under BSD 3-clause --- LICENSE | 42 ++++++++++++++++++++++------------- README.md | 10 +++++---- notebooks/cst.ipynb | 54 +++++++++++++++++++++++++++++++-------------- 3 files changed, 70 insertions(+), 36 deletions(-) diff --git a/LICENSE b/LICENSE index 969d061..82321e8 100644 --- a/LICENSE +++ b/LICENSE @@ -1,17 +1,29 @@ -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +BSD 3-Clause License -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +Copyright (c) 2022, Tony Bark +All rights reserved. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/README.md b/README.md index 12bd82a..ccc362a 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,10 @@ -# Sixam.CST +# CSTNet [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg)](code_of_conduct.md) -Caret-Separated Text (or CST) is a key-value pair format represented by digits or words as keys and the value as text enclosed between carets. (e.g. `` ^^``) Any text which is not enclosed with carets is considered a comment and ignored. Neither strings nor comments may use the caret character. Sixam.CST is a library for parsing the CST format. +Caret-Separated Text (or CST) is a key-value pair format represented by digits or words as keys and the value as text enclosed between carets. (e.g. `` ^^``) Any text which is not enclosed with carets is considered a comment and ignored. Neither strings nor comments may use the caret character. CST.NET is a library for parsing the CST format. + +CST.NET uses .NET's built-in indexing extension function to accomplish locating of each respective key. As a consequence, it does not matter what you use for keys. I added an additional normalization to the pipeline that converts the document's line endings to the system's, in order to prevent crashes. ## Usage @@ -18,9 +20,9 @@ See [usage.md](./usage.md). ## Requirements -- [.NET](https://dotnet.microsoft.com/download) 6+. +- [.NET](https://dotnet.microsoft.com/download) 6 or later. - [.NET Interactive](https://github.com/dotnet/interactive/blob/main/README.md) for notebooks (optional). - - [VSCode Extension](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.dotnet-interactive-vscode) or [nteract](https://nteract.io/) + - [VSCode Extension](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.dotnet-interactive-vscode) or [nteract](https://nteract.io/). ## License diff --git a/notebooks/cst.ipynb b/notebooks/cst.ipynb index 1637710..b141d45 100644 --- a/notebooks/cst.ipynb +++ b/notebooks/cst.ipynb @@ -10,24 +10,33 @@ "\n", "## CST.NET\n", "\n", - "CST.NET uses .NET's built-in indexing extension function to accomplish locating of each respective key. As a consequence, it does not matter what you use for keys. I added an additional normalizion to the pipeline that converts the document's line endings to the system's, in order to prevent crashes." + "CST.NET uses .NET's built-in indexing extension function to accomplish locating of each respective key. As a consequence, it does not matter what you use for keys. I added an additional normalization to the pipeline that converts the document's line endings to the system's, in order to prevent crashes." ] }, { "cell_type": "code", "execution_count": 1, - "metadata": {}, + "metadata": { + "vscode": { + "languageId": "csharp" + } + }, + "outputs": [], "source": [ "using System.IO;\n", "using System.Collections.Generic;\n", "using System.Text.RegularExpressions;" - ], - "outputs": [] + ] }, { "cell_type": "code", "execution_count": 1, - "metadata": {}, + "metadata": { + "vscode": { + "languageId": "csharp" + } + }, + "outputs": [], "source": [ "public static class CaretSeparatedText\n", "{\n", @@ -114,13 +123,17 @@ " return \"***MISSING***\";\n", " }\n", "}" - ], - "outputs": [] + ] }, { "cell_type": "code", "execution_count": 1, - "metadata": {}, + "metadata": { + "vscode": { + "languageId": "csharp" + } + }, + "outputs": [], "source": [ "class ContentStrings\n", "{\n", @@ -161,13 +174,17 @@ " return CaretSeparatedText.Parse(file, key);\n", " }\n", "}" - ], - "outputs": [] + ] }, { "cell_type": "code", "execution_count": 1, - "metadata": {}, + "metadata": { + "vscode": { + "languageId": "csharp" + } + }, + "outputs": [], "source": [ "var english = new ContentStrings();\n", "var v1Path = Path.Combine(Environment.CurrentDirectory, \"data\", \"v1.cst\");\n", @@ -178,13 +195,17 @@ "Console.WriteLine($\"One:{Environment.NewLine}{one}\");\n", "/*Console.WriteLine($\"Three:{Environment.NewLine}{three}\");\n", "Console.WriteLine($\"Four:{Environment.NewLine}{four}\"); */" - ], - "outputs": [] + ] }, { "cell_type": "code", "execution_count": 1, - "metadata": {}, + "metadata": { + "vscode": { + "languageId": "csharp" + } + }, + "outputs": [], "source": [ "var v2Path = Path.Combine(Environment.CurrentDirectory, \"data\", \"v2.cst\");\n", "var v2File = File.ReadAllText(v2Path);\n", @@ -192,8 +213,7 @@ "var multiLineV2 = CaretSeparatedText.Parse(v2File, \"Multiline\");\n", "Console.WriteLine($\"Single line v2:{Environment.NewLine}{singleLineV2}\");\n", "Console.WriteLine($\"Multiline v2:{Environment.NewLine}{multiLineV2}\");" - ], - "outputs": [] + ] } ], "metadata": { @@ -212,4 +232,4 @@ }, "nbformat": 4, "nbformat_minor": 4 -} \ No newline at end of file +}