/// <summary> /// Visits the port pulses /// </summary> /// <param name="line">Line to add the tag for</param> /// <param name="context">PortPulseNode to visit</param> /// <param name="lineNo">Current line numer</param> /// <param name="collectedSpans">Collection of spancs found</param> private void Visit(ITextSnapshotLine line, PortPulseNode context, int lineNo, List <TagSpan <Z80TestTokenTag> > collectedSpans) { if (context == null || lineNo < context.Span.StartLine || lineNo > context.Span.EndLine) { return; } Visit(line, context.ValueExpr, lineNo, collectedSpans); Visit(line, context.Pulse1Expr, lineNo, collectedSpans); Visit(line, context.Pulse2Expr, lineNo, collectedSpans); }
/// <summary> /// Visits the port pulses /// </summary> /// <param name="line">Line to add the tag for</param> /// <param name="context">PortPulseNode to visit</param> /// <param name="lineNo">Current line number</param> /// <param name="collectedSpans">Collection of spans found</param> private void Visit(ITextSnapshotLine line, PortPulseNode context, int lineNo, List <ClassificationSpan> collectedSpans) { if (context == null || lineNo < context.Span.StartLine || lineNo > context.Span.EndLine) { return; } Visit(line, context.ValueExpr, lineNo, collectedSpans); Visit(line, context.Pulse1Expr, lineNo, collectedSpans); Visit(line, context.Pulse2Expr, lineNo, collectedSpans); }
/// <summary> /// Visit a parse tree produced by <see cref="Z80TestParser.portPulse"/>. /// <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 override object VisitPortPulse(Z80TestParser.PortPulseContext context) { if (IsInvalidContext(context)) { return(null); } var node = new PortPulseNode(context); if (context.expr().Length > 0) { node.ValueExpr = (ExpressionNode)VisitExpr(context.expr()[0]); } if (context.expr().Length > 1) { node.Pulse1Expr = (ExpressionNode)VisitExpr(context.expr()[1]); } if (context.expr().Length > 2) { node.Pulse2Expr = (ExpressionNode)VisitExpr(context.expr()[2]); node.IsInterval = context.GetChild(4).GetText() == ".."; } return(node); }