compound ops

This commit is contained in:
Aleksey Kladov 2018-08-05 16:09:25 +03:00
parent 5691da4c84
commit 1e1e2e83c4
8 changed files with 171 additions and 16 deletions

View file

@ -58,6 +58,10 @@ impl<'t> Parser<'t> {
self.current() == kind
}
pub(crate) fn at_compound2(&self, c1: SyntaxKind, c2: SyntaxKind) -> bool {
self.0.at_compound2(c1, c2)
}
/// Checks if the current token is contextual keyword with text `t`.
pub(crate) fn at_contextual_kw(&self, t: &str) -> bool {
self.0.at_kw(t)
@ -85,6 +89,13 @@ impl<'t> Parser<'t> {
self.0.bump_remap(kind);
}
/// Advances the parser by `n` tokens, remapping its kind.
/// This is useful to create compound tokens from parts. For
/// example, an `<<` token is two consecutive remapped `<` tokens
pub(crate) fn bump_compound(&mut self, kind: SyntaxKind, n: u8) {
self.0.bump_compound(kind, n);
}
/// Emit error with the `message`
/// TODO: this should be much more fancy and support
/// structured errors with spans and notes, like rustc