public void MatchFieldVariables(IParseTO payload, IList <IDev2DataLanguageIntellisensePart> refParts, bool addCompleteParts, IList <IIntellisenseResult> result, string[] parts, bool isRs, string rawSearch, string search, bool emptyOk)
            {
                var tmpTo = new ParseTO {
                    Payload = parts[0], StartIndex = 0, EndIndex = parts[0].Length - 1
                };

                var isRecName = isRs && rawSearch.Contains(DataListUtil.RecordsetIndexOpeningBracket) && rawSearch.EndsWith(DataListUtil.RecordsetIndexClosingBracket);

                const string DisplayString = "Recordset";

                if ((!isRecName || parts[1] == string.Empty) && payload.Child == null)
                {
                    if (_parserHelper.ValidateName(rawSearch, DisplayString, result, out IList <IIntellisenseResult> intellisenseResults))
                    {
                        return;
                    }
                }
                else
                {
                    if (_parserHelper.ValidateName(search, DisplayString, result, out IList <IIntellisenseResult> intellisenseResults))
                    {
                        return;
                    }
                }

                try
                {
                    _parserHelper.IsValidIndex(tmpTo);
                }
                catch (Dev2DataLanguageParseError e)
                {
                    result.Add(_parserHelper.AddErrorToResults(isRs, parts[0], e, !payload.HangingOpen));
                }

                var recordsetPart = refParts.FirstOrDefault(c => c.Name.ToLower() == search && c.Children != null);

                var display  = parts[0];
                var partName = parts[0];
                var start    = display.IndexOf(DataListUtil.RecordsetIndexOpeningBracket, StringComparison.Ordinal);

                if (start >= 0 && recordsetPart == null)
                {
                    display  = display.Substring(0, start);
                    display += "()";
                }

                if (partName.IndexOf(' ') < 0)
                {
                    search = ProcessValidPartNameContainingFields(payload, addCompleteParts, result, parts, search, emptyOk, partName, recordsetPart, display);
                }
                else
                {
                    var part = IntellisenseFactory.CreateDataListValidationRecordsetPart(parts[0], "." + parts[1], true);
                    result.Add(IntellisenseFactory.CreateErrorResult(payload.StartIndex, payload.EndIndex, part, " [[" + display + "]] contains a space, this is an invalid character for a variable name", enIntellisenseErrorCode.SyntaxError, !payload.HangingOpen));
                }
            }
Ejemplo n.º 2
0
 bool ValidateName(string rawSearch, string displayString, IList <IIntellisenseResult> result, out IList <IIntellisenseResult> intellisenseResults)
 => _parserHelper.ValidateName(rawSearch, displayString, result, out intellisenseResults);
 public IIntellisenseResult ValidateName(string name, string displayString) => _parserHelper.ValidateName(name, displayString);