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); }
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); }
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); }