miller/pkg/dsl/token.go
John Kerl 268a96d002
Export library code in pkg/ (#1391)
* Export library code in `pkg/`

* new doc page
2023-09-10 17:15:13 -04:00

17 lines
456 B
Go

package dsl
import (
"fmt"
"github.com/johnkerl/miller/pkg/parsing/token"
)
// TokenToLocationInfo is used to track runtime errors back to source-code locations in DSL
// expressions, so we can have more informative error messages.
func TokenToLocationInfo(sourceToken *token.Token) string {
if sourceToken == nil {
return ""
} else {
return fmt.Sprintf(" at DSL expression line %d column %d", sourceToken.Pos.Line, sourceToken.Pos.Column)
}
}