println('(' . $name); $this->indent++; } /** * Decreases indentation level by one and prints a closing parenthesis. * * This method is called after executing a production. */ public function endProduction(): void { $this->indent--; $this->println(')'); } /** * Prints text indented with spaces depending on current indentation level. * * @param string $str The text. */ public function println(string $str): void { if (! $this->silent) { echo str_repeat(' ', $this->indent), $str, "\n"; } } }