rust/src/parser/event_parser/grammar/paths.rs

20 lines
411 B
Rust
Raw Normal View History

2018-01-09 21:32:18 +01:00
use super::*;
pub(crate) fn use_path(p: &mut Parser) {
if !AnyOf(&[IDENT, COLONCOLON]).is_ahead(p) {
return;
}
node(p, PATH, |p| {
p.eat(COLONCOLON);
path_segment(p);
2018-01-11 18:55:08 +01:00
});
many(p, |p| {
node_if(p, COLONCOLON, PATH, |p| {
path_segment(p);
})
});
2018-01-09 21:32:18 +01:00
}
fn path_segment(p: &mut Parser) -> bool {
2018-01-11 18:55:08 +01:00
node_if(p, IDENT, PATH_SEGMENT, |_| ())
2018-01-09 21:32:18 +01:00
}