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

#42 in Parser implementations

Download history 120155/week @ 2024-07-23 121608/week @ 2024-07-30 115538/week @ 2024-08-06 117084/week @ 2024-08-13 120024/week @ 2024-08-20 133774/week @ 2024-08-27 137107/week @ 2024-09-03 132099/week @ 2024-09-10 130526/week @ 2024-09-17 146871/week @ 2024-09-24 152499/week @ 2024-10-01 129628/week @ 2024-10-08 145302/week @ 2024-10-15 146331/week @ 2024-10-22 149180/week @ 2024-10-29 149744/week @ 2024-11-05

612,979 downloads per month
Used in 875 crates (46 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–290KB