Esempio n. 1
0
        internal static bool TryParseIndices(string indicesStr, out IList <int[]> jaggedIndices, out ArrayIndexType type)
        {
            string str   = indicesStr.Trim();
            Match  match = arrayIndexExpression.Match(str);

            if (match.Success)
            {
                Group group  = match.get_Groups().get_Item("arrayIndices");
                Group group2 = match.get_Groups().get_Item("oversamplingIndex");
                if (group.get_Captures().Count > 0)
                {
                    jaggedIndices = getIndicesFromGroup(group);
                    type          = (jaggedIndices.Count <= 1) ? ArrayIndexType.Standard : ArrayIndexType.Jagged;
                    return(true);
                }
                if (group2.get_Captures().Count > 0)
                {
                    jaggedIndices = getIndicesFromGroup(group2);
                    type          = ArrayIndexType.Oversample;
                    return(true);
                }
            }
            jaggedIndices = null;
            type          = ArrayIndexType.Standard;
            return(false);
        }
Esempio n. 2
0
        internal static bool TryParseArrayElement(string nameWithIndices, out string instanceName, out string indicesStr, out IList <int[]> jaggedIndices, out ArrayIndexType type)
        {
            string str   = nameWithIndices.Trim();
            Match  match = arrayExpression.Match(str);

            if (match.Success)
            {
                Group group = match.get_Groups().get_Item("name");
                instanceName = group.get_Captures().get_Item(0).Value;
                Group group2 = match.get_Groups().get_Item("indicesStr");
                indicesStr = group2.get_Captures().get_Item(0).Value;
                Group group3 = match.get_Groups().get_Item("indices");
                Group group4 = match.get_Groups().get_Item("arrayIndices");
                Group group5 = match.get_Groups().get_Item("oversamplingIndex");
                if (group4.get_Captures().Count > 0)
                {
                    jaggedIndices = getIndicesFromGroup(group4);
                    type          = (jaggedIndices.Count <= 1) ? ArrayIndexType.Standard : ArrayIndexType.Jagged;
                    return(true);
                }
                if (group5.get_Captures().Count > 0)
                {
                    jaggedIndices = getIndicesFromGroup(group5);
                    type          = ArrayIndexType.Oversample;
                    return(true);
                }
            }
            instanceName  = null;
            indicesStr    = null;
            jaggedIndices = null;
            type          = ArrayIndexType.Standard;
            return(false);
        }