{"modulePath":"github.com/unpackdev/solgo","version":"v0.3.7","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package syntaxerrors\n\nPackage syntaxerrors provides tools for detecting and handling syntax errors in Solidity contracts.\n\n## Functions\n\n```go\nfunc ReplaceErrorMessage(originalMsg, oldText, newText string) string\n```\nReplaceErrorMessage replaces a specific error message with a new message. It takes the original message, the old text to replace, and the new text, and returns the modified message.\n\n## Types\n\n```go\ntype ContextualParser struct {\n\t*parser.SolidityParser\n\tSyntaxErrorListener *SyntaxErrorListener\n}\n```\nContextualParser is a wrapper around the SolidityParser that maintains a stack of contexts. It provides methods for parsing function and contract definitions, and adds the current context to the SyntaxErrorListener.\n\n```go\nfunc NewContextualParser(tokens antlr.TokenStream, listener *SyntaxErrorListener) *ContextualParser\n```\nNewContextualParser creates a new ContextualSolidityParser. It takes a token stream and a SyntaxErrorListener, and returns a pointer to a ContextualSolidityParser.\n\n```go\nfunc (p *ContextualParser) SourceUnit() parser.ISourceUnitContext\n```\nSourceUnit parses a function definition and adds the \"SourceUnit\" context to the SyntaxErrorListener.\n\n```go\ntype SeverityLevel int\n```\nSeverityLevel represents the severity of a syntax error.\n\n```go\nconst (\n\t// SeverityInfo represents a syntax error of informational level.\n\tSeverityInfo SeverityLevel = iota\n\n\t// SeverityWarning represents a syntax error of warning level.\n\tSeverityWarning\n\n\t// SeverityError represents a syntax error of error level.\n\tSeverityError\n)\n```\n\n```go\nfunc (s SeverityLevel) String() string\n```\nString returns a string representation of the SeverityLevel.\n\n```go\ntype SyntaxError struct {\n\tLine     int\n\tColumn   int\n\tMessage  string\n\tSeverity SeverityLevel\n\tContext  string\n}\n```\nSyntaxError represents a syntax error in a Solidity contract. It includes the line and column where the error occurred, the error message, the severity of the error, and the context in which the error occurred.\n\n```go\nfunc (e SyntaxError) Error() error\n```\nError returns the error message.\n\n```go\ntype SyntaxErrorListener struct {\n\t*parser.BaseSolidityParserListener\n\t*antlr.DefaultErrorListener\n\tErrors []SyntaxError\n\t// contains filtered or unexported fields\n}\n```\nSyntaxErrorListener is a listener for syntax errors in Solidity contracts. It maintains a stack of contexts and a slice of SyntaxErrors.\n\n```go\nfunc NewSyntaxErrorListener() *SyntaxErrorListener\n```\nNewSyntaxErrorListener creates a new SyntaxErrorListener. It returns a pointer to a SyntaxErrorListener with an empty slice of SyntaxErrors and an empty stack of contexts.\n\n```go\nfunc (l *SyntaxErrorListener) DetermineSeverity(msg, context string) SeverityLevel\n```\nDetermineSeverity determines the severity of a syntax error. It returns the severity of the error.\n\n```go\nfunc (l *SyntaxErrorListener) PopContext()\n```\nPopContext removes the most recent context from the stack.\n\n```go\nfunc (l *SyntaxErrorListener) PushContext(ctx string)\n```\nPushContext adds a context to the stack.\n\n```go\nfunc (l *SyntaxErrorListener) SyntaxError(recognizer antlr.Recognizer, offendingSymbol interface{}, line, column int, msg string, e antlr.RecognitionException)\n```\nSyntaxError handles a syntax error. It creates a new SyntaxError with the given parameters and adds it to the Errors slice.\n\n","path":"github.com/unpackdev/solgo/syntaxerrors","name":"syntaxerrors","synopsis":"Package syntaxerrors provides tools for detecting and handling syntax errors in Solidity contracts.","isRedistributable":true}
