//! Parser contains the command parser for handling receiving commands from the GUI
use std::collections::HashMap;
use commands;
use either::Either;
pub use either::Left;
pub use either::Right;
/// Token represents a parsable token in the string sent via STDIN from the GUI
#[derive(Debug, Eq, PartialEq)]
pub enum Token {
UCI,
DEBUG,
ISREADY,
SETOPTION,
REGISTER,
UCINEWGAME,
POSITION,
GO,
STOP,
PONDERHIT,
QUIT,
}
#[derive(Clone, Debug, PartialEq, PartialOrd)]
pub enum CommandValue {
Int(i32),
Float(f64),
Text(String),
Boolean(bool),
}
pub struct Parser {}
/// TokenResult is a convenient way to package an entire command string. It is identified by it's associated
/// Token, and the arguments.
///
/// Example:
///
/// setoption name Hash value 32
/// --------- ---- ---- ----- --
/// Token arg val arg val
///
/// debug on
/// ----- --
/// Token val
///
///
/// The user is still responsible for knowing what to look for in the hashmap but this structure makes it far
/// easier to work with commands. Some commands don't have arguments, in that case the args will be None.
#[derive(Debug, PartialEq)]
pub struct TokenResult {
token: Token,
args: Either