diff options
| author | Laurenz <laurmaedje@gmail.com> | 2019-10-17 12:55:34 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2019-10-17 12:55:34 +0200 |
| commit | 1987e5861cf2c033e3a540a5ef7c0f7106016929 (patch) | |
| tree | dcbf2d32c88d394e63b60e7473b2f6ba79fc83e3 /src/library/breaks.rs | |
| parent | f22f9513aea21408ebf6febd01912e630e9ad5e6 (diff) | |
Create basic box and line-break functions 📦
Diffstat (limited to 'src/library/breaks.rs')
| -rw-r--r-- | src/library/breaks.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/library/breaks.rs b/src/library/breaks.rs index 22d572f0..a622350f 100644 --- a/src/library/breaks.rs +++ b/src/library/breaks.rs @@ -1,5 +1,28 @@ use super::prelude::*; +/// Ends the current line. +#[derive(Debug, PartialEq)] +pub struct LinebreakFunc; + +impl Function for LinebreakFunc { + fn parse(header: &FuncHeader, body: Option<&str>, _: ParseContext) -> ParseResult<Self> + where Self: Sized { + if has_arguments(header) { + return err("linebreak: expected no arguments"); + } + + if body.is_some() { + return err("linebreak: expected no body"); + } + + Ok(LinebreakFunc) + } + + fn layout(&self, _: LayoutContext) -> LayoutResult<CommandList> { + Ok(commands![Command::FinishFlexRun]) + } +} + /// Ends the current page. #[derive(Debug, PartialEq)] pub struct PagebreakFunc; |
