tamer: nir::air: Lower to Air::TODO

This actually passes data to the next parser, whereas before we were
stopping short.

DEV-13160
main
Mike Gerwitz 2022-12-13 14:28:16 -05:00
parent d55b3add77
commit be41d056bb
2 changed files with 9 additions and 1 deletions

View File

@ -60,6 +60,10 @@ pub type DepSym = SymbolId;
/// subsequently analyzed and rewritten. /// subsequently analyzed and rewritten.
#[derive(Debug, PartialEq)] #[derive(Debug, PartialEq)]
pub enum AirToken { pub enum AirToken {
/// Placeholder token for objects that do not yet have a proper place on
/// the ASG.
Todo,
/// Declare a resolved identifier. /// Declare a resolved identifier.
IdentDecl(IdentSym, IdentKind, Source), IdentDecl(IdentSym, IdentKind, Source),
/// Declare an external identifier that must be resolved before linking. /// Declare an external identifier that must be resolved before linking.
@ -91,6 +95,8 @@ impl Display for AirToken {
use AirToken::*; use AirToken::*;
match self { match self {
Todo => write!(f, "TODO"),
IdentDecl(sym, ..) => { IdentDecl(sym, ..) => {
write!(f, "declaration of identifier `{sym}`") write!(f, "declaration of identifier `{sym}`")
} }
@ -139,6 +145,8 @@ impl ParseState for AirAggregate {
use AirToken::*; use AirToken::*;
match (self, tok) { match (self, tok) {
(Empty, Todo) => Transition(Empty).incomplete(),
(Empty, IdentDecl(sym, kind, src)) => { (Empty, IdentDecl(sym, kind, src)) => {
asg.declare(sym, kind, src).map(|_| ()).transition(Empty) asg.declare(sym, kind, src).map(|_| ()).transition(Empty)
} }

View File

@ -53,7 +53,7 @@ impl ParseState for NirToAir {
_tok: Self::Token, _tok: Self::Token,
_: NoContext, _: NoContext,
) -> TransitionResult<Self::Super> { ) -> TransitionResult<Self::Super> {
Transition(self).incomplete() Transition(self).ok(Air::Todo)
} }
fn is_accepting(&self, _: &Self::Context) -> bool { fn is_accepting(&self, _: &Self::Context) -> bool {