Add parenthesized expression to ast
This commit is contained in:
parent
629eca7409
commit
b3ddc793d0
1 changed files with 11 additions and 0 deletions
11
src/ast.rs
11
src/ast.rs
|
|
@ -265,6 +265,16 @@ pub enum BinOp {
|
||||||
pub enum Expr {
|
pub enum Expr {
|
||||||
Lit(Lit),
|
Lit(Lit),
|
||||||
|
|
||||||
|
/// `(a)`
|
||||||
|
///
|
||||||
|
/// Structure: `( s0 inner s1 )`
|
||||||
|
Paren {
|
||||||
|
s0: Space,
|
||||||
|
inner: Box<Expr>,
|
||||||
|
s1: Space,
|
||||||
|
span: Span,
|
||||||
|
},
|
||||||
|
|
||||||
/// See [`TableConstr`].
|
/// See [`TableConstr`].
|
||||||
TableConstr(TableConstr),
|
TableConstr(TableConstr),
|
||||||
|
|
||||||
|
|
@ -389,6 +399,7 @@ impl HasSpan for Expr {
|
||||||
fn span(&self) -> Span {
|
fn span(&self) -> Span {
|
||||||
match self {
|
match self {
|
||||||
Expr::Lit(lit) => lit.span(),
|
Expr::Lit(lit) => lit.span(),
|
||||||
|
Expr::Paren { span, .. } => *span,
|
||||||
Expr::TableConstr(tcr) => tcr.span(),
|
Expr::TableConstr(tcr) => tcr.span(),
|
||||||
Expr::Var { span, .. } => *span,
|
Expr::Var { span, .. } => *span,
|
||||||
Expr::VarIdent(_) => todo!(),
|
Expr::VarIdent(_) => todo!(),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue