From 7c67612b8a894187fa3b64725531a5459f9211bf Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 10 Aug 2018 22:33:29 +0300 Subject: organizize --- src/yellow/mod.rs | 62 ------------------------------------------------------- 1 file changed, 62 deletions(-) delete mode 100644 src/yellow/mod.rs (limited to 'src/yellow/mod.rs') diff --git a/src/yellow/mod.rs b/src/yellow/mod.rs deleted file mode 100644 index ff3bb221b..000000000 --- a/src/yellow/mod.rs +++ /dev/null @@ -1,62 +0,0 @@ -mod builder; -mod green; -mod red; -mod syntax; - -use std::{ - ops::Deref, - sync::Arc, - ptr, -}; -pub use self::syntax::{SyntaxNode, SyntaxNodeRef, SyntaxError}; -pub(crate) use self::{ - builder::GreenBuilder, - green::GreenNode, - red::RedNode, -}; - -pub trait TreeRoot: Deref + Clone + Send + Sync {} - -#[derive(Debug)] -pub struct SyntaxRoot { - red: RedNode, - pub(crate) errors: Vec, -} - -impl TreeRoot for Arc {} - -impl<'a> TreeRoot for &'a SyntaxRoot {} - -impl SyntaxRoot { - pub(crate) fn new(green: GreenNode, errors: Vec) -> SyntaxRoot { - SyntaxRoot { - red: RedNode::new_root(green), - errors, - } - } -} - -#[derive(Clone, Copy, PartialEq, Eq, Debug)] -pub(crate) struct RedPtr(ptr::NonNull); - -unsafe impl Send for RedPtr {} - -unsafe impl Sync for RedPtr {} - -impl RedPtr { - fn new(red: &RedNode) -> RedPtr { - RedPtr(red.into()) - } - - unsafe fn get<'a>(self, _root: &'a impl TreeRoot) -> &'a RedNode { - &*self.0.as_ptr() - } -} - -#[test] -fn assert_send_sync() { - fn f() {} - f::(); - f::(); - f::(); -} -- cgit v1.2.3