syntax

package
v0.38.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2026 License: Apache-2.0 Imports: 3 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package syntax specifies all of the syntax pragmas (including editions) that Protocompile understands.

Index

Constants

View Source
const LatestImplementedEdition = Edition2024

LatestImplementedEdition is the most recent edition that the compiler implements.

Variables

This section is empty.

Functions

func All

func All() iter.Seq[Syntax]

All returns an iterator over all known Syntax values.

func Editions

func Editions() iter.Seq[Syntax]

Editions returns an iterator over all the editions in this package.

Types

type Syntax

type Syntax int32

Syntax is a known syntax pragma.

Not only does this include "proto2" and "proto3", but also all of the editions.

The integer values of the constants correspond to their the values of google.protobuf.Edition.

const (
	Unknown          Syntax = 0
	Proto2           Syntax = 998
	Proto3           Syntax = 999
	Edition2023      Syntax = 1000
	Edition2024      Syntax = 1001
	EditionLegacy    Syntax = 900
	EditionTest1     Syntax = 1
	EditionTest2     Syntax = 2
	EditionTest99997 Syntax = 99997
	EditionTest99998 Syntax = 99998
	EditionTest99999 Syntax = 99999
	EditionMax       Syntax = 0x7fff_ffff
)

func Lookup

func Lookup(s string) Syntax

Lookup looks up a syntax pragma by name.

If name does not name a known pragma, returns Unknown.

func (Syntax) DescriptorName

func (s Syntax) DescriptorName() string

DescriptorName converts a syntax into the corresponding google.protobuf.Edition name.

Returns a stringified digit if it is not a named edition value.

func (Syntax) GoString

func (v Syntax) GoString() string

GoString implements fmt.GoStringer.

func (Syntax) IsConstraint

func (s Syntax) IsConstraint() bool

IsConstraint returns whether this syntax can be used as a constraint in google.protobuf.FieldOptions.feature_support.

func (Syntax) IsEdition

func (s Syntax) IsEdition() bool

IsEdition returns whether this represents an edition.

func (Syntax) IsKnown

func (s Syntax) IsKnown() bool

IsKnown returns whether this syntax is a known value in google.protobuf.Edition.

func (Syntax) IsSupported

func (s Syntax) IsSupported() bool

IsSupported returns whether this syntax is fully supported.

func (Syntax) IsValid

func (s Syntax) IsValid() bool

IsValid returns whether this syntax is valid (i.e., it can appear in a syntax/edition declaration).

func (Syntax) Name

func (s Syntax) Name() string

Name returns the name of this syntax as it should appear in diagnostics.

func (Syntax) String

func (v Syntax) String() string

String implements fmt.Stringer.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL