From b3621f1efdf3fc309ac6e834c7b4df25dc65da75 Mon Sep 17 00:00:00 2001 From: Joscha Date: Thu, 17 Nov 2022 15:45:22 +0100 Subject: [PATCH] Add comments/multiline strings --- src/ast.rs | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/src/ast.rs b/src/ast.rs index ff34f7f..cdf6b4d 100644 --- a/src/ast.rs +++ b/src/ast.rs @@ -23,6 +23,12 @@ enum TableLitElem { /// `foo: a` Named(Ident, Box), + + /// ```text + /// # foo + /// # bar + /// ``` + MultlineString(String), } /// `'{ a, foo: b }` @@ -55,11 +61,8 @@ enum Lit { #[derive(Debug, Clone)] enum TableConstrElem { - /// `a` - Positional(Box), - - /// `foo: a` - Named(Ident, Box), + /// See [`TableLitElem`]. + Lit(TableLitElem), /// `[a]: b` Indexed(Box, Box), @@ -137,14 +140,7 @@ enum Expr { BinOp(Box, BinOp, Box), } +/// The contents of a program file are just a table literal without the +/// surrounding `'{` and `}`. #[derive(Debug, Clone)] -enum Program { - /// At the beginning of the file: - /// ```text - /// module - /// ... - /// ``` - Module(TableLit), - - Expr(Expr), -} +struct Program(TableLit);