scaffold
scaffold scaffold
This commit is contained in:
commit
2a3f0436d8
11 changed files with 5394 additions and 0 deletions
9
parser/Cargo.toml
Normal file
9
parser/Cargo.toml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
[package]
|
||||
name = "parser"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
strum = "0.27.1"
|
||||
strum_macros = "0.27.1"
|
||||
winnow = "0.7.11"
|
||||
11
parser/README.md
Normal file
11
parser/README.md
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# Parser library
|
||||
This is a parser for the BMS file format.
|
||||
Right now its goal is correctness of behaviour for what our _users_ expect as
|
||||
opposed to what the informal specs say.
|
||||
|
||||
This means we will inherit defaults from the most popular players such as LR2.
|
||||
|
||||
## Resources
|
||||
[BMS command memo by hitkey](https://hitkey.bms.ms/cmds.htm) was invaluable when
|
||||
writing this. Whilst it's rough around the edges from machine translation it's
|
||||
one of the most thorough English-language documents detailing the BMS spec.
|
||||
19
parser/src/header.rs
Normal file
19
parser/src/header.rs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
struct Header {
|
||||
player: Player,
|
||||
}
|
||||
|
||||
/// Defines the play side.
|
||||
#[derive(FromRepr, Debug, PartialEq, Clone)]
|
||||
#[repr(u8)]
|
||||
enum Player {
|
||||
One, // SP
|
||||
Two, // Couple play
|
||||
Three, // DP
|
||||
Four, // Battle Play. This is very, very rare
|
||||
}
|
||||
|
||||
impl Default for Player {
|
||||
fn default() -> Self {
|
||||
Self::One
|
||||
}
|
||||
}
|
||||
14
parser/src/lib.rs
Normal file
14
parser/src/lib.rs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
pub fn add(left: u64, right: u64) -> u64 {
|
||||
left + right
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn it_works() {
|
||||
let result = add(2, 2);
|
||||
assert_eq!(result, 4);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue