private void _PutRuntime(ILanguageRuntime runtime) { if (m_singleThreaded) { m_runtimes.Add(runtime); } }
public Interpreter(object context, ILanguageRuntime language) { this.language = language; this.context = context; this.logging = new MemoryLogging(); // Default behavior this.LoggingKind = LoggingKind.ThrowOnError; }
private void Dispose(bool disposing) { if (disposing) { this.language = null; this.context = null; this.logging = null; } }
public static int IdentifySymbolValue(this ILanguageRuntime @this, object value) { if (value == null) { return(PredefinedTokens.Eoi); } return(@this.Identify(value.GetType())); }
private void Parse(ILanguageRuntime lang, string input) { using (var interp = new Interpreter(context, lang)) { interp.LoggingKind = LoggingKind.Collect; interp.Parse(input); errorCount = interp.ErrorCount; } }
public void AsynHandler(int methodId, string input) { ILanguageRuntime runtime = null; try { runtime = _GetRuntime(); runtime.AsynHandler(methodId, input); } finally { if (runtime != null) { _PutRuntime(runtime); } } }
internal int LoadProgram(string file) { ILanguageRuntime runtime = null; try { runtime = _GetRuntime(); return(runtime.LoadProgram(file)); } finally { if (runtime != null) { _PutRuntime(runtime); } } }
private static bool IsBootstrap(ILanguageRuntime result) { return(result is IBootstrapLanguage); }
public Interpreter(ILanguageRuntime language) : this(language.CreateDefaultContext(), language) { }
public static Msg Symbol <T>(this ILanguageRuntime @this, T value) { var id = @this.IdentifySymbolValue(value); return(new Msg(id, value, Loc.Unknown)); }
public static Msg Symbol <T>(this ILanguageRuntime @this) where T : new() { return(@this.Symbol(new T())); }
public static Msg Literal(this ILanguageRuntime @this, string literal) { var id = @this.Identify(literal); return(new Msg(id, null, Loc.Unknown)); }