Beispiel #1
0
        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();
        }
Beispiel #2
0
        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());
        }