mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 08:02:02 +00:00
adding # as a recognized start of single line comment
This commit is contained in:
parent
c523544463
commit
0cac4b4a6e
@ -280,6 +280,18 @@ Token Lexer::nextTokenImpl()
|
|||||||
}
|
}
|
||||||
return Token(TokenType::Slash, token_begin, pos);
|
return Token(TokenType::Slash, token_begin, pos);
|
||||||
}
|
}
|
||||||
|
case '#': /// start of single line comment, MySQL style
|
||||||
|
{ /// PostgreSQL has some operators using '#' character.
|
||||||
|
/// For less ambiguity, we will recognize a comment only if # is followed by whitespace.
|
||||||
|
/// or #! as a special case for "shebang".
|
||||||
|
/// #hello - not a comment
|
||||||
|
/// # hello - a comment
|
||||||
|
/// #!/usr/bin/clickhouse-local --queries-file - a comment
|
||||||
|
++pos;
|
||||||
|
if (pos < end && (*pos == ' ' || *pos == '!'))
|
||||||
|
return comment_until_end_of_line();
|
||||||
|
return Token(TokenType::Error, token_begin, pos);
|
||||||
|
}
|
||||||
case '%':
|
case '%':
|
||||||
return Token(TokenType::Percent, token_begin, ++pos);
|
return Token(TokenType::Percent, token_begin, ++pos);
|
||||||
case '=': /// =, ==
|
case '=': /// =, ==
|
||||||
|
Loading…
Reference in New Issue
Block a user