#dnd #dice #parser #ttrpg

dice-command-parser

A library for parsing basic dice roll commands like 2d20 + 2a

9 unstable releases

0.7.3 Aug 30, 2021
0.7.2 Apr 18, 2021
0.6.0 Aug 21, 2020
0.5.1 May 10, 2020
0.3.1 Mar 22, 2020

#5 in #dnd

Download history 29/week @ 2023-02-05 26/week @ 2023-02-12 47/week @ 2023-02-19 1/week @ 2023-02-26 25/week @ 2023-03-05 26/week @ 2023-03-12 10/week @ 2023-03-19 6/week @ 2023-03-26 9/week @ 2023-04-02 34/week @ 2023-04-09 6/week @ 2023-04-16 6/week @ 2023-04-23 24/week @ 2023-04-30 27/week @ 2023-05-07 8/week @ 2023-05-14 7/week @ 2023-05-21

66 downloads per month
Used in 2 crates (via dnd_dice_roller)

MIT license

32KB
757 lines

Dice Command Parser

This library parses a simple dice roll command and produces a representation of the dice that should be rolled and its modifier.

Example input: d6, 3d20, d6 + 5, or 2d20 - 4, d20+4d, d100, d100, d100.


lib.rs:

This crate provides functionality for the basic parsing of dice roll commands e.g. d100, d6 + 5, 2d20 - 1. Given some input it will produce a DiceRollWithOp struct which can be used to then calculate a result.

Dependencies

~1.2–1.8MB
~39K SLoC