MCPcopy Create free account
hub / github.com/cockroachdb/cockroachdb-parser / helpWith

Function helpWith

pkg/sql/parser/help.go:77–89  ·  view source on GitHub ↗

helpWith is to be used in parser actions to mark the parser "in error", with the error set to a contextual help message about the current statement.

(sqllex sqlLexer, helpText string)

Source from the content-addressed store, hash-verified

75// error", with the error set to a contextual help message about the
76// current statement.
77func helpWith(sqllex sqlLexer, helpText string) int {
78 scan := sqllex.(*lexer)
79 if helpText == "" {
80 scan.lastError = pgerror.WithCandidateCode(errors.New("help upon syntax error"), pgcode.Syntax)
81 scan.populateHelpMsg("help:\n" + AllHelp)
82 return 1
83 }
84 msg := HelpMessage{Command: helpText, HelpMessageBody: HelpMessages[helpText]}
85 scan.SetHelp(msg)
86 // We return non-zero to indicate to the caller of Parse() that the
87 // parse was unsuccessful.
88 return 1
89}
90
91// helpWithFunction is to be used in parser actions to mark the parser
92// "in error", with the error set to a contextual help message about

Callers

nothing calls this directly

Calls 3

WithCandidateCodeFunction · 0.92
populateHelpMsgMethod · 0.80
SetHelpMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…