public void SetOptionValue(ReplOptions option, object value) { if (_restoreOptions == null) { _restoreOptions = new Dictionary <ReplOptions, object>(); } try { _restoreOptions.Add(option, _window.GetOptionValue(option)); } catch (ArgumentException) { // Don't overwrite existing 'restore' values } _window.SetOptionValue(option, value); }
public object GetOptionValue(ReplOptions option) { return(null); }
public void SetOptionValue(ReplOptions option, object value) { }
private static void Main(string[] args) { var text = new StringBuilder(); while (true) { if (text.Length == 0) { Console.Write("> "); } else { Console.Write("· "); } var line = Console.ReadLine(); if (string.IsNullOrEmpty(line)) { continue; } if (line.StartsWith('/')) { switch (line.ToUpperInvariant()) { case "/Q": case "/EXIT": return; case "/CLS": Console.Clear(); break; case "/L": case "/LEX": case "/SHOWLEX": _replOptions = SwitchFlag(ReplOptions.PrintLexedTokens); var printLexString = _replOptions.HasFlag(ReplOptions.PrintLexedTokens) ? $"#{ConsoleColor.Green}#enabled#RESET#" : $"#{ConsoleColor.Red}#disabled#RESET#"; ColoredConsole.WriteLine($"Printing lexed tokens {printLexString}."); break; case "/S": case "/SYNTAX": case "/SHOWSYNTAX": _replOptions = SwitchFlag(ReplOptions.PrintSyntaxTokens); var printSyntaxString = _replOptions.HasFlag(ReplOptions.PrintSyntaxTokens) ? $"#{ConsoleColor.Green}#enabled#RESET#" : $"#{ConsoleColor.Red}#disabled#RESET#"; ColoredConsole.WriteLine($"Printing syntax tree {printSyntaxString}."); break; case "/R": case "/RUN": Process(text.ToString()); break; case "/E": case "/EMIT": Emit(text.ToString()); break; case "/RS": case "/RESET": text.Clear(); break; default: Console.Error.WriteLine($"Unknown command: {line}."); break; } } else { text.AppendLine(line); } } }
private static ReplOptions SwitchFlag(ReplOptions flag) => (_replOptions & flag) != 0 ? _replOptions & ~flag : _replOptions ^ flag;
public object GetOptionValue(ReplOptions option) { return(_window.GetOptionValue(option)); }
public object GetOptionValue(ReplOptions option) { return null; }
public object GetOptionValue(ReplOptions option) { throw new NotImplementedException(); }