8 releases

0.3.2 Feb 10, 2022
0.3.1 Feb 10, 2022
0.3.0 Jan 8, 2021
0.2.1 Jul 22, 2020
0.1.4 Jul 21, 2020

#1398 in Parser implementations


Used in knitting_chart

Custom license

26KB
609 lines

knitting_parser

LICENSE Rust Crates.io Version

A library designed to assist with parsing knitting patterns.

There seems to be no real standard for the syntax of a knitting pattern, so we are going to do our best at describing our own.

Syntax

  • All stitch names are lower case
  • A comma , separates stitches
  • Stitches can be grouped in parenthesis ( and )
  • Multipliers can be provided after a group or stitch: k x12 for twelve knits in a row
  • Groups can be embedded: (k, (p, ml)x2)x2 to produce k, p, ml, p, ml, k, p, ml, p, ml
  • Line starting with ## are for options
    • in_round : used to say the pattern is in the round.
    • start_wrong_side : used to say the pattern starts on the wrong side.
    • first_line=X : used to say the first line is X
  • Lines starting with # are ignored

Stitches

  • 1lcf
  • 1rcb
  • 2lcf
  • 2rcb
  • 3lcf
  • 3rcb
  • 4lcf
  • 4rcb
  • bead
  • bo
  • bobble
  • k
  • k2tog
  • kbf
  • kfb
  • ktbl
  • m kwise
  • m pwise
  • ml
  • mr
  • nostitch
  • p
  • p2tog
  • pbf
  • pfb
  • ptbl
  • sl kwise
  • sl pwise
  • ssk
  • ssp
  • yo

Documentation

docs.rs

Dependencies

~1MB
~19K SLoC