Example #1
0
 public DirectiveProcessor(IFileSystem fileSystem, ISolution solution, IDirectiveRunner runner, IDirectiveParser parser)
 {
     _fileSystem = fileSystem;
     _solution = solution;
     _runner = runner;
     _parser = parser;
 }
Example #2
0
 public DirectiveProcessor(IFileSystem fileSystem, ISolution solution, IDirectiveRunner runner, IDirectiveParser parser)
 {
     _fileSystem = fileSystem;
     _solution   = solution;
     _runner     = runner;
     _parser     = parser;
 }
Example #3
0
 public DirectiveHolder(string directive, string value, IDirectiveParser parser, int position)
 {
     _parser   = parser;
     Directive = directive;
     parser.SetValue(value);
     Position     = position;
     CurrentItems = ContentItems["main"];
 }
Example #4
0
        private void ParseTextLine(string line)
        {
            bool   isNewLine = true;
            string textLine  = HandleLineEnding(line);

            if (whiteHandlingExpr.IsMatch(textLine))
            {
                isNewLine = false;
                textLine  = textLine.Substring(0, textLine.LastIndexOf(WhiteDirective));
            }

            List <IDirectiveParser> parsers = MatchDirectives(textLine);

            parsers.Sort(
                delegate(IDirectiveParser x, IDirectiveParser y)
            {
                if (x.Index < y.Index)
                {
                    return(-1);
                }
                else if (x.Index > y.Index)
                {
                    return(1);
                }
                else
                {
                    return(0);
                }
            });

            int        index = 0;
            StaticText staticText;

            for (int i = 0; i < parsers.Count; i++)
            {
                IDirectiveParser parser = parsers[i];

                staticText =
                    new StaticText(
                        textLine.Substring(index, parser.Index - index).Replace("@@", "@"),
                        this.lineCount);

                if (i == 0)
                {
                    staticText.IsStartOfLine = true;
                }

                this.currentDirective.Directives.Add(staticText);
                parser.Parse();
                index = parser.Index + parser.Length;
            }

            staticText =
                new StaticText(
                    textLine.Substring(index, textLine.Length - index).Replace("@@", "@"),
                    this.lineCount);
            staticText.IsNewLine = isNewLine;

            if (parsers.Count == 0)
            {
                staticText.IsStartOfLine = true;
            }

            this.currentDirective.Directives.Add(staticText);

            ParseBetweenStartIfAny(line);
        }