Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parser: cleanup parser/scanner error. #145

Merged
merged 2 commits into from
Sep 15, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 40 additions & 40 deletions parser/parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -889,12 +889,12 @@ CreateIndexStmt:
{
indexName, tableIdent, colNameList := $4.(string), $6.(table.Ident), $8.([]*coldef.IndexColName)
if strings.EqualFold(indexName, tableIdent.Name.O) {
yylex.(*lexer).err("", "index name collision: %s", indexName)
yylex.(*lexer).errf("index name collision: %s", indexName)
return 1
}
for _, colName := range colNameList {
if indexName == colName.ColumnName {
yylex.(*lexer).err("", "index name collision: %s", indexName)
yylex.(*lexer).errf("index name collision: %s", indexName)
return 1
}
}
Expand Down Expand Up @@ -966,7 +966,7 @@ CreateDatabaseStmt:

ok := charset.ValidCharsetAndCollation(cs, co)
if !ok {
yylex.(*lexer).err("", "Unknown character set %s or collate %s ", cs, co)
yylex.(*lexer).errf("Unknown character set %s or collate %s ", cs, co)
}
dbopt := &coldef.CharsetOpt{Chs: cs, Col: co}

Expand Down Expand Up @@ -1008,7 +1008,7 @@ CharsetName:
if charset.ValidCharsetAndCollation(c, "") {
$$ = c
} else {
yylex.(*lexer).err("", fmt.Sprintf("Unknown character set: '%s'", $1.(string)))
yylex.(*lexer).errf("Unknown character set: '%s'", $1.(string))
return 1
}
}
Expand All @@ -1018,7 +1018,7 @@ CharsetName:
if charset.ValidCharsetAndCollation(c, "") {
$$ = c
} else {
yylex.(*lexer).err("", fmt.Sprintf("Unknown character set: '%s'", $1.(string)))
yylex.(*lexer).errf("Unknown character set: '%s'", $1.(string))
return 1
}
}
Expand Down Expand Up @@ -1072,7 +1072,7 @@ CreateTableStmt:
}
}
if len(columnDefs) == 0 {
yylex.(*lexer).err("", "Column Definition List can't be empty.")
yylex.(*lexer).err("Column Definition List can't be empty.")
return 1
}

