}
public SQLStatement parseCreateUser() throws ParserException {
accept(Token.USER);
MySqlCreateUserStatement stmt = new MySqlCreateUserStatement();
for (;;) {
MySqlCreateUserStatement.UserSpecification userSpec = new MySqlCreateUserStatement.UserSpecification();
SQLCharExpr expr = (SQLCharExpr) exprParser.expr();
String user = expr.toString();
if (lexer.token() == Token.VARIANT) {
lexer.nextToken();
SQLCharExpr expr2 = (SQLCharExpr) exprParser.expr();
user += '@';
user += expr2.toString();
}
userSpec.setUser(new SQLIdentifierExpr(user));
if (lexer.token() == Token.IDENTIFIED) {
lexer.nextToken();
if (lexer.token() == Token.BY) {
lexer.nextToken();
if (lexer.token() == Token.PASSWORD) {
lexer.nextToken();
}
SQLCharExpr password = (SQLCharExpr) this.exprParser.expr();
userSpec.setPassword(password);
} else if (lexer.token() == Token.WITH) {
lexer.nextToken();
SQLCharExpr text = (SQLCharExpr) this.exprParser.expr();
userSpec.setAuthPlugin(text);
}
}
stmt.getUsers().add(userSpec);
if (lexer.token() == Token.COMMA) {
lexer.nextToken();
continue;
}