You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: from_syntax.rs
    path of file: ./repos/taplo/crates/taplo/src/dom
    
    the code of the file until where you have to start completion: use super::{
    error::Error,
    node::{
        Array, ArrayInner, ArrayKind, Bool, BoolInner, DateTime, DateTimeInner, DomNode, Float,
        FloatInner, Integer, IntegerInner, IntegerRepr, Invalid, InvalidInner, Key, KeyInner, Node,
        Str, StrInner, StrRepr, Table, TableInner, TableKind,
    },
    Comment, Keys,
};
use crate::{
    private::Sealed,
    syntax::{SyntaxElement, SyntaxKind::*},
    util::{iter::ExactIterExt, shared::Shared},
};
use either::Either;

pub trait FromSyntax: Sized + Sealed {
    fn from_syntax(syntax: SyntaxElement) -> Self;
}

impl FromSyntax for Node {
    fn from_syntax(syntax: SyntaxElement) -> Self {
        match syntax.kind() {
            VALUE => {
                if let Some(child) = syntax.as_node().and_then(|n| n.first_child_or_token()) {
                    Node::from_syntax(child)
                } else {
                    Invalid::from_syntax(syntax).into()
                }
            }
            STRING | MULTI_LINE_STRING | STRING_LITERAL | MULTI_LINE_STRING_LITERAL => {
                Str::from_syntax(syntax).into()
            }
            INTEGER | INTEGER_HEX | INTEGER_OCT | INTEGER_BIN => {
                Integer::from_syntax(syntax).into()
            }
            FLOAT => Float::from_syntax(syntax).into(),
            BOOL => Bool::from_syntax(syntax).into(),
            DATE_TIME_OFFSET | DATE_TIME_LOCAL | DATE | TIME => {
                DateTime::from_syntax(syntax).into()
            }
            ARRAY => Array::from_syntax(syntax).into(),
            INLINE_TABLE | ROOT => Table::from_syntax(syntax).into(),
            _ => Invalid::from_syntax(syntax).into(),
        }
    }
}

impl FromSyntax for Table {
    fn from_syntax(syntax: SyntaxElement) -> Self {
        let mut errors = Vec::new();
        match syntax.kind() {
            ROOT => root_from_syntax(syntax),
            TABLE_HEADER | TABLE_ARRAY_HEADER => TableInner {
                errors: errors.into(),
                syntax: Some(syntax),
                header: true,
     
    
fn merge_intermediate(key: Key, table: Table) -> Table {
    let mut current_table = table;
    let new_table = Table::pseudo(&key, true);
    current_table.clone().inner.entries.update(|entries| {
        if let Some((existing_key, existing_node)) = entries.lookup.get_key_value(&key) {
            if let Some(key_syntax) = key.syntax() {
                existing_key
                    .inner
                    .additional_syntaxes
                    .update(|key_syntaxes| {
                        key_syntaxes.push(key_syntax.clone());
                    });
            }

            match existing_node {
                Node::Table(existing_table) => {
                    if !matches!(
                        existing_table.inner.kind,
                        TableKind::Regular | TableKind::Pseudo
                    ) {
                        existing_table.inner.errors.update(|errors| {
                            errors.push(Error::ExpectedTable {
                                not_table: existing_key.clone(),
                                required_by: key.clone(),
                            })
                        });
                    }

                    current_table = existing_table.clone();
                }
                Node::Array(existing_array) => {
                    if existing_array.inner.kind != ArrayKind::Tables {
                        existing_array.inner.errors.update(|errors| {
                            errors.push(Error::ExpectedArrayOfTables {
                                not_array_of_tables: existing_key.clone(),
                                required_by: key.clone(),
                            })
                        });
                    }

                    let items = existing_array.inner.items.read();

                    let item = items.iter().last();

                    if let Some(Node::Table(t)) = item {
                        current_table = t.clone();
                    } else {
                        let pt = Table::pseudo(&key, true);
                        existing_array
                            .inner
                            .items
                            .update(|items| items.push(pt.clone().into()));
                        current_table = pt;
                    }
                }
                _ => {
                    current_table.inner.errors.update(|errors| {
                        errors.push(Error::ExpectedTable {
                            not_table: existing_key.clone(),
                            required_by: key.clone(),
                        })
                    });
                    entries.add(key, new_table.clone().into());
                    current_table = new_table.clone();
                }
            }
        } else {
            entries.add(key, new_table.clone().into());
            current_table = new_table.clone();
        }
    });
    current_table
}