I took the Token module from the Arcanum project and brought it over to here. It was a nice data oriented way of handling the Tokens. I then created a Lexer that can scan a file or text and allow the user to transform the scanned tokens before the final token array is returned. This should allow for more complex and specific tokens to be created for whatever domain is being targeted. I also added basic library examples and testing. Finally, I made sure the documentation generated nicely. This is now marked as version: 0.1.0
34 lines
999 B
Rust
34 lines
999 B
Rust
//! This is where information about the library.
|
|
|
|
|
|
|
|
/// The environment variable defined by Cargo for the name.
|
|
const NAME: Option<&str> = option_env!("CARGO_PKG_NAME");
|
|
|
|
/// The environment variable defined by Cargo for the version.
|
|
const VERSION: Option<&str> = option_env!("CARGO_PKG_VERSION");
|
|
|
|
/// The string to display if a value is not defined during compile time.
|
|
const NOT_DEFINED: &'static str = "UNDEFINED";
|
|
|
|
|
|
|
|
/// Returns the name of the library as defined by the CARGO_PKG_NAME. This is
|
|
/// set at compile time and comes from the Cargo.toml file.
|
|
///
|
|
/// If a value is not found, then it will return the not defined value.
|
|
pub fn get_name() -> &'static str
|
|
{
|
|
NAME.unwrap_or(NOT_DEFINED)
|
|
}
|
|
|
|
|
|
/// Returns the name of the library as defined by the CARGO_PKG_VERSION. This is
|
|
/// set at compile time and comes from the Cargo.toml file.
|
|
///
|
|
/// If a value is not found, then it will return the not defined value.
|
|
pub fn get_version() -> &'static str
|
|
{
|
|
VERSION.unwrap_or(NOT_DEFINED)
|
|
}
|