{"modulePath":"github.com/wudi/php-parser","version":"v0.1.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package errors\n\n## Types\n\n```go\ntype Error struct {\n\tType     ErrorType      `json:\"type\"`\n\tMessage  string         `json:\"message\"`\n\tPosition lexer.Position `json:\"position\"`\n\tSource   string         `json:\"source,omitempty\"`\n}\n```\nError 表示解析错误\n\n```go\nfunc NewLexicalError(message string, pos lexer.Position) *Error\n```\nNewLexicalError 创建词法错误\n\n```go\nfunc NewSemanticError(message string, pos lexer.Position) *Error\n```\nNewSemanticError 创建语义错误\n\n```go\nfunc NewSyntaxError(message string, pos lexer.Position) *Error\n```\nNewSyntaxError 创建语法错误\n\n```go\nfunc (e *Error) Error() string\n```\nError 实现 error 接口\n\n```go\nfunc (e *Error) PrintFormatted() string\n```\nPrintFormatted 格式化打印错误（带源代码上下文）\n\n```go\nfunc (e *Error) String() string\n```\nString 返回错误的字符串表示\n\n```go\nfunc (e *Error) WithSource(source string) *Error\n```\nWithSource 添加源代码上下文\n\n```go\ntype ErrorList []*Error\n```\nErrorList 错误列表\n\n```go\nfunc (el *ErrorList) Add(err *Error)\n```\nAdd 添加错误\n\n```go\nfunc (el *ErrorList) AddLexicalError(message string, pos lexer.Position)\n```\nAddLexicalError 添加词法错误\n\n```go\nfunc (el *ErrorList) AddSemanticError(message string, pos lexer.Position)\n```\nAddSemanticError 添加语义错误\n\n```go\nfunc (el *ErrorList) AddSyntaxError(message string, pos lexer.Position)\n```\nAddSyntaxError 添加语法错误\n\n```go\nfunc (el ErrorList) Count() int\n```\nCount 返回错误数量\n\n```go\nfunc (el ErrorList) Error() string\n```\nError 实现 error 接口\n\n```go\nfunc (el ErrorList) FilterByType(errorType ErrorType) ErrorList\n```\nFilterByType 按类型过滤错误\n\n```go\nfunc (el ErrorList) GetLexicalErrors() ErrorList\n```\nGetLexicalErrors 获取词法错误\n\n```go\nfunc (el ErrorList) GetSemanticErrors() ErrorList\n```\nGetSemanticErrors 获取语义错误\n\n```go\nfunc (el ErrorList) GetSyntaxErrors() ErrorList\n```\nGetSyntaxErrors 获取语法错误\n\n```go\nfunc (el ErrorList) HasErrors() bool\n```\nHasErrors 检查是否有错误\n\n```go\nfunc (el ErrorList) String() string\n```\nString 返回所有错误的字符串表示\n\n```go\ntype ErrorReporter struct {\n\t// contains filtered or unexported fields\n}\n```\nErrorReporter 错误报告器\n\n```go\nfunc NewErrorReporter(source string) *ErrorReporter\n```\nNewErrorReporter 创建新的错误报告器\n\n```go\nfunc (er *ErrorReporter) Clear()\n```\nClear 清除所有错误\n\n```go\nfunc (er *ErrorReporter) GetErrorCount() int\n```\nGetErrorCount 获取错误数量\n\n```go\nfunc (er *ErrorReporter) GetErrors() ErrorList\n```\nGetErrors 获取所有错误\n\n```go\nfunc (er *ErrorReporter) HasErrors() bool\n```\nHasErrors 检查是否有错误\n\n```go\nfunc (er *ErrorReporter) Report(err *Error)\n```\nReport 报告错误\n\n```go\nfunc (er *ErrorReporter) ReportLexicalError(message string, pos lexer.Position)\n```\nReportLexicalError 报告词法错误\n\n```go\nfunc (er *ErrorReporter) ReportSemanticError(message string, pos lexer.Position)\n```\nReportSemanticError 报告语义错误\n\n```go\nfunc (er *ErrorReporter) ReportSyntaxError(message string, pos lexer.Position)\n```\nReportSyntaxError 报告语法错误\n\n```go\ntype ErrorType int\n```\nErrorType 错误类型\n\n```go\nconst (\n\tSyntaxError ErrorType = iota\n\tLexicalError\n\tSemanticError\n)\n```\n\n","path":"github.com/wudi/php-parser/errors","name":"errors","synopsis":"","isRedistributable":true}
