public CommandSyntaxParsingResult(
     CommandSyntax commandSyntax,
     MatchingParameters matchingParameters,
     List <ParseError> parseErrors
     )
 {
     CommandSyntax      = commandSyntax;
     MatchingParameters = matchingParameters;
     ParseErrors        = parseErrors;
 }
        public (ParseError parseError, ParameterSyntax parameterSyntax) MatchSegment(
            StringComparison syntaxMatchingRule,
            MatchingParameters matchingParameters,
            string segment,
            int position,
            int index,
            string[] rightSegments,
            string[] segments)
        {
            var cs  = CommandSpecification;
            var csp = CommandParameterSpecification;

            if (matchingParameters.Contains(csp.ParameterName))
            {
                if (position > 0)
                {
                    var leftSegments = segments[0..(position - 1)];
Exemplo n.º 3
0
        public (MatchingParameters matchingParameters, List <ParseError> parseErrors) Match(
            StringComparison syntaxMatchingRule,
            string[] segments,
            int firstIndex = 0)
        {
            var matchingParameters = new MatchingParameters();

            if (segments.Length < MinAttemptedSegments)
            {
                return(matchingParameters,
                       new List <ParseError> {
                    new ParseError(
                        $"missing parameter(s). minimum attempted is {MinAttemptedSegments}, founded {segments.Length}",
                        0,
                        firstIndex,
                        CommandSpecification,
                        AttemptedParameters(0)
                        )
                });