more complex tests
This commit is contained in:
parent
df5cb47cb4
commit
2c30975571
6 changed files with 179 additions and 320 deletions
|
|
@ -164,7 +164,7 @@ fn process(document: String) -> Result<Ast, String> {
|
|||
} else if let Some(s) = tok_is_symbol(&token) {
|
||||
obj = Ctr::Symbol(s);
|
||||
} else {
|
||||
return Err(format!("Unparsable token:{}", token));
|
||||
return Err(format!("Unparsable token: {}", token));
|
||||
}
|
||||
|
||||
token = String::new();
|
||||
|
|
@ -195,14 +195,14 @@ fn process(document: String) -> Result<Ast, String> {
|
|||
|
||||
|
||||
/* Returns true if token
|
||||
* - is all alphanumeric
|
||||
* - is all alphanumeric except dash and underscore
|
||||
*
|
||||
* else returns false
|
||||
*/
|
||||
fn tok_is_symbol(token: &String) -> Option<String> {
|
||||
let tok = token.as_str();
|
||||
for t in tok.chars() {
|
||||
if !t.is_alphabetic() && !t.is_digit(10) {
|
||||
if !t.is_alphabetic() && !t.is_digit(10) && !(t == '-') && !(t == '_') {
|
||||
return None
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue