Beispiel #1
0
 public PastelContext CompileCode(string filename, string code)
 {
     if (this.compiler == null)
     {
         this.compiler = new PastelCompiler(
             this.Language,
             this.dependencies,
             this.constants,
             this.CodeLoader,
             this.extensibleFunctions);
     }
     this.compiler.CompileBlobOfCode(filename, code);
     return(this);
 }
Beispiel #2
0
 public PastelCompiler(
     bool isLibrary,
     PastelCompiler sharedScope,
     IDictionary <string, object> constants,
     IInlineImportCodeLoader inlineImportCodeLoader,
     IDictionary <string, PType> returnTypesForNativeMethods,
     IDictionary <string, PType[]> argumentTypesForNativeMethods)
 {
     this.isLibrary   = isLibrary;
     this.SharedScope = sharedScope;
     this.LibraryNativeFunctionReferenceArgumentTypes = argumentTypesForNativeMethods;
     this.LibraryNativeFunctionReferenceReturnTypes   = returnTypesForNativeMethods;
     this.StructDefinitions   = new Dictionary <string, StructDefinition>();
     this.EnumDefinitions     = new Dictionary <string, EnumDefinition>();
     this.Globals             = new Dictionary <string, VariableDeclaration>();
     this.ConstantDefinitions = new Dictionary <string, VariableDeclaration>();
     this.FunctionDefinitions = new Dictionary <string, FunctionDefinition>();
     this.interpreterParser   = new PastelParser(constants, inlineImportCodeLoader);
 }
Beispiel #3
0
 private PastelCompiler GetCompiler()
 {
     if (this.lazyInitCompiler == null)
     {
         if (!this.dependenciesFinalized)
         {
             throw new System.Exception("Cannot get compiler before dependencies are finalized.");
         }
         this.lazyInitCompiler = new PastelCompiler(
             this,
             this.Language,
             this.dependencies,
             this.dependencyReferenceNamespacesToDependencyIndex,
             this.constants,
             this.CodeLoader,
             this.extensibleFunctions);
     }
     return(this.lazyInitCompiler);
 }