Make ast types pub
This commit is contained in:
parent
b3621f1efd
commit
3db4ec581f
1 changed files with 15 additions and 15 deletions
30
src/ast.rs
30
src/ast.rs
|
|
@ -1,8 +1,8 @@
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
struct Ident(String);
|
pub struct Ident(pub String);
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
enum NumLit {
|
pub enum NumLit {
|
||||||
/// - `0b_0001_1011`
|
/// - `0b_0001_1011`
|
||||||
/// - `-0b10`
|
/// - `-0b10`
|
||||||
Bin(i64, String),
|
Bin(i64, String),
|
||||||
|
|
@ -17,7 +17,7 @@ enum NumLit {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
enum TableLitElem {
|
pub enum TableLitElem {
|
||||||
/// `a`
|
/// `a`
|
||||||
Positional(Box<Expr>),
|
Positional(Box<Expr>),
|
||||||
|
|
||||||
|
|
@ -28,18 +28,18 @@ enum TableLitElem {
|
||||||
/// # foo
|
/// # foo
|
||||||
/// # bar
|
/// # bar
|
||||||
/// ```
|
/// ```
|
||||||
MultlineString(String),
|
BlockString(Vec<String>),
|
||||||
}
|
}
|
||||||
|
|
||||||
/// `'{ a, foo: b }`
|
/// `'{ a, foo: b }`
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
struct TableLit {
|
pub struct TableLit {
|
||||||
elems: Vec<TableLitElem>,
|
pub elems: Vec<TableLitElem>,
|
||||||
trailing_comma: bool,
|
pub trailing_comma: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
enum Lit {
|
pub enum Lit {
|
||||||
/// `nil`
|
/// `nil`
|
||||||
Nil,
|
Nil,
|
||||||
|
|
||||||
|
|
@ -60,7 +60,7 @@ enum Lit {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
enum TableConstrElem {
|
pub enum TableConstrElem {
|
||||||
/// See [`TableLitElem`].
|
/// See [`TableLitElem`].
|
||||||
Lit(TableLitElem),
|
Lit(TableLitElem),
|
||||||
|
|
||||||
|
|
@ -70,13 +70,13 @@ enum TableConstrElem {
|
||||||
|
|
||||||
/// `{ a, b, foo: c, [d]: e }`
|
/// `{ a, b, foo: c, [d]: e }`
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
struct TableConstr {
|
pub struct TableConstr {
|
||||||
elems: Vec<TableConstrElem>,
|
pub elems: Vec<TableConstrElem>,
|
||||||
trailing_comma: bool,
|
pub trailing_comma: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy)]
|
#[derive(Debug, Clone, Copy)]
|
||||||
enum BinOp {
|
pub enum BinOp {
|
||||||
/// `+`
|
/// `+`
|
||||||
Add,
|
Add,
|
||||||
/// `-`
|
/// `-`
|
||||||
|
|
@ -98,7 +98,7 @@ enum BinOp {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
enum Expr {
|
pub enum Expr {
|
||||||
Lit(Lit),
|
Lit(Lit),
|
||||||
|
|
||||||
/// See [`TableConstr`].
|
/// See [`TableConstr`].
|
||||||
|
|
@ -143,4 +143,4 @@ enum Expr {
|
||||||
/// The contents of a program file are just a table literal without the
|
/// The contents of a program file are just a table literal without the
|
||||||
/// surrounding `'{` and `}`.
|
/// surrounding `'{` and `}`.
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
struct Program(TableLit);
|
pub struct Program(pub TableLit);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue