Documentation
¶
Overview ¶
Package lang 管理各类语言提取注释代码块规则的定义
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Blocker ¶
type Blocker interface {
// 确定 l 的当前位置是否匹配 Blocker 的起始位置。
BeginFunc(l *Lexer) bool
// 确定 l 的当前位置是否匹配 Blocker 的结束位置
//
// data 表示匹配的内容,如果不使用返回的内容,可以返回空值。
// 比如字符串,只需要返回 true,以确保找到了结束位置,但是 data 可以直接返回 nil。
//
// 如果在到达文件末尾都没有找到结束符,则应该返回 nil, false
EndFunc(l *Lexer) (data []byte, ok bool)
}
Blocker 接口定义了解析代码块的所有操作
type Language ¶
type Language struct {
DisplayName string // 显示友好的名称
ID string // 语言唯一名称,一律小写
Blocks []Blocker // 注释块的解析规则定义
Exts []string // 扩展名列表,必须以 . 开头且小写
}
Language 语言模块的定义
Click to show internal directories.
Click to hide internal directories.