From 90cf7c60075666c63d40f324b0b261b43c7a1290 Mon Sep 17 00:00:00 2001 From: Lemon73 <108001913+Lemon73-Computing@users.noreply.github.com> Date: Tue, 5 Mar 2024 22:15:36 +0900 Subject: [PATCH 1/5] create: .gitattributes --- .gitattributes | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..1ff0c42 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,63 @@ +############################################################################### +# Set default behavior to automatically normalize line endings. +############################################################################### +* text=auto + +############################################################################### +# Set default behavior for command prompt diff. +# +# This is need for earlier builds of msysgit that does not have it on by +# default for csharp files. +# Note: This is only used by command line +############################################################################### +#*.cs diff=csharp + +############################################################################### +# Set the merge driver for project and solution files +# +# Merging from the command prompt will add diff markers to the files if there +# are conflicts (Merging from VS is not affected by the settings below, in VS +# the diff markers are never inserted). Diff markers may cause the following +# file extensions to fail to load in VS. An alternative would be to treat +# these files as binary and thus will always conflict and require user +# intervention with every merge. To do so, just uncomment the entries below +############################################################################### +#*.sln merge=binary +#*.csproj merge=binary +#*.vbproj merge=binary +#*.vcxproj merge=binary +#*.vcproj merge=binary +#*.dbproj merge=binary +#*.fsproj merge=binary +#*.lsproj merge=binary +#*.wixproj merge=binary +#*.modelproj merge=binary +#*.sqlproj merge=binary +#*.wwaproj merge=binary + +############################################################################### +# behavior for image files +# +# image files are treated as binary by default. +############################################################################### +#*.jpg binary +#*.png binary +#*.gif binary + +############################################################################### +# diff behavior for common document formats +# +# Convert binary document formats to text before diffing them. This feature +# is only available from the command line. Turn it on by uncommenting the +# entries below. +############################################################################### +#*.doc diff=astextplain +#*.DOC diff=astextplain +#*.docx diff=astextplain +#*.DOCX diff=astextplain +#*.dot diff=astextplain +#*.DOT diff=astextplain +#*.pdf diff=astextplain +#*.PDF diff=astextplain +#*.rtf diff=astextplain +#*.RTF diff=astextplain From 916ae0bcc9b704aa6fc6b2c781d26bde8416fef2 Mon Sep 17 00:00:00 2001 From: Lemon73-Computing Date: Tue, 5 Mar 2024 22:28:25 +0900 Subject: [PATCH 2/5] rename: anov syntax --- Alice-Console.sln | 2 +- {AnovReader => AnovSyntax}/Anov.cs | 40 +++++++++---------- .../AnovSyntax.csproj | 18 ++++----- Sample/Program.cs | 2 +- Sample/Sample.csproj | 2 +- 5 files changed, 32 insertions(+), 32 deletions(-) rename {AnovReader => AnovSyntax}/Anov.cs (92%) rename AnovReader/AnovReader.csproj => AnovSyntax/AnovSyntax.csproj (95%) diff --git a/Alice-Console.sln b/Alice-Console.sln index 7f5446f..dcdc55c 100644 --- a/Alice-Console.sln +++ b/Alice-Console.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.0.31903.59 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AnovReader", "AnovReader\AnovReader.csproj", "{B0401C3C-0DD7-4064-9134-CBB7F68AE63F}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AnovSyntax", "AnovSyntax\AnovSyntax.csproj", "{B0401C3C-0DD7-4064-9134-CBB7F68AE63F}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample", "Sample\Sample.csproj", "{BCFC05BD-904F-4C84-B160-D88DF9E62401}" EndProject diff --git a/AnovReader/Anov.cs b/AnovSyntax/Anov.cs similarity index 92% rename from AnovReader/Anov.cs rename to AnovSyntax/Anov.cs index 3e87a7c..5b5e763 100644 --- a/AnovReader/Anov.cs +++ b/AnovSyntax/Anov.cs @@ -1,20 +1,20 @@ -using System.Text.RegularExpressions; - -namespace AnovReader; - -public class Anov -{ - public static void Read(string str) - { - Match match; - // "- "から始まる"人物"を読み込み - match = Regex.Match(str, @"- (.*)"); - if (match.Success) - Console.Write(match.Groups[1].Value); - - // "["と"]"で囲む"会話"を読み込み - match = Regex.Match(str, @"\[(.*?)\]"); - if (match.Success) - Console.WriteLine("「" + match.Groups[1].Value + "」"); - } -} +using System.Text.RegularExpressions; + +namespace AnovSyntax; + +public class Anov +{ + public static void Read(string str) + { + Match match; + // "- "から始まる"人物"を読み込み + match = Regex.Match(str, @"- (.*)"); + if (match.Success) + Console.Write(match.Groups[1].Value); + + // "["と"]"で囲む"会話"を読み込み + match = Regex.Match(str, @"\[(.*?)\]"); + if (match.Success) + Console.WriteLine("「" + match.Groups[1].Value + "」"); + } +} diff --git a/AnovReader/AnovReader.csproj b/AnovSyntax/AnovSyntax.csproj similarity index 95% rename from AnovReader/AnovReader.csproj rename to AnovSyntax/AnovSyntax.csproj index bb23fb7..fa71b7a 100644 --- a/AnovReader/AnovReader.csproj +++ b/AnovSyntax/AnovSyntax.csproj @@ -1,9 +1,9 @@ - - - - net8.0 - enable - enable - - - + + + + net8.0 + enable + enable + + + diff --git a/Sample/Program.cs b/Sample/Program.cs index 7f6cba9..f97853f 100644 --- a/Sample/Program.cs +++ b/Sample/Program.cs @@ -1,4 +1,4 @@ -using AnovReader; +using AnovSyntax; // input test that is written in Anov Syntax. string input_1 = "- a girl"; diff --git a/Sample/Sample.csproj b/Sample/Sample.csproj index 68b27c0..5b8fe29 100644 --- a/Sample/Sample.csproj +++ b/Sample/Sample.csproj @@ -8,7 +8,7 @@ - + From 8d04d55413f5fcc19a622c69161facf6d6abed86 Mon Sep 17 00:00:00 2001 From: Lemon73-Computing Date: Sat, 16 Mar 2024 18:36:30 +0900 Subject: [PATCH 3/5] change: sample files --- Sample/Program.cs | 14 ++++++++++---- Sample/sample.anov | 5 +++++ 2 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 Sample/sample.anov diff --git a/Sample/Program.cs b/Sample/Program.cs index f97853f..599cf22 100644 --- a/Sample/Program.cs +++ b/Sample/Program.cs @@ -1,8 +1,14 @@ using AnovSyntax; // input test that is written in Anov Syntax. -string input_1 = "- a girl"; -string input_2 = "[Hello, World!]"; +string filePath = @"sample.anov"; -Anov.Read(input_1); -Anov.Read(input_2); +using (StreamReader sr = new(filePath)) +{ + while (!sr.EndOfStream) + { + string? line = sr.ReadLine(); + if (line is not null) + Anov.Read(line); + } +} diff --git a/Sample/sample.anov b/Sample/sample.anov new file mode 100644 index 0000000..cb56a7e --- /dev/null +++ b/Sample/sample.anov @@ -0,0 +1,5 @@ +- Alice +[Hello everyone!!] + +- Bob +[Hi, Alice.] From 6ace9f7a86f7290d3839ef17172f17133387c869 Mon Sep 17 00:00:00 2001 From: Lemon73-Computing Date: Sat, 16 Mar 2024 19:26:16 +0900 Subject: [PATCH 4/5] add: readkey user control rule --- Sample/Program.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Sample/Program.cs b/Sample/Program.cs index 599cf22..9cc5387 100644 --- a/Sample/Program.cs +++ b/Sample/Program.cs @@ -8,7 +8,9 @@ while (!sr.EndOfStream) { string? line = sr.ReadLine(); - if (line is not null) + if (line == "") + Console.ReadLine(); + else if (line is not null) Anov.Read(line); } } From 567eb62f56093fcfd021559abda2a0c0bcc49eaa Mon Sep 17 00:00:00 2001 From: Lemon73-Computing Date: Sat, 16 Mar 2024 19:39:13 +0900 Subject: [PATCH 5/5] change: to english style --- AnovSyntax/Anov.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/AnovSyntax/Anov.cs b/AnovSyntax/Anov.cs index 5b5e763..238c0c4 100644 --- a/AnovSyntax/Anov.cs +++ b/AnovSyntax/Anov.cs @@ -7,14 +7,15 @@ public class Anov public static void Read(string str) { Match match; - // "- "から始まる"人物"を読み込み + + // Read "- people-name" match = Regex.Match(str, @"- (.*)"); if (match.Success) Console.Write(match.Groups[1].Value); - // "["と"]"で囲む"会話"を読み込み + // Read "[conversatioc-content]" match = Regex.Match(str, @"\[(.*?)\]"); if (match.Success) - Console.WriteLine("「" + match.Groups[1].Value + "」"); + Console.WriteLine(" \"" + match.Groups[1].Value + "\""); } }