コード例 #1
0
        private void SetCommandArguments(Dictionary <string, object> context, ArgumentsSectionSyntax syntax)
        {
            if (syntax == null)
            {
                ContextHelper.SetOptions(context, Array.Empty <KeyValuePair <string, string> >());
                ContextHelper.SetOperands(context, Array.Empty <string>());
                return;
            }

            var arguments = syntax.Arguments;

            _optionsBuffer.Clear();
            _operandsBuffer.Clear();

            foreach (var arg in arguments)
            {
                switch (arg)
                {
                case OptionSyntax option:
                    string optionName  = option.Name.StringValue;
                    string optionValue = GetValue(option.Value);
                    _optionsBuffer.Add(new KeyValuePair <string, string>(optionName, optionValue));
                    break;

                case OperandSyntax operand:
                    string operandValue = GetValue(operand.Value);
                    _operandsBuffer.Add(operandValue);
                    break;

                default:
                    break;
                }
            }

            ContextHelper.SetOptions(context, _optionsBuffer.ToArray());
            ContextHelper.SetOperands(context, _operandsBuffer.ToArray());
        }
コード例 #2
0
 public bool VisitArgumentsSection(ArgumentsSectionSyntax argumentsSection, CommandLineHighlightingVisitorParams <TStyle> param)
 {
     return(true);
 }