irpb

package module
v0.0.0-...-3d450db Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package irpb is the Go form of the resolved IR every cpybkc generator plugin is handed.

It is the one package a third-party generator is expected to import, which is why it lives at an importable path rather than under internal/: the IR is a contract, and a contract the only audience for it cannot import is not one. docs/ir/SPEC.md is the contract itself, and it is normative for what every node means; this package is only its spelling in Go.

Why this is a module and not a package

The import path alone would have been enough to make the types reachable. It would not have been enough to make them cheap. A package inside github.com/Zaba505/cpybkc puts every dependency that module ever acquires — the layout parser's, the plugin runner's, whatever the CLI grows — into the build list of a plugin author who wanted twelve node kinds and a Marshal. So the boundary is a module boundary: irpb requires google.golang.org/protobuf and nothing else, TestModuleDependsOnlyOnTheProtobufRuntime in module_test.go asserts it, and the arrow points one way. The CLI depends on this module; this module depends on no part of the CLI and never will.

Versions, of which there are two

The Go module tag this package is released under is irpb/vX.Y.Z, moves for Go's reasons — a dependency bump, a documentation fix — and says nothing about the descriptor. The IR's own version is Descriptor's version field, a single monotonic integer, and reading it before anything else is a consumer's first obligation. One IR version outlives many module tags, and the tags are pushed independently of the CLI's own vX.Y.Z for exactly that reason.

Should the schema ever break its wire format and become package cpybkc.ir.v2, that is a breaking change to every Go consumer, so it arrives here as module github.com/Zaba505/cpybkc/irpb/v2 under Go's own major-version rule. The protobuf package's version suffix and the Go module's major version are then the same number, without either having to be kept in step with the other by hand.

Generated code

ir.pb.go is generated from proto/cpybkc/ir/v1/ir.proto by protoc-gen-go, as buf.gen.yaml pins it. Do not edit it — change the .proto and run `dagger call proto-gen export --path=irpb`, in the same commit.

Example (ReadADescriptorWithoutGeneratedCode)

Example_readADescriptorWithoutGeneratedCode is the worked example docs/ir/SPEC.md's "Reading a descriptor without generated code" points at: a consumer reads a descriptor through the published FileDescriptorSet alone, with no code generated from proto/ anywhere in it.

Everything below the marked line uses only protobuf's own runtime — the descriptor types, a registry built from the published bytes, and a dynamic message — so it transliterates directly into any language whose protobuf runtime can load a FileDescriptorSet, which is every one of them. In practice the consumer's first two lines are a read of the ir.binpb release asset and a read of the file cpybkc passed as --descriptor; they are spelled as in-process calls here so that the example runs as a test and cannot rot.

package main

import (
	"fmt"

	"github.com/Zaba505/cpybkc/irpb"

	"google.golang.org/protobuf/proto"
	"google.golang.org/protobuf/reflect/protodesc"
	"google.golang.org/protobuf/reflect/protoreflect"
	"google.golang.org/protobuf/types/descriptorpb"
	"google.golang.org/protobuf/types/dynamicpb"
)

// exampleDescriptor is a descriptor of the shape cpybkc emits, kept as small as
// a conforming one can be: an unframed file, one accepting state reached by one
// transition, and a record whose top-level group holds a single DISPLAY field.
//
// It exercises every part of the schema a dynamic consumer meets on its first
// descriptor — the version enum, the flat node set, a oneof, a nested message
// and an optional string — so that a set which described any of them wrongly
// would fail the round trip above rather than decoding into a plausible-looking
// message.
func exampleDescriptor() *irpb.Descriptor {
	return &irpb.Descriptor{
		Version: irpb.IrVersion_IR_VERSION_1,
		Nodes: []*irpb.Node{
			{
				Id: 0,
				Kind: &irpb.Node_File{
					File: &irpb.File{
						Framing:      &irpb.File_Unframed{Unframed: &irpb.Unframed{}},
						StartStateId: 1,
					},
				},
			},
			{
				Id: 1,
				Kind: &irpb.Node_State{
					State: &irpb.State{
						Accepts:       true,
						TransitionIds: []uint64{2},
					},
				},
			},
			{
				Id: 2,
				Kind: &irpb.Node_Transition{
					Transition: &irpb.Transition{
						RecordId:    3,
						NextStateId: 1,
					},
				},
			},
			{
				Id: 3,
				Kind: &irpb.Node_Record{
					Record: &irpb.Record{
						RootId: 4,
						Names:  &irpb.Names{Original: "CUSTOMER-RECORD"},
					},
				},
			},
			{
				Id: 4,
				Kind: &irpb.Node_Group{
					Group: &irpb.Group{
						MemberIds: []uint64{5},
						Names:     &irpb.Names{Original: "CUSTOMER-RECORD"},
					},
				},
			},
			{
				Id: 5,
				Kind: &irpb.Node_Field{
					Field: &irpb.Field{
						Width: 8,
						Encoding: &irpb.Encoding{
							Charset:        irpb.Charset_CHARSET_CP037,
							SignConvention: irpb.SignConvention_SIGN_CONVENTION_EBCDIC,
							ByteOrder:      irpb.ByteOrder_BYTE_ORDER_BIG_ENDIAN,
							FloatFormat:    irpb.FloatFormat_FLOAT_FORMAT_IBM_HFP,
						},
						Usage: irpb.Usage_USAGE_DISPLAY,
						Picture: &irpb.Picture{
							Category: irpb.Category_CATEGORY_NUMERIC,
							Digits:   8,
						},
						Names: &irpb.Names{
							Original:     "CUST-ID",
							OverrideName: proto.String("CustomerID"),
						},
					},
				},
			},
		},
	}
}

func main() {
	// The producer half. cpybkc encodes a descriptor and publishes the set that
	// describes it; a plugin author writes neither of these two statements.
	descriptor, err := proto.Marshal(exampleDescriptor())
	if err != nil {
		panic(err)
	}

	irBinpb, err := irpb.MarshalFileDescriptorSet()
	if err != nil {
		panic(err)
	}

	// ---- The consumer half: no generated code past this line. ----

	var set descriptorpb.FileDescriptorSet
	if err := proto.Unmarshal(irBinpb, &set); err != nil {
		panic(err)
	}

	files, err := protodesc.NewFiles(&set)
	if err != nil {
		panic(err)
	}

	desc, err := files.FindDescriptorByName("cpybkc.ir.v1.Descriptor")
	if err != nil {
		panic(err)
	}

	md, ok := desc.(protoreflect.MessageDescriptor)
	if !ok {
		panic("cpybkc.ir.v1.Descriptor is not a message")
	}

	msg := dynamicpb.NewMessage(md)
	if err := proto.Unmarshal(descriptor, msg); err != nil {
		panic(err)
	}

	// The IR version comes first, always: docs/ir/SPEC.md makes reading it
	// before anything else a consumer's first obligation, and a version this
	// consumer does not know is a descriptor it must refuse rather than walk.
	version := msg.Get(md.Fields().ByName("version")).Enum()
	fmt.Println("ir version:", md.Fields().ByName("version").Enum().Values().ByNumber(version).Name())

	// A descriptor is a flat set of nodes referring to each other by
	// identifier, so a consumer indexes it before it walks anything.
	nodes := msg.Get(md.Fields().ByName("nodes")).List()

	byID := make(map[uint64]protoreflect.Message, nodes.Len())
	for i := range nodes.Len() {
		node := nodes.Get(i).Message()
		byID[node.Get(node.Descriptor().Fields().ByName("id")).Uint()] = node
	}

	for i := range nodes.Len() {
		node := nodes.Get(i).Message()

		kind := node.WhichOneof(node.Descriptor().Oneofs().ByName("kind"))
		if kind == nil || kind.Name() != "record" {
			continue
		}

		record := node.Get(kind).Message()
		fmt.Println("record:", name(record))

		group := byID[record.Get(record.Descriptor().Fields().ByName("root_id")).Uint()]
		groupKind := group.Get(group.Descriptor().Fields().ByName("group")).Message()

		members := groupKind.Get(groupKind.Descriptor().Fields().ByName("member_ids")).List()
		for j := range members.Len() {
			member := byID[members.Get(j).Uint()]
			field := member.Get(member.Descriptor().Fields().ByName("field")).Message()

			width := field.Get(field.Descriptor().Fields().ByName("width")).Uint()
			fmt.Printf("  field %s: %d bytes\n", name(field), width)
		}
	}

}

// name reads the copybook spelling out of any message carrying a Names.
//
// It is part of the consumer half above: the names field is a nested message
// with the original spelling in it, and reaching through one is the shape of
// almost every read a generator performs.
func name(msg protoreflect.Message) string {
	names := msg.Get(msg.Descriptor().Fields().ByName("names")).Message()

	return names.Get(names.Descriptor().Fields().ByName("original")).String()
}
Output:
ir version: IR_VERSION_1
record: CUSTOMER-RECORD
  field CUST-ID: 8 bytes

Index

Examples

Constants

This section is empty.

Variables

View Source
var (
	IrVersion_name = map[int32]string{
		0: "IR_VERSION_UNSPECIFIED",
		1: "IR_VERSION_1",
	}
	IrVersion_value = map[string]int32{
		"IR_VERSION_UNSPECIFIED": 0,
		"IR_VERSION_1":           1,
	}
)

Enum value maps for IrVersion.

View Source
var (
	DelimiterPlacement_name = map[int32]string{
		0: "DELIMITER_PLACEMENT_UNSPECIFIED",
		1: "DELIMITER_PLACEMENT_TERMINATOR",
		2: "DELIMITER_PLACEMENT_SEPARATOR",
		3: "DELIMITER_PLACEMENT_OPTIONAL_TERMINATOR",
	}
	DelimiterPlacement_value = map[string]int32{
		"DELIMITER_PLACEMENT_UNSPECIFIED":         0,
		"DELIMITER_PLACEMENT_TERMINATOR":          1,
		"DELIMITER_PLACEMENT_SEPARATOR":           2,
		"DELIMITER_PLACEMENT_OPTIONAL_TERMINATOR": 3,
	}
)

Enum value maps for DelimiterPlacement.

View Source
var (
	BinarySize_name = map[int32]string{
		0: "BINARY_SIZE_UNSPECIFIED",
		1: "BINARY_SIZE_248",
		2: "BINARY_SIZE_1248",
		3: "BINARY_SIZE_SMALLEST",
		4: "BINARY_SIZE_FULL",
	}
	BinarySize_value = map[string]int32{
		"BINARY_SIZE_UNSPECIFIED": 0,
		"BINARY_SIZE_248":         1,
		"BINARY_SIZE_1248":        2,
		"BINARY_SIZE_SMALLEST":    3,
		"BINARY_SIZE_FULL":        4,
	}
)

Enum value maps for BinarySize.

View Source
var (
	Charset_name = map[int32]string{
		0: "CHARSET_UNSPECIFIED",
		1: "CHARSET_CP037",
		2: "CHARSET_CP500",
		3: "CHARSET_CP1047",
		4: "CHARSET_CP1140",
		5: "CHARSET_ASCII",
		6: "CHARSET_NONE",
	}
	Charset_value = map[string]int32{
		"CHARSET_UNSPECIFIED": 0,
		"CHARSET_CP037":       1,
		"CHARSET_CP500":       2,
		"CHARSET_CP1047":      3,
		"CHARSET_CP1140":      4,
		"CHARSET_ASCII":       5,
		"CHARSET_NONE":        6,
	}
)

Enum value maps for Charset.

View Source
var (
	SignConvention_name = map[int32]string{
		0: "SIGN_CONVENTION_UNSPECIFIED",
		1: "SIGN_CONVENTION_EBCDIC",
		2: "SIGN_CONVENTION_ASCII_ZONE37",
		3: "SIGN_CONVENTION_TRANSLATED_EBCDIC",
		4: "SIGN_CONVENTION_REALIA",
	}
	SignConvention_value = map[string]int32{
		"SIGN_CONVENTION_UNSPECIFIED":       0,
		"SIGN_CONVENTION_EBCDIC":            1,
		"SIGN_CONVENTION_ASCII_ZONE37":      2,
		"SIGN_CONVENTION_TRANSLATED_EBCDIC": 3,
		"SIGN_CONVENTION_REALIA":            4,
	}
)

Enum value maps for SignConvention.

