Skip to content

Commit

Permalink
Allows both Runtime and Runtime.Standard versions to be loaded; updat…
Browse files Browse the repository at this point in the history
…es README
  • Loading branch information
zspitz committed Oct 31, 2019
1 parent 30c6cf6 commit 49a5ddc
Show file tree
Hide file tree
Showing 7 changed files with 118 additions and 20 deletions.
24 changes: 24 additions & 0 deletions 2017.Standard/AssemblyAttributes.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

[assembly: DebuggerVisualizer(
visualizer: typeof(ParseTreeVisualizer.Visualizer),
visualizerObjectSource: typeof(ParseTreeVisualizer.ObjectSource),
Target = typeof(Antlr4.Runtime.RuleContext),
Description = "ANTLR4 Parse Tree Visualizer (Standard)")]

[assembly: DebuggerVisualizer(
visualizer: typeof(ParseTreeVisualizer.Visualizer),
visualizerObjectSource: typeof(ParseTreeVisualizer.ObjectSource),
Target = typeof(string),
Description = "ANTLR4 Parse Tree Visualizer (Standard)")]

[assembly: DebuggerVisualizer(
visualizer: typeof(ParseTreeVisualizer.Visualizer),
visualizerObjectSource: typeof(ParseTreeVisualizer.ObjectSource),
Target = typeof(Antlr4.Runtime.BufferedTokenStream),
Description = "ANTLR4 Parse Tree Visualizer (Standard)")]
24 changes: 24 additions & 0 deletions 2017/AssemblyAttributes.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

[assembly: DebuggerVisualizer(
visualizer: typeof(ParseTreeVisualizer.Visualizer),
visualizerObjectSource: typeof(ParseTreeVisualizer.ObjectSource),
Target = typeof(Antlr4.Runtime.RuleContext),
Description = "ANTLR4 Parse Tree Visualizer")]

[assembly: DebuggerVisualizer(
visualizer: typeof(ParseTreeVisualizer.Visualizer),
visualizerObjectSource: typeof(ParseTreeVisualizer.ObjectSource),
Target = typeof(string),
Description = "ANTLR4 Parse Tree Visualizer")]

[assembly: DebuggerVisualizer(
visualizer: typeof(ParseTreeVisualizer.Visualizer),
visualizerObjectSource: typeof(ParseTreeVisualizer.ObjectSource),
Target = typeof(Antlr4.Runtime.BufferedTokenStream),
Description = "ANTLR4 Parse Tree Visualizer")]
24 changes: 24 additions & 0 deletions 2019.Standard/AssemblyAttributes.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

[assembly: DebuggerVisualizer(
visualizer: typeof(ParseTreeVisualizer.Visualizer),
visualizerObjectSource: typeof(ParseTreeVisualizer.ObjectSource),
Target = typeof(Antlr4.Runtime.RuleContext),
Description = "ANTLR4 Parse Tree Visualizer (Standard)")]

[assembly: DebuggerVisualizer(
visualizer: typeof(ParseTreeVisualizer.Visualizer),
visualizerObjectSource: typeof(ParseTreeVisualizer.ObjectSource),
Target = typeof(string),
Description = "ANTLR4 Parse Tree Visualizer (Standard)")]

[assembly: DebuggerVisualizer(
visualizer: typeof(ParseTreeVisualizer.Visualizer),
visualizerObjectSource: typeof(ParseTreeVisualizer.ObjectSource),
Target = typeof(Antlr4.Runtime.BufferedTokenStream),
Description = "ANTLR4 Parse Tree Visualizer (Standard)")]
24 changes: 24 additions & 0 deletions 2019/AssemblyAttributes.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

[assembly: DebuggerVisualizer(
visualizer: typeof(ParseTreeVisualizer.Visualizer),
visualizerObjectSource: typeof(ParseTreeVisualizer.ObjectSource),
Target = typeof(Antlr4.Runtime.RuleContext),
Description = "ANTLR4 Parse Tree Visualizer")]

[assembly: DebuggerVisualizer(
visualizer: typeof(ParseTreeVisualizer.Visualizer),
visualizerObjectSource: typeof(ParseTreeVisualizer.ObjectSource),
Target = typeof(string),
Description = "ANTLR4 Parse Tree Visualizer")]

