Skip to content

Instantly share code, notes, and snippets.

@rust-play
Created March 13, 2018 23:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rust-play/f34c03ff396e7df4fb99f94f53c72dd2 to your computer and use it in GitHub Desktop.
Save rust-play/f34c03ff396e7df4fb99f94f53c72dd2 to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
use lexer::lex_token;
use lexer::lexer_parts::literal_lexer;
use constants::TokenTypes;
use constants::operations::OPARRAY;
use constants::delimiters::SEMICOLON;
use constants::datatypes::DATATYPESARRAY;
use constants::reserved_constants::RESERVEDCONSTANTSARRAY;
use constants::accessident::ACCESSIDENTARRAY;
use lexer::lexer_parts::data_type_lexer;
use lexer::lexer_parts::op_token_lexer;
use lexer::lexer_parts::end_token_lexer;
pub fn is_token_accessident(vect_token:&String)-> bool{
let mut is_token_acessident: bool = false;
for accessident_token in ACCESSIDENTARRAY {
if (vect_token == accessident_token) {
//println!("{}", reserved_word);
is_token_acessident = true;
}
}
return is_token_acessident
}
pub fn lex_valid_accessident_token(vect_token: &String) -> String {
let mut valid_accessident_token: String = String::from("");
for accessident_token in DATATYPESARRAY {
if accessident_token == &vect_token {
valid_accessident_token = accessident_token.to_string();
return valid_accessident_token;
}
}
return valid_accessident_token
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment