mirror of
https://github.com/MontFerret/ferret.git
synced 2024-12-23 01:24:30 +02:00
26 lines
394 B
Go
26 lines
394 B
Go
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 {
|
|
return fmt.Sprintf("%s at %d:%d", s.text, s.line, s.column)
|
|
}
|