charmbracelet / charmbracelet/x

ansi: implement a new ansi.Scanner to replace ansi.Parser

Open
#239 0 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
314
Forks
94
Avg merge
3d 22h
Merged PRs (30d)
2

Description

Currently, the `ansi.Parser` API is hard to work with and feels flaky. We need a cleaner and Golang idiomatic way to parse sequences and text.

We might need to come up with a container type that can hold the scanned/parsed data to limit allocations. Limiting allocations should be optional, and defaults to unlimited allocations when not specified (or zero is used).

Should we drop the `parser` sub-package? Replace that with `ansi.DecodeSequence`? Are there any performance penalties for doing so? How will the new scanner API look like?

Related: https://github.com/charmbracelet/x/pull/215

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the existing ansi.Parser API and parser sub-package, then compare the related pull request #215. Investigate the proposed ansi.Scanner and ansi.DecodeSequence directions, including optional allocation limits and performance trade-offs. Done means an agreed, idiomatic replacement design with a clear migration path.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.