github.com/jhump/protoreflect@v1.16.0/desc/protoparse/ast/source_pos.go (about)

     1  package ast
     2  
     3  import (
     4  	"github.com/bufbuild/protocompile/ast"
     5  )
     6  
     7  // SourcePos identifies a location in a proto source file.
     8  type SourcePos = ast.SourcePos
     9  
    10  // PosRange is a range of positions in a source file that indicates
    11  // the span of some region of source, such as a single token or
    12  // a sub-tree of the AST.
    13  type PosRange struct {
    14  	Start, End SourcePos
    15  }
    16  
    17  // Comment represents a single comment in a source file. It indicates
    18  // the position of the comment and its contents.
    19  type Comment struct {
    20  	// The location of the comment in the source file.
    21  	PosRange
    22  	// Any whitespace between the prior lexical element (either a token
    23  	// or other comment) and this comment.
    24  	LeadingWhitespace string
    25  	// The text of the comment, including any "//" or "/*" and "*/"
    26  	// symbols at the start and end. Single-line comments will include
    27  	// the trailing newline rune in Text.
    28  	Text string
    29  }