Example #1
0
        /// <summary>
        ///     合并注释
        /// </summary>
        /// <param name="element"></param>
        private void MergeLuaRem(WordElement element)
        {
            if (IsWithLineEnd())
            {
                return;
            }
            element.Append(WordElements[++CurWordIndex]);
            var a = WordElements[CurWordIndex].Char;

            if (IsWithLineEnd())
            {
                return;
            }
            element.Append(WordElements[++CurWordIndex]);
            var b = WordElements[CurWordIndex].Char;

            if (a == '[' && b == '[') //多行注释
            {
                bool isShift = false;
                for (CurWordIndex++; CurWordIndex < WordElements.Count; CurWordIndex++)
                {
                    element.Append(WordElements[++CurWordIndex]);
                    if (WordElements[CurWordIndex].Char == ']') //多行注释结束
                    {
                        if (isShift)
                        {
                            return;
                        }
                        isShift = true;
                    }
                    else if (isShift)
                    {
                        isShift = false;
                    }
                }
            }
            else
            {
                for (CurWordIndex++; CurWordIndex < WordElements.Count; CurWordIndex++)
                {
                    if (WordElements[CurWordIndex].IsLine) //行已结束
                    {
                        --CurWordIndex;                    //回退
                        return;
                    }
                    element.Append(WordElements[++CurWordIndex]);
                }
            }
        }
Example #2
0
        /// <summary>
        ///     合并多行文本
        /// </summary>
        /// <param name="codeElement"></param>
        private void MergeMulitString(WordElement codeElement)
        {
            bool isShift = false;

            for (CurWordIndex++; CurWordIndex < WordElements.Count; CurWordIndex++)
            {
                WordElement curElement = WordElements[CurWordIndex];
                if (curElement.Char == '\"')
                {
                    isShift = !isShift;
                    codeElement.Append(curElement);
                    continue;
                }
                if (isShift)
                {
                    --CurWordIndex;//回退
                    return;
                }
                codeElement.Append(curElement);
            }
        }
Example #3
0
        /// <summary>
        ///     合并多行文本
        /// </summary>
        /// <param name="codeElement"></param>
        private void MergeMulitString(WordElement codeElement)
        {
            bool preShift = false;

            for (CurWordIndex++; CurWordIndex < WordElements.Count; CurWordIndex++)
            {
                WordElement cur = WordElements[CurWordIndex];
                codeElement.Append(cur);
                if (cur.IsPunctuate && cur.Char == ']')
                {
                    if (preShift)
                    {
                        return;
                    }
                    preShift = true;
                }
                else
                {
                    preShift = false;
                }
            }
        }