Add comments/multiline strings

This commit is contained in:
Joscha 2022-11-17 15:45:22 +01:00
parent 29d321334c
commit b3621f1efd

View file

@ -23,6 +23,12 @@ enum TableLitElem {
/// `foo: a` /// `foo: a`
Named(Ident, Box<Expr>), Named(Ident, Box<Expr>),
/// ```text
/// # foo
/// # bar
/// ```
MultlineString(String),
} }
/// `'{ a, foo: b }` /// `'{ a, foo: b }`
@ -55,11 +61,8 @@ enum Lit {
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
enum TableConstrElem { enum TableConstrElem {
/// `a` /// See [`TableLitElem`].
Positional(Box<Expr>), Lit(TableLitElem),
/// `foo: a`
Named(Ident, Box<Expr>),
/// `[a]: b` /// `[a]: b`
Indexed(Box<Expr>, Box<Expr>), Indexed(Box<Expr>, Box<Expr>),
@ -137,14 +140,7 @@ enum Expr {
BinOp(Box<Expr>, BinOp, Box<Expr>), BinOp(Box<Expr>, BinOp, Box<Expr>),
} }
/// The contents of a program file are just a table literal without the
/// surrounding `'{` and `}`.
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
enum Program { struct Program(TableLit);
/// At the beginning of the file:
/// ```text
/// module
/// ...
/// ```
Module(TableLit),
Expr(Expr),
}