syntax

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

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

Go to latest
Published: Jul 31, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package syntax 负责对标签语法的解析操作。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OutputError

func OutputError(l *log.Logger, file string, line int, format string, v ...interface{})

OutputError 向日志通道输出一条语法错误信息 file 错误所在的文件; line 错误所在的行号;

func Parse

func Parse(input *Input, d *types.Doc)

Parse 分析一段代码,并将结果保存到 d 中。

若出错,则会在 Input.Error 中输出错误信息,并中断解析, 也不会在 d 中添加任何内容;若是警告信息,会继续执行。

Types

type Input

type Input struct {
	File  string      // 该段代码所在的文件
	Line  int         // 该段代码在文件中的行号
	Data  []rune      // 需要解析的代码段
	Error *log.Logger // 出错时的输出通道
	Warn  *log.Logger // 警告信息的输出通道
}

Input 由外界提供的与标签语法相关的内容。

Jump to

Keyboard shortcuts

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