@@ -498,29 +498,29 @@ fn line_numbers() {
498
498
"b\" "
499
499
) ) ;
500
500
let mut input = Parser :: new ( & mut input) ;
501
- assert_eq ! ( input. current_source_location( ) , SourceLocation { line: 0 , column: 0 } ) ;
501
+ assert_eq ! ( input. current_source_location( ) , SourceLocation { line: 0 , column: 1 } ) ;
502
502
assert_eq ! ( input. next_including_whitespace( ) , Ok ( & Token :: Ident ( "fo00o" . into( ) ) ) ) ;
503
- assert_eq ! ( input. current_source_location( ) , SourceLocation { line: 1 , column: 2 } ) ;
504
- assert_eq ! ( input. next_including_whitespace( ) , Ok ( & Token :: WhiteSpace ( " " ) ) ) ;
505
503
assert_eq ! ( input. current_source_location( ) , SourceLocation { line: 1 , column: 3 } ) ;
504
+ assert_eq ! ( input. next_including_whitespace( ) , Ok ( & Token :: WhiteSpace ( " " ) ) ) ;
505
+ assert_eq ! ( input. current_source_location( ) , SourceLocation { line: 1 , column: 4 } ) ;
506
506
assert_eq ! ( input. next_including_whitespace( ) , Ok ( & Token :: Ident ( "bar" . into( ) ) ) ) ;
507
- assert_eq ! ( input. current_source_location( ) , SourceLocation { line: 1 , column: 6 } ) ;
507
+ assert_eq ! ( input. current_source_location( ) , SourceLocation { line: 1 , column: 7 } ) ;
508
508
assert_eq ! ( input. next_including_whitespace_and_comments( ) , Ok ( & Token :: Comment ( "\n " ) ) ) ;
509
- assert_eq ! ( input. current_source_location( ) , SourceLocation { line: 2 , column: 2 } ) ;
509
+ assert_eq ! ( input. current_source_location( ) , SourceLocation { line: 2 , column: 3 } ) ;
510
510
assert_eq ! ( input. next_including_whitespace( ) , Ok ( & Token :: Ident ( "baz" . into( ) ) ) ) ;
511
- assert_eq ! ( input. current_source_location( ) , SourceLocation { line: 2 , column: 5 } ) ;
511
+ assert_eq ! ( input. current_source_location( ) , SourceLocation { line: 2 , column: 6 } ) ;
512
512
let state = input. state ( ) ;
513
513
514
514
assert_eq ! ( input. next_including_whitespace( ) , Ok ( & Token :: WhiteSpace ( "\r \n \n " ) ) ) ;
515
- assert_eq ! ( input. current_source_location( ) , SourceLocation { line: 4 , column: 0 } ) ;
515
+ assert_eq ! ( input. current_source_location( ) , SourceLocation { line: 4 , column: 1 } ) ;
516
516
517
- assert_eq ! ( state. source_location( ) , SourceLocation { line: 2 , column: 5 } ) ;
517
+ assert_eq ! ( state. source_location( ) , SourceLocation { line: 2 , column: 6 } ) ;
518
518
519
519
assert_eq ! ( input. next_including_whitespace( ) , Ok ( & Token :: UnquotedUrl ( "u" . into( ) ) ) ) ;
520
- assert_eq ! ( input. current_source_location( ) , SourceLocation { line: 6 , column: 1 } ) ;
520
+ assert_eq ! ( input. current_source_location( ) , SourceLocation { line: 6 , column: 2 } ) ;
521
521
522
522
assert_eq ! ( input. next_including_whitespace( ) , Ok ( & Token :: QuotedString ( "ab" . into( ) ) ) ) ;
523
- assert_eq ! ( input. current_source_location( ) , SourceLocation { line: 7 , column: 2 } ) ;
523
+ assert_eq ! ( input. current_source_location( ) , SourceLocation { line: 7 , column: 3 } ) ;
524
524
assert ! ( input. next_including_whitespace( ) . is_err( ) ) ;
525
525
}
526
526
@@ -1000,14 +1000,14 @@ fn parser_maintains_current_line() {
1000
1000
fn parser_with_line_number_offset ( ) {
1001
1001
let mut input = ParserInput :: new_with_line_number_offset ( "ident\n ident" , 72 ) ;
1002
1002
let mut parser = Parser :: new ( & mut input) ;
1003
- assert_eq ! ( parser. current_source_location( ) , SourceLocation { line: 72 , column: 0 } ) ;
1003
+ assert_eq ! ( parser. current_source_location( ) , SourceLocation { line: 72 , column: 1 } ) ;
1004
1004
assert_eq ! ( parser. next_including_whitespace_and_comments( ) , Ok ( & Token :: Ident ( "ident" . into( ) ) ) ) ;
1005
- assert_eq ! ( parser. current_source_location( ) , SourceLocation { line: 72 , column: 5 } ) ;
1005
+ assert_eq ! ( parser. current_source_location( ) , SourceLocation { line: 72 , column: 6 } ) ;
1006
1006
assert_eq ! ( parser. next_including_whitespace_and_comments( ) ,
1007
1007
Ok ( & Token :: WhiteSpace ( "\n " . into( ) ) ) ) ;
1008
- assert_eq ! ( parser. current_source_location( ) , SourceLocation { line: 73 , column: 0 } ) ;
1008
+ assert_eq ! ( parser. current_source_location( ) , SourceLocation { line: 73 , column: 1 } ) ;
1009
1009
assert_eq ! ( parser. next_including_whitespace_and_comments( ) , Ok ( & Token :: Ident ( "ident" . into( ) ) ) ) ;
1010
- assert_eq ! ( parser. current_source_location( ) , SourceLocation { line: 73 , column: 5 } ) ;
1010
+ assert_eq ! ( parser. current_source_location( ) , SourceLocation { line: 73 , column: 6 } ) ;
1011
1011
}
1012
1012
1013
1013
#[ test]
@@ -1088,24 +1088,24 @@ fn utf16_columns() {
1088
1088
// the column is in units of UTF-16, the 4-byte sequence results
1089
1089
// in two columns.
1090
1090
let tests = vec ! [
1091
- ( "" , 0 ) ,
1092
- ( "ascii" , 5 ) ,
1093
- ( "/*QΡ✈🆒*/" , 9 ) ,
1094
- ( "'QΡ✈🆒*'" , 8 ) ,
1095
- ( "\" \\ \" 'QΡ✈🆒*'" , 11 ) ,
1096
- ( "\\ Q\\ Ρ\\ ✈\\ 🆒" , 9 ) ,
1097
- ( "QΡ✈🆒" , 5 ) ,
1098
- ( "QΡ✈🆒\\ Q\\ Ρ\\ ✈\\ 🆒" , 14 ) ,
1099
- ( "newline\r \n QΡ✈🆒" , 5 ) ,
1100
- ( "url(QΡ✈🆒\\ Q\\ Ρ\\ ✈\\ 🆒)" , 19 ) ,
1101
- ( "url(QΡ✈🆒)" , 10 ) ,
1102
- ( "url(\r \n QΡ✈🆒\\ Q\\ Ρ\\ ✈\\ 🆒)" , 15 ) ,
1103
- ( "url(\r \n QΡ✈🆒\\ Q\\ Ρ\\ ✈\\ 🆒" , 14 ) ,
1104
- ( "url(\r \n QΡ✈🆒\\ Q\\ Ρ\\ ✈\\ 🆒 x" , 16 ) ,
1105
- ( "QΡ✈🆒()" , 7 ) ,
1091
+ ( "" , 1 ) ,
1092
+ ( "ascii" , 6 ) ,
1093
+ ( "/*QΡ✈🆒*/" , 10 ) ,
1094
+ ( "'QΡ✈🆒*'" , 9 ) ,
1095
+ ( "\" \\ \" 'QΡ✈🆒*'" , 12 ) ,
1096
+ ( "\\ Q\\ Ρ\\ ✈\\ 🆒" , 10 ) ,
1097
+ ( "QΡ✈🆒" , 6 ) ,
1098
+ ( "QΡ✈🆒\\ Q\\ Ρ\\ ✈\\ 🆒" , 15 ) ,
1099
+ ( "newline\r \n QΡ✈🆒" , 6 ) ,
1100
+ ( "url(QΡ✈🆒\\ Q\\ Ρ\\ ✈\\ 🆒)" , 20 ) ,
1101
+ ( "url(QΡ✈🆒)" , 11 ) ,
1102
+ ( "url(\r \n QΡ✈🆒\\ Q\\ Ρ\\ ✈\\ 🆒)" , 16 ) ,
1103
+ ( "url(\r \n QΡ✈🆒\\ Q\\ Ρ\\ ✈\\ 🆒" , 15 ) ,
1104
+ ( "url(\r \n QΡ✈🆒\\ Q\\ Ρ\\ ✈\\ 🆒 x" , 17 ) ,
1105
+ ( "QΡ✈🆒()" , 8 ) ,
1106
1106
// Test that under/over-flow of current_line_start_position is
1107
1107
// handled properly; see the special case in consume_4byte_intro.
1108
- ( "🆒" , 2 ) ,
1108
+ ( "🆒" , 3 ) ,
1109
1109
] ;
1110
1110
1111
1111
for test in tests {
0 commit comments