1
0
mirror of https://github.com/MontFerret/ferret.git synced 2025-02-07 13:31:56 +02:00
ferret/pkg/runtime/core/source.go

26 lines
394 B
Go
Raw Normal View History

2018-09-18 16:42:38 -04:00
package core
import "fmt"
type SourceMap struct {
text string
line int
column int
}
func NewSourceMap(text string, line, col int) SourceMap {
return SourceMap{text, line, col}
}
func (s SourceMap) Line() int {
return s.line
}
func (s SourceMap) Column() int {
return s.column
}
func (s SourceMap) String() string {
2018-09-23 04:33:20 -04:00
return fmt.Sprintf("%s at %d:%d", s.text, s.line, s.column)
2018-09-18 16:42:38 -04:00
}