synom

Stripped-down Nom parser used by Syn

4 releases

0.11.3 Mar 1, 2017
0.11.2 Feb 27, 2017
0.11.1 Feb 27, 2017
0.11.0 Feb 19, 2017

#4 in Procedural macro helpers

Download history 25822/week @ 2018-05-27 29492/week @ 2018-06-03 32753/week @ 2018-06-10 27771/week @ 2018-06-17 30234/week @ 2018-06-24 30558/week @ 2018-07-01 28899/week @ 2018-07-08 32361/week @ 2018-07-15 34758/week @ 2018-07-22 32657/week @ 2018-07-29 29184/week @ 2018-08-05 25227/week @ 2018-08-12 24479/week @ 2018-08-19

123,001 downloads per month
Used in 242 crates (6 directly)

MIT/Apache

55KB
736 lines


lib.rs:

Adapted from nom by removing the IResult::Incomplete variant which:

  • we don't need,
  • is an unintuitive footgun when working with non-streaming use cases, and
  • more than doubles compilation time.

Whitespace handling strategy

As (sy)nom is a parser combinator library, the parsers provided here and that you implement yourself are all made up of successively more primitive parsers, eventually culminating in a small number of fundamental parsers that are implemented in Rust. Among these are punct! and keyword!.

All synom fundamental parsers (those not combined out of other parsers) should be written to skip over leading whitespace in their input. This way, as long as every parser eventually boils down to some combination of fundamental parsers, we get correct whitespace handling at all levels for free.

For our use case, this strategy is a huge improvement in usability, correctness, and compile time over nom's ws! strategy.

Dependencies

~49KB

  • dev syn 0.11+parsing+full