diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-01-28 20:17:30 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-01-28 20:17:30 +0100 |
| commit | 3a07603b66fab6b343b34156f4a3a6015e2d69e1 (patch) | |
| tree | 8abfbc80d3d5ceaf8921f64e7b358afe85a63421 /src/syntax | |
| parent | 76b1d4a93f6d045901f17db46d82a97c9f407703 (diff) | |
Remove unnecessary group
Diffstat (limited to 'src/syntax')
| -rw-r--r-- | src/syntax/ast.rs | 96 |
1 files changed, 48 insertions, 48 deletions
diff --git a/src/syntax/ast.rs b/src/syntax/ast.rs index 39854052..6732aa40 100644 --- a/src/syntax/ast.rs +++ b/src/syntax/ast.rs @@ -876,54 +876,6 @@ impl SetExpr { } node! { - /// An import expression: `import a, b, c from "utils.typ"`. - ImportExpr -} - -impl ImportExpr { - /// The items to be imported. - pub fn imports(&self) -> Imports { - self.0 - .children() - .find_map(|node| match node.kind() { - NodeKind::Star => Some(Imports::Wildcard), - NodeKind::ImportItems => { - let items = node.children().filter_map(RedRef::cast).collect(); - Some(Imports::Items(items)) - } - _ => None, - }) - .expect("import is missing items") - } - - /// The location of the importable file. - pub fn path(&self) -> Expr { - self.0.cast_last_child().expect("import is missing path") - } -} - -/// The items that ought to be imported from a file. -#[derive(Debug, Clone, PartialEq)] -pub enum Imports { - /// All items in the scope of the file should be imported. - Wildcard, - /// The specified items from the file should be imported. - Items(Vec<Ident>), -} - -node! { - /// An include expression: `include "chapter1.typ"`. - IncludeExpr -} - -impl IncludeExpr { - /// The location of the file to be included. - pub fn path(&self) -> Expr { - self.0.cast_last_child().expect("include is missing path") - } -} - -node! { /// A show expression: `show heading(body) as [*{body}*]`. ShowExpr } @@ -1042,6 +994,54 @@ impl ForPattern { } node! { + /// An import expression: `import a, b, c from "utils.typ"`. + ImportExpr +} + +impl ImportExpr { + /// The items to be imported. + pub fn imports(&self) -> Imports { + self.0 + .children() + .find_map(|node| match node.kind() { + NodeKind::Star => Some(Imports::Wildcard), + NodeKind::ImportItems => { + let items = node.children().filter_map(RedRef::cast).collect(); + Some(Imports::Items(items)) + } + _ => None, + }) + .expect("import is missing items") + } + + /// The location of the importable file. + pub fn path(&self) -> Expr { + self.0.cast_last_child().expect("import is missing path") + } +} + +/// The items that ought to be imported from a file. +#[derive(Debug, Clone, PartialEq)] +pub enum Imports { + /// All items in the scope of the file should be imported. + Wildcard, + /// The specified items from the file should be imported. + Items(Vec<Ident>), +} + +node! { + /// An include expression: `include "chapter1.typ"`. + IncludeExpr +} + +impl IncludeExpr { + /// The location of the file to be included. + pub fn path(&self) -> Expr { + self.0.cast_last_child().expect("include is missing path") + } +} + +node! { /// An identifier. Ident: NodeKind::Ident(_) } |
