github.com/mattn/anko@v0.1.10/ast/pos.go (about)

     1  package ast
     2  
     3  // Position provides interface to store code locations.
     4  type Position struct {
     5  	Line   int
     6  	Column int
     7  }
     8  
     9  // Pos interface provides two functions to get/set the position for expression or statement.
    10  type Pos interface {
    11  	Position() Position
    12  	SetPosition(Position)
    13  }
    14  
    15  // PosImpl provides commonly implementations for Pos.
    16  type PosImpl struct {
    17  	pos Position
    18  }
    19  
    20  // Position return the position of the expression or statement.
    21  func (x *PosImpl) Position() Position {
    22  	return x.pos
    23  }
    24  
    25  // SetPosition is a function to specify position of the expression or statement.
    26  func (x *PosImpl) SetPosition(pos Position) {
    27  	x.pos = pos
    28  }