public ParameterListParser(IsblParser.ParameterListContext parameters) { if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } this.parameterList = parameters; this.ParameterValues = new List <ParameterValue>(); }
private void CheckTemplateString(string templateString, ParserRuleContext stringSourceContext, TemplateStringSource templateStringSource, IsblParser.ParameterListContext paramsOfArrayFunction) { var templateParser = new TemplateStringParser(templateString); var paramsParser = new ParameterListParser(paramsOfArrayFunction); templateParser.Parse(); paramsParser.Parse(); foreach (var formatItem in templateParser.FormatItems) { var foundArg = paramsParser.ParameterValues.FirstOrDefault(a => a.Index == formatItem.Index); if (foundArg == null) { this.FormatItemsWithoutArguments.Add(new IncorrectFormatEntry <FormatItem> { TemplateString = templateString, Data = formatItem, Context = stringSourceContext, TemplateStringSource = templateStringSource }); } else if (foundArg.IsEmpty) { this.FormatItemsWithEmptyArguments.Add(new IncorrectFormatEntry <FormatItem> { TemplateString = templateString, Data = formatItem, Context = stringSourceContext, TemplateStringSource = templateStringSource }); } } foreach (var parameter in paramsParser.ParameterValues.Where(p => !p.IsEmpty)) { if (!templateParser.FormatItems.Any(f => f.Index == parameter.Index)) { this.ArgumentsWithoutFormatItems.Add(new IncorrectFormatEntry <ParameterValue> { TemplateString = templateString, Data = parameter, Context = parameter.Context, TemplateStringSource = templateStringSource }); } } }