コード例 #1
0
        /* Function: TryToGetFirstBlockLine
         * If the iterator is on a line that starts with one of the <BlockTags>, extracts the components and returns true.
         * Use <GetBlockTag()> to get the complete block since it may span multiple lines.
         */
        protected bool TryToGetFirstBlockLine(LineIterator lineIterator, out string tag, out TokenIterator startOfContent)
        {
            tag            = null;
            startOfContent = default(TokenIterator);

            TokenIterator tokenIterator = lineIterator.FirstToken(LineBoundsMode.CommentContent);

            if (tokenIterator.Character != '@')
            {
                return(false);
            }

            tokenIterator.Next();

            if (tokenIterator.FundamentalType != FundamentalType.Text)
            {
                return(false);
            }

            string possibleTag = tokenIterator.String;

            if (BlockTags.Contains(possibleTag) == false)
            {
                return(false);
            }

            tokenIterator.Next();
            tokenIterator.NextPastWhitespace();

            tag            = possibleTag;
            startOfContent = tokenIterator;
            return(true);
        }
コード例 #2
0
        /* Function: HasAnyTag
         * Whether the passed block of text contains any Javadoc tags at all.
         */
        protected bool HasAnyTag(TokenIterator start, TokenIterator end)
        {
            string text     = start.Tokenizer.RawText;
            int    endIndex = end.RawTextIndex;

            int textIndex = text.IndexOf('@', start.RawTextIndex, endIndex - start.RawTextIndex);

            while (textIndex != -1)
            {
                start.NextByCharacters(textIndex - start.RawTextIndex);
                start.Next();

                if (textIndex > 0 && text[textIndex - 1] == '{')
                {
                    if (InlineTags.Contains(start.String))
                    {
                        return(true);
                    }
                }
                else
                {
                    if (BlockTags.Contains(start.String))
                    {
                        return(true);
                    }
                }

                textIndex = text.IndexOf('@', textIndex + 1, endIndex - (textIndex + 1));
            }

            return(false);
        }
コード例 #3
0
ファイル: CreateObject.cs プロジェクト: KooroshNaderi/Tetris
    public static string FromBlockTagsToString(BlockTags bt)
    {
        switch (bt)
        {
        case BlockTags.Block:
            return("Block");

        case BlockTags.Ground:
            return("Ground");

        case BlockTags.LeftWall:
            return("LeftWall");

        case BlockTags.MovingBlock:
            return("MovingBlock");

        case BlockTags.RightWall:
            return("RightWall");
        }

        return("");
    }