Exemplo n.º 1
0
        public static string tryStringFromNewVertexString(string text, int startPos, ref int pos)
        {
            string newVertex = null;

            int sPos = startPos;

            bool shallProceed = true;

            if (ZeroCodeUtil.tryStringMatch(text, sPos, ZeroCodeCommon.NewVertexPrefix.ToString()))
            {
                while (shallProceed)
                {
                    sPos++;

                    if (text[sPos] == ZeroCodeCommon.NewVertexSuffix &&
                        sPos > 0 && text[sPos - 1] != ZeroCodeCommon.EscapeCharacter)    // if is no \"
                    {
                        shallProceed = false;
                    }
                }

                pos = sPos + 1;

                newVertex = ZeroCodeCommon.stringFromNewVertexString(text.Substring(startPos, sPos - startPos + 1));
            }

            return(newVertex);
        }
Exemplo n.º 2
0
        // to be used only in ZeroCodeCommon.stringFromLinkString( , FALSE) scenario
        // and that means that TO BE USED ONLY IN KEYWORDS
        public static string tryStringFromLinkString(string text, int startPos, ref int pos, int endPos)
        {
            string newVertex = null;

            int sPos = startPos;

            bool shallProceed = true;

            if (ZeroCodeUtil.tryStringMatch(text, startPos, ZeroCodeCommon.CodeGraphLinkPrefix.ToString()))
            {
                bool isInEscape = false;

                while (shallProceed)
                {
                    sPos++;

                    if (sPos == endPos)
                    {
                        shallProceed = false;
                    }

                    if (text[sPos] == '\n' || text[sPos] == '\r')
                    {
                        shallProceed = false;
                    }

                    //if (text[sPos] == ' ' && !isInEscape)
                    //  shallProceed = false;

                    if (text[sPos] == '\'' && !isInEscape)
                    {
                        isInEscape = true;
                    }

                    if (text[sPos] == '\'' && isInEscape &&
                        sPos > 0 && text[sPos - 1] != '\\')    // if is no \'
                    {
                        isInEscape = false;
                    }
                }

                pos = sPos;

                newVertex = ZeroCodeCommon.stringFromLinkString(text.Substring(startPos, sPos - startPos), false);
            }

            return(newVertex);
        }