github.com/cloudflare/circl@v1.5.0/abe/cpabe/tkn20/internal/dsl/expr.go (about) 1 package dsl 2 3 type Expr interface { 4 Accept(ExprVisitor) 5 } 6 7 type ExprVisitor interface { 8 visitBinary(binary Binary) 9 visitUnary(unary Unary) 10 visitGrouping(grouping Grouping) 11 visitLiteral(literal Literal) 12 } 13 14 // Binary is used for And, Or 15 type Binary struct { 16 Left Expr 17 Operator Token 18 Right Expr 19 Output attr 20 } 21 22 func (b Binary) Accept(visitor ExprVisitor) { 23 visitor.visitBinary(b) 24 } 25 26 // Unary is used for Not 27 type Unary struct { 28 Operator Token 29 Right Expr 30 } 31 32 func (u Unary) Accept(visitor ExprVisitor) { 33 visitor.visitUnary(u) 34 } 35 36 // Grouping is used for LeftParen, RightParen 37 type Grouping struct { 38 Expr Expr 39 } 40 41 func (g Grouping) Accept(visitor ExprVisitor) { 42 visitor.visitGrouping(g) 43 } 44 45 type Literal struct { 46 Key attr 47 Value attrValue 48 } 49 50 func (l Literal) Accept(visitor ExprVisitor) { 51 visitor.visitLiteral(l) 52 }