summaryrefslogtreecommitdiff
path: root/src/syntax/mod.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2020-09-30 12:38:02 +0200
committerLaurenz <laurmaedje@gmail.com>2020-09-30 12:45:33 +0200
commitbc1b4216a802d09e8d00dd277a0e204d49bcaa7f (patch)
tree31dabd48d5062fdd684797ed6053bf279ba67490 /src/syntax/mod.rs
parentfee5170a68a6ef97108d731a4873787894f65a06 (diff)
Reorganize syntax types into two modules 📦
Diffstat (limited to 'src/syntax/mod.rs')
-rw-r--r--src/syntax/mod.rs57
1 files changed, 9 insertions, 48 deletions
diff --git a/src/syntax/mod.rs b/src/syntax/mod.rs
index 70935e79..1b9f8ba8 100644
--- a/src/syntax/mod.rs
+++ b/src/syntax/mod.rs
@@ -1,50 +1,11 @@
-//! Syntax trees, parsing and tokenization.
+//! Syntax types.
-pub mod decoration;
-pub mod parsing;
-pub mod span;
-pub mod tokens;
-pub mod tree;
+mod decoration;
+mod span;
+mod token;
+mod tree;
-#[cfg(test)]
-mod tests {
- use super::span;
- use crate::prelude::*;
- use std::fmt::Debug;
-
- /// Assert that expected and found are equal, printing both and panicking
- /// and the source of their test case if they aren't.
- ///
- /// When `cmp_spans` is false, spans are ignored.
- pub fn check<T>(src: &str, exp: T, found: T, cmp_spans: bool)
- where
- T: Debug + PartialEq,
- {
- span::set_cmp(cmp_spans);
- let equal = exp == found;
- span::set_cmp(true);
-
- if !equal {
- println!("source: {:?}", src);
- if cmp_spans {
- println!("expected: {:#?}", exp);
- println!("found: {:#?}", found);
- } else {
- println!("expected: {:?}", exp);
- println!("found: {:?}", found);
- }
- panic!("test failed");
- }
- }
-
- pub fn s<T>(sl: usize, sc: usize, el: usize, ec: usize, v: T) -> Spanned<T> {
- Spanned::new(v, Span::new(Pos::new(sl, sc), Pos::new(el, ec)))
- }
-
- // Enables tests to optionally specify spans.
- impl<T> From<T> for Spanned<T> {
- fn from(t: T) -> Self {
- Spanned::zero(t)
- }
- }
-}
+pub use decoration::*;
+pub use span::*;
+pub use token::*;
+pub use tree::*;