Пример #1
0
        /// <summary>
        /// Parses the line into a dictionary of key/value pairs.
        /// </summary>
        /// <param name="line">e.g. "-env:prod", "-config:prod.xml", "-date:T-1", "20"</param>
        /// <param name="prefix">Prefix used for named arguments. E.g. "-" as in "-env:prod"</param>
        /// <param name="separator">Separator used between name and value of named arguments. E.g. ":" as in "-env:prod"</param>
        /// <returns></returns>
        public static IDictionary <string, string> Parse(string line, string prefix, string separator)
        {
            var lexer  = new LexArgs();
            var tokens = lexer.ParseText(line);

            return(Parse(tokens.ToArray(), prefix, separator));
        }
Пример #2
0
        /// <summary>
        /// Parse supplied text using supplied settings.
        /// </summary>
        /// <param name="line">List to parse.</param>
        /// <param name="settings">Parsing settings to use.</param>
        /// <returns>List with parse results.</returns>
        public static List <string> Parse(string line, LexSettings settings)
        {
            LexArgs lex = new LexArgs(settings);

            return(lex.ParseText(line));
        }