[assembly: DebuggerVisualizer(
visualizer: typeof(ParseTreeVisualizer.Visualizer),
visualizerObjectSource: typeof(ParseTreeVisualizer.ObjectSource),
Target = typeof(Antlr4.Runtime.BufferedTokenStream),
Description = "ANTLR4 Parse Tree Visualizer")]
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,12 @@ If you are debugging .NET Core applications, you may also need to put an additio
## Usage

1. Begin a debugging session, and break at some point.
2. Navigate to an instance of one of the visualizer target types (`Antlr4.Runtime.RuleContext`, `Antlr4.Runtime.BufferedTokenStream`, or `string`), in the code editor, or the Watch or Locals window. This instance can be exposed by any variable, or any expression; the type of the expression doesn't matter.
2. Hover over an instance of one of the visualizer target types (`Antlr4.Runtime.RuleContext`, `Antlr4.Runtime.BufferedTokenStream`, or `string`), in the code editor, or the Watch or Locals window. This instance can be exposed by any variable, or any expression; the type of the expression doesn't matter.
3. Click on the magnifying glass to the right of the expression.
4. You may need to choose a lexer class from the settings if you are visualizing a `string`, and you haven't already done so.
5. You may need to choose a parser class from the settings, if you are visualizing a `BufferedTokenStream` or a `string`, or the debugged assemblies have multiple parser classes; you will also need to choose a parsing method. (These choices persist between sessions, so if you've already chosen, there's no need to do so again.)
4. You may need to choose a lexer class if you are visualizing a `string` and there are multiple lexers in the debugged assemblies; and you haven't already done so.
5. You may need to choose a parser class from the settings, if you are visualizing a `BufferedTokenStream` or a `string`, or the debugged assemblies have multiple parser classes; you will also need to choose a parsing method. (These choices persist between sessions, so if you've already chosen, there's no need to do so again.)

![Visualizing a string](visualize-string.gif)

## Contributing

Expand Down
34 changes: 17 additions & 17 deletions Shared/Visualizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@
using ParseTreeVisualizer.Util;
using Microsoft.Xaml.Behaviors;

[assembly: DebuggerVisualizer(
visualizer: typeof(ParseTreeVisualizer.Visualizer),
visualizerObjectSource: typeof(ParseTreeVisualizer.ObjectSource),
Target = typeof(Antlr4.Runtime.RuleContext),
Description = "ANTLR4 Parse Tree Visualizer")]

[assembly: DebuggerVisualizer(
visualizer: typeof(ParseTreeVisualizer.Visualizer),
visualizerObjectSource: typeof(ParseTreeVisualizer.ObjectSource),
Target = typeof(string),
Description = "ANTLR4 Parse Tree Visualizer")]

[assembly: DebuggerVisualizer(
visualizer: typeof(ParseTreeVisualizer.Visualizer),
visualizerObjectSource: typeof(ParseTreeVisualizer.ObjectSource),
Target = typeof(Antlr4.Runtime.BufferedTokenStream),
Description = "ANTLR4 Parse Tree Visualizer")]
//[assembly: DebuggerVisualizer(
// visualizer: typeof(ParseTreeVisualizer.Visualizer),
// visualizerObjectSource: typeof(ParseTreeVisualizer.ObjectSource),
// Target = typeof(Antlr4.Runtime.RuleContext),
// Description = "ANTLR4 Parse Tree Visualizer")]

//[assembly: DebuggerVisualizer(
// visualizer: typeof(ParseTreeVisualizer.Visualizer),
// visualizerObjectSource: typeof(ParseTreeVisualizer.ObjectSource),
// Target = typeof(string),
// Description = "ANTLR4 Parse Tree Visualizer")]

//[assembly: DebuggerVisualizer(
// visualizer: typeof(ParseTreeVisualizer.Visualizer),
// visualizerObjectSource: typeof(ParseTreeVisualizer.ObjectSource),
// Target = typeof(Antlr4.Runtime.BufferedTokenStream),
// Description = "ANTLR4 Parse Tree Visualizer")]


namespace ParseTreeVisualizer {
Expand Down
Binary file added visualize-string.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 49a5ddc

Please sign in to comment.