my $new_structs = <<'NEW_STRUCTS';
/// CREATE SEQUENCE statement
#[derive(Debug, Clone, PartialEq)]
pub struct CreateSequenceStatement {
    pub token: Token,
    pub name: TableName,
    pub if_not_exists: bool,
    pub start_with: Option<i64>,
    pub increment_by: Option<i64>,
    pub min_value: Option<i64>,
    pub max_value: Option<i64>,
    pub cycle: bool,
}

impl fmt::Display for CreateSequenceStatement {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(f, "CREATE SEQUENCE ")?;
        if self.if_not_exists {
            write!(f, "IF NOT EXISTS ")?;
        }
        write!(f, "{}", self.name)?;
        if let Some(v) = self.start_with {
            write!(f, " START WITH {}", v)?;
        }
        if let Some(v) = self.increment_by {
            write!(f, " INCREMENT BY {}", v)?;
        }
        if let Some(v) = self.min_value {
            write!(f, " MINVALUE {}", v)?;
        }
        if let Some(v) = self.max_value {
            write!(f, " MAXVALUE {}", v)?;
        }
        if self.cycle {
            write!(f, " CYCLE")?;
        }
        Ok(())
    }
}

impl Node for CreateSequenceStatement {
    fn token_literal(&self) -> &str {
        self.token.literal()
    }
    fn position(&self) -> Position {
        self.token.position
    }
}

/// ALTER SEQUENCE statement
#[derive(Debug, Clone, PartialEq)]
pub struct AlterSequenceStatement {
    pub token: Token,
    pub name: TableName,
    pub if_exists: bool,
    pub restart_with: Option<i64>,
    pub increment_by: Option<i64>,
    pub min_value: Option<i64>,
    pub max_value: Option<i64>,
    pub cycle: Option<bool>,
}

impl fmt::Display for AlterSequenceStatement {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(f, "ALTER SEQUENCE ")?;
        if self.if_exists {
            write!(f, "IF EXISTS ")?;
        }
        write!(f, "{}", self.name)?;
        if let Some(v) = self.restart_with {
            write!(f, " RESTART WITH {}", v)?;
        }
        if let Some(v) = self.increment_by {
            write!(f, " INCREMENT BY {}", v)?;
        }
        if let Some(v) = self.min_value {
            write!(f, " MINVALUE {}", v)?;
        }
        if let Some(v) = self.max_value {
            write!(f, " MAXVALUE {}", v)?;
        }
        if let Some(v) = self.cycle {
            write!(f, " {}", if v { "CYCLE" } else { "NO CYCLE" })?;
        }
        Ok(())
    }
}

impl Node for AlterSequenceStatement {
    fn token_literal(&self) -> &str {
        self.token.literal()
    }
    fn position(&self) -> Position {
        self.token.position
    }
}

/// DROP SEQUENCE statement
#[derive(Debug, Clone, PartialEq)]
pub struct DropSequenceStatement {
    pub token: Token,
    pub name: TableName,
    pub if_exists: bool,
}

impl fmt::Display for DropSequenceStatement {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(f, "DROP SEQUENCE ")?;
        if self.if_exists {
            write!(f, "IF EXISTS ")?;
        }
        write!(f, "{}", self.name)
    }
}

impl Node for DropSequenceStatement {
    fn token_literal(&self) -> &str {
        self.token.literal()
    }
    fn position(&self) -> Position {
        self.token.position
    }
}

NEW_STRUCTS

open my $fh, '<', 'src/parser/ast.rs' or die $!;
my $content = do { local $/; <$fh> };
close $fh;

$content =~ s/(\/\/\/ CREATE SCHEMA statement)/$new_structs$1/;

open $fh, '>', 'src/parser/ast.rs' or die $!;
print $fh $content;
close $fh;