View Source
var (
	ByteOrder_name = map[int32]string{
		0: "BYTE_ORDER_UNSPECIFIED",
		1: "BYTE_ORDER_BIG_ENDIAN",
		2: "BYTE_ORDER_LITTLE_ENDIAN",
	}
	ByteOrder_value = map[string]int32{
		"BYTE_ORDER_UNSPECIFIED":   0,
		"BYTE_ORDER_BIG_ENDIAN":    1,
		"BYTE_ORDER_LITTLE_ENDIAN": 2,
	}
)

Enum value maps for ByteOrder.

View Source
var (
	FloatFormat_name = map[int32]string{
		0: "FLOAT_FORMAT_UNSPECIFIED",
		1: "FLOAT_FORMAT_IEEE754",
		2: "FLOAT_FORMAT_IBM_HFP",
	}
	FloatFormat_value = map[string]int32{
		"FLOAT_FORMAT_UNSPECIFIED": 0,
		"FLOAT_FORMAT_IEEE754":     1,
		"FLOAT_FORMAT_IBM_HFP":     2,
	}
)

Enum value maps for FloatFormat.

View Source
var (
	Usage_name = map[int32]string{
		0:  "USAGE_UNSPECIFIED",
		1:  "USAGE_DISPLAY",
		2:  "USAGE_PACKED_DECIMAL",
		3:  "USAGE_COMP_6",
		4:  "USAGE_BINARY",
		5:  "USAGE_COMP_5",
		6:  "USAGE_COMP_1",
		7:  "USAGE_COMP_2",
		8:  "USAGE_INDEX",
		9:  "USAGE_POINTER",
		10: "USAGE_NATIONAL",
	}
	Usage_value = map[string]int32{
		"USAGE_UNSPECIFIED":    0,
		"USAGE_DISPLAY":        1,
		"USAGE_PACKED_DECIMAL": 2,
		"USAGE_COMP_6":         3,
		"USAGE_BINARY":         4,
		"USAGE_COMP_5":         5,
		"USAGE_COMP_1":         6,
		"USAGE_COMP_2":         7,
		"USAGE_INDEX":          8,
		"USAGE_POINTER":        9,
		"USAGE_NATIONAL":       10,
	}
)

Enum value maps for Usage.

View Source
var (
	Category_name = map[int32]string{
		0: "CATEGORY_UNSPECIFIED",
		1: "CATEGORY_NUMERIC",
		2: "CATEGORY_ALPHABETIC",
		3: "CATEGORY_ALPHANUMERIC",
		4: "CATEGORY_NUMERIC_EDITED",
		5: "CATEGORY_ALPHANUMERIC_EDITED",
	}
	Category_value = map[string]int32{
		"CATEGORY_UNSPECIFIED":         0,
		"CATEGORY_NUMERIC":             1,
		"CATEGORY_ALPHABETIC":          2,
		"CATEGORY_ALPHANUMERIC":        3,
		"CATEGORY_NUMERIC_EDITED":      4,
		"CATEGORY_ALPHANUMERIC_EDITED": 5,
	}
)

Enum value maps for Category.

View Source
var (
	SignPosition_name = map[int32]string{
		0: "SIGN_POSITION_UNSPECIFIED",
		1: "SIGN_POSITION_LEADING",
		2: "SIGN_POSITION_TRAILING",
		3: "SIGN_POSITION_LEADING_SEPARATE",
		4: "SIGN_POSITION_TRAILING_SEPARATE",
	}
	SignPosition_value = map[string]int32{
		"SIGN_POSITION_UNSPECIFIED":       0,
		"SIGN_POSITION_LEADING":           1,
		"SIGN_POSITION_TRAILING":          2,
		"SIGN_POSITION_LEADING_SEPARATE":  3,
		"SIGN_POSITION_TRAILING_SEPARATE": 4,
	}
)

Enum value maps for SignPosition.

View Source
var (
	RegisterKind_name = map[int32]string{
		0: "REGISTER_KIND_UNSPECIFIED",
		1: "REGISTER_KIND_BYTES",
		2: "REGISTER_KIND_INTEGER",
	}
	RegisterKind_value = map[string]int32{
		"REGISTER_KIND_UNSPECIFIED": 0,
		"REGISTER_KIND_BYTES":       1,
		"REGISTER_KIND_INTEGER":     2,
	}
)

Enum value maps for RegisterKind.

View Source
var File_cpybkc_ir_v1_ir_proto protoreflect.FileDescriptor

Functions

func FileDescriptorSet

func FileDescriptorSet() *descriptorpb.FileDescriptorSet

FileDescriptorSet returns the IR's self-description: the protobuf FileDescriptorSet describing a Descriptor, and so the thing that lets a consumer decode one with no generated code at all.

It exists for the plugin author whose language has weak protobuf tooling, or none in the build. protobuf's one real disadvantage against a self-describing format is that a reader normally needs the schema compiled in ahead of time; a FileDescriptorSet closes it, because every runtime worth the name can build a message type out of one at run time and decode against it. docs/ir/SPEC.md's "Why protobuf, and why no gRPC" is where that trade is argued and "Reading a descriptor without generated code" is what this function ships.

Why it is computed rather than committed

The set is derived, on every call, from the descriptors protoc-gen-go compiled into this package — the same descriptors this package marshals a descriptor with. There is no .binpb checked into the repository and no protoc invocation anybody has to remember, so there is no second copy of the IR that could describe a version of it that no longer exists. Changing proto/cpybkc/ir/v1/ir.proto and regenerating ir.pb.go changes what this returns in the same commit, because it is one input read twice rather than two artifacts kept in step by hand.

What is in it, and what is deliberately not

Descriptor is the only root. It is what a plugin is handed — the IR defines exactly one message a generator consumes — so the set is its file plus the transitive closure of that file's imports, and nothing else. Naming the root as a type rather than as a path is what keeps that true: a file added to proto/ that nothing reachable from Descriptor imports is not published, and the test that fails when one appears is in the module that can see the directory.

Comments and source positions are not in it. protoc-gen-go does not compile SourceCodeInfo into the descriptors this is derived from, so what is published describes the schema and not the document: field numbers, types, names and nesting, which is everything a decode needs and nothing a reader of ir.proto would go looking for. docs/ir/SPEC.md is the prose, and a copy of it embedded in an artifact would be a second one to keep current.

Order

Files are emitted in dependency order: a file appears only after every file it imports. That is what `protoc --include_imports` produces and what a consumer walking the set linearly — building each file's types as it goes, which is the shape of most dynamic protobuf APIs — needs in order to resolve a type reference the first time it meets one. Within that, the order is fixed by the import declarations themselves, so the output is a function of the schema and not of a map iteration.

func MarshalFileDescriptorSet

func MarshalFileDescriptorSet() ([]byte, error)

MarshalFileDescriptorSet encodes FileDescriptorSet into the protobuf binary wire encoding, which is the form every dynamic protobuf runtime reads a FileDescriptorSet in and the form the published ir.binpb artifact holds.

