MCPcopy Index your code
hub / github.com/pingcap/tidb / parse

Method parse

pkg/parser/hintparserimpl.go:131–149  ·  view source on GitHub ↗
(input string, sqlMode mysql.SQLMode, initPos Pos)

Source from the content-addressed store, hash-verified

129}
130
131func (hp *hintParser) parse(input string, sqlMode mysql.SQLMode, initPos Pos) ([]*ast.TableOptimizerHint, []error) {
132 hp.result = nil
133 hp.lexer.reset(input[3:])
134 hp.lexer.SetSQLMode(sqlMode)
135 hp.lexer.r.updatePos(Pos{
136 Line: initPos.Line,
137 Col: initPos.Col + 3, // skipped the initial '/*+'
138 Offset: 0,
139 })
140 hp.lexer.inBangComment = true // skip the final '*/' (we need the '*/' for reporting warnings)
141
142 yyhintParse(&hp.lexer, hp)
143
144 warns, errs := hp.lexer.Errors()
145 if len(errs) == 0 {
146 errs = warns
147 }
148 return hp.result, errs
149}
150
151// ParseHint parses an optimizer hint (the interior of `/*+ ... */`).
152func ParseHint(input string, sqlMode mysql.SQLMode, initPos Pos) ([]*ast.TableOptimizerHint, []error) {

Callers 4

ParseHintFunction · 0.45
parseHintMethod · 0.45
fetchTaskQueueFunction · 0.45
fetchTaskCfgFunction · 0.45

Calls 5

yyhintParseFunction · 0.85
updatePosMethod · 0.80
ErrorsMethod · 0.65
resetMethod · 0.45
SetSQLModeMethod · 0.45

Tested by

no test coverage detected