subconsciousnetwork / subtext

Markup for note taking
Apache License 2.0
271 stars 20 forks source link

Implement prototype Rust Subtext parser #22

Closed cdata closed 2 years ago

cdata commented 2 years ago

Rust Subtext

This change proposes a prototype Subtext parser written in Rust.

Currently it is implemented as a basic recursive descent parser. No sophisticated matching (e.g., regex) and almost no backtracking is used in the implementation. This simplicity is afforded us by Subtext's relative simple grammar. However, many edge cases may yet be unrecognized at this time.

Included is a small, not-comprehensive suite of tests that cover various Subtext block formats.

Additionally, there is an example that prints out the AST of a given input Subtext file.

The parser has only one dependency: a Servo crate that makes it more ergonomic to exercise zero-copy string sharing.

gordonbrander commented 2 years ago

Awesome! LGTM.