Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ToProto ¶
func ToProto(e expr.Expr, options ToProtoOptions) *exprpb.Expr
ToProto converts this AST into a Protobuf representation, which may be serialized.
Note that package ast does not support deserialization from this proto; instead, you will need to re-parse the text file included in the message. This is because the AST is much richer than what is stored in this message; the message only provides enough information for further semantic analysis and diagnostic generation, but not for pretty-printing.
Panics if the AST contains a cycle (e.g. a message that contains itself as a nested message). Parsed ASTs will never contain cycles, but users may modify them into a cyclic state.
Types ¶
type ToProtoOptions ¶
type ToProtoOptions struct {
// If set, no spans will be serialized.
//
// This operation only destroys non-semantic information.
OmitSpans bool
// If set, the contents of the file the AST was parsed from will not
// be serialized.
OmitFile bool
}
ToProtoOptions contains options for the [File.ToProto] function.