about summary refs log tree commit diff
path: root/pkg/lang/ast/op.go
diff options
context:
space:
mode:
authorMel <einebeere@gmail.com>2022-07-27 22:53:35 +0000
committerMel <einebeere@gmail.com>2022-07-27 22:53:35 +0000
commitd79973cb9df8660fe89810507557f5ba86256f30 (patch)
tree201774dae1fa63e6b962e7be9aeea20c033bb5e3 /pkg/lang/ast/op.go
parent4f23155ca7f8591cae0be6938610386513d24b7f (diff)
downloadjinx-d79973cb9df8660fe89810507557f5ba86256f30.tar.zst
jinx-d79973cb9df8660fe89810507557f5ba86256f30.zip
Parse type declaration statements
Diffstat (limited to 'pkg/lang/ast/op.go')
-rw-r--r--pkg/lang/ast/op.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/pkg/lang/ast/op.go b/pkg/lang/ast/op.go
index 6f48e0c..063a309 100644
--- a/pkg/lang/ast/op.go
+++ b/pkg/lang/ast/op.go
@@ -21,6 +21,8 @@ const (
 	BinOpLte
 	BinOpGt
 	BinOpGte
+
+	BinOpDot
 )
 
 func BinOpFromToken(tok token.Token) (BinOp, bool) {
@@ -50,6 +52,8 @@ func BinOpFromToken(tok token.Token) (BinOp, bool) {
 		op = BinOpGt
 	case token.Gte:
 		op = BinOpGte
+	case token.Dot:
+		op = BinOpDot
 	default:
 		return 0, false
 	}
@@ -67,6 +71,8 @@ func (op BinOp) Precedence() int {
 		return 3
 	case BinOpStar, BinOpSlash, BinOpPercent:
 		return 4
+	case BinOpDot:
+		return 5
 
 	default:
 		panic(fmt.Sprintf("unknown binary operator: %d", op))
@@ -88,6 +94,8 @@ func (op BinOp) Associativity() Associativity {
 		return AssociativityRight
 	case BinOpEq, BinOpNeq, BinOpLt, BinOpLte, BinOpGt, BinOpGte:
 		return AssociativityLeft
+	case BinOpDot:
+		return AssociativityLeft
 	default:
 		panic(fmt.Sprintf("unknown binary operator: %d", op))
 	}