public static string[] Process(string text, Func<string, string> variables, bool preserveSurroundingQuotes) { var grammar = new CommandGrammar(variables, preserveSurroundingQuotes); var cursor = new Cursor(text, 0, text.Length); var result = grammar.Parse(cursor); if (!result.Remainder.IsEnd) { throw new ArgumentException($"Malformed command text '{text}'", nameof(text)); } return result.Value.ToArray(); }
public static string[] Process(string text, Func <string, string> variables, bool preserveSurroundingQuotes) { var grammar = new CommandGrammar(variables, preserveSurroundingQuotes); var cursor = new Cursor(text, 0, text.Length); var result = grammar.Parse(cursor); if (!result.Remainder.IsEnd) { throw new ArgumentException($"Malformed command text '{text}'", nameof(text)); } return(result.Value.ToArray()); }