-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Access internal data of TokenVec
#310
Comments
Sure, I will have a look at it soon. |
jsinger67
added a commit
that referenced
this issue
Mar 20, 2024
Hi @dalance , /// A vector of tokens in a string representation
#[derive(Debug, Default)]
pub struct TokenVec(Vec<String>);
impl TokenVec {
/// Pushes a token to the vector
pub fn push(&mut self, token: String) {
self.0.push(token);
}
/// Returns an iterator over the tokens
pub fn iter(&self) -> std::slice::Iter<String> {
self.0.iter()
}
/// Returns a token at the given index
pub fn get(&self, index: usize) -> Option<&String> {
self.0.get(index)
}
} The changes are on branch jsinger67/issue310 for now. Br, |
Thanks! Looks good. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I want to handle
expected_tokens
ofSyntaxError
like below, but I can't access internalVec
ofTokenVec
.Could you add any API to access the internal
Vec
?The text was updated successfully, but these errors were encountered: