parser

package
v0.0.0-...-429302c Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2022 License: GPL-3.0 Imports: 14 Imported by: 0

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

func ResetCache()

ResetCache resets the parser's global cache.

func SetupCache

func SetupCache()

SetupCache sets up the parser's global cache.

Types

type Config

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

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

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