Example #1
0
        /// <summary>
        /// Would be the same as BlockStack.Peek() but only returns the topmost block of given type
        /// </summary>
        /// <returns></returns>
        public T GetTopMostBlock <T>() where T : ParsedScope
        {
            T   output = BlockStack.Peek() as T;
            var i      = 0;

            while (output == null)
            {
                i++;
                if (i >= BlockStack.Count)
                {
                    break;
                }
                output = BlockStack.ElementAt(i) as T;
            }
            return(output);
        }
Example #2
0
 internal SyntaxTreeNode AddNodeToCurrentBlock(SyntaxTreeNode node)
 {
     BlockStack.Peek().Block.Add(node);
     return(node);
 }