Expand Down Expand Up @@ -1444,7 +1444,7 @@ Factor1:
var err error
$$, err = expressions.NewBetween($1.(expression.Expression), $4.(expression.Expression), $6.(expression.Expression), $2.(bool))
if err != nil {
yylex.(*lexer).err("", "%v", err)
yylex.(*lexer).err(err)
return 1
}
}
Expand Down Expand Up @@ -1755,7 +1755,7 @@ Operand:
{
l := yylex.(*lexer)
if !l.prepare {
l.err("", "Can not accept placeholder when not parsing prepare sql")
l.err("Can not accept placeholder when not parsing prepare sql")
}
pm := &expressions.ParamMarker{}
l.ParamList = append(l.ParamList, pm)
Expand Down Expand Up @@ -1855,7 +1855,7 @@ FunctionCallConflict:
var err error
$$, err = expressions.NewCall($1.(string), $3.([]expression.Expression), false)
if err != nil {
x.err("", "%v", err)
x.err(err)
return 1
}
}
Expand Down Expand Up @@ -1884,7 +1884,7 @@ FunctionCallKeyword:
$$, err = expressions.NewCall($1.(string), $4.([]expression.Expression), $3.(bool))
if err != nil {
l := yylex.(*lexer)
l.err("", "%v", err)
l.err(err)
return 1
}
}
Expand Down Expand Up @@ -1931,7 +1931,7 @@ FunctionCallKeyword:
$$, err = expressions.NewCall($1.(string), args, false)
if err != nil {
l := yylex.(*lexer)
l.err("", "%v", err)
l.err(err)
return 1
}
}
Expand All @@ -1946,7 +1946,7 @@ FunctionCallKeyword:
$$, err = expressions.NewCall($1.(string), $3.([]expression.Expression), false)
if err != nil {
l := yylex.(*lexer)
l.err("", "%v", err)
l.err(err)
return 1
}
}
Expand All @@ -1957,7 +1957,7 @@ FunctionCallKeyword:
$$, err = expressions.NewCall($1.(string), args, false)
if err != nil {
l := yylex.(*lexer)
l.err("", "%v", err)
l.err(err)
return 1
}
}
Expand All @@ -1969,7 +1969,7 @@ FunctionCallNonKeyword:
$$, err = expressions.NewCall($1.(string), $3.([]expression.Expression), false)
if err != nil {
l := yylex.(*lexer)
l.err("", "%v", err)
l.err(err)
return 1
}
}
Expand All @@ -1980,7 +1980,7 @@ FunctionCallNonKeyword:
$$, err = expressions.NewCall($1.(string), args, false)
if err != nil {
l := yylex.(*lexer)
l.err("", "%v", err)
l.err(err)
return 1
}
}
Expand All @@ -1990,7 +1990,7 @@ FunctionCallNonKeyword:
$$, err = expressions.NewCall($1.(string), $3.([]expression.Expression), false)
if err != nil {
l := yylex.(*lexer)
l.err("", "%v", err)
l.err(err)
return 1
}
}
Expand All @@ -2000,7 +2000,7 @@ FunctionCallNonKeyword:
$$, err = expressions.NewCall($1.(string), $3.([]expression.Expression), false)
if err != nil {
l := yylex.(*lexer)
l.err("", "%v", err)
l.err(err)
return 1
}
}
Expand All @@ -2011,7 +2011,7 @@ FunctionCallNonKeyword:
$$, err = expressions.NewCall($1.(string), args, false)
if err != nil {
l := yylex.(*lexer)
l.err("", "%v", err)
l.err(err)
return 1
}
}
Expand All @@ -2022,7 +2022,7 @@ FunctionCallNonKeyword:
$$, err = expressions.NewCall($1.(string), args, false)
if err != nil {
l := yylex.(*lexer)
l.err("", "%v", err)
l.err(err)
return 1
}
}
Expand All @@ -2033,7 +2033,7 @@ FunctionCallNonKeyword:
$$, err = expressions.NewCall($1.(string), args, false)
if err != nil {
l := yylex.(*lexer)
l.err("", "%v", err)
l.err(err)
return 1
}
}
Expand All @@ -2044,7 +2044,7 @@ FunctionCallNonKeyword:
$$, err = expressions.NewCall($1.(string), args, false)
if err != nil {
l := yylex.(*lexer)
l.err("", "%v", err)
l.err(err)
return 1
}
}
Expand All @@ -2055,7 +2055,7 @@ FunctionCallNonKeyword:
$$, err = expressions.NewCall($1.(string), args, false)
if err != nil {
l := yylex.(*lexer)
l.err("", "%v", err)
l.err(err)
return 1
}
}
Expand All @@ -2066,7 +2066,7 @@ FunctionCallNonKeyword:
$$, err = expressions.NewCall($1.(string), args, false)
if err != nil {
l := yylex.(*lexer)
l.err("", "%v", err)
l.err(err)
return 1
}
}
Expand All @@ -2076,7 +2076,7 @@ FunctionCallNonKeyword:
$$, err = expressions.NewCall($1.(string), $3.([]expression.Expression), false)
if err != nil {
l := yylex.(*lexer)
l.err("", "%v", err)
l.err(err)
return 1
}
}
Expand All @@ -2087,7 +2087,7 @@ FunctionCallNonKeyword:
$$, err = expressions.NewCall($1.(string), args, false)
if err != nil {
l := yylex.(*lexer)
l.err("", "%v", err)
l.err(err)
return 1
}
}
Expand All @@ -2098,7 +2098,7 @@ FunctionCallNonKeyword:
$$, err = expressions.NewCall($1.(string), args, false)
if err != nil {
l := yylex.(*lexer)
l.err("", "%v", err)
l.err(err)
return 1
}
}
Expand All @@ -2109,7 +2109,7 @@ FunctionCallNonKeyword:
$$, err = expressions.NewCall($1.(string), args, false)
if err != nil {
l := yylex.(*lexer)
l.err("", "%v", err)
l.err(err)
return 1
}
}
Expand All @@ -2120,7 +2120,7 @@ FunctionCallNonKeyword:
$$, err = expressions.NewCall($1.(string), args, false)
if err != nil {
l := yylex.(*lexer)
l.err("", "%v", err)
l.err(err)
return 1
}
}
Expand All @@ -2130,7 +2130,7 @@ FunctionCallNonKeyword:
$$, err = expressions.NewCall($1.(string), $3.([]expression.Expression),false)
if err != nil {
l := yylex.(*lexer)
l.err("", "%v", err)
l.err(err)
return 1
}
}
Expand All @@ -2140,7 +2140,7 @@ FunctionCallNonKeyword:
$$, err = expressions.NewCall($1.(string), $3.([]expression.Expression), false)
if err != nil {
l := yylex.(*lexer)
l.err("", "%v", err)
l.err(err)
return 1
}
}
Expand All @@ -2151,7 +2151,7 @@ FunctionCallNonKeyword:
$$, err = expressions.NewCall($1.(string), args, false)
if err != nil {
l := yylex.(*lexer)
l.err("", "%v", err)
l.err(err)
return 1
}
}
Expand Down Expand Up @@ -2192,7 +2192,7 @@ FunctionCallNonKeyword:
$$, err = expressions.NewCall($1.(string), args, false)
if err != nil {
l := yylex.(*lexer)
l.err("", "%v", err)
l.err(err)
return 1
}
}
Expand All @@ -2203,7 +2203,7 @@ FunctionCallNonKeyword:
$$, err = expressions.NewCall($1.(string), args, false)
if err != nil {
l := yylex.(*lexer)
l.err("", "%v", err)
l.err(err)
return 1
}
}
Expand All @@ -2213,7 +2213,7 @@ FunctionCallNonKeyword:
$$, err = expressions.NewCall($1.(string), $3.([]expression.Expression),false)
if err != nil {
l := yylex.(*lexer)
l.err("", "%v", err)
l.err(err)
return 1
}
}
Expand All @@ -2225,7 +2225,7 @@ FunctionCallAgg:
$$, err = expressions.NewCall($1.(string), $4.([]expression.Expression), $3.(bool))
if err != nil {
l := yylex.(*lexer)
l.err("", "%v", err)
l.err(err)
return 1
}
}
Expand All @@ -2236,7 +2236,7 @@ FunctionCallAgg:
$$, err = expressions.NewCall($1.(string), args, $3.(bool))
if err != nil {
l := yylex.(*lexer)
l.err("", "%v", err)
l.err(err)
return 1
}
}
Expand All @@ -2246,7 +2246,7 @@ FunctionCallAgg:
$$, err = expressions.NewCall($1.(string), $4.([]expression.Expression),$3.(bool))
if err != nil {
l := yylex.(*lexer)
l.err("", "%v", err)
l.err(err)
return 1
}
}
Expand All @@ -2257,7 +2257,7 @@ FunctionCallAgg:
$$, err = expressions.NewCall($1.(string), args, $3.(bool))
if err != nil {
l := yylex.(*lexer)
l.err("", "%v", err)
l.err(err)
return 1
}
}
Expand All @@ -2268,7 +2268,7 @@ FunctionCallAgg:
$$, err = expressions.NewCall($1.(string), args, $3.(bool))
if err != nil {
l := yylex.(*lexer)
l.err("", "%v", err)
l.err(err)
return 1
}
}
Expand All @@ -2279,7 +2279,7 @@ FunctionCallAgg:
$$, err = expressions.NewCall($1.(string), args, $3.(bool))
if err != nil {
l := yylex.(*lexer)
l.err("", "%v", err)
l.err(err)
return 1
}
}
Expand Down
Loading