protected override Microsoft.Scripting.ScriptCode CompileSourceCode(Microsoft.Scripting.SourceUnit sourceUnit, Microsoft.Scripting.CompilerOptions options, Microsoft.Scripting.ErrorSink errorSink) { return(null); // ClojureParser cp = new ClojureParser(sourceUnit); // LambdaExpression ast; // switch (sourceUnit.Kind) // { // case SourceCodeKind.InteractiveCode: // { // ScriptCodeParseResult result; // object code = cp.ParseInteractiveStatement(out result); // sourceUnit.CodeProperties = result; // if (result != ScriptCodeParseResult.Complete) // return null; // //ast = Generator.Generate(code, true); // ast = Compiler.GenerateLambda(code, true); // } // break; // default: // sourceUnit.CodeProperties = ScriptCodeParseResult.Complete; // ast = Generator.Generate(cp.ParseFile(), sourceUnit); // break; // } // //ast = new GlobalLookupRewriter().RewriteLambda(ast); // //DEBUG!!! // //Compiler.SaveContext(); // return new LegacyScriptCode(ast, sourceUnit); }
protected ScriptCode(SourceUnit sourceUnit) { ContractUtils.RequiresNotNull(sourceUnit, "sourceUnit"); _sourceUnit = sourceUnit; }
public override void Add(SourceUnit source, string /*!*/ message, SourceSpan span, int errorCode, Severity severity) { }
public override void Add(SourceUnit source, string /*!*/ message, SourceSpan span, int errorCode, Severity severity) { CountError(severity); _sink.Add(source, message, span, errorCode, severity); }
public ScriptModule CompileModule(string name, SourceUnit sourceUnit) { return(CompileModule(name, ScriptModuleKind.Default, null, null, null, sourceUnit)); }
private ScriptModule CompileAndPublishModule(string moduleName, SourceUnit su) { Assert.NotNull(moduleName, su); EnsureModules(); string key = su.Id ?? moduleName; // check if we've already published this SourceUnit lock (_modules) { ScriptModule tmp = GetCachedModuleNoLock(key); if (tmp != null) { return(tmp); } } // compile and initialize the module... ScriptModule mod = CompileModule(moduleName, su); lock (_modules) { // check if someone else compiled it first... ScriptModule tmp = GetCachedModuleNoLock(key); if (tmp != null) { return(tmp); } LoadInfo load; if (_loading.TryGetValue(key, out load)) { if (load.Thread == Thread.CurrentThread) { return(load.Module); } Monitor.Exit(_modules); try { lock (load) { if (!load.Done) { if (load.Mre == null) { load.Mre = new ManualResetEvent(false); } Monitor.Exit(load); try { load.Mre.WaitOne(); } finally { Monitor.Enter(load); } } } if (load.Module != null) { return(load.Module); } throw load.Exception; } finally { Monitor.Enter(_modules); } } load = new LoadInfo(); load.Module = mod; load.Thread = Thread.CurrentThread; _loading[key] = load; bool success = false; Monitor.Exit(_modules); try { mod.Execute(); success = true; lock (load) { load.Done = true; if (load.Mre != null) { load.Mre.Set(); } } return(mod); } catch (Exception e) { lock (load) { load.Exception = e; load.Done = true; if (load.Mre != null) { load.Mre.Set(); } } throw; } finally { Monitor.Enter(_modules); _loading.Remove(key); if (success) { _modules[key] = new WeakReference(mod); } } } }
protected SavableScriptCode(SourceUnit sourceUnit) : base(sourceUnit) { }
public ScriptCode CompileSourceCode(SourceUnit sourceUnit, CompilerOptions options) { return(CompileSourceCode(sourceUnit, options, null)); }
public ScriptCode CompileSourceCode(SourceUnit sourceUnit) { return(CompileSourceCode(sourceUnit, null, null)); }
//TODO: need localization public virtual void Add(SourceUnit source, string message, SourceSpan span, int errorCode, Severity severity) { throw new SyntaxErrorException(message, source, span, errorCode, severity); }
public CompilerContext CopyWithNewSourceUnit(SourceUnit sourceUnit) { return(new CompilerContext(sourceUnit, (CompilerOptions)_options.Clone(), _errors)); }
public CompilerContext(SourceUnit sourceUnit, CompilerOptions options, ErrorSink errorSink) : this(sourceUnit, options, errorSink, null) { }
public CompilerContext(SourceUnit sourceUnit) : this(sourceUnit, null, null, null) { }