Merge pull request #4871 from boothby/issue4769

Address bugs when //, /// or //! are immediately followed by EOF
This commit is contained in:
Andrew Kelley 2020-03-31 10:56:21 -04:00 committed by GitHub
commit 47a0e3ec5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 0 deletions

View File

@ -1494,9 +1494,17 @@ void tokenize(Buf *buf, Tokenization *out) {
tokenize_error(&t, "unexpected EOF");
break;
case TokenizeStateLineComment:
break;
case TokenizeStateSawSlash2:
cancel_token(&t);
break;
case TokenizeStateSawSlash3:
set_token_id(&t, t.cur_tok, TokenIdDocComment);
end_token(&t);
break;
case TokenizeStateSawSlashBang:
set_token_id(&t, t.cur_tok, TokenIdContainerDocComment);
end_token(&t);
break;
}
if (t.state != TokenizeStateError) {

View File

@ -41,6 +41,9 @@ comptime {
_ = @import("behavior/bugs/3586.zig");
_ = @import("behavior/bugs/3742.zig");
_ = @import("behavior/bugs/4560.zig");
_ = @import("behavior/bugs/4769_a.zig");
_ = @import("behavior/bugs/4769_b.zig");
_ = @import("behavior/bugs/4769_c.zig");
_ = @import("behavior/bugs/394.zig");
_ = @import("behavior/bugs/421.zig");
_ = @import("behavior/bugs/529.zig");

View File

@ -0,0 +1 @@
//

View File

@ -0,0 +1 @@
//!

View File

@ -0,0 +1 @@
///