Skip to content

feat: add fmt.Stringer implementation for Node#151

Merged
ianlewis merged 1 commit intomainfrom
98-feature-utilities-for-printing-tokens-and-trees
Nov 11, 2025
Merged

feat: add fmt.Stringer implementation for Node#151
ianlewis merged 1 commit intomainfrom
98-feature-utilities-for-printing-tokens-and-trees

Conversation

@ianlewis
Copy link
Copy Markdown
Owner

@ianlewis ianlewis commented Nov 11, 2025

Description:

Add a fmt.Stringer implementation for Node. The String method prints the full tree structure of the Node and its children in a human friendly format similar to the GNU tree program.

Related Issues:

Fixes #98

Checklist:

  • Review the CONTRIBUTING.md documentation.
  • Add a reference to a related issue in the repository.
  • Add a description of the changes proposed in the pull request.
  • Add unit tests if applicable.
  • Update documentation if applicable.
  • Add a note in the CHANGELOG.md if applicable.

@ianlewis ianlewis linked an issue Nov 11, 2025 that may be closed by this pull request
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Nov 11, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.09%. Comparing base (e14f106) to head (32c6480).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #151      +/-   ##
==========================================
+ Coverage   83.85%   86.09%   +2.24%     
==========================================
  Files           5        5              
  Lines         353      374      +21     
==========================================
+ Hits          296      322      +26     
+ Misses         40       34       -6     
- Partials       17       18       +1     
Files with missing lines Coverage Δ
parser.go 91.93% <100.00%> (+1.64%) ⬆️

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ianlewis ianlewis force-pushed the 98-feature-utilities-for-printing-tokens-and-trees branch from 65d351e to 29dc7ad Compare November 11, 2025 11:10
@ianlewis ianlewis requested a review from Copilot November 11, 2025 11:12
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a fmt.Stringer implementation to the Node type, enabling it to render tree structures in a human-readable format similar to the GNU tree program. The implementation recursively formats nodes and their children with proper indentation and tree-drawing characters.

Key changes:

  • Added String() method to Node type implementing fmt.Stringer interface
  • Implemented recursive fmtNode() helper function for tree formatting
  • Added comprehensive test coverage for the new functionality

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
parser.go Implements String() and fmtNode() methods for tree-formatted output of Node structures
parser_test.go Adds test case validating the tree formatting output with nested child nodes

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Add a `fmt.Stringer` implementation for `Node`. The `String` method
prints the full tree structure of the `Node` and its children in a human
friendly format similar to the GNU `tree` program.

Signed-off-by: Ian Lewis <ian@ianlewis.org>
@ianlewis ianlewis force-pushed the 98-feature-utilities-for-printing-tokens-and-trees branch from 29dc7ad to 32c6480 Compare November 11, 2025 11:34
@ianlewis ianlewis merged commit 1939770 into main Nov 11, 2025
24 checks passed
@ianlewis ianlewis deleted the 98-feature-utilities-for-printing-tokens-and-trees branch November 11, 2025 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feature] Utilities for printing tokens and trees

3 participants