parser

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2022 License: GPL-3.0 Imports: 13 Imported by: 1

Documentation

Overview

Package parser parses a setup file's functions, types, and fields using an Abstract Syntax Tree.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(gen *models.Generator) error

Parse parses a generator's setup file.

func ResetCache added in v0.3.3

func ResetCache()

ResetCache resets the parser's global cache.

func SetupCache added in v0.3.3

func SetupCache()

SetupCache sets up the parser's global cache.

Types

type Config added in v0.3.0

type Config struct {
	// SetupFile represents the setup file as an Abstract Syntax Tree.
	SetupFile *ast.File

	// SetupPkg represent the setup file's package.
	SetupPkg *packages.Package

	// Fileset represents the parser's fileset.
	Fileset *token.FileSet
}

Config represents a Parser's configuration.

type Options added in v0.3.0

type Options struct {
	// commentOptionMap represents a map of comments (as text) to an option.
	CommentOptionMap map[string]*options.Option

	// convertOptions represents a global list of convert options (for convert functions).
	ConvertOptions []*options.Option
}

Options represents a parser's options.

type Parser

type Parser struct {
	Config  Config
	Options Options
	Pkgs    []*packages.Package
}

Parser represents a parser that parses Abstract Syntax Tree data into models.

func (*Parser) Keep added in v0.3.0

func (p *Parser) Keep(astFile *ast.File) error

Keep removes ast.Nodes from an ast.File that will be kept in a generated output file.

Directories

Path Synopsis
Package options parses function comments and sets them to fields.
Package options parses function comments and sets them to fields.

Jump to

Keyboard shortcuts

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