/// <summary>
 /// Parses the given data into the output file using a given template
 /// </summary>
 /// <param name="output">The output file</param>
 /// <param name="dataEnumerator">The exported data</param>
 public virtual void Parse(StreamWriter output, ITreeEnumerator <string> dataEnumerator)
 {
     for (int currLine = 0; currLine < this.lines.Count; currLine++)
     {
         foreach (var parser in sectionParsers)
         {
             if (!parser.CanParse(GetLine(currLine)))
             {
                 continue;
             }
             parser.Parse(this, output, ref currLine, dataEnumerator);
             break;
         }
     }
 }
Exemple #2
0
        public void Parse(LatexExportParser parent, StreamWriter output, ref int currLine, ITreeEnumerator <string> dataEnumerator)
        {
            int forBegin = currLine + 1;

            dataEnumerator.MoveIn();

            while (dataEnumerator.MoveNext())
            {
                currLine = forBegin;

                while (parent.GetLine(currLine) != null && !parent.GetLine(currLine).Contains("%# end for #%"))
                {
                    foreach (var parser in parent.SectionParsers)
                    {
                        if (!parser.CanParse(parent.GetLine(currLine)))
                        {
                            continue;
                        }

                        parser.Parse(parent, output, ref currLine, dataEnumerator);
                        break;
                    }
                }
            }
        }
Exemple #3
0
        public void Parse(LatexExportParser parent, StreamWriter output, ref int currLine, ITreeEnumerator <string> dataEnumerator)
        {
            string token = parent.GetLine(currLine);

            if (token.Contains("%# InputCurrentData #%"))
            {
                if (dataEnumerator.Current != "")
                {
                    output.WriteLine(dataEnumerator.Current);
                }
            }
            else if (token.Contains("%# InputNextData #%"))
            {
                if (!dataEnumerator.MoveNext())
                {
                    throw new IndexOutOfRangeException("No printable data found");
                }

                if (dataEnumerator.Current != "")
                {
                    output.WriteLine(dataEnumerator.Current);
                }
            }
            else if (token.Contains("%# SkipData #%"))
            {
                if (!dataEnumerator.MoveNext())
                {
                    throw new IndexOutOfRangeException("No printable data found");
                }
            }
        }
Exemple #4
0
        public void Parse(LatexExportParser parent, StreamWriter output, ref int currLine, ITreeEnumerator <string> dataEnumerator)
        {
            if (!CanParse(parent.GetLine(currLine)))
            {
                return;
            }

            output.WriteLine(parent.GetLine(currLine));
        }