input

package
v0.0.0-...-3fc9e9f Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2017 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

input 用于处理文件输入,过滤代码,生成 doc.Doc 数据。

多行注释和单行注释在处理上会有一定区别:

  • 单行注释,风格相同且相邻的注释会被合并成一个注释块;
  • 单行注释,风格不相同且相邻的注释会被按注释风格多个注释块;
  • 多行注释,即使两个注释释块相邻也会被分成两个注释块来处理。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetectDirLang

func DetectDirLang(dir string) (string, error)

DetectDirLang 检测指定目录下的语言类型。

检测依据为根据扩展名来做统计,数量最大且被支持的获胜。 不会分析子目录。

func Langs

func Langs() []string

Langs 返回所有支持的语言

func Parse

func Parse(docs *doc.Doc, o *Options) error

Parse 分析源代码,获取相应的文档内容。

Types

type Options

type Options struct {
	SyntaxLog *log.Logger `json:"-"`              // 语法错误输出通道
	Lang      string      `json:"lang"`           // 输入的目标语言
	Dir       string      `json:"dir"`            // 源代码目录
	Exts      []string    `json:"exts,omitempty"` // 需要扫描的文件扩展名,若未指定,则使用默认值
	Recursive bool        `json:"recursive"`      // 是否查找 Dir 的子目录
}

Options 指定输入内容的相关信息。

func (*Options) Init

func (opt *Options) Init() *app.OptionsError

Init 检测 Options 变量是否符合要求

Jump to

Keyboard shortcuts

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