lang: basic module syntax grammar

This commit is contained in:
Schrottkatze 2024-06-03 11:22:36 +02:00
parent f6da90a354
commit 946ac879a7
Signed by: schrottkatze
SSH key fingerprint: SHA256:hXb3t1vINBFCiDCmhRABHX5ocdbLiKyCdKI4HK2Rbbc
7 changed files with 136 additions and 8 deletions

View file

@ -111,7 +111,7 @@ impl Marker {
}
}
fn complete_node(mut self, p: &mut Parser, kind: NodeKind) -> CompletedMarker {
fn close_node(mut self, p: &mut Parser, kind: NodeKind) -> CompletedMarker {
self.bomb.defuse();
match &mut p.events[self.pos] {
Event::Start { kind: slot, .. } => *slot = kind.clone(),
@ -127,11 +127,11 @@ impl Marker {
}
pub(crate) fn complete(self, p: &mut Parser<'_, '_>, kind: SyntaxKind) -> CompletedMarker {
self.complete_node(p, NodeKind::Syntax(kind))
self.close_node(p, NodeKind::Syntax(kind))
}
pub(crate) fn error(self, p: &mut Parser, kind: SyntaxError) -> CompletedMarker {
self.complete_node(p, NodeKind::Error(kind))
self.close_node(p, NodeKind::Error(kind))
}
pub(crate) fn abandon(mut self, p: &mut Parser<'_, '_>) {