Browse Source

Some work on the parser

ag-yep
Taylor Bockman 7 years ago
parent
commit
0ce59d6169
  1. 4
      src/parser.rs
  2. 6
      tests/parser.rs

4
src/parser.rs

@ -52,8 +52,8 @@ impl Parser {
} }
/// Parses a single string from the GUI and turns it into a neatly packaged TokenResult for processing /// Parses a single string from the GUI and turns it into a neatly packaged TokenResult for processing
/// by the engine /// by the engine.
pub fn parse(s: &str) -> TokenResult { pub fn parse(s: &str) -> Result<TokenResult, &'static str> {
let tokens: Vec<&str> = s.split_whitespace().collect::<Vec<&str>>(); let tokens: Vec<&str> = s.split_whitespace().collect::<Vec<&str>>();
} }
} }

6
tests/parser.rs

@ -0,0 +1,6 @@
// TODO: Write parser tests before implementing the parser.
// Start with setoption and branch out from there. The commands are finite so you should be able
// to write a test for each one. Take the time to do this right so that the rest of this project is
// a cakewalk
//
// // Also remember to fix the constant thing noted in the lib.rs for uci.... lol
Loading…
Cancel
Save