(input string, sqlMode mysql.SQLMode, initPos Pos)
| 129 | } |
| 130 | |
| 131 | func (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 `/*+ ... */`). |
| 152 | func ParseHint(input string, sqlMode mysql.SQLMode, initPos Pos) ([]*ast.TableOptimizerHint, []error) { |
no test coverage detected