summaryrefslogtreecommitdiff
path: root/vendor/github.com/jhump/protoreflect/desc/protoparse/ast/source_pos.go
blob: 8ab09c6f253f43ba543e5757ced1fb5c01f58547 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package ast

import (
	"github.com/bufbuild/protocompile/ast"
)

// SourcePos identifies a location in a proto source file.
type SourcePos = ast.SourcePos

// PosRange is a range of positions in a source file that indicates
// the span of some region of source, such as a single token or
// a sub-tree of the AST.
type PosRange struct {
	Start, End SourcePos
}

// Comment represents a single comment in a source file. It indicates
// the position of the comment and its contents.
type Comment struct {
	// The location of the comment in the source file.
	PosRange
	// Any whitespace between the prior lexical element (either a token
	// or other comment) and this comment.
	LeadingWhitespace string
	// The text of the comment, including any "//" or "/*" and "*/"
	// symbols at the start and end. Single-line comments will include
	// the trailing newline rune in Text.
	Text string
}