summaryrefslogtreecommitdiff
path: root/vendor/github.com/authzed/spicedb/pkg/caveats/source.go
blob: 8550f032a2b3139701ac1d63d5bf263d45fbdcbc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package caveats

import (
	"github.com/authzed/cel-go/common"
)

// SourcePosition is an incoming source position.
type SourcePosition interface {
	// LineAndColumn returns the 0-indexed line number and column position in the source file.
	LineAndColumn() (int, int, error)

	// RunePosition returns the 0-indexed rune position in the source file.
	RunePosition() (int, error)
}

// NewSource creates a new source for compilation into a caveat.
func NewSource(expressionString string, name string) (common.Source, error) {
	return common.NewStringSource(expressionString, name), nil
}