github.com/MontFerret/ferret@v0.18.0/pkg/runtime/core/source.go (about)

     1  package core
     2  
     3  import "fmt"
     4  
     5  type SourceMap struct {
     6  	text   string
     7  	line   int
     8  	column int
     9  }
    10  
    11  func NewSourceMap(text string, line, col int) SourceMap {
    12  	return SourceMap{text, line, col}
    13  }
    14  
    15  func (s SourceMap) Line() int {
    16  	return s.line
    17  }
    18  
    19  func (s SourceMap) Column() int {
    20  	return s.column
    21  }
    22  
    23  func (s SourceMap) String() string {
    24  	return fmt.Sprintf("%s at %d:%d", s.text, s.line, s.column)
    25  }