Add comments/multiline strings
This commit is contained in:
parent
29d321334c
commit
b3621f1efd
1 changed files with 11 additions and 15 deletions
26
src/ast.rs
26
src/ast.rs
|
|
@ -23,6 +23,12 @@ enum TableLitElem {
|
|||
|
||||
/// `foo: a`
|
||||
Named(Ident, Box<Expr>),
|
||||
|
||||
/// ```text
|
||||
/// # foo
|
||||
/// # bar
|
||||
/// ```
|
||||
MultlineString(String),
|
||||
}
|
||||
|
||||
/// `'{ a, foo: b }`
|
||||
|
|
@ -55,11 +61,8 @@ enum Lit {
|
|||
|
||||
#[derive(Debug, Clone)]
|
||||
enum TableConstrElem {
|
||||
/// `a`
|
||||
Positional(Box<Expr>),
|
||||
|
||||
/// `foo: a`
|
||||
Named(Ident, Box<Expr>),
|
||||
/// See [`TableLitElem`].
|
||||
Lit(TableLitElem),
|
||||
|
||||
/// `[a]: b`
|
||||
Indexed(Box<Expr>, Box<Expr>),
|
||||
|
|
@ -137,14 +140,7 @@ enum 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)]
|
||||
enum Program {
|
||||
/// At the beginning of the file:
|
||||
/// ```text
|
||||
/// module
|
||||
/// ...
|
||||
/// ```
|
||||
Module(TableLit),
|
||||
|
||||
Expr(Expr),
|
||||
}
|
||||
struct Program(TableLit);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue