Crates.io | specmc-base |
lib.rs | specmc-base |
version | 0.1.11 |
source | src |
created_at | 2024-06-08 13:00:22.617717 |
updated_at | 2024-06-12 16:43:24.109349 |
description | A library with common code for parsing Minecraft specification. |
homepage | |
repository | https://github.com/SpecMC/Base |
max_upload_size | |
id | 1265725 |
size | 13,471 |
A library with common code for parsing Minecraft specification.
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:?}");