Пример #1
0
        public FileAnalyzer(StreamReader filestream, ICCMNotify callback, object context, bool suppressMethodSignatures, string filename,
            ParserSwitchBehavior switchBehavior = ParserSwitchBehavior.TraditionalInclude)
        {
            this.buffer = new CharBuffer(filestream.BaseStream.Length);
              this.buffer.ReadEntireStream(filestream);

              var processStream = new StreamReader(buffer.GetBytesMemoryStream());

              // run through preprocessor before setting up parser...
              Preprocessor preprocessor = new Preprocessor(processStream);
              StreamReader stream = preprocessor.Process();

              // this construct should be fixed and support OCP
              if (filename.ToLower().EndsWith(".js") || filename.ToLower().EndsWith(".ts"))
            this.parser = LookAheadLangParser.CreateJavascriptParser(stream);
              else
            this.parser = LookAheadLangParser.CreateCppParser(stream);

              this.callback = callback;
              this.context = context;
              this.suppressMethodSignatures = suppressMethodSignatures;
              this.filename = filename;
              this.switchBehavior = switchBehavior;
        }