parse

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 5, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package parse for parse golang code. Extraction of basic information to generate helpfull code.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Node

type Node struct {
	TokenType       token.Token
	NodeDocComments *ast.CommentGroup
	NodePosition    token.Position

	FieldName  string
	FieldValue ast.Expr

	FieldDocComments  *ast.CommentGroup
	FieldLineComments *ast.CommentGroup

	// var, const
	ValueSpec *ast.ValueSpec
	// value type; or nil
	ValueSpecType ast.Expr

	// type ...
	TypeSpec *ast.TypeSpec
	// *Ident, *ParenExpr, *SelectorExpr, *StarExpr, or any of the *XxxTypes
	TypeSpecType ast.Expr
}

Node is backet with the prepared information.

func Parse

func Parse(pathFile string) []Node

Parse return interested nodes of file.

func (Node) DocComments

func (n Node) DocComments() string

func (Node) IsConst

func (n Node) IsConst() bool

IsConst return true if node is const.

func (Node) IsType

func (n Node) IsType() bool

IsType return true if node is type.

func (Node) IsVar

func (n Node) IsVar() bool

IsVar return true if node is var.

Jump to

Keyboard shortcuts

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