specmc-base

Crates.iospecmc-base
lib.rsspecmc-base
version0.1.11
sourcesrc
created_at2024-06-08 13:00:22.617717
updated_at2024-06-12 16:43:24.109349
descriptionA library with common code for parsing Minecraft specification.
homepage
repositoryhttps://github.com/SpecMC/Base
max_upload_size
id1265725
size13,471
TheAIguy_ (TheAIguy-dev)

documentation

README

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:?}");
Commit count: 27

cargo fmt