File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
11
11
12
12
- Lexing of conditional directive expressions containing compiler directives, comments, or strings.
13
13
- Lexing of compiler directives similar to conditional directives (e.g. ` {$if_} ` ).
14
+ - Lexing of unterminated asm text literals at EOF.
14
15
15
16
## [ 0.3.0] - 2024-05-29
16
17
Original file line number Diff line number Diff line change @@ -860,16 +860,20 @@ fn asm_text_literal(mut args: LexArgs) -> OffsetAndTokenType {
860
860
match args. next_byte ( ) {
861
861
Some ( b'\\' ) => {
862
862
args. offset += 1 ;
863
+ if args. next_byte ( ) . is_some ( ) {
864
+ args. offset += 1 ;
865
+ }
863
866
}
864
867
Some ( b'\"' ) => {
865
868
return ( args. offset + 1 , TT :: TextLiteral ( TLK :: Asm ) ) ;
866
869
}
867
870
None | Some ( b'\n' | b'\r' ) => {
868
871
break ;
869
872
}
870
- _ => { }
873
+ _ => {
874
+ args. offset += 1 ;
875
+ }
871
876
}
872
- args. offset += 1 ;
873
877
}
874
878
875
879
warn_unterminated ( "asm text literal" , args. input , start_offset) ;
@@ -2398,6 +2402,17 @@ mod tests {
2398
2402
) ;
2399
2403
}
2400
2404
2405
+ #[ test]
2406
+ fn unterminated_asm_text_literal_at_eof ( ) {
2407
+ run_test (
2408
+ r#"asm"\"# ,
2409
+ & [
2410
+ ( "asm" , TT :: Keyword ( KK :: Asm ) ) ,
2411
+ ( "\" \\ " , TT :: TextLiteral ( TLK :: Unterminated ) ) ,
2412
+ ] ,
2413
+ ) ;
2414
+ }
2415
+
2401
2416
#[ test]
2402
2417
fn inline_assembly_with_comments ( ) {
2403
2418
run_test (
You can’t perform that action at this time.
0 commit comments