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`
|
/// `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),
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue