From 53ca5a7fc5829d4c5b1cffc6d5a5f1706f8ec3cd Mon Sep 17 00:00:00 2001 From: Laurenz Date: Mon, 27 Jul 2020 13:47:29 +0200 Subject: =?UTF-8?q?Refactor=20parser=20=F0=9F=9A=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/syntax/func/mod.rs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/syntax/func/mod.rs') diff --git a/src/syntax/func/mod.rs b/src/syntax/func/mod.rs index d379b407..4228488d 100644 --- a/src/syntax/func/mod.rs +++ b/src/syntax/func/mod.rs @@ -9,22 +9,23 @@ pub_use_mod!(maps); pub_use_mod!(keys); pub_use_mod!(values); +/// An invocation of a function. +#[derive(Debug, Clone, PartialEq)] +pub struct FuncCall<'s> { + pub header: FuncHeader, + /// The body as a raw string containing what's inside of the brackets. + pub body: Option>, +} -/// The parsed header of a function. +/// The parsed header of a function (everything in the first set of brackets). #[derive(Debug, Clone, PartialEq)] pub struct FuncHeader { - /// The function name, that is: - /// ```typst - /// [box: w=5cm] - /// ^^^ - /// ``` pub name: Spanned, - /// The arguments passed to the function. pub args: FuncArgs, } /// The positional and keyword arguments passed to a function. -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Default, Clone, PartialEq)] pub struct FuncArgs { /// The positional arguments. pub pos: Tuple, -- cgit v1.2.3