diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-01-28 21:01:05 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-01-28 21:01:36 +0100 |
| commit | 9c906f92c50d453822b12896d29b7883802ea567 (patch) | |
| tree | 78e2465a4fa805bbddc80407b7eea585b5ebb60c /src/syntax/mod.rs | |
| parent | 3a07603b66fab6b343b34156f4a3a6015e2d69e1 (diff) | |
Parse `break`, `continue` and `return` expression
Diffstat (limited to 'src/syntax/mod.rs')
| -rw-r--r-- | src/syntax/mod.rs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/syntax/mod.rs b/src/syntax/mod.rs index 74a642ca..9b606e0e 100644 --- a/src/syntax/mod.rs +++ b/src/syntax/mod.rs @@ -689,6 +689,12 @@ pub enum NodeKind { ImportItems, /// An include expression: `include "chapter1.typ"`. IncludeExpr, + /// A break expression: `break`. + BreakExpr, + /// A continue expression: `continue`. + ContinueExpr, + /// A return expression: `return x + 1`. + ReturnExpr, /// A line comment, two slashes followed by inner contents, terminated with /// a newline: `//<str>\n`. LineComment, @@ -755,7 +761,7 @@ impl NodeKind { } } - /// Whether this token appears in Markup. + /// Which mode this token can appear in, in both if `None`. pub fn mode(&self) -> Option<TokenMode> { match self { Self::Markup(_) @@ -780,6 +786,9 @@ impl NodeKind { | Self::Block | Self::Ident(_) | Self::LetExpr + | Self::SetExpr + | Self::ShowExpr + | Self::WrapExpr | Self::IfExpr | Self::WhileExpr | Self::ForExpr @@ -897,6 +906,9 @@ impl NodeKind { Self::ImportExpr => "`import` expression", Self::ImportItems => "import items", Self::IncludeExpr => "`include` expression", + Self::BreakExpr => "`break` expression", + Self::ContinueExpr => "`continue` expression", + Self::ReturnExpr => "`return` expression", Self::LineComment => "line comment", Self::BlockComment => "block comment", Self::Error(_, _) => "parse error", |
