Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Import ¶
type Import struct { // Path of the imported file. Path string // Indicate if public or weak keyword was used in import statement. IsPublic, IsWeak bool }
Import represents an import in a Protobuf source file.
type Result ¶
Result is the result of scanning a Protobuf source file. It contains the information extracted from the file.
func Scan ¶
Scan scans the given reader, which should contain Protobuf source, and returns the set of imports declared in the file. The result also contains the value of any package declaration in the file. It returns an error if there is an I/O error reading from r or if syntax errors are recognized while scanning. In the event of such an error, it will still return a result that contains as much information as was found (either before the I/O error occurred, or all that could be parsed despite syntax errors). The results are not necessarily valid, in that the parsed package name might not be a legal package name in protobuf or the imports may not refer to valid paths. Full validation of the source should be done using a full parser.
type SyntaxError ¶
type SyntaxError []reporter.ErrorWithPos
SyntaxError is returned from Scan when one or more syntax errors are observed. Scan does not fully parse the source, so there are many kinds of syntax errors that will not be recognized. A full parser should be used to reliably detect errors in the source. But if the scanner happens to see things that are clearly wrong while scanning for the package and imports, it will return them. The slice contains one error for each location where a syntax issue is found.
func (SyntaxError) Error ¶
func (e SyntaxError) Error() string
Error implements the error interface, returning an error message with the details of the syntax error issues.
func (SyntaxError) Unwrap ¶
func (e SyntaxError) Unwrap() []error
Unwrap returns an error for each location where a syntax error was identified.