9 unstable releases

0.6.2 Aug 2, 2022
0.6.1 Apr 7, 2022
0.6.0 Dec 22, 2021
0.5.0 Apr 14, 2021
0.1.0 Jun 30, 2019

#162 in Command-line interface

Download history 10924/week @ 2022-10-09 12163/week @ 2022-10-16 8145/week @ 2022-10-23 13140/week @ 2022-10-30 12933/week @ 2022-11-06 10850/week @ 2022-11-13 7654/week @ 2022-11-20 11111/week @ 2022-11-27 10219/week @ 2022-12-04 11039/week @ 2022-12-11 6203/week @ 2022-12-18 3450/week @ 2022-12-25 6047/week @ 2023-01-01 10718/week @ 2023-01-08 11854/week @ 2023-01-15 13883/week @ 2023-01-22

42,800 downloads per month
Used in 17 crates (via termwiz)

MIT license

53KB
1.5K SLoC

vtparse

This is an implementation of a parser for escape and control sequences. It is based on the DEC ANSI Parser.

It has been modified slightly to support UTF-8 sequences.

vtparse is the lowest level parser; it categorizes the basic types of sequences but does not ascribe any semantic meaning to them.

You may wish to look at termwiz::escape::parser::Parser in the termwiz crate if you're looking for semantic parsing.

Comparison with the vte crate

vtparse has support for dynamically sized OSC buffers, which makes it suitable for processing large escape sequences, such as those used by the iTerm2 image protocol.


lib.rs:

An implementation of the state machine described by DEC ANSI Parser, modified to support UTF-8.

This is sufficient to broadly categorize ANSI/ECMA-48 escape sequences that are commonly used in terminal emulators. It does not ascribe semantic meaning to those escape sequences; for example, if you wish to parse the SGR sequence that makes text bold, you will need to know which codes correspond to bold in your implementation of VTActor.

You may wish to use termwiz::escape::parser::Parser in the termwiz crate if you don't want to have to research all those possible escape sequences for yourself.

Dependencies

~14KB