Documentation
¶
Index ¶
- type Error
- type ErrorList
- func (el *ErrorList) Add(err *Error)
- func (el *ErrorList) AddLexicalError(message string, pos lexer.Position)
- func (el *ErrorList) AddSemanticError(message string, pos lexer.Position)
- func (el *ErrorList) AddSyntaxError(message string, pos lexer.Position)
- func (el ErrorList) Count() int
- func (el ErrorList) Error() string
- func (el ErrorList) FilterByType(errorType ErrorType) ErrorList
- func (el ErrorList) GetLexicalErrors() ErrorList
- func (el ErrorList) GetSemanticErrors() ErrorList
- func (el ErrorList) GetSyntaxErrors() ErrorList
- func (el ErrorList) HasErrors() bool
- func (el ErrorList) String() string
- type ErrorReporter
- func (er *ErrorReporter) Clear()
- func (er *ErrorReporter) GetErrorCount() int
- func (er *ErrorReporter) GetErrors() ErrorList
- func (er *ErrorReporter) HasErrors() bool
- func (er *ErrorReporter) Report(err *Error)
- func (er *ErrorReporter) ReportLexicalError(message string, pos lexer.Position)
- func (er *ErrorReporter) ReportSemanticError(message string, pos lexer.Position)
- func (er *ErrorReporter) ReportSyntaxError(message string, pos lexer.Position)
- type ErrorType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Error ¶
type Error struct {
Type ErrorType `json:"type"`
Message string `json:"message"`
Position lexer.Position `json:"position"`
Source string `json:"source,omitempty"`
}
Error 表示解析错误
func NewLexicalError ¶
NewLexicalError 创建词法错误
func NewSemanticError ¶
NewSemanticError 创建语义错误
func NewSyntaxError ¶
NewSyntaxError 创建语法错误
func (*Error) PrintFormatted ¶
PrintFormatted 格式化打印错误(带源代码上下文)
type ErrorList ¶
type ErrorList []*Error
ErrorList 错误列表
func (*ErrorList) AddLexicalError ¶
AddLexicalError 添加词法错误
func (*ErrorList) AddSemanticError ¶
AddSemanticError 添加语义错误
func (*ErrorList) AddSyntaxError ¶
AddSyntaxError 添加语法错误
func (ErrorList) FilterByType ¶
FilterByType 按类型过滤错误
func (ErrorList) GetLexicalErrors ¶
GetLexicalErrors 获取词法错误
func (ErrorList) GetSemanticErrors ¶
GetSemanticErrors 获取语义错误
func (ErrorList) GetSyntaxErrors ¶
GetSyntaxErrors 获取语法错误
type ErrorReporter ¶
type ErrorReporter struct {
// contains filtered or unexported fields
}
ErrorReporter 错误报告器
func NewErrorReporter ¶
func NewErrorReporter(source string) *ErrorReporter
NewErrorReporter 创建新的错误报告器
func (*ErrorReporter) GetErrorCount ¶
func (er *ErrorReporter) GetErrorCount() int
GetErrorCount 获取错误数量
func (*ErrorReporter) ReportLexicalError ¶
func (er *ErrorReporter) ReportLexicalError(message string, pos lexer.Position)
ReportLexicalError 报告词法错误
func (*ErrorReporter) ReportSemanticError ¶
func (er *ErrorReporter) ReportSemanticError(message string, pos lexer.Position)
ReportSemanticError 报告语义错误
func (*ErrorReporter) ReportSyntaxError ¶
func (er *ErrorReporter) ReportSyntaxError(message string, pos lexer.Position)
ReportSyntaxError 报告语法错误
Click to show internal directories.
Click to hide internal directories.