Ejemplo n.º 1
0
        /// <summary>
        /// Extracts meta comments from a single C# file.
        /// </summary>
        /// <param name="f"></param>
        /// <param name="isMain">If false, it is a file added through meta option 'c'.</param>
        void _ParseFile(FileNode f, bool isMain)
        {
            //var p1 = APerf.Create();
            string code = f.GetText(cache: true);
            //p1.Next();
            bool isScript = f.IsScript;

            if (_isMain = isMain)
            {
                Name     = APath.GetFileName(f.Name, true);
                IsScript = isScript;

                Optimize     = DefaultOptimize;
                WarningLevel = DefaultWarningLevel;
                NoWarnings   = DefaultNoWarnings != null ? new List <string>(DefaultNoWarnings) : new List <string>();
                Defines      = new List <string>();
                Role         = DefaultRole(isScript);

                CodeFiles  = new List <MetaCodeFile>();
                References = new MetaReferences();
            }

            CodeFiles.Add(new MetaCodeFile(f, code));

            _fn   = f;
            _code = code;

            int endOf = FindMetaComments(code);

            if (endOf > 0)
            {
                if (isMain)
                {
                    EndOfMeta = endOf;
                }

                foreach (var t in EnumOptions(code, endOf))
                {
                    //var p1 = APerf.Create();
                    _ParseOption(t.Name(), t.Value(), t.nameStart, t.valueStart);
                    //p1.Next(); var t1 = p1.TimeTotal; if(t1 > 5) AOutput.Write(t1, t.Name(), t.Value());
                }
            }
            //p1.NW();
        }
Ejemplo n.º 2
0
 protected void AppendCode(string className, StringBuilder code)
 {
     Code.Append(code);
     CodeFiles.Add(className, code);
 }
Ejemplo n.º 3
0
 public void AddCodeFile(CodeFile codeFile)
 {
     CurrentCodeFile = codeFile;
     lock (CodeFiles)
         CodeFiles.Add(codeFile);
 }