summaryrefslogtreecommitdiff
path: root/src/syntax/mod.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2020-01-21 17:09:31 +0100
committerLaurenz <laurmaedje@gmail.com>2020-01-21 17:09:31 +0100
commit78da2bdd5d77d1b8572e5e9da119bfa68127a3fa (patch)
tree020c8c39268690d34226eb7e33e75f86304988d6 /src/syntax/mod.rs
parent1c1c994c46f7dc30ee34dbc99b02f2342c4617f3 (diff)
Decoupled function parser 🔗 [WIP]
Diffstat (limited to 'src/syntax/mod.rs')
-rw-r--r--src/syntax/mod.rs21
1 files changed, 3 insertions, 18 deletions
diff --git a/src/syntax/mod.rs b/src/syntax/mod.rs
index 75407f82..a77c764e 100644
--- a/src/syntax/mod.rs
+++ b/src/syntax/mod.rs
@@ -23,22 +23,6 @@ pub mod prelude {
}
-pub struct Parsed<T> {
- pub output: T,
- pub errors: SpanVec<Error>,
- pub decorations: SpanVec<Decoration>,
-}
-
-impl<T> Parsed<T> {
- pub fn map<F, U>(self, f: F) -> Parsed<U> where F: FnOnce(T) -> U {
- Parsed {
- output: f(self.output),
- errors: self.errors,
- decorations: self.decorations,
- }
- }
-}
-
#[async_trait::async_trait(?Send)]
pub trait Model: Debug + ModelBounds {
async fn layout<'a>(
@@ -110,7 +94,7 @@ impl SyntaxModel {
#[async_trait::async_trait(?Send)]
impl Model for SyntaxModel {
- async fn layout<'a>(&'a self, ctx: LayoutContext<'_, '_>) -> Layouted<Commands<'a>> {
+ async fn layout<'a>(&'a self, _: LayoutContext<'_, '_>) -> Layouted<Commands<'a>> {
Layouted {
output: vec![Command::LayoutSyntaxModel(self)],
errors: vec![],
@@ -153,7 +137,8 @@ impl PartialEq for Node {
}
}
-#[derive(Debug, Copy, Clone, Eq, PartialEq)]
+#[derive(Debug, Copy, Clone, Eq, PartialEq, Serialize)]
+#[serde(rename_all = "camelCase")]
pub enum Decoration {
ValidFuncName,
InvalidFuncName,