#identifier

specmc-base

A library with common code for parsing Minecraft specification

8 releases

0.1.11 Jun 12, 2024
0.1.10 Jun 9, 2024

#69 in #identifier

Download history 1/week @ 2024-07-29 102/week @ 2024-09-30

499 downloads per month
Used in specmc-protocol

MIT license

10KB
215 lines

SpecMC Base

A library with common code for parsing Minecraft specification.

Examples

use specmc_base::{
    parse::{Identifier, Literal, Parse},
    tokenize::tokenize,
};

let mut tokens: Vec<String> = tokenize("true 42 123.0 \"string\" cool_identifier");
tokens.reverse();

let lit_bool: Literal = Literal::parse(&mut tokens).unwrap();
let lit_int: Literal = Literal::parse(&mut tokens).unwrap();
let lit_float: Literal = Literal::parse(&mut tokens).unwrap();
let lit_str: Literal = Literal::parse(&mut tokens).unwrap();
let ident: Identifier = Identifier::parse(&mut tokens).unwrap();

println!("{lit_bool:?} {lit_int:?} {lit_float:?} {lit_str:?} {ident:?}");

lib.rs:

A library with common code for parsing Minecraft specification.

Dependencies

~265–720KB
~17K SLoC