generator

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

generator package is responsible for parsing the file and generating the enum go file. It uses the ast package to parse the file and generate the enum go file from the parsed information. The EnumRepresentation struct is the struct to store the information that is to be used in writing the enum to a file. ParseAndGenerate function to parse the file and generate the enum go file for the enum type with failfast mode flag. Provides the failfast mode flag to enable failfast mode. This mode is 'error on invalid' and will error instead of generating an enum class as 'Invalid' when Parsed.

Index

Constants

This section is empty.

Variables

View Source
var ErrFailedToParseFile = fmt.Errorf("failed to parse file")

ErrFailedToParseFile is an error returned when the file cannot be parsed.

Functions

func ParseAndGenerate added in v0.2.0

func ParseAndGenerate(filename string, failfast bool) error

ParseAndGenerate parses the file and generates the enum go file for the enum type with failfast mode flag.

Types

type Enum

type Enum struct {
	Info     info
	TypeInfo typeInfo
	Raw      raw
}

Enum is a struct to store the information for each enum to be written.

type EnumRepresentation added in v0.2.0

type EnumRepresentation struct {
	PackageName string
	Failfast    bool
	TypeInfo    typeInfo
	Enums       []Enum
}

EnumRepresentation is a struct to store the information to be used in writing the enum to a file.

Jump to

Keyboard shortcuts

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