diff --git a/AliceConsole/Program.cs b/AliceConsole/Program.cs index 9b3522c..b348353 100644 --- a/AliceConsole/Program.cs +++ b/AliceConsole/Program.cs @@ -11,7 +11,7 @@ if (line == "") Console.ReadLine(); else if (line is not null) - Anov.Read(line); + Console.WriteLine(Anov.Read(line)); } Console.ReadLine(); } diff --git a/AnovSyntax/Anov.cs b/AnovSyntax/Anov.cs index e137827..7ebd0a7 100644 --- a/AnovSyntax/Anov.cs +++ b/AnovSyntax/Anov.cs @@ -8,48 +8,51 @@ public class Anov /// Read the text in anov syntax. /// /// The text in anov syntax - public static void Read(string str) + public static string Read(string str) { Match match; + string _return = ""; // Unsupported // Read "> place" match = Regex.Match(str, @"> (.*)"); if (match.Success) - Console.WriteLine(""); + _return += ""; // Unsupported // Read "bgm: background-music" match = Regex.Match(str, @"bgm: (.*)"); if (match.Success) - Console.WriteLine(""); + _return += ""; // Unsupported // Read "movie: movie" match = Regex.Match(str, @"movie: (.*)"); if (match.Success) - Console.WriteLine(""); + _return += ""; // Read "- people-name / emotion" match = Regex.Match(str, @"- (.*?)/"); if (match.Success) - Console.Write(match.Groups[1].Value.Trim()); + _return += match.Groups[1].Value.Trim(); else { // Read "- people-name" match = Regex.Match(str, @"- (.*)"); if (match.Success) - Console.Write(match.Groups[1].Value.Trim()); + _return += match.Groups[1].Value.Trim(); } // Read "/ emotion" match = Regex.Match(str, @"/ (.*)"); if (match.Success) - Console.Write(" (" + match.Groups[1].Value.Trim() + ")"); + _return += " (" + match.Groups[1].Value.Trim() + ")"; // Read "[conversatioc-content]" match = Regex.Match(str, @"\[(.*?)\]"); if (match.Success) - Console.WriteLine(" \"" + match.Groups[1].Value.Trim() + "\""); + _return += " \"" + match.Groups[1].Value.Trim() + "\""; + + return _return; } }