From 4dbd9285c91d59d527f4324df4aaf239ecb007ca Mon Sep 17 00:00:00 2001 From: Laurenz Date: Fri, 11 Jun 2021 14:00:06 +0200 Subject: Basic enums --- src/syntax/node.rs | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'src/syntax/node.rs') diff --git a/src/syntax/node.rs b/src/syntax/node.rs index b4684d0b..a97430b6 100644 --- a/src/syntax/node.rs +++ b/src/syntax/node.rs @@ -21,8 +21,10 @@ pub enum Node { Raw(RawNode), /// A section heading: `= Introduction`. Heading(HeadingNode), - /// A single list item: `- ...`. - List(ListNode), + /// An item in an unordered list: `- ...`. + List(ListItem), + /// An item in an enumeration (ordered list): `1. ...`. + Enum(EnumItem), /// An expression. Expr(Expr), } @@ -115,11 +117,22 @@ pub struct HeadingNode { pub body: Rc, } -/// A single list item: `- ...`. +/// An item in an unordered list: `- ...`. #[derive(Debug, Clone, PartialEq)] -pub struct ListNode { +pub struct ListItem { /// The source code location. pub span: Span, /// The contents of the list item. pub body: Tree, } + +/// An item in an enumeration (ordered list): `1. ...`. +#[derive(Debug, Clone, PartialEq)] +pub struct EnumItem { + /// The source code location. + pub span: Span, + /// The number, if any. + pub number: Option, + /// The contents of the list item. + pub body: Tree, +} -- cgit v1.2.3