diff options
Diffstat (limited to 'src/syntax/scope.rs')
| -rw-r--r-- | src/syntax/scope.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/syntax/scope.rs b/src/syntax/scope.rs index 83b9fdee..d3092944 100644 --- a/src/syntax/scope.rs +++ b/src/syntax/scope.rs @@ -5,7 +5,7 @@ use std::fmt::{self, Debug, Formatter}; use crate::func::ParseFunc; use super::parsing::CallParser; -use super::model::Model; +use super::tree::DynamicNode; /// A map from identifiers to function parsers. pub struct Scope { @@ -17,7 +17,7 @@ impl Scope { /// Create a new empty scope with a fallback parser that is invoked when no /// match is found. pub fn new<F>() -> Scope - where F: ParseFunc<Meta=()> + Model + 'static { + where F: ParseFunc<Meta=()> + DynamicNode + 'static { Scope { parsers: HashMap::new(), fallback: make_parser::<F>(()), @@ -31,14 +31,14 @@ impl Scope { /// Associate the given name with a type that is parseable into a function. pub fn add<F>(&mut self, name: &str) - where F: ParseFunc<Meta=()> + Model + 'static { + where F: ParseFunc<Meta=()> + DynamicNode + 'static { self.add_with_meta::<F>(name, ()); } /// Add a parseable type with additional metadata that is given to the /// parser (other than the default of `()`). pub fn add_with_meta<F>(&mut self, name: &str, metadata: <F as ParseFunc>::Meta) - where F: ParseFunc + Model + 'static { + where F: ParseFunc + DynamicNode + 'static { self.parsers.insert( name.to_string(), make_parser::<F>(metadata), @@ -65,9 +65,9 @@ impl Debug for Scope { } fn make_parser<F>(metadata: <F as ParseFunc>::Meta) -> Box<CallParser> -where F: ParseFunc + Model + 'static { +where F: ParseFunc + DynamicNode + 'static { Box::new(move |f, s| { F::parse(f, s, metadata.clone()) - .map(|model| Box::new(model) as Box<dyn Model>) + .map(|tree| Box::new(tree) as Box<dyn DynamicNode>) }) } |
