code: def test_deep_nested_rule(self) -> None:
      grammar = """
          start: 'a' ['b'['c'['d']]]
          """
      rules = parse_string(grammar, GrammarParser)
  
      printer = ASTGrammarPrinter()
      lines: List[str] = []
      printer.print_grammar_ast(rules, printer=lines.append)
  
      output = "\n".join(lines)
      expected_output = textwrap.dedent(
          """\
          └──Rule
             └──Rhs
                └──Alt
                   ├──NamedItem
                   │  └──StringLeaf("'a'")
                   └──NamedItem
                      └──Opt
                         └──Rhs
                            └──Alt
                               ├──NamedItem
                               │  └──StringLeaf("'b'")
                               └──NamedItem
                                  └──Opt
                                     └──Rhs
                                        └──Alt
                                           ├──NamedItem
                                           │  └──StringLeaf("'c'")
                                           └──NamedItem
                                              └──Opt
                                                 └──Rhs
                                                    └──Alt
                                                       └──NamedItem
                                                          └──StringLeaf("'d'")
                                  """
      )
  
      self.assertEqual(output, expected_output)
  
imports: import ast
  import difflib
  import io
  import textwrap
  import unittest
  from test import test_tools
  from typing import Dict, Any
  from tokenize import TokenInfo, NAME, NEWLINE, NUMBER, OP
label_desc: Use image node_id 3 for calling the TestGrammarVisualizer obj's underlying member method code with example usage: obj.test_deep_nested_rule() without return types