The bytes are deterministic. The artifact is attached to a release and copied into the published image (#57), and a set whose bytes moved between two builds of the same schema would make every rebuild look like a change to the contract. Field order is protobuf's own, the file order is fixed by FileDescriptorSet, and the deterministic option pins the one construct — a map field — whose encoding would otherwise follow Go's randomised map iteration.

Types

type Arm

type Arm struct {

	// The Predicate node that selects this arm. Always set, unlike a transition's
	// — an arm chosen by nothing is not a thing an alternation can mean — and
	// pointing at the same message a transition's predicate reference does. One
	// closed set of tests, not a second set for arms.
	//
	// Where it is evaluated is what differs: inside one occurrence of the group
	// that repeats, with the record already admitted, so its target MUST be
	// contained in that occurrence. See docs/ir/SPEC.md, "A predicate on an arm
	// reads one occurrence".
	PredicateId uint64 `protobuf:"varint,1,opt,name=predicate_id,json=predicateId,proto3" json:"predicate_id,omitempty"`
	// The arm's body. Two kinds are admitted here and the reference says which,
	// rather than leaving a consumer to dereference an untyped identifier and
	// find out.
	//
	// Types that are valid to be assigned to Body:
	//
	//	*Arm_GroupId
	//	*Arm_FieldId
	Body isArm_Body `protobuf_oneof:"body"`
	// contains filtered or unexported fields
}

Arm is one alternative of a variant: the predicate that selects it and the item that is its body.

A repeated message on Variant rather than a thirteenth node kind. Nothing points at an arm, so it needs no identifier, and a kind for it would be one more member a consumer switches over in order to reach two references. A repetition is already carried this way, on the item it belongs to rather than as a node of its own.

func (*Arm) Descriptor deprecated

func (*Arm) Descriptor() ([]byte, []int)

Deprecated: Use Arm.ProtoReflect.Descriptor instead.

func (*Arm) GetBody

func (x *Arm) GetBody() isArm_Body

func (*Arm) GetFieldId

func (x *Arm) GetFieldId() uint64

func (*Arm) GetGroupId

func (x *Arm) GetGroupId() uint64

func (*Arm) GetPredicateId

func (x *Arm) GetPredicateId() uint64

func (*Arm) ProtoMessage

func (*Arm) ProtoMessage()

func (*Arm) ProtoReflect

func (x *Arm) ProtoReflect() protoreflect.Message

func (*Arm) Reset

func (x *Arm) Reset()

func (*Arm) String

func (x *Arm) String() string

type Arm_FieldId

type Arm_FieldId struct {
	FieldId uint64 `protobuf:"varint,3,opt,name=field_id,json=fieldId,proto3,oneof"`
}

type Arm_GroupId

type Arm_GroupId struct {
	GroupId uint64 `protobuf:"varint,2,opt,name=group_id,json=groupId,proto3,oneof"`
}

type BinarySize

type BinarySize int32

BinarySize is the width staircase a compiler applies to USAGE BINARY items — BINARY, COMP, COMPUTATIONAL, COMP-4 and COMP-5.

A binary item's width is a staircase in its digit count and never the digit count itself, and which staircase is a property of the compiler that produced the file rather than of the copybook: PIC S9(2) COMP is two bytes under IBM Enterprise COBOL and one under GnuCOBOL's default. Nothing in the file disagrees with the wrong answer — a wrong staircase shifts every field after the first binary item it touches — so a producer states it and a consumer MUST NOT infer it. Widths per member are cobol-go's codec/SPEC.md, "Binary widths by digit count", and are not restated here.

The members and their spellings are GnuCOBOL's `binary-size` runtime option, which is the only place all four have names anybody has written down.

A producer MUST NOT emit BINARY_SIZE_UNSPECIFIED. It is not "the usual one": the 1--2 digit row is a real fork between compilers, so there is no staircase a consumer could fall back to that is right more often than it is silently wrong.

const (
	BinarySize_BINARY_SIZE_UNSPECIFIED BinarySize = 0
	// 2/4/8/16 bytes by digit count: IBM Enterprise COBOL, Micro Focus under its
	// IBM-compatible directives, and GnuCOBOL's `binary-size: 2-4-8`.
	BinarySize_BINARY_SIZE_248 BinarySize = 1
	// 1/2/4/8/16 bytes by digit count: GnuCOBOL's default `binary-size:
	// 1-2-4-8`, which gives a 1--2 digit item one byte where BINARY_SIZE_248
	// gives it two.
	BinarySize_BINARY_SIZE_1248 BinarySize = 2
	// GnuCOBOL's `binary-size: 1--8`: the smallest byte count from 1 to 8 whose
	// signed range holds the digits, and sixteen beyond eighteen digits. It is
	// the only staircase with 3, 5, 6 and 7-byte steps.
	BinarySize_BINARY_SIZE_SMALLEST BinarySize = 3
	// GnuCOBOL's `binary-size: full`: always eight bytes, and sixteen beyond
	// eighteen digits.
	BinarySize_BINARY_SIZE_FULL BinarySize = 4
)

func (BinarySize) Descriptor

func (BinarySize) Descriptor() protoreflect.EnumDescriptor

func (BinarySize) Enum

func (x BinarySize) Enum() *BinarySize

func (BinarySize) EnumDescriptor deprecated

func (BinarySize) EnumDescriptor() ([]byte, []int)

Deprecated: Use BinarySize.Descriptor instead.

func (BinarySize) Number

func (x BinarySize) Number() protoreflect.EnumNumber

func (BinarySize) String

func (x BinarySize) String() string

func (BinarySize) Type

type Binding

type Binding struct {

	// The Register node written.
	RegisterId uint64 `protobuf:"varint,1,opt,name=register_id,json=registerId,proto3" json:"register_id,omitempty"`
	// The value written. A producer MUST NOT bind a field whose value does not
	// decode to the register's kind, and a consumer MUST report a source field it
	// cannot decode as that kind as malformed data rather than substituting a
	// zero or spaces.
	//
	// Types that are valid to be assigned to Value:
	//
	//	*Binding_FieldId
	//	*Binding_Decrement
	Value isBinding_Value `protobuf_oneof:"value"`
	// contains filtered or unexported fields
}

Binding writes a register. It is the only thing that does: no register is derived from anything, and every value in one was put there by a binding naming where it came from.

func (*Binding) Descriptor deprecated

func (*Binding) Descriptor() ([]byte, []int)

Deprecated: Use Binding.ProtoReflect.Descriptor instead.

func (*Binding) GetDecrement

func (x *Binding) GetDecrement() *Decrement

func (*Binding) GetFieldId

func (x *Binding) GetFieldId() uint64

func (*Binding) GetRegisterId

func (x *Binding) GetRegisterId() uint64

func (*Binding) GetValue

func (x *Binding) GetValue() isBinding_Value

func (*Binding) ProtoMessage

func (*Binding) ProtoMessage()

func (*Binding) ProtoReflect

func (x *Binding) ProtoReflect() protoreflect.Message

func (*Binding) Reset

func (x *Binding) Reset()

func (*Binding) String

func (x *Binding) String() string

type Binding_Decrement

type Binding_Decrement struct {
	// The register's own value, less one. This member exists to count: a
	// transition that admits one detail and takes one off the counter is how a
	// run of n records is read without n states.
	//
	// A producer MUST guard such a transition so that the register cannot run
	// below zero, and a consumer reaching one that would MUST report it rather
	// than wrapping or clamping.
	Decrement *Decrement `protobuf:"bytes,3,opt,name=decrement,proto3,oneof"`
}

type Binding_FieldId

type Binding_FieldId struct {
	// A Field node contained in the record the transition admits. A producer
	// MUST NOT name a field of any other record — the admitted record is the
	// one the consumer has bytes for — and MUST NOT name a field that repeats
	// or one inside a group that repeats.
	FieldId uint64 `protobuf:"varint,2,opt,name=field_id,json=fieldId,proto3,oneof"`
}

type ByteOrder

type ByteOrder int32

ByteOrder governs COMP, COMP-4 and COMP-5 binary integers. Weakly detectable and never inferred; see cobol-go's codec/SPEC.md, "Byte order — an explicit fork".

const (
	ByteOrder_BYTE_ORDER_UNSPECIFIED   ByteOrder = 0
	ByteOrder_BYTE_ORDER_BIG_ENDIAN    ByteOrder = 1
	ByteOrder_BYTE_ORDER_LITTLE_ENDIAN ByteOrder = 2
)

func (ByteOrder) Descriptor

func (ByteOrder) Descriptor() protoreflect.EnumDescriptor

func (ByteOrder) Enum

func (x ByteOrder) Enum() *ByteOrder

func (ByteOrder) EnumDescriptor deprecated

func (ByteOrder) EnumDescriptor() ([]byte, []int)

Deprecated: Use ByteOrder.Descriptor instead.

func (ByteOrder) Number

func (x ByteOrder) Number() protoreflect.EnumNumber

func (ByteOrder) String

func (x ByteOrder) String() string

func (ByteOrder) Type

type BytesEqual

type BytesEqual struct {

	// The literal, already padded by the producer to the target field's width, so
	// that a consumer compares the whole of the target's bytes rather than a
	// prefix of them. Padding a literal out to a field's width is a COBOL
	// comparison rule and applying it is the producer's work like every other; a
	// consumer left to decide whether "Y" matches "Y " is a consumer that decides
	// differently in each language.
	Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

BytesEqual is satisfied when the target field's bytes are the carried literal.

func (*BytesEqual) Descriptor deprecated

func (*BytesEqual) Descriptor() ([]byte, []int)

Deprecated: Use BytesEqual.ProtoReflect.Descriptor instead.

func (*BytesEqual) GetValue

func (x *BytesEqual) GetValue() []byte

func (*BytesEqual) ProtoMessage

func (*BytesEqual) ProtoMessage()

func (*BytesEqual) ProtoReflect

func (x *BytesEqual) ProtoReflect() protoreflect.Message

func (*BytesEqual) Reset

func (x *BytesEqual) Reset()

func (*BytesEqual) String

func (x *BytesEqual) String() string

type BytesOneOf

type BytesOneOf struct {

	// The literals, each padded by the producer to the target field's width, in
	// the order the layout wrote them. A producer MUST carry at least two and
	// MUST NOT carry the same literal twice: one literal is BytesEqual's work,
	// and a repeated one is a value tested twice and a producer that did not
	// check its own overlap.
	//
	// The order decides nothing — a consumer stopping at the first that matches
	// and one comparing them all report the same thing, because the literals are
	// distinct. It is preserved so that two producers handed one layout emit one
	// descriptor, which is what "identical inputs produce byte-identical IR"
	// requires of every repeated field here.
	Values [][]byte `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"`
	// contains filtered or unexported fields
}

BytesOneOf is satisfied when the target field's bytes are one of the carried literals.

A member of its own rather than a shorthand a producer expands into several BytesEqual predicates: a transition carries at most one predicate and an arm carries exactly one, so a strategy admitting three type codes has nowhere to put three of them, and splitting it into three transitions to one state would turn a set of values into a set of edges for the overlap rule to forgive. Two of these overlap when their literal sets intersect, which is the same question about bytes that BytesEqual asks.

func (*BytesOneOf) Descriptor deprecated

func (*BytesOneOf) Descriptor() ([]byte, []int)

Deprecated: Use BytesOneOf.ProtoReflect.Descriptor instead.

func (*BytesOneOf) GetValues

func (x *BytesOneOf) GetValues() [][]byte

func (*BytesOneOf) ProtoMessage

func (*BytesOneOf) ProtoMessage()

func (*BytesOneOf) ProtoReflect

func (x *BytesOneOf) ProtoReflect() protoreflect.Message

func (*BytesOneOf) Reset

func (x *BytesOneOf) Reset()

func (*BytesOneOf) String

func (x *BytesOneOf) String() string

type Category

type Category int32

Category is the category the set of symbols in the picture fixes. Only numeric items have a USAGE other than DISPLAY in any meaningful sense.

const (
	Category_CATEGORY_UNSPECIFIED         Category = 0
	Category_CATEGORY_NUMERIC             Category = 1
	Category_CATEGORY_ALPHABETIC          Category = 2
	Category_CATEGORY_ALPHANUMERIC        Category = 3
	Category_CATEGORY_NUMERIC_EDITED      Category = 4
	Category_CATEGORY_ALPHANUMERIC_EDITED Category = 5
)

func (Category) Descriptor

func (Category) Descriptor() protoreflect.EnumDescriptor

func (Category) Enum

func (x Category) Enum() *Category

func (Category) EnumDescriptor deprecated

func (Category) EnumDescriptor() ([]byte, []int)

Deprecated: Use Category.Descriptor instead.

func (Category) Number

func (x Category) Number() protoreflect.EnumNumber

func (Category) String

func (x Category) String() string

func (Category) Type

type Charset

type Charset int32

Charset governs alphanumeric character data, the digit zone of zoned decimal, and the byte values of a separate sign. It governs nothing in packed, binary or floating-point items; which axis touches which encoding is cobol-go's codec/SPEC.md, "Charset as a First-Class Axis", and is not restated here.

The members are the code pages that document names. A consumer MUST refuse a value it does not recognise as a malformed descriptor rather than falling back to one it does. Because an unrecognised value arrives as its own number and is refused on sight, a code page added here later is not something a consumer can silently misread, and adding one does not advance IrVersion — unlike a member of the closed sets a consumer switches over to decide what something means.

const (
	Charset_CHARSET_UNSPECIFIED Charset = 0
	Charset_CHARSET_CP037       Charset = 1
	Charset_CHARSET_CP500       Charset = 2
	Charset_CHARSET_CP1047      Charset = 3
	Charset_CHARSET_CP1140      Charset = 4
	// ASCII, the identity translation.
	Charset_CHARSET_ASCII Charset = 5
	// No charset: the item's bytes are a payload and not characters at all.
	//
	// It is not a code page and not an identity translation. A PIC X item is
	// routinely used to carry a binary payload — a status flag whose documented
	// values are 0x01 through 0x03, a region identifier holding a hex value —
	// and decoding one through any charset produces a value nobody can read,
	// print or compare, while the trailing-space trim ReadAlphanumeric applies
	// deletes a payload byte that happens to be the charset's space. Neither is
	// recoverable, and no charset makes such an item text, so the axis that
	// answers "how do these bytes become characters" answers here that they do
	// not.
	//
	// A field carrying it MUST be USAGE_DISPLAY with CATEGORY_ALPHANUMERIC. A
	// consumer MUST read and write its bytes as they stand, MUST apply no
	// translation and MUST strip and add no padding. See docs/ir/SPEC.md, "An
	// item with no charset carries bytes, not characters".
	//
	// Adding it does not advance IrVersion, and not for the reason stated above.
	// A code page a consumer has no table for is one it cannot emit a reader for
	// at all; this value is one it could translate through and would be wrong to,
	// so the refusal rule is a rule rather than a mechanism here. What carries it
	// is that closed sets are settled before the first release and IR_VERSION_1
	// is the version being assembled. See docs/ir/SPEC.md, "An item with no
	// charset carries bytes, not characters".
	Charset_CHARSET_NONE Charset = 6
)

func (Charset) Descriptor

func (Charset) Descriptor() protoreflect.EnumDescriptor

func (Charset) Enum

func (x Charset) Enum() *Charset

func (Charset) EnumDescriptor deprecated

func (Charset) EnumDescriptor() ([]byte, []int)

Deprecated: Use Charset.Descriptor instead.

func (Charset) Number

func (x Charset) Number() protoreflect.EnumNumber

func (Charset) String

func (x Charset) String() string

func (Charset) Type

func (Charset) Type() protoreflect.EnumType

type Decrement

type Decrement struct {
	// contains filtered or unexported fields
}

Decrement carries nothing: which register is written is Binding's, and there is no operand.

func (*Decrement) Descriptor deprecated

func (*Decrement) Descriptor() ([]byte, []int)

Deprecated: Use Decrement.ProtoReflect.Descriptor instead.

func (*Decrement) ProtoMessage

func (*Decrement) ProtoMessage()

func (*Decrement) ProtoReflect

func (x *Decrement) ProtoReflect() protoreflect.Message

func (*Decrement) Reset

func (x *Decrement) Reset()

func (*Decrement) String

func (x *Decrement) String() string

type Delimited

type Delimited struct {

	// The delimiter as literal bytes, never a named character, a code point or a
	// line-ending style. A producer MUST NOT emit an empty delimiter, and a
	// consumer MUST compare it to the input as bytes and MUST NOT interpret
	// either side through a charset.
	//
	// Bytes because nothing names the byte that ends a line-delimited record:
	// cp037 and cp1047 disagree about which of 0x15 and 0x25 is LF, the same file
	// through Linux ends its records with 0x0A and through Windows with 0x0D
	// 0x0A, and a spec naming a character would have made one shop wrong about
	// the other's files. See docs/ir/SPEC.md, "A delimiter is bytes, not a
	// character".
	Delimiter []byte             `protobuf:"bytes,1,opt,name=delimiter,proto3" json:"delimiter,omitempty"`
	Placement DelimiterPlacement `protobuf:"varint,2,opt,name=placement,proto3,enum=cpybkc.ir.v1.DelimiterPlacement" json:"placement,omitempty"`
	// contains filtered or unexported fields
}

Delimited: a record's bytes are its extent, with the delimiter around it as placement says. What line sequential and the line-delimited "RECFM=V" of GnuCOBOL and Micro Focus resolve to.

func (*Delimited) Descriptor deprecated

func (*Delimited) Descriptor() ([]byte, []int)

Deprecated: Use Delimited.ProtoReflect.Descriptor instead.

func (*Delimited) GetDelimiter

func (x *Delimited) GetDelimiter() []byte

func (*Delimited) GetPlacement

func (x *Delimited) GetPlacement() DelimiterPlacement

func (*Delimited) ProtoMessage

func (*Delimited) ProtoMessage()

func (*Delimited) ProtoReflect

func (x *Delimited) ProtoReflect() protoreflect.Message

func (*Delimited) Reset

func (x *Delimited) Reset()

func (*Delimited) String

func (x *Delimited) String() string

type DelimiterPlacement

type DelimiterPlacement int32

DelimiterPlacement is where a delimited file's delimiter stands relative to the records it separates. It is carried rather than decided by a consumer because it is what makes the end of a file checkable: under separator a trailing delimiter announces a record that is not there, and under terminator a final record with nothing behind it is a file that was cut short. See docs/ir/SPEC.md, "Terminator, separator, and the last record".

const (
	DelimiterPlacement_DELIMITER_PLACEMENT_UNSPECIFIED DelimiterPlacement = 0
	// A delimiter follows every record, the last included. A file of n records
	// carries n of them.
	DelimiterPlacement_DELIMITER_PLACEMENT_TERMINATOR DelimiterPlacement = 1
	// A delimiter stands between two records. A file of n records carries n-1,
	// and nothing follows the last record.
	DelimiterPlacement_DELIMITER_PLACEMENT_SEPARATOR DelimiterPlacement = 2
	// A delimiter follows every record, except that the file MAY end after the
	// last record without one. A member because real files need it: a shop's
	// extract carries the final delimiter on Tuesday and not on Wednesday, out of
	// the same program over the same data.
	DelimiterPlacement_DELIMITER_PLACEMENT_OPTIONAL_TERMINATOR DelimiterPlacement = 3
)

func (DelimiterPlacement) Descriptor

func (DelimiterPlacement) Enum

func (DelimiterPlacement) EnumDescriptor deprecated

func (DelimiterPlacement) EnumDescriptor() ([]byte, []int)

Deprecated: Use DelimiterPlacement.Descriptor instead.

func (DelimiterPlacement) Number

func (DelimiterPlacement) String

func (x DelimiterPlacement) String() string

func (DelimiterPlacement) Type

type Descriptor

type Descriptor struct {

	// Field number 1 so that it precedes the node list on the wire for a producer
	// that serializes in field-number order, which is what makes "read the
	// version before anything else" cheap as well as required. A consumer MUST
	// read it first whatever order the bytes arrive in.
	Version IrVersion `protobuf:"varint,1,opt,name=version,proto3,enum=cpybkc.ir.v1.IrVersion" json:"version,omitempty"`
	// Every node in the descriptor, in ascending identifier order. Exactly one
	// node of kind File exists and it is the root; the descriptor does not point
	// at it separately, because a root identifier beside a kind that occurs
	// exactly once would be one fact stated twice.
	//
	// A producer MUST assign identifiers by a deterministic traversal of the
	// resolved layout, so that identical inputs produce byte-identical IR (#38).
	// See docs/ir/SPEC.md, "Identity, ordering and determinism".
	Nodes []*Node `protobuf:"bytes,2,rep,name=nodes,proto3" json:"nodes,omitempty"`
	// contains filtered or unexported fields
}

Descriptor is a resolved layout: everything a generator plugin consumes, and the only thing it consumes.

Structure is a flat set of typed nodes with references between them, never a message nested inside another message. A consumer MUST index nodes by identifier before it can walk anything, and MUST resolve every reference by identifier rather than by name. See docs/ir/SPEC.md, "A node set, not a tree".

func (*Descriptor) Descriptor deprecated

func (*Descriptor) Descriptor() ([]byte, []int)

Deprecated: Use Descriptor.ProtoReflect.Descriptor instead.

func (*Descriptor) GetNodes

func (x *Descriptor) GetNodes() []*Node

func (*Descriptor) GetVersion

func (x *Descriptor) GetVersion() IrVersion

func (*Descriptor) ProtoMessage

func (*Descriptor) ProtoMessage()

func (*Descriptor) ProtoReflect

func (x *Descriptor) ProtoReflect() protoreflect.Message

func (*Descriptor) Reset

func (x *Descriptor) Reset()

func (*Descriptor) String

func (x *Descriptor) String() string

type DescriptorWord

type DescriptorWord struct {
	// contains filtered or unexported fields
}

DescriptorWord: each record is preceded by the record descriptor word DFSMS defines. What RECFM V and VB resolve to.

The descriptor word's own width comes with that definition and is not carried here: a width beside it could hold a number describing no format anyone has.

func (*DescriptorWord) Descriptor deprecated

func (*DescriptorWord) Descriptor() ([]byte, []int)

Deprecated: Use DescriptorWord.ProtoReflect.Descriptor instead.

func (*DescriptorWord) ProtoMessage

func (*DescriptorWord) ProtoMessage()

func (*DescriptorWord) ProtoReflect

func (x *DescriptorWord) ProtoReflect() protoreflect.Message

func (*DescriptorWord) Reset

func (x *DescriptorWord) Reset()

func (*DescriptorWord) String

func (x *DescriptorWord) String() string

type Encoding

type Encoding struct {
	Charset        Charset        `protobuf:"varint,1,opt,name=charset,proto3,enum=cpybkc.ir.v1.Charset" json:"charset,omitempty"`
	SignConvention SignConvention `` /* 137-byte string literal not displayed */
	ByteOrder      ByteOrder      `protobuf:"varint,3,opt,name=byte_order,json=byteOrder,proto3,enum=cpybkc.ir.v1.ByteOrder" json:"byte_order,omitempty"`
	FloatFormat    FloatFormat    `protobuf:"varint,4,opt,name=float_format,json=floatFormat,proto3,enum=cpybkc.ir.v1.FloatFormat" json:"float_format,omitempty"`
	BinarySize     BinarySize     `protobuf:"varint,5,opt,name=binary_size,json=binarySize,proto3,enum=cpybkc.ir.v1.BinarySize" json:"binary_size,omitempty"`
	// contains filtered or unexported fields
}

Encoding is the five axes of an encoding, resolved.

A producer MUST set all five on every field and MUST NOT leave one unset. A consumer MUST NOT supply a default for a missing axis and MUST treat a field missing one as a malformed descriptor: an IR that reached a generator with an axis unresolved is a bug in resolve, and every one of the five fails silently when wrong.

Carried per field and not as a node, so nothing can point at it and nothing can inherit from it. The layout format has a profile layer and per-field overrides; resolution applies the second over the first, and what a field carries is the result. A profile surviving into the IR would be an invitation to inherit, which is a default, and the whole value of the resolved form is that no default survives into it. A record whose fields disagree about charset is therefore the ordinary case here rather than an exception. See docs/ir/SPEC.md, "The encoding profile, applied".

Four of them are the layout's and the fifth is the dialect's

The first four are properties of the *bytes*, and a layout author writes them on the `encoding` profile and its overrides. binary_size is a property of the *compiler* the file was produced by, which is docs/layout/SPEC.md's dialect, and a layout author does not write it at all: a producer resolves it from the dialect it computed the record's widths under and puts it here so that the widths a consumer reads are the widths the producer laid out. See docs/ir/SPEC.md, "A binary item's width is the staircase, not the digits".

It sits on Encoding rather than on the file node because it is consumed exactly where the other four are — an encoding is what a consumer hands its byte reader — and a fifth thing to gather from a second place is a fifth thing to forget. That it does not vary between the fields of one descriptor is a property of how a producer resolves it, not a licence to carry it once.

func (*Encoding) Descriptor deprecated

func (*Encoding) Descriptor() ([]byte, []int)

Deprecated: Use Encoding.ProtoReflect.Descriptor instead.

func (*Encoding) GetBinarySize

func (x *Encoding) GetBinarySize() BinarySize

func (*Encoding) GetByteOrder

func (x *Encoding) GetByteOrder() ByteOrder

func (*Encoding) GetCharset

func (x *Encoding) GetCharset() Charset

func (*Encoding) GetFloatFormat

func (x *Encoding) GetFloatFormat() FloatFormat

func (*Encoding) GetSignConvention

func (x *Encoding) GetSignConvention() SignConvention

func (*Encoding) ProtoMessage

func (*Encoding) ProtoMessage()

func (*Encoding) ProtoReflect

func (x *Encoding) ProtoReflect() protoreflect.Message

func (*Encoding) Reset

func (x *Encoding) Reset()

func (*Encoding) String

func (x *Encoding) String() string

type Field

type Field struct {

	// The item's width in bytes, for one occurrence. Widths come from cobol-go's
	// codec/SPEC.md, "Storage Widths", and are resolved before the IR exists: an
	// item carrying no logical value a generator can use — numeric-edited,
	// national, INDEX, POINTER — still carries one, so that the sum stays
	// correct across it.
	Width    uint32    `protobuf:"varint,1,opt,name=width,proto3" json:"width,omitempty"`
	Encoding *Encoding `protobuf:"bytes,2,opt,name=encoding,proto3" json:"encoding,omitempty"`
	Usage    Usage     `protobuf:"varint,3,opt,name=usage,proto3,enum=cpybkc.ir.v1.Usage" json:"usage,omitempty"`
	// The attributes that follow from the item's PICTURE. Absent where the item
	// has none: COMP-1 and COMP-2 do not permit a PICTURE, and INDEX and POINTER
	// have no logical value to describe.
	Picture *Picture `protobuf:"bytes,4,opt,name=picture,proto3" json:"picture,omitempty"`
	Names   *Names   `protobuf:"bytes,5,opt,name=names,proto3" json:"names,omitempty"`
	// Absent where the field does not repeat.
	Repetition *Repetition `protobuf:"bytes,6,opt,name=repetition,proto3" json:"repetition,omitempty"`
	// contains filtered or unexported fields
}

Field is an elementary item.

func (*Field) Descriptor deprecated

func (*Field) Descriptor() ([]byte, []int)

Deprecated: Use Field.ProtoReflect.Descriptor instead.

func (*Field) GetEncoding

func (x *Field) GetEncoding() *Encoding

func (*Field) GetNames

func (x *Field) GetNames() *Names

func (*Field) GetPicture

func (x *Field) GetPicture() *Picture

func (*Field) GetRepetition

func (x *Field) GetRepetition() *Repetition

func (*Field) GetUsage

func (x *Field) GetUsage() Usage

func (*Field) GetWidth

func (x *Field) GetWidth() uint32

func (*Field) ProtoMessage

func (*Field) ProtoMessage()

func (*Field) ProtoReflect

func (x *Field) ProtoReflect() protoreflect.Message

func (*Field) Reset

func (x *Field) Reset()

func (*Field) String

func (x *Field) String() string

type File

type File struct {

	// Where one record's bytes end and the next record's begin. Framing bytes
	// belong to the dataset and not to any record: no item covers them, they are
	// not slack, and no predicate ever sees one.
	//
	// Four members, and none of them is a RECFM. A layout file keeps the
	// adopter's spelling and resolve maps it; see docs/ir/SPEC.md, "Four framings,
	// and none of them is a RECFM". Adding a fifth advances IrVersion.
	//
	// Types that are valid to be assigned to Framing:
	//
	//	*File_Unframed
	//	*File_DescriptorWord
	//	*File_Segmented
	//	*File_Delimited
	Framing isFile_Framing `protobuf_oneof:"framing"`
	// The state the read begins in. A State node.
	StartStateId uint64 `protobuf:"varint,5,opt,name=start_state_id,json=startStateId,proto3" json:"start_state_id,omitempty"`
	// contains filtered or unexported fields
}

File is the dataset: its physical framing and where the automaton starts. Exactly one exists.

It carries no record length, no maximum record length, no block size and no descriptor-word width. Each is absent for a reason docs/ir/SPEC.md's "Lengths the file node does not carry" gives, and the shortest of them is that a consumer takes a record's end from its extent, so a length carried here is a value a consumer would have to ignore.

func (*File) Descriptor deprecated

func (*File) Descriptor() ([]byte, []int)

Deprecated: Use File.ProtoReflect.Descriptor instead.

func (*File) GetDelimited

func (x *File) GetDelimited() *Delimited

func (*File) GetDescriptorWord

func (x *File) GetDescriptorWord() *DescriptorWord

func (*File) GetFraming

func (x *File) GetFraming() isFile_Framing

func (*File) GetSegmented

func (x *File) GetSegmented() *Segmented

func (*File) GetStartStateId

func (x *File) GetStartStateId() uint64

func (*File) GetUnframed

func (x *File) GetUnframed() *Unframed

func (*File) ProtoMessage

func (*File) ProtoMessage()

func (*File) ProtoReflect

func (x *File) ProtoReflect() protoreflect.Message

func (*File) Reset

func (x *File) Reset()

func (*File) String

func (x *File) String() string

type File_Delimited

type File_Delimited struct {
	Delimited *Delimited `protobuf:"bytes,4,opt,name=delimited,proto3,oneof"`
}

type File_DescriptorWord

type File_DescriptorWord struct {
	DescriptorWord *DescriptorWord `protobuf:"bytes,2,opt,name=descriptor_word,json=descriptorWord,proto3,oneof"`
}

type File_Segmented

type File_Segmented struct {
	Segmented *Segmented `protobuf:"bytes,3,opt,name=segmented,proto3,oneof"`
}

type File_Unframed

type File_Unframed struct {
	Unframed *Unframed `protobuf:"bytes,1,opt,name=unframed,proto3,oneof"`
}

type FloatFormat

type FloatFormat int32

FloatFormat governs COMP-1 and COMP-2. Neither format can detect the other, because every bit pattern is valid in both: an IBM HFP 1.0 read as IEEE is 9.0, which is not an error, not a NaN and not out of range. See cobol-go's codec/SPEC.md, "Two incompatible formats".

const (
	FloatFormat_FLOAT_FORMAT_UNSPECIFIED FloatFormat = 0
	FloatFormat_FLOAT_FORMAT_IEEE754     FloatFormat = 1
	FloatFormat_FLOAT_FORMAT_IBM_HFP     FloatFormat = 2
)

func (FloatFormat) Descriptor

func (FloatFormat) Enum

func (x FloatFormat) Enum() *FloatFormat

func (FloatFormat) EnumDescriptor deprecated

func (FloatFormat) EnumDescriptor() ([]byte, []int)

Deprecated: Use FloatFormat.Descriptor instead.

func (FloatFormat) Number

func (x FloatFormat) Number() protoreflect.EnumNumber

func (FloatFormat) String

func (x FloatFormat) String() string

func (FloatFormat) Type

type GreaterThanZero

type GreaterThanZero struct {
	// contains filtered or unexported fields
}

GreaterThanZero carries nothing: which register is tested is Guard's, and the bound is the name.

func (*GreaterThanZero) Descriptor deprecated

func (*GreaterThanZero) Descriptor() ([]byte, []int)

Deprecated: Use GreaterThanZero.ProtoReflect.Descriptor instead.

func (*GreaterThanZero) ProtoMessage

func (*GreaterThanZero) ProtoMessage()

func (*GreaterThanZero) ProtoReflect

func (x *GreaterThanZero) ProtoReflect() protoreflect.Message

func (*GreaterThanZero) Reset

func (x *GreaterThanZero) Reset()

func (*GreaterThanZero) String

func (x *GreaterThanZero) String() string

type Group

type Group struct {

	// The group's members in record order — the order in which they occupy bytes,
	// which is data here and not a convention a consumer restores by sorting.
	// Each names a Group, Variant, Field or Slack node.
	//
	// A member list MUST NOT contain two items whose extents overlap. REDEFINES
	// is resolved away before the IR exists rather than carried; see
	// docs/ir/SPEC.md, "Members never overlap, and `REDEFINES` is resolved away",
	// and Variant for the one place an alternation survives.
	//
	// Containment is stated once, downward. A consumer needing a parent inverts
	// the member lists while it indexes.
	MemberIds []uint64 `protobuf:"varint,1,rep,packed,name=member_ids,json=memberIds,proto3" json:"member_ids,omitempty"`
	Names     *Names   `protobuf:"bytes,2,opt,name=names,proto3" json:"names,omitempty"`
	// Absent where the group does not repeat.
	Repetition *Repetition `protobuf:"bytes,3,opt,name=repetition,proto3" json:"repetition,omitempty"`
	// contains filtered or unexported fields
}

Group is an item holding other items.

Its width is the sum of its members' and is not carried: no node in this file carries a byte offset, and no record node carries a length. Position is stated once, as ordering and width, so that a producer cannot state it a second time and be wrong in a way no consumer could detect. See docs/ir/SPEC.md, "Ordering and width, and no offset".

func (*Group) Descriptor deprecated

func (*Group) Descriptor() ([]byte, []int)

Deprecated: Use Group.ProtoReflect.Descriptor instead.

func (*Group) GetMemberIds

func (x *Group) GetMemberIds() []uint64

func (*Group) GetNames

func (x *Group) GetNames() *Names

func (*Group) GetRepetition

func (x *Group) GetRepetition() *Repetition

func (*Group) ProtoMessage

func (*Group) ProtoMessage()

func (*Group) ProtoReflect

func (x *Group) ProtoReflect() protoreflect.Message

func (*Group) Reset

func (x *Group) Reset()

func (*Group) String

func (x *Group) String() string

type Guard

type Guard struct {

	// The Register node tested.
	RegisterId uint64 `protobuf:"varint,1,opt,name=register_id,json=registerId,proto3" json:"register_id,omitempty"`
	// The test: three members and no fourth. Conjunction is the guard list,
	// disjunction is a second transition leaving the same state, and a state
	// already is a disjunction, so the set needs neither. Its membership is
	// settled here rather than deferred the way the predicate set's is, because a
	// guard reads a value this schema's own machinery put in a register: there is
	// no layout-side strategy list for it to follow.
	//
	// Types that are valid to be assigned to Test:
	//
	//	*Guard_Equals
	//	*Guard_OneOf
	//	*Guard_GreaterThanZero
	Test isGuard_Test `protobuf_oneof:"test"`
	// contains filtered or unexported fields
}

Guard reads a register and decides whether the transition carrying it is eligible at all — or, on a state, whether reaching the end of the input there is a complete file.

A guard MUST NOT name a field node. A guard reads what the automaton remembers; a predicate reads the bytes in front of the consumer.

func (*Guard) Descriptor deprecated

func (*Guard) Descriptor() ([]byte, []int)

Deprecated: Use Guard.ProtoReflect.Descriptor instead.

func (*Guard) GetEquals

func (x *Guard) GetEquals() *Literal

func (*Guard) GetGreaterThanZero

func (x *Guard) GetGreaterThanZero() *GreaterThanZero

func (*Guard) GetOneOf

func (x *Guard) GetOneOf() *LiteralSet

func (*Guard) GetRegisterId

func (x *Guard) GetRegisterId() uint64

func (*Guard) GetTest

func (x *Guard) GetTest() isGuard_Test

func (*Guard) ProtoMessage

func (*Guard) ProtoMessage()

func (*Guard) ProtoReflect

func (x *Guard) ProtoReflect() protoreflect.Message

func (*Guard) Reset

func (x *Guard) Reset()

func (*Guard) String

func (x *Guard) String() string

type Guard_Equals

type Guard_Equals struct {
	// The register equals the carried literal.
	Equals *Literal `protobuf:"bytes,2,opt,name=equals,proto3,oneof"`
}

type Guard_GreaterThanZero

type Guard_GreaterThanZero struct {
	// The register holds an integer greater than zero.
	GreaterThanZero *GreaterThanZero `protobuf:"bytes,4,opt,name=greater_than_zero,json=greaterThanZero,proto3,oneof"`
}

type Guard_OneOf

type Guard_OneOf struct {
	// The register is one of the carried literals.
	OneOf *LiteralSet `protobuf:"bytes,3,opt,name=one_of,json=oneOf,proto3,oneof"`
}

type IrVersion

type IrVersion int32

IrVersion is the contract a descriptor was written against.

One monotonic integer, never a major and a minor, for the reason docs/ir/SPEC.md's "The version field" gives: the only question a consumer can act on is whether it understands the descriptor in front of it, and a minor number exists to let it answer "not entirely, but I will continue anyway".

A producer MUST set Descriptor.version. A consumer MUST read it before anything else and MUST refuse a version it does not know — naming the version it found and the version it understands — rather than proceeding on the parts it recognises. An unknown value arrives as its number, so refusing it is always possible; what is not possible is noticing a meaning that changed underneath a number that did not.

This field is the only guard on semantics

The IR carries no capability vocabulary and a plugin declares no feature set: #46's --plugin-info handshake is not being adopted, so nothing asks a plugin what it supports before handing it a descriptor. A plugin that meets something it cannot support errors, and the whole weight of noticing that there is something to error about rests here.

The failure to catch is not the plugin that errors. It is the plugin that does not: a thirteenth node kind, a new member of any closed set below, or a fifth framing decodes cleanly in a plugin built before it existed, because protobuf's tolerance is a rule about fields and not about meanings. An unrecognised oneof member arrives as an unset choice, which reads exactly like a member that was never there. The plugin then generates confidently wrong code from a descriptor it half-understood, the compiler sees code that builds, and nothing anywhere reports it.

When this advances

The rule is keyed to what a generator must understand in order to be correct, which is stricter than what a decoder can still parse. A version rule keyed to wire compatibility would never advance at all — every addition named below is wire-compatible — and would guard nothing.

It advances for:

  • A new member of Node.kind: a thirteenth node kind.
  • A new member of any other closed set in this file: a framing, a delimiter placement, a predicate test, a guard test, a register kind, a value a binding may write, a kind of node a reference position admits.
  • Removing a field, reusing a number, or changing what an existing field means, including narrowing or widening the values it may hold.
  • Any other addition a consumer must understand in order to stay correct, whether or not protobuf would call it compatible.

It does not advance for a new field a consumer ignoring it still handles the descriptor correctly without. Within a version every edit MUST be wire-compatible in the sense of the protobuf language guide's "Updating A Message Type", and a consumer MUST ignore fields it does not recognise.

Those two rules point in opposite directions on purpose. A consumer MUST ignore an unknown field and MUST fail on an unknown member of a closed set: a field it has never seen is information it did not need, while a choice it has never seen is a fact about the data it cannot represent at all.

This is not the IR Go module's tag (#18), and not the assertion generated code carries against the codec it links (#53). One IR version outlives many of both. See docs/ir/SPEC.md, "Versioning and compatibility".

const (
	// Never emitted by a conforming producer, and refused by a conforming
	// consumer. A descriptor whose version is zero is a descriptor whose producer
	// did not set one.
	IrVersion_IR_VERSION_UNSPECIFIED IrVersion = 0
	// The first release.
	IrVersion_IR_VERSION_1 IrVersion = 1
)

func (IrVersion) Descriptor

func (IrVersion) Descriptor() protoreflect.EnumDescriptor

func (IrVersion) Enum

func (x IrVersion) Enum() *IrVersion

func (IrVersion) EnumDescriptor deprecated

func (IrVersion) EnumDescriptor() ([]byte, []int)

Deprecated: Use IrVersion.Descriptor instead.

func (IrVersion) Number

func (x IrVersion) Number() protoreflect.EnumNumber

func (IrVersion) String

func (x IrVersion) String() string

func (IrVersion) Type

type Literal

type Literal struct {

	// Types that are valid to be assigned to Value:
	//
	//	*Literal_BytesValue
	//	*Literal_Integer
	Value isLiteral_Value `protobuf_oneof:"value"`
	// contains filtered or unexported fields
}

Literal is a value a guard compares a register against. Which member is set MUST match the kind of the register tested, which is why this mirrors RegisterKind rather than carrying an untyped byte string.

func (*Literal) Descriptor deprecated

func (*Literal) Descriptor() ([]byte, []int)

Deprecated: Use Literal.ProtoReflect.Descriptor instead.

func (*Literal) GetBytesValue

func (x *Literal) GetBytesValue() []byte

func (*Literal) GetInteger

func (x *Literal) GetInteger() int64

func (*Literal) GetValue

func (x *Literal) GetValue() isLiteral_Value

func (*Literal) ProtoMessage

func (*Literal) ProtoMessage()

func (*Literal) ProtoReflect

func (x *Literal) ProtoReflect() protoreflect.Message

func (*Literal) Reset

func (x *Literal) Reset()

func (*Literal) String

func (x *Literal) String() string

type LiteralSet

type LiteralSet struct {
	Values []*Literal `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"`
	// contains filtered or unexported fields
}

LiteralSet is the set a one-of guard tests against.

func (*LiteralSet) Descriptor deprecated

func (*LiteralSet) Descriptor() ([]byte, []int)

Deprecated: Use LiteralSet.ProtoReflect.Descriptor instead.

func (*LiteralSet) GetValues

func (x *LiteralSet) GetValues() []*Literal

func (*LiteralSet) ProtoMessage

func (*LiteralSet) ProtoMessage()

func (*LiteralSet) ProtoReflect

func (x *LiteralSet) ProtoReflect() protoreflect.Message

func (*LiteralSet) Reset

func (x *LiteralSet) Reset()

func (*LiteralSet) String

func (x *LiteralSet) String() string

type Literal_BytesValue

type Literal_BytesValue struct {
	// Compared against a bytes register, already padded by the producer to the
	// width of the value it will be compared against; a consumer MUST compare
	// the whole of that value rather than a prefix of it.
	BytesValue []byte `protobuf:"bytes,1,opt,name=bytes_value,json=bytesValue,proto3,oneof"`
}

type Literal_Integer

type Literal_Integer struct {
	// Compared against an integer register.
	Integer int64 `protobuf:"varint,2,opt,name=integer,proto3,oneof"`
}

type Names

type Names struct {

	// The name as the copybook spells it. Present even where an override is: a
	// rename substitutes a name, and the substitute is carried beside the
	// original rather than in place of it, so that generated code can still point
	// back at the copybook it came from.
	//
	// Language-neutral. A producer MUST NOT apply the casing or identifier
	// conventions of any language to either name; turning one into an identifier
	// in some target language is the generator's work.
	Original string `protobuf:"bytes,1,opt,name=original,proto3" json:"original,omitempty"`
	// The rename an adopter asked for, absent where they asked for none.
	OverrideName *string `protobuf:"bytes,2,opt,name=override_name,json=overrideName,proto3,oneof" json:"override_name,omitempty"`
	// contains filtered or unexported fields
}

Names is what a named node is called. Group, Field and Record nodes carry one; Variant, Slack and State nodes have no names at all.

A name is not identity: a consumer MUST resolve a reference by identifier and MUST NOT look a node up by name, because duplicate data names are legal COBOL. A name is also local — no node carries a materialised qualified path, for the same reason none carries an offset. A consumer needing one walks the member lists it has already inverted.

func (*Names) Descriptor deprecated

func (*Names) Descriptor() ([]byte, []int)

Deprecated: Use Names.ProtoReflect.Descriptor instead.

func (*Names) GetOriginal

func (x *Names) GetOriginal() string

func (*Names) GetOverrideName

func (x *Names) GetOverrideName() string

func (*Names) ProtoMessage

func (*Names) ProtoMessage()

func (*Names) ProtoReflect

func (x *Names) ProtoReflect() protoreflect.Message

func (*Names) Reset

func (x *Names) Reset()

func (*Names) String

func (x *Names) String() string

type Node

type Node struct {

	// Identity and nothing else. A consumer MUST NOT infer containment, ordering
	// or position from an identifier.
	//
	// Zero is an ordinary identifier. Nothing in this file uses it as a sentinel:
	// the one reference that may be absent says so with explicit presence, for
	// exactly that reason. See Transition.predicate_id.
	//
	// Every other reference here is a plain scalar, and that is the reading of
	// `optional` this schema keeps: it marks a reference absence is a meaning
	// for, not one a producer might have forgotten. Marking the required
	// references optional too would tell every consumer author that a transition
	// may admit no record and a file may have no start state, which is the
	// reading docs/ir/SPEC.md's "A transition may carry no predicate" is careful
	// to allow about predicates and nothing else.
	//
	// What catches an omission instead is the obligation that is already on both
	// sides: a producer MUST set every reference its position requires, and a
	// consumer MUST resolve each one to a node of a kind that position admits and
	// MUST report one that does not as a malformed descriptor.
	Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	// Types that are valid to be assigned to Kind:
	//
	//	*Node_File
	//	*Node_Record
	//	*Node_Group
	//	*Node_Variant
	//	*Node_Field
	//	*Node_Slack
	//	*Node_Predicate
	//	*Node_State
	//	*Node_Transition
	//	*Node_Register
	//	*Node_Binding
	//	*Node_Guard
	Kind isNode_Kind `protobuf_oneof:"kind"`
	// contains filtered or unexported fields
}

Node is one node of the descriptor: an identifier, and a body that is one member of the closed set of twelve kinds.

The set is closed so that a consumer switches over members the schema enumerates and a member it has never heard of is a failure it can detect rather than a string it silently ignores. Adding a kind advances IrVersion.

func (*Node) Descriptor deprecated

func (*Node) Descriptor() ([]byte, []int)

Deprecated: Use Node.ProtoReflect.Descriptor instead.

func (*Node) GetBinding

func (x *Node) GetBinding() *Binding

func (*Node) GetField

func (x *Node) GetField() *Field

func (*Node) GetFile

func (x *Node) GetFile() *File

func (*Node) GetGroup

func (x *Node) GetGroup() *Group

func (*Node) GetGuard

func (x *Node) GetGuard() *Guard

func (*Node) GetId

func (x *Node) GetId() uint64

func (*Node) GetKind

func (x *Node) GetKind() isNode_Kind

func (*Node) GetPredicate

func (x *Node) GetPredicate() *Predicate

func (*Node) GetRecord

func (x *Node) GetRecord() *Record

func (*Node) GetRegister

func (x *Node) GetRegister() *Register

func (*Node) GetSlack

func (x *Node) GetSlack() *Slack

func (*Node) GetState

func (x *Node) GetState() *State

func (*Node) GetTransition

func (x *Node) GetTransition() *Transition

func (*Node) GetVariant

func (x *Node) GetVariant() *Variant

func (*Node) ProtoMessage

func (*Node) ProtoMessage()

func (*Node) ProtoReflect

func (x *Node) ProtoReflect() protoreflect.Message

func (*Node) Reset

func (x *Node) Reset()

func (*Node) String

func (x *Node) String() string

type Node_Binding

type Node_Binding struct {
	Binding *Binding `protobuf:"bytes,12,opt,name=binding,proto3,oneof"`
}

type Node_Field

type Node_Field struct {
	Field *Field `protobuf:"bytes,6,opt,name=field,proto3,oneof"`
}

type Node_File

type Node_File struct {
	File *File `protobuf:"bytes,2,opt,name=file,proto3,oneof"`
}

type Node_Group

type Node_Group struct {
	Group *Group `protobuf:"bytes,4,opt,name=group,proto3,oneof"`
}

type Node_Guard

type Node_Guard struct {
	Guard *Guard `protobuf:"bytes,13,opt,name=guard,proto3,oneof"`
}

type Node_Predicate

type Node_Predicate struct {
	Predicate *Predicate `protobuf:"bytes,8,opt,name=predicate,proto3,oneof"`
}

type Node_Record

type Node_Record struct {
	Record *Record `protobuf:"bytes,3,opt,name=record,proto3,oneof"`
}

type Node_Register

type Node_Register struct {
	Register *Register `protobuf:"bytes,11,opt,name=register,proto3,oneof"`
}

type Node_Slack

type Node_Slack struct {
	Slack *Slack `protobuf:"bytes,7,opt,name=slack,proto3,oneof"`
}

type Node_State

type Node_State struct {
	State *State `protobuf:"bytes,9,opt,name=state,proto3,oneof"`
}

type Node_Transition

type Node_Transition struct {
	Transition *Transition `protobuf:"bytes,10,opt,name=transition,proto3,oneof"`
}

type Node_Variant

type Node_Variant struct {
	Variant *Variant `protobuf:"bytes,5,opt,name=variant,proto3,oneof"`
}

type Picture

type Picture struct {
	Category Category `protobuf:"varint,1,opt,name=category,proto3,enum=cpybkc.ir.v1.Category" json:"category,omitempty"`
	// The number of stored digit positions: the count of 9 symbols with every
	// repeat count expanded. P positions are digit positions of the value, occupy
	// no storage, and are not counted here.
	Digits uint32 `protobuf:"varint,2,opt,name=digits,proto3" json:"digits,omitempty"`
	// The scale, such that value = unscaled_integer * 10^(-scale). Signed,
	// because a picture ending in a run of P has a negative one. Scale never
	// affects the number of bytes and is not recoverable from them, which is why
	// it is carried.
	Scale int32 `protobuf:"varint,3,opt,name=scale,proto3" json:"scale,omitempty"`
	// Whether the item carries an operational sign: S present in the picture. An
	// unsigned item stores the unsigned sign value for its encoding, and a
	// negative value stored into it is stored as its absolute value.
	Signed bool `protobuf:"varint,4,opt,name=signed,proto3" json:"signed,omitempty"`
	// Where the sign is held. SIGN_POSITION_UNSPECIFIED where the question does
	// not arise: an unsigned item, or a USAGE the SIGN clause has no effect on,
	// which is every usage other than DISPLAY.
	SignPosition SignPosition `` /* 129-byte string literal not displayed */
	// contains filtered or unexported fields
}

Picture is what the PICTURE character-string and the SIGN clause resolved to. Deriving these is cobol-go's work and it is done before the IR exists; see codec/SPEC.md, "From PICTURE to Attributes".

func (*Picture) Descriptor deprecated

func (*Picture) Descriptor() ([]byte, []int)

Deprecated: Use Picture.ProtoReflect.Descriptor instead.

func (*Picture) GetCategory

func (x *Picture) GetCategory() Category

func (*Picture) GetDigits

func (x *Picture) GetDigits() uint32

func (*Picture) GetScale

func (x *Picture) GetScale() int32

func (*Picture) GetSignPosition

func (x *Picture) GetSignPosition() SignPosition

func (*Picture) GetSigned

func (x *Picture) GetSigned() bool

func (*Picture) ProtoMessage

func (*Picture) ProtoMessage()

func (*Picture) ProtoReflect

func (x *Picture) ProtoReflect() protoreflect.Message

func (*Picture) Reset

func (x *Picture) Reset()

func (*Picture) String

func (x *Picture) String() string

type Predicate

type Predicate struct {

	// The Field node whose bytes are tested. Always set: every member of the set
	// names a field, there is no member testing a record's length or where it
	// sits in the stream, and selecting a transition on nothing at all is the
	// absence of a predicate rather than a member here. See docs/ir/SPEC.md, "A
	// predicate always names a field".
	//
	// A producer MUST ensure the target is contained in the record the referring
	// transition admits, at any depth, and MUST NOT name a field of any other. It
	// MUST NOT name a register — a predicate reads the bytes in front of the
	// consumer and a guard reads what the automaton remembers, and neither
	// reaches into the other's half.
	//
	// The target MUST NOT repeat and MUST NOT sit inside a group that repeats,
	// and its position MUST be constant within the record: no item ahead of it
	// may carry a repetition whose count is a reference. A target whose position
	// depended on a count would oblige a consumer to decode that count out of
	// bytes it has not identified yet.
	FieldId uint64 `protobuf:"varint,1,opt,name=field_id,json=fieldId,proto3" json:"field_id,omitempty"`
	// The test.
	//
	// The set is closed so that it can be checked for overlap and for
	// exhaustiveness, and so that the IR stays data rather than carrying source
	// only one language could run. Its membership is these two, settled with the
	// layout format's discriminator strategies (#22, #28), which are what lower
	// into it: `equals` becomes BytesEqual and `one-of` becomes BytesOneOf, while
	// `single-record-type` becomes no predicate at all. Every member MUST be
	// decidable by a writer against the record it is about to emit, from that
	// record's bytes and its own position in the automaton, at the moment it
	// emits it — see docs/ir/SPEC.md, "A writer evaluates a predicate, it never
	// inverts one". Adding one advances IrVersion, which is why the set is
	// settled before the first release rather than grown afterwards.
	//
	// Types that are valid to be assigned to Test:
	//
	//	*Predicate_BytesEqual
	//	*Predicate_BytesOneOf
	Test isPredicate_Test `protobuf_oneof:"test"`
	// contains filtered or unexported fields
}

Predicate is a compiled discriminator: the field node it tests, and the test.

Two things select on bytes and they share this kind and this set of tests: a transition, choosing a record, and an arm of a variant, choosing an alternative inside one occurrence of a table.

A consumer evaluates one knowing no COBOL and knowing nothing about what the strategy that produced it was called in a layout file. See docs/ir/SPEC.md, "Discriminator predicates".

func (*Predicate) Descriptor deprecated

func (*Predicate) Descriptor() ([]byte, []int)

Deprecated: Use Predicate.ProtoReflect.Descriptor instead.

func (*Predicate) GetBytesEqual

func (x *Predicate) GetBytesEqual() *BytesEqual

func (*Predicate) GetBytesOneOf

func (x *Predicate) GetBytesOneOf() *BytesOneOf

func (*Predicate) GetFieldId

func (x *Predicate) GetFieldId() uint64

func (*Predicate) GetTest

func (x *Predicate) GetTest() isPredicate_Test

func (*Predicate) ProtoMessage

func (*Predicate) ProtoMessage()

func (*Predicate) ProtoReflect

func (x *Predicate) ProtoReflect() protoreflect.Message

func (*Predicate) Reset

func (x *Predicate) Reset()

func (*Predicate) String

func (x *Predicate) String() string

type Predicate_BytesEqual

type Predicate_BytesEqual struct {
	BytesEqual *BytesEqual `protobuf:"bytes,2,opt,name=bytes_equal,json=bytesEqual,proto3,oneof"`
}

type Predicate_BytesOneOf

type Predicate_BytesOneOf struct {
	BytesOneOf *BytesOneOf `protobuf:"bytes,3,opt,name=bytes_one_of,json=bytesOneOf,proto3,oneof"`
}

type Record

type Record struct {

	// The record's top level, a Group node.
	//
	// A group rather than either kind of item, because a record's top level holds
	// the slack nodes that resolving REDEFINES away and padding to a fixed stride
	// produce, and holding members is what a group is. The positions that admit
	// more than one kind of node are enumerated in docs/ir/SPEC.md, "Identity,
	// ordering and determinism", and this is not one of them.
	RootId uint64 `protobuf:"varint,1,opt,name=root_id,json=rootId,proto3" json:"root_id,omitempty"`
	Names  *Names `protobuf:"bytes,2,opt,name=names,proto3" json:"names,omitempty"`
	// contains filtered or unexported fields
}

Record is a record type: what a transition admits.

func (*Record) Descriptor deprecated

func (*Record) Descriptor() ([]byte, []int)

Deprecated: Use Record.ProtoReflect.Descriptor instead.

func (*Record) GetNames

func (x *Record) GetNames() *Names

func (*Record) GetRootId

func (x *Record) GetRootId() uint64

func (*Record) ProtoMessage

func (*Record) ProtoMessage()

func (*Record) ProtoReflect

func (x *Record) ProtoReflect() protoreflect.Message

func (*Record) Reset

func (x *Record) Reset()

func (*Record) String

func (x *Record) String() string

type Register

type Register struct {
	Kind RegisterKind `protobuf:"varint,1,opt,name=kind,proto3,enum=cpybkc.ir.v1.RegisterKind" json:"kind,omitempty"`
	// contains filtered or unexported fields
}

Register is a value the automaton carries forward between records: how a header's count or flag governs records other than the one holding it.

It declares the kind of value it holds and nothing more. There is one register file for the whole read, a register holds what the most recent binding put in it, and nothing saves or restores one — so the count in force is the one from the nearest preceding record that bound it, along the path actually taken. See docs/ir/SPEC.md, "The automaton remembers, in registers".

func (*Register) Descriptor deprecated

func (*Register) Descriptor() ([]byte, []int)

Deprecated: Use Register.ProtoReflect.Descriptor instead.

func (*Register) GetKind

func (x *Register) GetKind() RegisterKind

func (*Register) ProtoMessage

func (*Register) ProtoMessage()

func (*Register) ProtoReflect

func (x *Register) ProtoReflect() protoreflect.Message

func (*Register) Reset

func (x *Register) Reset()

func (*Register) String

func (x *Register) String() string

type RegisterKind

type RegisterKind int32

RegisterKind is what a register holds.

const (
	RegisterKind_REGISTER_KIND_UNSPECIFIED RegisterKind = 0
	// The source field's bytes as they appear in the record, so that a guard over
	// one is a byte comparison needing no charset knowledge.
	RegisterKind_REGISTER_KIND_BYTES RegisterKind = 1
	// A number, decoded from the source field by that field's own five encoding
	// axes, because a count is arithmetic and the field holding one may be zoned,
	// packed or binary — and a binary count is the case the fifth of them
	// decides, since how many bytes the register reads is the staircase's
	// answer.
	RegisterKind_REGISTER_KIND_INTEGER RegisterKind = 2
)

func (RegisterKind) Descriptor

func (RegisterKind) Enum

func (x RegisterKind) Enum() *RegisterKind

func (RegisterKind) EnumDescriptor deprecated

func (RegisterKind) EnumDescriptor() ([]byte, []int)

Deprecated: Use RegisterKind.Descriptor instead.

func (RegisterKind) Number

func (RegisterKind) String

func (x RegisterKind) String() string

func (RegisterKind) Type

type Repetition

type Repetition struct {

	// Types that are valid to be assigned to Count:
	//
	//	*Repetition_Constant
	//	*Repetition_Variable
	Count isRepetition_Count `protobuf_oneof:"count"`
	// contains filtered or unexported fields
}

Repetition is what an item that repeats carries. An item that does not repeat carries none.

func (*Repetition) Descriptor deprecated

func (*Repetition) Descriptor() ([]byte, []int)

Deprecated: Use Repetition.ProtoReflect.Descriptor instead.

func (*Repetition) GetConstant

func (x *Repetition) GetConstant() uint32

func (*Repetition) GetCount

func (x *Repetition) GetCount() isRepetition_Count

func (*Repetition) GetVariable

func (x *Repetition) GetVariable() *VariableCount

func (*Repetition) ProtoMessage

func (*Repetition) ProtoMessage()

func (*Repetition) ProtoReflect

func (x *Repetition) ProtoReflect() protoreflect.Message

func (*Repetition) Reset

func (x *Repetition) Reset()

func (*Repetition) String

func (x *Repetition) String() string

type Repetition_Constant

type Repetition_Constant struct {
	// A constant number of occurrences: OCCURS n. Carries no bounds — there is
	// nothing to check a constant against.
	Constant uint32 `protobuf:"varint,1,opt,name=constant,proto3,oneof"`
}

type Repetition_Variable

type Repetition_Variable struct {
	// OCCURS DEPENDING ON: a count read at run time, with the bounds the
	// copybook declared.
	Variable *VariableCount `protobuf:"bytes,2,opt,name=variable,proto3,oneof"`
}

type Segmented

type Segmented struct {

	// The largest segment a writer may emit, in bytes. The only size any framing
	// carries.
	MaxSegmentSize uint32 `protobuf:"varint,1,opt,name=max_segment_size,json=maxSegmentSize,proto3" json:"max_segment_size,omitempty"`
	// contains filtered or unexported fields
}

Segmented: a record is the concatenation of its segments' data, each segment preceded by a segment descriptor word. What RECFM VBS resolves to.

func (*Segmented) Descriptor deprecated

func (*Segmented) Descriptor() ([]byte, []int)

Deprecated: Use Segmented.ProtoReflect.Descriptor instead.

func (*Segmented) GetMaxSegmentSize

func (x *Segmented) GetMaxSegmentSize() uint32

func (*Segmented) ProtoMessage

func (*Segmented) ProtoMessage()

func (*Segmented) ProtoReflect

func (x *Segmented) ProtoReflect() protoreflect.Message

func (*Segmented) Reset

func (x *Segmented) Reset()

func (*Segmented) String

func (x *Segmented) String() string

type SignConvention

type SignConvention int32

SignConvention is how an overpunched sign is spelled in a zoned decimal byte. It is a property of the file in hand and cannot be read from the copybook at all, which is why it is an axis of its own rather than a consequence of charset: a mainframe-written file converted to ASCII has ASCII characters, translated-EBCDIC signs and big-endian binary, and no boolean expresses it. Values and byte tables are cobol-go's codec/SPEC.md, "Zoned Sign Conventions".

const (
	SignConvention_SIGN_CONVENTION_UNSPECIFIED SignConvention = 0
	// Every EBCDIC file. Universal: there is no competing EBCDIC convention.
	SignConvention_SIGN_CONVENTION_EBCDIC SignConvention = 1
	// The native ASCII convention: Micro Focus, Microsoft COBOL, and GnuCOBOL
	// compiling for ASCII.
	SignConvention_SIGN_CONVENTION_ASCII_ZONE37 SignConvention = 2
	// What an EBCDIC-to-ASCII text conversion produces from EBCDIC sign data.
	SignConvention_SIGN_CONVENTION_TRANSLATED_EBCDIC SignConvention = 3
	// CA Realia COBOL.
	SignConvention_SIGN_CONVENTION_REALIA SignConvention = 4
)

func (SignConvention) Descriptor

func (SignConvention) Enum

func (x SignConvention) Enum() *SignConvention

func (SignConvention) EnumDescriptor deprecated

func (SignConvention) EnumDescriptor() ([]byte, []int)

Deprecated: Use SignConvention.Descriptor instead.

func (SignConvention) Number

func (SignConvention) String

func (x SignConvention) String() string

func (SignConvention) Type

type SignPosition

type SignPosition int32

SignPosition is the copybook's side of the sign: where an operational sign sits and whether it takes a byte of its own. It is not SignConvention, which is how a sign is spelled in the file in hand; both are needed and they are different axes.

const (
	// The item holds no operational sign in a position: it is unsigned, or its
	// USAGE is one the SIGN clause has no effect on.
	SignPosition_SIGN_POSITION_UNSPECIFIED SignPosition = 0
	SignPosition_SIGN_POSITION_LEADING     SignPosition = 1
	// The default for a signed DISPLAY item.
	SignPosition_SIGN_POSITION_TRAILING          SignPosition = 2
	SignPosition_SIGN_POSITION_LEADING_SEPARATE  SignPosition = 3
	SignPosition_SIGN_POSITION_TRAILING_SEPARATE SignPosition = 4
)

func (SignPosition) Descriptor

func (SignPosition) Enum

func (x SignPosition) Enum() *SignPosition

func (SignPosition) EnumDescriptor deprecated

func (SignPosition) EnumDescriptor() ([]byte, []int)

Deprecated: Use SignPosition.Descriptor instead.

func (SignPosition) Number

func (SignPosition) String

func (x SignPosition) String() string

func (SignPosition) Type

type Slack

type Slack struct {
	Width uint32 `protobuf:"varint,1,opt,name=width,proto3" json:"width,omitempty"`
	// contains filtered or unexported fields
}

Slack is bytes that are part of the record and belong to no item: what SYNCHRONIZED inserts ahead of an aligned item, what resolving REDEFINES away leaves behind, and what padding a record out to a fixed stride adds.

A width and nothing else. No fill byte, because a reader retains the bytes it read and a writer emits what was retained; and no member naming which of the three produced it, because nothing a consumer does depends on the answer. A producer MUST emit one node per maximal run of such bytes, so that two runs of different origin that abut are one node and not two. See docs/ir/SPEC.md, "Slack is a node, not a rule" and "Slack survives a read".

Alignment is therefore bytes a generator already has rather than a rule it applies: a generator MUST NOT implement one, because there is nothing left for it to do.

func (*Slack) Descriptor deprecated

func (*Slack) Descriptor() ([]byte, []int)

Deprecated: Use Slack.ProtoReflect.Descriptor instead.

func (*Slack) GetWidth

func (x *Slack) GetWidth() uint32

func (*Slack) ProtoMessage

func (*Slack) ProtoMessage()

func (*Slack) ProtoReflect

func (x *Slack) ProtoReflect() protoreflect.Message

func (*Slack) Reset

func (x *Slack) Reset()

func (*Slack) String

func (x *Slack) String() string

type State

type State struct {

	// Whether reaching the end of the input in this state is a complete file.
	Accepts bool `protobuf:"varint,1,opt,name=accepts,proto3" json:"accepts,omitempty"`
	// Guard nodes qualifying that acceptance, where it is conditional. All of
	// them MUST hold, so their order is not significant, and they are evaluated
	// against the register file as it stands on entry to the state.
	//
	// Empty where acceptance is unconditional — which, on a state that does not
	// accept at all, it is.
	AcceptanceGuardIds []uint64 `protobuf:"varint,2,rep,packed,name=acceptance_guard_ids,json=acceptanceGuardIds,proto3" json:"acceptance_guard_ids,omitempty"`
	// The transitions leaving this state, in the order a consumer evaluates them.
	TransitionIds []uint64 `protobuf:"varint,3,rep,packed,name=transition_ids,json=transitionIds,proto3" json:"transition_ids,omitempty"`
	// contains filtered or unexported fields
}

State is a state of the record automaton. Sequencing reaches a generator compiled: no consumer parses a grammar and no generator author implements one. See docs/ir/SPEC.md, "The sequencing automaton".

States carry identifiers and no names.

func (*State) Descriptor deprecated

func (*State) Descriptor() ([]byte, []int)

Deprecated: Use State.ProtoReflect.Descriptor instead.

func (*State) GetAcceptanceGuardIds

func (x *State) GetAcceptanceGuardIds() []uint64

func (*State) GetAccepts

func (x *State) GetAccepts() bool

func (*State) GetTransitionIds

func (x *State) GetTransitionIds() []uint64

func (*State) ProtoMessage

func (*State) ProtoMessage()

func (*State) ProtoReflect

func (x *State) ProtoReflect() protoreflect.Message

func (*State) Reset

func (x *State) Reset()

func (*State) String

func (x *State) String() string

type Transition

type Transition struct {

	// The Record node this transition admits. A producer MUST NOT emit a
	// transition admitting a record whose extent is zero.
	RecordId uint64 `protobuf:"varint,1,opt,name=record_id,json=recordId,proto3" json:"record_id,omitempty"`
	// The State node this transition moves to. A cycle here is a file that
	// repeats a record, which is most files.
	NextStateId uint64 `protobuf:"varint,2,opt,name=next_state_id,json=nextStateId,proto3" json:"next_state_id,omitempty"`
	// The Predicate node that selects this transition, where it carries one.
	//
	// Explicitly optional, and that is the point of the keyword: a transition MAY
	// carry no predicate, one that does not matches every record, and an absent
	// reference MUST be distinguishable from every identifier a node may carry so
	// that a consumer never reads one as identifier zero. A sentinel value would
	// not have been distinguishable, because zero is an ordinary identifier.
	//
	// It is optional in the first release rather than later because a consumer
	// that has not heard of the relaxation reads an unset reference as a
	// malformed descriptor and refuses a conforming file — a file with one record
	// type has nothing for a predicate to test. A producer SHOULD still carry one
	// wherever the record offers a target, because a predicate the automaton does
	// not need in order to choose is the only detection such a state has. See
	// docs/ir/SPEC.md, "A transition may carry no predicate".
	PredicateId *uint64 `protobuf:"varint,3,opt,name=predicate_id,json=predicateId,proto3,oneof" json:"predicate_id,omitempty"`
	// Guard nodes making this transition eligible. All of them MUST hold, so
	// their order is not significant. A transition carrying none is always
	// eligible. Guards are evaluated before the record in front of the consumer
	// is examined at all, and against the register file as it stands on entry to
	// the state, so a guard never reads what its own transition binds.
	GuardIds []uint64 `protobuf:"varint,4,rep,packed,name=guard_ids,json=guardIds,proto3" json:"guard_ids,omitempty"`
	// Binding nodes this transition applies. They apply when the transition is
	// taken, after the record is admitted, and each reads the register file as it
	// stood on entry to the state — so their order is not significant either, and
	// nothing this transition reads sees what it writes. A producer MUST NOT put
	// two bindings writing one register on a single transition.
	BindingIds []uint64 `protobuf:"varint,5,rep,packed,name=binding_ids,json=bindingIds,proto3" json:"binding_ids,omitempty"`
	// contains filtered or unexported fields
}

Transition is one edge of the record automaton: it consumes exactly one record. There are no epsilon transitions.

func (*Transition) Descriptor deprecated

func (*Transition) Descriptor() ([]byte, []int)

Deprecated: Use Transition.ProtoReflect.Descriptor instead.

func (*Transition) GetBindingIds

func (x *Transition) GetBindingIds() []uint64

func (*Transition) GetGuardIds

func (x *Transition) GetGuardIds() []uint64

func (*Transition) GetNextStateId

func (x *Transition) GetNextStateId() uint64

func (*Transition) GetPredicateId

func (x *Transition) GetPredicateId() uint64

func (*Transition) GetRecordId

func (x *Transition) GetRecordId() uint64

func (*Transition) ProtoMessage

func (*Transition) ProtoMessage()

func (*Transition) ProtoReflect

func (x *Transition) ProtoReflect() protoreflect.Message

func (*Transition) Reset

func (x *Transition) Reset()

func (*Transition) String

func (x *Transition) String() string

type Unframed

type Unframed struct {
	// contains filtered or unexported fields
}

Unframed: a record's bytes are its extent, beginning at the byte after the record before it. What RECFM F and FB resolve to, and nothing else does.

A descriptor whose framing is unframed MUST NOT carry a record type any item of which has a repetition whose count is a reference, at any depth: a record whose extent moves with its data has no single number of bytes to pad out to a fixed stride. See docs/ir/SPEC.md, "A variable record does not fit a fixed-length dataset".

Empty rather than absent from the set, because "which of the four" is a question every consumer asks and a framing carrying nothing still has to be one of the four answers.

func (*Unframed) Descriptor deprecated

func (*Unframed) Descriptor() ([]byte, []int)

Deprecated: Use Unframed.ProtoReflect.Descriptor instead.

func (*Unframed) ProtoMessage

func (*Unframed) ProtoMessage()

func (*Unframed) ProtoReflect

func (x *Unframed) ProtoReflect() protoreflect.Message

func (*Unframed) Reset

func (x *Unframed) Reset()

func (*Unframed) String

func (x *Unframed) String() string

type Usage

type Usage int32

Usage is the item's USAGE, resolved to the one the bytes are in rather than to the alias the copybook spelled. Byte-level meaning is cobol-go's codec/SPEC.md and is not restated here.

const (
	Usage_USAGE_UNSPECIFIED Usage = 0
	// DISPLAY: one character per digit or character position.
	Usage_USAGE_DISPLAY Usage = 1
	// PACKED-DECIMAL, spelled COMP-3 or COMPUTATIONAL-3.
	Usage_USAGE_PACKED_DECIMAL Usage = 2
	// COMP-6: packed with no sign nibble. GnuCOBOL and Micro Focus.
	Usage_USAGE_COMP_6 Usage = 3
	// BINARY, spelled COMP, COMP-4 or COMPUTATIONAL.
	Usage_USAGE_BINARY Usage = 4
	// COMP-5: the same widths as BINARY, native byte order, different range
	// semantics.
	Usage_USAGE_COMP_5 Usage = 5
	// COMP-1, spelled FLOAT-SHORT. Four bytes, no PICTURE.
	Usage_USAGE_COMP_1 Usage = 6
	// COMP-2, spelled FLOAT-LONG. Eight bytes, no PICTURE.
	Usage_USAGE_COMP_2 Usage = 7
	// INDEX. Carries a width so that the sum stays correct across it, and no
	// logical value a generator can use.
	Usage_USAGE_INDEX Usage = 8
	// POINTER. As INDEX.
	Usage_USAGE_POINTER Usage = 9
	// NATIONAL. Carries a width so that the sum stays correct across it;
	// codec/SPEC.md places national items out of scope and derives no PICTURE
	// attributes for them, so a field carrying this usage carries no Picture.
	Usage_USAGE_NATIONAL Usage = 10
)

func (Usage) Descriptor

func (Usage) Descriptor() protoreflect.EnumDescriptor

func (Usage) Enum

func (x Usage) Enum() *Usage

func (Usage) EnumDescriptor deprecated

func (Usage) EnumDescriptor() ([]byte, []int)

Deprecated: Use Usage.Descriptor instead.

func (Usage) Number

func (x Usage) Number() protoreflect.EnumNumber

func (Usage) String

func (x Usage) String() string

func (Usage) Type

func (Usage) Type() protoreflect.EnumType

type VariableCount

type VariableCount struct {

	// Where the count is read from. Two kinds of node are admitted and the
	// reference says which, rather than leaving a consumer to dereference an
	// untyped identifier and find out.
	//
	// A field count MUST be contained in the record being read, at any depth, and
	// MUST lie ahead of the item it counts at a constant position. A register
	// count MUST have been bound by a transition taken strictly earlier than the
	// one admitting this record. Both are constraints resolve proves, not things
	// this message carries; see docs/ir/SPEC.md, "A count is in hand before the
	// extent it decides".
	//
	// Neither kind is one-to-one: two repeating items of one record MAY name the
	// same count, and nothing here distinguishes a count two repetitions share
	// from one a single repetition names, because the sharing is two repetitions
	// pointing at one node.
	//
	// Types that are valid to be assigned to Count:
	//
	//	*VariableCount_FieldId
	//	*VariableCount_RegisterId
	Count isVariableCount_Count `protobuf_oneof:"count"`
	// The copybook's own OCCURS integer-1 TO integer-2, carried for one purpose:
	// a count outside them is malformed data and a consumer MUST report it rather
	// than reading that many occurrences. Nothing else in this schema reads them.
	//
	// Without them the check does not exist. A descriptor word stating the length
	// a forbidden count implies agrees with the extent exactly, so the framing
	// check passes on a record the copybook says cannot exist — which is what a
	// file written against a later version of that copybook looks like.
	MinOccurrences uint32 `protobuf:"varint,3,opt,name=min_occurrences,json=minOccurrences,proto3" json:"min_occurrences,omitempty"`
	MaxOccurrences uint32 `protobuf:"varint,4,opt,name=max_occurrences,json=maxOccurrences,proto3" json:"max_occurrences,omitempty"`
	// contains filtered or unexported fields
}

VariableCount is an OCCURS DEPENDING ON count: where the number of occurrences is read from, and what range the copybook says it may hold.

The item's extent is the width of one occurrence times that count, and the item behind it begins at the byte after the last occurrence the count states. The table slides; the other vendor reading resolves to a constant repetition and a field instead, so nothing here says which reading a file was written under. See docs/ir/SPEC.md, "An item after a table slides, and the other reading is a fixed table".

func (*VariableCount) Descriptor deprecated

func (*VariableCount) Descriptor() ([]byte, []int)

Deprecated: Use VariableCount.ProtoReflect.Descriptor instead.

func (*VariableCount) GetCount

func (x *VariableCount) GetCount() isVariableCount_Count

func (*VariableCount) GetFieldId

func (x *VariableCount) GetFieldId() uint64

func (*VariableCount) GetMaxOccurrences

func (x *VariableCount) GetMaxOccurrences() uint32

func (*VariableCount) GetMinOccurrences

func (x *VariableCount) GetMinOccurrences() uint32

func (*VariableCount) GetRegisterId

func (x *VariableCount) GetRegisterId() uint64

func (*VariableCount) ProtoMessage

func (*VariableCount) ProtoMessage()

func (*VariableCount) ProtoReflect

func (x *VariableCount) ProtoReflect() protoreflect.Message

func (*VariableCount) Reset

func (x *VariableCount) Reset()

func (*VariableCount) String

func (x *VariableCount) String() string

type VariableCount_FieldId

type VariableCount_FieldId struct {
	FieldId uint64 `protobuf:"varint,1,opt,name=field_id,json=fieldId,proto3,oneof"`
}

type VariableCount_RegisterId

type VariableCount_RegisterId struct {
	RegisterId uint64 `protobuf:"varint,2,opt,name=register_id,json=registerId,proto3,oneof"`
}

type Variant

type Variant struct {

	// The arms in evaluation order. Every arm begins at the variant's first byte,
	// so this order says nothing about position — it is the one ordered list in
	// this schema that is not a member list.
	//
	// Every arm's extent MUST equal every other arm's, and no item of an arm MAY
	// carry a repetition whose count is a reference at any depth. That one
	// requirement is what keeps a variant's contribution to the sum constant, so
	// that nothing else in this schema moves for it.
	Arms []*Arm `protobuf:"bytes,1,rep,name=arms,proto3" json:"arms,omitempty"`
	// contains filtered or unexported fields
}

Variant is an alternation over one run of bytes inside a table: what a REDEFINES inside a repeating group resolves to, and the only place an alternation survives resolution.

It carries its arms and nothing else. No width, because the width is the arms' common extent and a group's width is not carried either. No names, because the copybook gives the alternation none — the redefined item is the first arm and carries its own. No repetition, because a variant repeats by sitting inside the group that does.

A variant MUST be contained, at any depth, in a group that repeats, and a producer MUST NOT emit one anywhere else: outside a table an alternative is chosen once per record and becomes a Record node instead. See docs/ir/SPEC.md, "A variant is chosen once per occurrence".

func (*Variant) Descriptor deprecated

func (*Variant) Descriptor() ([]byte, []int)

Deprecated: Use Variant.ProtoReflect.Descriptor instead.

func (*Variant) GetArms

func (x *Variant) GetArms() []*Arm

func (*Variant) ProtoMessage

func (*Variant) ProtoMessage()

func (*Variant) ProtoReflect

func (x *Variant) ProtoReflect() protoreflect.Message

func (*Variant) Reset

func (x *Variant) Reset()

func (*Variant) String

func (x *Variant) String() string

Jump to

Keyboard shortcuts

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