public override void ExitEveryRule([NotNull] ParserRuleContext context) { base.ExitEveryRule(context); ActiveNode.Add(new XAttribute("Text", context.GetSourceText(Recognizer))); ActiveNode.Add(new XAttribute("RuleIndex", context.RuleIndex)); ActiveNode.Add(new XAttribute("SourceInterval", context.SourceInterval.ToString( ))); if (context.exception != null) { ActiveNode.Add(new XAttribute("Exception", context.exception)); } Pop( ); }
public override void ExitEveryRule([ValidatedNotNull] ParserRuleContext context) { context.ValidateNotNull(nameof(context)); base.ExitEveryRule(context); if (ActiveNode is null) { throw new InvalidOperationException("ActiveNode is null!"); } ActiveNode.Add(new XAttribute("Text", context.GetSourceText(Recognizer))); ActiveNode.Add(new XAttribute("RuleIndex", context.RuleIndex)); ActiveNode.Add(new XAttribute("SourceInterval", context.SourceInterval.ToString( ))); if (context.exception != null) { ActiveNode.Add(new XAttribute("Exception", context.exception)); } Pop( ); }
public override void ExitEveryRule(ParserRuleContext context) { base.ExitEveryRule(context); ActiveNode.Properties.Add("Text", context.GetSourceText(Recognizer)); ActiveNode.Properties.Add("RuleIndex", context.RuleIndex); ActiveNode.Properties.Add("SourceInterval", context.SourceInterval.ToString( )); if (context.exception != null) { ActiveNode.Category = "HasException"; ActiveNode.Properties.Add("Exception", context.exception); } if (context.Parent != null) { Graph.Links.Add(new Link( ) { Source = context.Parent.GetUniqueNodeId( ), Target = context.GetUniqueNodeId( ) }); } Pop( ); }