/// <summary> /// Visit a parse tree produced by <see cref="CommandToolParser.setBreakpointCommand"/>. /// <para> /// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/> /// on <paramref name="context"/>. /// </para> /// </summary> /// <param name="context">The parse tree.</param> /// <return>The visitor result.</return> public virtual Result VisitSetBreakpointCommand([NotNull] CommandToolParser.SetBreakpointCommandContext context) { return(VisitChildren(context)); }
/// <summary> /// Exit a parse tree produced by <see cref="CommandToolParser.setBreakpointCommand"/>. /// <para>The default implementation does nothing.</para> /// </summary> /// <param name="context">The parse tree.</param> public virtual void ExitSetBreakpointCommand([NotNull] CommandToolParser.SetBreakpointCommandContext context) { }
public SetBreakpointToolCommand(CommandToolParser.SetBreakpointCommandContext context) { if (context.LITERAL().Length < 1) { return; } var type = ProcessId(context.LITERAL()[0].GetText(), out var number, out var symbol); if (HasSemanticError) { return; } if (type) { Symbol = symbol; } else { Address = number; } if (HasSemanticError) { return; } var isCompact = !string.IsNullOrWhiteSpace(context.GetChild(1).GetText()); if (context.ChildCount < (isCompact ? 3 : 4)) { return; } // --- We have hit and/or filter condition var hitChild = isCompact ? 4 : 5; var conditionChild = isCompact ? 5 : 6; if (context.GetChild(isCompact ? 3 : 4).GetText().ToLower() == "h") { // --- Hit condition conditionChild = isCompact ? 11 : 12; HitConditionType = context.GetChild(hitChild).GetText(); if (string.IsNullOrWhiteSpace(HitConditionType)) { hitChild = isCompact ? 5 : 6; HitConditionType = context.GetChild(hitChild).GetText(); } else { conditionChild = isCompact ? 10 : 11; } hitChild++; if (!string.IsNullOrWhiteSpace(context.GetChild(hitChild).GetText())) { conditionChild--; } if (context.LITERAL().Length > 1) { HitConditionValue = ProcessNumber(context.LITERAL()[1].GetText()); if (HasSemanticError) { return; } } } // --- The remaining part is the filter condition var sb = new StringBuilder(); for (var i = conditionChild; i < context.ChildCount; i++) { sb.Append(context.GetChild(i).GetText()); } Condition = sb.ToString(); }