예제 #1
0
        internal override void ParseInternal(System.IO.StringReader reader)
        {
            if (reader == null) return;
            string line = reader.ReadLine();
            while (line != null)
            {
                HtaccessNode node = null;
                if (Block.IsMatch(line) == MatchTypes.ALL)
                {
                    node = new Block();
                    node.ParseInternal(line);
                }
                else if (Block.IsMatch(line) == MatchTypes.START)
                {
                    node = new Block();
                    node.ParseInternal(line);
                    node.ParseInternal(reader);
                }
                else if (Block.IsMatch(line) == MatchTypes.END)
                {
                    // Skip
                }
                else if (WhiteLine.IsMatch(line) == MatchTypes.ALL)
                {
                    node = new WhiteLine();
                }
                else if (Comment.IsMatch(line) == MatchTypes.ALL)
                {
                    node = new Comment();
                    node.ParseInternal(line);
                }
                else if (Directive.IsMatch(line) == MatchTypes.ALL)
                {
                    node = new Directive();
                    node.ParseInternal(line);
                }

                if (node != null)
                {
                    this.Nodes.Add(node);
                }
                line = reader.ReadLine();
            }
        }