github.com/aretext/aretext@v1.3.0/syntax/parser/state.go (about)

     1  package parser
     2  
     3  // State represents an arbitrary state of the parser.
     4  type State interface {
     5  	// Equals returns whether two states are equal.
     6  	Equals(other State) bool
     7  }
     8  
     9  // EmptyState represents an empty state.
    10  // An empty state is considered equal to every other empty state.
    11  type EmptyState struct{}
    12  
    13  func (s EmptyState) Equals(other State) bool {
    14  	_, ok := other.(EmptyState)
    15  	return ok
    16  }