scanner: expected array is strange with a EOF at the binigging
Closed this issue · 2 comments
vincenzopalazzo commented
let expected = vec![
token::CSVToken {
ty: token::CSVTokenType::EOF,
val: "".to_string(),
},
token::CSVToken {
ty: token::CSVTokenType::LiteralString,
val: "gflen".to_string(),
},
token::CSVToken {
ty: token::CSVTokenType::Byte,
val: "byte".to_string(),
},
token::CSVToken {
ty: token::CSVTokenType::LiteralString,
val: "globalfeatures".to_string(),
},
token::CSVToken {
ty: token::CSVTokenType::LiteralString,
val: "init".to_string(),
},
token::CSVToken {
ty: token::CSVTokenType::MsgData,
val: "msgdata".to_string(),
},
];
I do not understand why token::CSVTokenType::EOF
it is at the beginning
michiboo commented
cause I reverse the whole vector in order for testing the last line... vector does not allow pop back so that why I reverse it
vincenzopalazzo commented
why not access in the last position of the vector with array[array.len() - 1]
? I'm sure that to do that you must not pay O(N)
in rust!
You should find a better solution