コード例 #1
0
 public CommandSyntaxParsingResult(
     CommandSyntax commandSyntax,
     MatchingParameters matchingParameters,
     List <ParseError> parseErrors
     )
 {
     CommandSyntax      = commandSyntax;
     MatchingParameters = matchingParameters;
     ParseErrors        = parseErrors;
 }
コード例 #2
0
        public (ParseError parseError, ParameterSyntax parameterSyntax) MatchSegment(
            StringComparison syntaxMatchingRule,
            MatchingParameters matchingParameters,
            StringSegment segment,
            int position,
            int index,
            StringSegment[] rightSegments,
            StringSegment[] segments)
        {
            var cs  = CommandSpecification;
            var csp = CommandParameterSpecification;

            if (matchingParameters.Contains(csp.ParameterName))
            {
                if (position > 0)
                {
                    var leftSegments = segments[0..(position - 1)];
コード例 #3
0
        Match(
            CommandEvaluationContext context,
            StringComparison syntaxMatchingRule,
            //string[] segments,
            StringSegment[] 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)
                        )
                });