@@ -30,6 +30,11 @@ public java.util.List<Node> getErrors() {
3030 return errors ;
3131 }
3232
33+ @ Override
34+ public String inspect (String source ) {
35+ return inspect ();
36+ }
37+
3338 @ Override
3439 public <R , C > R accept (NodeVisitor <R , C > visitor , C context ) {
3540 return visitor .visitNode (this , context );
@@ -79,6 +84,13 @@ protected String inspectErrors(String prefix) {
7984 * Helper to format an array of nodes for tree inspection.
8085 */
8186 protected String inspectArray (java .util .List <Node > array , String prefix ) {
87+ return inspectArray (array , prefix , null );
88+ }
89+
90+ /**
91+ * Helper to format an array of nodes for tree inspection with source for Prism nodes.
92+ */
93+ protected String inspectArray (java .util .List <Node > array , String prefix , String source ) {
8294 if (array == null ) return "∅\n " ;
8395 if (array .isEmpty ()) return "[]\n " ;
8496
@@ -92,7 +104,7 @@ protected String inspectArray(java.util.List<Node> array, String prefix) {
92104 String nextPrefix = isLast ? " " : "│ " ;
93105
94106 if (item != null ) {
95- String tree = item .inspect ();
107+ String tree = source != null ? item . inspect ( source ) : item .inspect ();
96108
97109 if (tree .endsWith ("\n " )) {
98110 tree = tree .substring (0 , tree .length () - 1 );
@@ -119,8 +131,15 @@ protected String inspectArray(java.util.List<Node> array, String prefix) {
119131 * Helper to format a single node for tree inspection.
120132 */
121133 protected String inspectNode (Node node , String prefix ) {
134+ return inspectNode (node , prefix , null );
135+ }
136+
137+ /**
138+ * Helper to format a single node for tree inspection with source for Prism nodes.
139+ */
140+ protected String inspectNode (Node node , String prefix , String source ) {
122141 if (node == null ) return "∅\n " ;
123- String tree = node .inspect ();
142+ String tree = source != null ? node . inspect ( source ) : node .inspect ();
124143
125144 if (tree .endsWith ("\n " )) {
126145 tree = tree .substring (0 , tree .length () - 1 );
0 commit comments