24 releases (12 breaking)

0.13.0 Nov 17, 2023
0.12.0 Sep 26, 2023
0.11.1 May 23, 2023
0.11.0 Jul 20, 2022
0.1.2 Sep 19, 2016

#37 in Parser implementations

Download history 116267/week @ 2024-08-08 118553/week @ 2024-08-15 131325/week @ 2024-08-22 127246/week @ 2024-08-29 140349/week @ 2024-09-05 131075/week @ 2024-09-12 130972/week @ 2024-09-19 151210/week @ 2024-09-26 144677/week @ 2024-10-03 134373/week @ 2024-10-10 147697/week @ 2024-10-17 148712/week @ 2024-10-24 148116/week @ 2024-10-31 152947/week @ 2024-11-07 164266/week @ 2024-11-14 141865/week @ 2024-11-21

635,950 downloads per month
Used in 885 crates (47 directly)

Apache-2.0 OR MIT

145KB
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 thing to see it in action is to pipe vim into it

cargo build --release --example parselog
vim | target/release/examples/parselog

Just type :q to exit.

Differences from original state machine description

  • UTF-8 Support for Input
  • OSC Strings can be terminated by 0x07
  • Only supports 7-bit codes. Some 8-bit codes are still supported, but they no longer work in all states.

Dependencies

~16–300KB