summaryrefslogtreecommitdiff
path: root/src/syntax/func
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2020-07-27 13:47:29 +0200
committerLaurenz <laurmaedje@gmail.com>2020-07-27 13:47:29 +0200
commit53ca5a7fc5829d4c5b1cffc6d5a5f1706f8ec3cd (patch)
tree517d63931d32e7425dad277c2d74fa7731227cb2 /src/syntax/func
parent9f400042cbb8aef7fa9b77b080f15a3701abf7a9 (diff)
Refactor parser 🚇
Diffstat (limited to 'src/syntax/func')
-rw-r--r--src/syntax/func/mod.rs17
1 files changed, 9 insertions, 8 deletions
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<Spanned<&'s str>>,
+}
-/// 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<Ident>,
- /// 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,