コード例 #1
0
        internal OsloCodeGeneratorInfo(OsloCodeGeneratorInfo root, string fileName)
        {
            this.CodeParser = root.CodeParser;
            this.TemplateParser = root.TemplateParser;
            this.CodePrinter = root.CodePrinter;
            this.ErrorReporter = root.ErrorReporter;

            this.References = new SortedSet<string>();
            this.Usings = new SortedSet<string>();
            this.Imports = new SortedSet<string>();
            this.Includes = new List<OsloCodeGeneratorInfo>();

            this.IgnoreIncludes = root.IgnoreIncludes;

            this.FileName = Path.GetFullPath(fileName);
            if (!File.Exists(this.FileName))
            {
                this.ErrorReporter.Error("File not found: {0}", fileName);
            }
            this.Program = this.CodeParser.Parse(new StreamReader(this.FileName), this.ErrorReporter);
        }
コード例 #2
0
 public void Process_Include(dynamic node)
 {
     if (this.codeGenerator.IgnoreIncludes) return;
     string includeFileName = node.FileName;
     if (includeFileName.Length < 2)
     {
         this.rootCodeGenerator.ErrorReporter.Error("Invalid include '{0}' in '{1}'.", includeFileName, this.codeGenerator.FileName);
     }
     includeFileName = includeFileName.Substring(1, includeFileName.Length - 2);
     string includeFilePath = Path.Combine(Path.GetDirectoryName(this.codeGenerator.FileName), includeFileName);
     bool includedAlready = this.rootCodeGenerator.Includes.Where(imp => imp.FileName == includeFilePath).Count() > 0;
     if (!includedAlready)
     {
         OsloCodeGeneratorInfo include = new OsloCodeGeneratorInfo(this.rootCodeGenerator, includeFilePath);
         this.rootCodeGenerator.Includes.Add(include);
         new OsloCodeGeneratorUsingProcessor(this.rootCodeGenerator, include).Process(include.Program);
     }
 }
コード例 #3
0
        public OsloCodeGeneratorPrintProcessor(OsloCodeGeneratorInfo rootCodeGenerator, OsloCodeGeneratorInfo codeGenerator)
        {
            this.rootCodeGenerator = rootCodeGenerator;
            this.codeGenerator = codeGenerator;
            this.CodePrinter = this.rootCodeGenerator.CodePrinter;
            if (this.codeGenerator != null && this.codeGenerator.FileName != null)
            {
                this.fileName = Path.GetFileName(this.codeGenerator.FileName);
            }

            this.loopStack = new Stack<LoopScope>();
            this.nameStack = new Stack<NameScope>();
            this.functionNames = new NameScope();

            this.functionCounter = 0;
        }
コード例 #4
0
 public OsloCodeGeneratorUsingProcessor(OsloCodeGeneratorInfo rootCodeGenerator, OsloCodeGeneratorInfo codeGenerator)
 {
     this.rootCodeGenerator = rootCodeGenerator;
     this.codeGenerator = codeGenerator;
 }