Fix node-types bugs involving aliases and external tokens

This commit is contained in:
Max Brunsfeld 2019-12-12 10:06:18 -08:00
parent 1b5ae380ce
commit fc19312913
3 changed files with 69 additions and 48 deletions

View file

@ -1,3 +1,4 @@
use super::grammars::VariableType;
use smallbitvec::SmallBitVec;
use std::collections::HashMap;
use std::iter::FromIterator;
@ -139,6 +140,16 @@ impl Rule {
}
}
impl Alias {
pub fn kind(&self) -> VariableType {
if self.is_named {
VariableType::Named
} else {
VariableType::Anonymous
}
}
}
#[cfg(test)]
impl Rule {
pub fn terminal(index: usize) -> Self {