27 unstable releases

new 0.14.1 Jan 12, 2025
0.13.1 Jan 2, 2025
0.13.0 Nov 17, 2023
0.11.1 May 23, 2023
0.1.2 Sep 19, 2016

#28 in Parser implementations

Download history 148119/week @ 2024-09-22 149329/week @ 2024-09-29 136662/week @ 2024-10-06 140255/week @ 2024-10-13 147484/week @ 2024-10-20 146380/week @ 2024-10-27 153740/week @ 2024-11-03 154821/week @ 2024-11-10 171983/week @ 2024-11-17 148896/week @ 2024-11-24 167321/week @ 2024-12-01 161909/week @ 2024-12-08 172830/week @ 2024-12-15 110204/week @ 2024-12-22 105900/week @ 2024-12-29 172982/week @ 2025-01-05

572,349 downloads per month
Used in 918 crates (48 directly)

Apache-2.0 OR MIT

150KB
3K SLoC

vte

Build Status Crates.io Version

Parser for implementing virtual terminal emulators in Rust.

The parser is implemented according to Paul Williams' ANSI parser state machine. The state machine doesn't assign meaning to the parsed data and is thus not itself sufficient for writing a terminal emulator. Instead, it is expected that an implementation of the Perform trait which does something useful with the parsed data. The Parser handles the book keeping, and the Perform gets to simply handle actions.

See the docs for more info.


lib.rs:

Parser for implementing virtual terminal emulators

Parser is implemented according to Paul Williams' ANSI parser state machine. The state machine doesn't assign meaning to the parsed data and is thus not itself sufficient for writing a terminal emulator. Instead, it is expected that an implementation of Perform is provided which does something useful with the parsed data. The Parser handles the book keeping, and the Perform gets to simply handle actions.

Examples

For an example of using the Parser please see the examples folder. The example included there simply logs all the actions Perform does. One quick way to see it in action is to pipe printf into it

printf '\x1b[31mExample' | cargo run --example parselog

Differences from original state machine description

  • UTF-8 Support for Input
  • OSC Strings can be terminated by 0x07
  • Only supports 7-bit codes

Dependencies

~120–530KB