From 3a07603b66fab6b343b34156f4a3a6015e2d69e1 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Fri, 28 Jan 2022 20:17:30 +0100 Subject: Remove unnecessary group --- src/syntax/ast.rs | 96 +++++++++++++++++++++++++++---------------------------- 1 file changed, 48 insertions(+), 48 deletions(-) (limited to 'src/syntax') 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 @@ -875,54 +875,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), -} - -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 @@ -1041,6 +993,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), +} + +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(_) -- cgit v1.2.3