Beispiel #1
0
 public PreprocessorParams(IPreprocessorReader reader, IPreprocessorWriter writer, string fileName,
                           IEnumerable <string> parentFiles, FileContext serverContext, ContentType contentType, string stopAtIncludeFile)
 {
     this.reader   = reader;
     this.writer   = writer;
     this.fileName = fileName;
     if (parentFiles != null)
     {
         this.parentFiles = parentFiles.ToArray();
     }
     this.fileContext       = serverContext;
     this.contentType       = contentType;
     this.stopAtIncludeFile = stopAtIncludeFile;
 }
Beispiel #2
0
        /// <summary>
        /// Preprocesses a document.
        /// </summary>
        /// <param name="reader">The document to be read.</param>
        /// <param name="writer">The output stream for the preprocessed document.</param>
        /// <param name="fileName">The name of the file being preprocessed.</param>
        /// <param name="parentFiles">A list of files which are to be considered parent files (to avoid cyclical #includes)</param>
        /// <param name="fileContext">The type of file.</param>
        /// <returns>True if the preprocessor changed a part of the document and the document should be re-run through this function again.
        /// False if the document has finished preprocessing.</returns>
        public PreprocessorResult Preprocess(IPreprocessorReader reader, IPreprocessorWriter writer, string fileName,
                                             IEnumerable <string> parentFiles, FileContext fileContext, string stopAtIncludeFile = null,
                                             IEnumerable <PreprocessorDefine> stdlibDefines = null)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }

            return(Preprocess(new PreprocessorParams(reader, writer, fileName, parentFiles, fileContext,
                                                     ContentType.File, stopAtIncludeFile)
            {
                isMainSource = true,
                stdlibDefines = stdlibDefines
            }));
        }
Beispiel #3
0
 public void SetWriter(IPreprocessorWriter writer)
 {
     _writer = writer;
 }