mirror of
https://github.com/johnkerl/miller.git
synced 2026-07-23 16:08:43 +00:00
* Add line/column info for DSL runtime non-parse failures * Other related callsites * test cases * Update already-existing test cases
17 lines
465 B
Go
17 lines
465 B
Go
package dsl
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/johnkerl/miller/internal/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)
|
|
}
|
|
}
|