GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — EZCode/EZCode/Debug.cs at master · EZCodeLanguage/EZCode Expand file tree/ Copy pathDebug.csMore file actions 79 lines (76 loc) · 3.12 KB / Copy pathDebug.csFile metadata and controls79 lines (76 loc) · 3.12 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 using static EZCodeLanguage.Parser; namespace EZCodeLanguage { public static class Debug { public class Breakpoint { public Line Line { get; set; } public bool Enabled { get; set; } public bool DisableWhenHit { get; set; } public string? EZCodeConditionToHit { get; set; } public string? EZCodeActionWhenHit { get; set; } public Breakpoint? EnabledWhenBreakpointIsHit { get; set; } public bool Hit { get; set; } public Breakpoint(Line line, bool enabled = true, bool disableWhenHit = false, string? ezcodeConditionToHit = null, string? ezcodeActionWhenHit = null, Breakpoint? enabledWhenBreakpointIsHit = null) { Line = line; Enabled = enabled; DisableWhenHit = disableWhenHit; EZCodeConditionToHit = ezcodeConditionToHit; EZCodeActionWhenHit = ezcodeActionWhenHit; EnabledWhenBreakpointIsHit = enabledWhenBreakpointIsHit; } } public static bool IsHit(Line line, Breakpoint[] breakpoints, Interpreter interpreter) { var point = breakpoints.FirstOrDefault(x => x.Line.FilePath == line.FilePath && x.Line.CodeLine == line.CodeLine); bool hit = point != null && point.Enabled; if (hit && point != null) { if (point.EZCodeConditionToHit != null) { Parser parser = new Parser(point.EZCodeConditionToHit, "Debugger"); var lines = parser.Parse(); object result = interpreter.GetValue(lines); if (result != null) { if (bool.TryParse(result.ToString(), out bool res)) { hit = res; } else { throw new Exception($"Error From Debugger in line \"{line.CodeLine}\" The condition does not return boolean"); } } else { throw new Exception($"Error From Debugger in line \"{line.CodeLine}\" The condition returns null instead of boolean"); } } if (hit && point.EZCodeActionWhenHit != null) { Parser parser = new Parser(point.EZCodeActionWhenHit, "Debugger"); var lines = parser.Parse(); foreach (var l in lines) { interpreter.SingleLine(l); } } if (point.EnabledWhenBreakpointIsHit != null) { point.EnabledWhenBreakpointIsHit.Enabled = true; } if (point.DisableWhenHit) { point.Enabled = false; } point.Hit = hit; } return hit; } } } |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |