diff options
| author | Laurenz <laurmaedje@gmail.com> | 2020-02-03 10:37:50 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2020-02-03 10:37:50 +0100 |
| commit | 40ea35cbe7482ce04096c4d63a848c8601cc1848 (patch) | |
| tree | 080a5727ba552ee4b2bf750208e5c243c1e195ef /src/syntax | |
| parent | 20fb4e7c379b79b84d9884d5f2c89d781c5793e2 (diff) | |
Upgrade to new toddle interface 🐳
Diffstat (limited to 'src/syntax')
| -rw-r--r-- | src/syntax/func/values.rs | 6 | ||||
| -rw-r--r-- | src/syntax/mod.rs | 10 | ||||
| -rw-r--r-- | src/syntax/parsing.rs | 2 | ||||
| -rw-r--r-- | src/syntax/scope.rs | 2 |
4 files changed, 13 insertions, 7 deletions
diff --git a/src/syntax/func/values.rs b/src/syntax/func/values.rs index 515d6a43..e4a0b2ad 100644 --- a/src/syntax/func/values.rs +++ b/src/syntax/func/values.rs @@ -145,7 +145,7 @@ impl Value for FontStyle { type Output = Self; fn parse(expr: Spanned<Expr>) -> Result<Self::Output, Error> { - FontStyle::from_str(Ident::parse(expr)?.as_str()) + FontStyle::from_name(Ident::parse(expr)?.as_str()) .ok_or_else(|| err!("invalid font style")) } } @@ -166,7 +166,7 @@ impl Value for FontWeight { } } Expr::Ident(id) => { - FontWeight::from_str(id.as_str()) + FontWeight::from_name(id.as_str()) .ok_or_else(|| err!("invalid font weight")) .map(|weight| (weight, false)) } @@ -180,7 +180,7 @@ impl Value for Paper { type Output = Self; fn parse(expr: Spanned<Expr>) -> Result<Self::Output, Error> { - Paper::from_str(Ident::parse(expr)?.as_str()) + Paper::from_name(Ident::parse(expr)?.as_str()) .ok_or_else(|| err!("invalid paper type")) } } diff --git a/src/syntax/mod.rs b/src/syntax/mod.rs index 4430f6e8..9d83e546 100644 --- a/src/syntax/mod.rs +++ b/src/syntax/mod.rs @@ -23,7 +23,10 @@ pub_use_mod!(tokens); pub trait Model: Debug + ModelBounds { /// Layout the model into a sequence of commands processed by a /// [`ModelLayouter`](crate::layout::ModelLayouter). - async fn layout<'a>(&'a self, ctx: LayoutContext<'_, '_>) -> Layouted<Commands<'a>>; + async fn layout<'a>( + &'a self, + ctx: LayoutContext<'_>, + ) -> Layouted<Commands<'a>>; } /// A tree representation of source code. @@ -47,7 +50,10 @@ impl SyntaxModel { #[async_trait(?Send)] impl Model for SyntaxModel { - async fn layout<'a>(&'a self, _: LayoutContext<'_, '_>) -> Layouted<Commands<'a>> { + async fn layout<'a>( + &'a self, + _: LayoutContext<'_>, + ) -> Layouted<Commands<'a>> { Layouted { output: vec![Command::LayoutSyntaxModel(self)], errors: vec![], diff --git a/src/syntax/parsing.rs b/src/syntax/parsing.rs index 9d128a46..1e8cc74f 100644 --- a/src/syntax/parsing.rs +++ b/src/syntax/parsing.rs @@ -81,7 +81,7 @@ pub fn parse(start: Position, src: &str, ctx: ParseContext) -> Parsed<SyntaxMode Token::Star => Node::ToggleBolder, Token::Underscore => Node::ToggleItalic, Token::Backtick => Node::ToggleMonospace, - Token::Text(text) => Node::Text(text.to_owned()), + Token::Text(text) => Node::Text(text.to_string()), Token::LineComment(_) | Token::BlockComment(_) => continue, diff --git a/src/syntax/scope.rs b/src/syntax/scope.rs index 895ee498..a6d27c1e 100644 --- a/src/syntax/scope.rs +++ b/src/syntax/scope.rs @@ -43,7 +43,7 @@ impl Scope { pub fn add_with_meta<F>(&mut self, name: &str, metadata: <F as ParseFunc>::Meta) where F: ParseFunc + Model + 'static { self.parsers.insert( - name.to_owned(), + name.to_string(), parser::<F>(metadata), ); } |
