Loading third_party/rust/cssparser/.cargo-checksum.json +1 −1 Original line number Diff line number Diff line {"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".travis.yml":"f1fb4b65964c81bc1240544267ea334f554ca38ae7a74d57066f4d47d2b5d568","Cargo.toml":"e186467e97bcbc828a3ddf0e359bbf035b0390380fcb7da12f621ac6b5aa4d36","LICENSE":"fab3dd6bdab226f1c08630b1dd917e11fcb4ec5e1e020e2c16f83a0a13863e85","README.md":"c5781e673335f37ed3d7acb119f8ed33efdf6eb75a7094b7da2abe0c3230adb8","build.rs":"950bcc47a196f07f99f59637c28cc65e02a885130011f90a2b2608248b4724a2","build/match_byte.rs":"89e8b941af74df2c204abf808672d3ff278bdec75abc918c41a843260b924677","docs/.nojekyll":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","docs/404.html":"025861f76f8d1f6d67c20ab624c6e418f4f824385e2dd8ad8732c4ea563c6a2e","docs/index.html":"025861f76f8d1f6d67c20ab624c6e418f4f824385e2dd8ad8732c4ea563c6a2e","src/color.rs":"422a2e934b06a2cca7beef7afeab42bdca81a73eb27afcbdb3d2a98db892590b","src/cow_rc_str.rs":"541216f8ef74ee3cc5cbbc1347e5f32ed66588c401851c9a7d68b867aede1de0","src/from_bytes.rs":"331fe63af2123ae3675b61928a69461b5ac77799fff3ce9978c55cf2c558f4ff","src/lib.rs":"37aec41c81021cd4cc8f34491ee75de2e8340feada2d0096b107597fc4ac485d","src/macros.rs":"adb9773c157890381556ea83d7942dcc676f99eea71abbb6afeffee1e3f28960","src/nth.rs":"246fa83a3ab97a7bb617c97a976af77136652ce77ba8ccca22e144b213b61310","src/parser.rs":"87a77f21b232b6c6f81777918997bb1d0b5ec7094c28714b312d0510db6d80d5","src/rules_and_declarations.rs":"962f59aab8030b0d1202859ff841ed6254ce4bd4159eee5e915ccdf4b802f4d5","src/serializer.rs":"3dc1d9441c9602f26d34c0b209f6d3954814815b780c068f9dc3514d808de3d9","src/size_of_tests.rs":"a28664d44797519119d659eaf7e84e1789ef97e9e2c2d36630eb9f226c0cc0a6","src/tests.rs":"fb238e8d6cd7e55e205ed8121a343b3366ef2fcbaf51e566cad75b088717247e","src/tokenizer.rs":"69313044052400c0e444fb1f7e4c0f5578ffa649b153c81b234b899cf1617dc0","src/unicode_range.rs":"fbbd0f4b393944699730a6b0f945b2b2376fcea61fce2ea37190fb287793021a"},"package":"71773af1c6bbbafa27cba64f310b95fea1f87cd82d5a8cd827bd96b4559e5c48"} No newline at end of file {"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".travis.yml":"f1fb4b65964c81bc1240544267ea334f554ca38ae7a74d57066f4d47d2b5d568","Cargo.toml":"c128f8077cdbf09c666f7b1ee43265f12450168c36b97236d9e4eaaf48aa85cb","LICENSE":"fab3dd6bdab226f1c08630b1dd917e11fcb4ec5e1e020e2c16f83a0a13863e85","README.md":"c5781e673335f37ed3d7acb119f8ed33efdf6eb75a7094b7da2abe0c3230adb8","build.rs":"950bcc47a196f07f99f59637c28cc65e02a885130011f90a2b2608248b4724a2","build/match_byte.rs":"89e8b941af74df2c204abf808672d3ff278bdec75abc918c41a843260b924677","docs/.nojekyll":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","docs/404.html":"025861f76f8d1f6d67c20ab624c6e418f4f824385e2dd8ad8732c4ea563c6a2e","docs/index.html":"025861f76f8d1f6d67c20ab624c6e418f4f824385e2dd8ad8732c4ea563c6a2e","src/color.rs":"422a2e934b06a2cca7beef7afeab42bdca81a73eb27afcbdb3d2a98db892590b","src/cow_rc_str.rs":"541216f8ef74ee3cc5cbbc1347e5f32ed66588c401851c9a7d68b867aede1de0","src/from_bytes.rs":"331fe63af2123ae3675b61928a69461b5ac77799fff3ce9978c55cf2c558f4ff","src/lib.rs":"37aec41c81021cd4cc8f34491ee75de2e8340feada2d0096b107597fc4ac485d","src/macros.rs":"adb9773c157890381556ea83d7942dcc676f99eea71abbb6afeffee1e3f28960","src/nth.rs":"246fa83a3ab97a7bb617c97a976af77136652ce77ba8ccca22e144b213b61310","src/parser.rs":"8ee54664ccf12f0f58f8d94959f9e2b8c8e780eb6f9650d202cead1776807699","src/rules_and_declarations.rs":"962f59aab8030b0d1202859ff841ed6254ce4bd4159eee5e915ccdf4b802f4d5","src/serializer.rs":"3dc1d9441c9602f26d34c0b209f6d3954814815b780c068f9dc3514d808de3d9","src/size_of_tests.rs":"a28664d44797519119d659eaf7e84e1789ef97e9e2c2d36630eb9f226c0cc0a6","src/tests.rs":"fe7f3ba5a50c21a23fdab6ed85e2ef2a80b23b62e1b6671252095d0330bb0ed7","src/tokenizer.rs":"f2953020e608bd1730fc192a1a7e6f6a960e2e4f3be9b49860cf348d89520c78","src/unicode_range.rs":"fbbd0f4b393944699730a6b0f945b2b2376fcea61fce2ea37190fb287793021a"},"package":"e88f0308699ff4e42b2ae57f170673f180a5b41f59364c95ae5c0c8022dbcbd1"} No newline at end of file third_party/rust/cssparser/Cargo.toml +21 −21 Original line number Diff line number Diff line Loading @@ -12,7 +12,7 @@ [package] name = "cssparser" version = "0.20.2" version = "0.21.0" authors = ["Simon Sapin <simon.sapin@exyr.org>"] build = "build.rs" exclude = ["src/css-parsing-tests/**", "src/big-data-url.css"] Loading @@ -22,48 +22,48 @@ readme = "README.md" keywords = ["css", "syntax", "parser"] license = "MPL-2.0" repository = "https://github.com/servo/rust-cssparser" [dependencies.procedural-masquerade] version = "0.1" [dependencies.itoa] version = "0.3" [dependencies.heapsize] version = ">= 0.3, < 0.5" optional = true [dependencies.dtoa-short] version = "0.3" [dependencies.phf] version = "0.7" [dependencies.itoa] version = "0.3" [dependencies.heapsize] version = ">= 0.3, < 0.5" optional = true [dependencies.dtoa-short] version = "0.3" [dependencies.smallvec] version = "0.4.3" [dependencies.serde] version = "1.0" optional = true [dependencies.smallvec] version = "0.4.3" [dependencies.cssparser-macros] version = "0.3" [dependencies.procedural-masquerade] version = "0.1" [dependencies.matches] version = "0.1" [dev-dependencies.difference] version = "1.0" [dependencies.cssparser-macros] [dev-dependencies.rustc-serialize] version = "0.3" [dev-dependencies.encoding_rs] version = "0.7" [dev-dependencies.rustc-serialize] [build-dependencies.quote] version = "0.3" [dev-dependencies.difference] version = "1.0" [build-dependencies.syn] version = "0.11" [build-dependencies.quote] version = "0.3" [features] bench = [] dummy_match_byte = [] bench = [] third_party/rust/cssparser/src/parser.rs +1 −1 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ impl ParserState { pub fn source_location(&self) -> SourceLocation { SourceLocation { line: self.current_line_number, column: (self.position - self.current_line_start_position) as u32, column: (self.position - self.current_line_start_position + 1) as u32, } } } Loading third_party/rust/cssparser/src/tests.rs +30 −30 Original line number Diff line number Diff line Loading @@ -498,29 +498,29 @@ fn line_numbers() { "b\"" )); let mut input = Parser::new(&mut input); assert_eq!(input.current_source_location(), SourceLocation { line: 0, column: 0 }); assert_eq!(input.current_source_location(), SourceLocation { line: 0, column: 1 }); assert_eq!(input.next_including_whitespace(), Ok(&Token::Ident("fo00o".into()))); assert_eq!(input.current_source_location(), SourceLocation { line: 1, column: 2 }); assert_eq!(input.next_including_whitespace(), Ok(&Token::WhiteSpace(" "))); assert_eq!(input.current_source_location(), SourceLocation { line: 1, column: 3 }); assert_eq!(input.next_including_whitespace(), Ok(&Token::WhiteSpace(" "))); assert_eq!(input.current_source_location(), SourceLocation { line: 1, column: 4 }); assert_eq!(input.next_including_whitespace(), Ok(&Token::Ident("bar".into()))); assert_eq!(input.current_source_location(), SourceLocation { line: 1, column: 6 }); assert_eq!(input.current_source_location(), SourceLocation { line: 1, column: 7 }); assert_eq!(input.next_including_whitespace_and_comments(), Ok(&Token::Comment("\n"))); assert_eq!(input.current_source_location(), SourceLocation { line: 2, column: 2 }); assert_eq!(input.current_source_location(), SourceLocation { line: 2, column: 3 }); assert_eq!(input.next_including_whitespace(), Ok(&Token::Ident("baz".into()))); assert_eq!(input.current_source_location(), SourceLocation { line: 2, column: 5 }); assert_eq!(input.current_source_location(), SourceLocation { line: 2, column: 6 }); let state = input.state(); assert_eq!(input.next_including_whitespace(), Ok(&Token::WhiteSpace("\r\n\n"))); assert_eq!(input.current_source_location(), SourceLocation { line: 4, column: 0 }); assert_eq!(input.current_source_location(), SourceLocation { line: 4, column: 1 }); assert_eq!(state.source_location(), SourceLocation { line: 2, column: 5 }); assert_eq!(state.source_location(), SourceLocation { line: 2, column: 6 }); assert_eq!(input.next_including_whitespace(), Ok(&Token::UnquotedUrl("u".into()))); assert_eq!(input.current_source_location(), SourceLocation { line: 6, column: 1 }); assert_eq!(input.current_source_location(), SourceLocation { line: 6, column: 2 }); assert_eq!(input.next_including_whitespace(), Ok(&Token::QuotedString("ab".into()))); assert_eq!(input.current_source_location(), SourceLocation { line: 7, column: 2 }); assert_eq!(input.current_source_location(), SourceLocation { line: 7, column: 3 }); assert!(input.next_including_whitespace().is_err()); } Loading Loading @@ -1000,14 +1000,14 @@ fn parser_maintains_current_line() { fn parser_with_line_number_offset() { let mut input = ParserInput::new_with_line_number_offset("ident\nident", 72); let mut parser = Parser::new(&mut input); assert_eq!(parser.current_source_location(), SourceLocation { line: 72, column: 0 }); assert_eq!(parser.current_source_location(), SourceLocation { line: 72, column: 1 }); assert_eq!(parser.next_including_whitespace_and_comments(), Ok(&Token::Ident("ident".into()))); assert_eq!(parser.current_source_location(), SourceLocation { line: 72, column: 5 }); assert_eq!(parser.current_source_location(), SourceLocation { line: 72, column: 6 }); assert_eq!(parser.next_including_whitespace_and_comments(), Ok(&Token::WhiteSpace("\n".into()))); assert_eq!(parser.current_source_location(), SourceLocation { line: 73, column: 0 }); assert_eq!(parser.current_source_location(), SourceLocation { line: 73, column: 1 }); assert_eq!(parser.next_including_whitespace_and_comments(), Ok(&Token::Ident("ident".into()))); assert_eq!(parser.current_source_location(), SourceLocation { line: 73, column: 5 }); assert_eq!(parser.current_source_location(), SourceLocation { line: 73, column: 6 }); } #[test] Loading Loading @@ -1088,24 +1088,24 @@ fn utf16_columns() { // the column is in units of UTF-16, the 4-byte sequence results // in two columns. let tests = vec![ ("", 0), ("ascii", 5), ("/*QΡ✈🆒*/", 9), ("'QΡ✈🆒*'", 8), ("\"\\\"'QΡ✈🆒*'", 11), ("\\Q\\Ρ\\✈\\🆒", 9), ("QΡ✈🆒", 5), ("QΡ✈🆒\\Q\\Ρ\\✈\\🆒", 14), ("newline\r\nQΡ✈🆒", 5), ("url(QΡ✈🆒\\Q\\Ρ\\✈\\🆒)", 19), ("url(QΡ✈🆒)", 10), ("url(\r\nQΡ✈🆒\\Q\\Ρ\\✈\\🆒)", 15), ("url(\r\nQΡ✈🆒\\Q\\Ρ\\✈\\🆒", 14), ("url(\r\nQΡ✈🆒\\Q\\Ρ\\✈\\🆒 x", 16), ("QΡ✈🆒()", 7), ("", 1), ("ascii", 6), ("/*QΡ✈🆒*/", 10), ("'QΡ✈🆒*'", 9), ("\"\\\"'QΡ✈🆒*'", 12), ("\\Q\\Ρ\\✈\\🆒", 10), ("QΡ✈🆒", 6), ("QΡ✈🆒\\Q\\Ρ\\✈\\🆒", 15), ("newline\r\nQΡ✈🆒", 6), ("url(QΡ✈🆒\\Q\\Ρ\\✈\\🆒)", 20), ("url(QΡ✈🆒)", 11), ("url(\r\nQΡ✈🆒\\Q\\Ρ\\✈\\🆒)", 16), ("url(\r\nQΡ✈🆒\\Q\\Ρ\\✈\\🆒", 15), ("url(\r\nQΡ✈🆒\\Q\\Ρ\\✈\\🆒 x", 17), ("QΡ✈🆒()", 8), // Test that under/over-flow of current_line_start_position is // handled properly; see the special case in consume_4byte_intro. ("🆒", 2), ("🆒", 3), ]; for test in tests { Loading third_party/rust/cssparser/src/tokenizer.rs +3 −3 Original line number Diff line number Diff line Loading @@ -276,7 +276,7 @@ impl<'a> Tokenizer<'a> { pub fn current_source_location(&self) -> SourceLocation { SourceLocation { line: self.current_line_number, column: (self.position - self.current_line_start_position) as u32, column: (self.position - self.current_line_start_position + 1) as u32, } } Loading Loading @@ -521,8 +521,8 @@ pub struct SourceLocation { /// The line number, starting at 0 for the first line, unless `with_first_line_number` was used. pub line: u32, /// The column number within a line, starting at 0 for first the character of the line. /// Column numbers are in units of UTF-16 characters. /// The column number within a line, starting at 1 for first the character of the line. /// Column numbers are counted in UTF-16 code units. pub column: u32, } Loading Loading
third_party/rust/cssparser/.cargo-checksum.json +1 −1 Original line number Diff line number Diff line {"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".travis.yml":"f1fb4b65964c81bc1240544267ea334f554ca38ae7a74d57066f4d47d2b5d568","Cargo.toml":"e186467e97bcbc828a3ddf0e359bbf035b0390380fcb7da12f621ac6b5aa4d36","LICENSE":"fab3dd6bdab226f1c08630b1dd917e11fcb4ec5e1e020e2c16f83a0a13863e85","README.md":"c5781e673335f37ed3d7acb119f8ed33efdf6eb75a7094b7da2abe0c3230adb8","build.rs":"950bcc47a196f07f99f59637c28cc65e02a885130011f90a2b2608248b4724a2","build/match_byte.rs":"89e8b941af74df2c204abf808672d3ff278bdec75abc918c41a843260b924677","docs/.nojekyll":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","docs/404.html":"025861f76f8d1f6d67c20ab624c6e418f4f824385e2dd8ad8732c4ea563c6a2e","docs/index.html":"025861f76f8d1f6d67c20ab624c6e418f4f824385e2dd8ad8732c4ea563c6a2e","src/color.rs":"422a2e934b06a2cca7beef7afeab42bdca81a73eb27afcbdb3d2a98db892590b","src/cow_rc_str.rs":"541216f8ef74ee3cc5cbbc1347e5f32ed66588c401851c9a7d68b867aede1de0","src/from_bytes.rs":"331fe63af2123ae3675b61928a69461b5ac77799fff3ce9978c55cf2c558f4ff","src/lib.rs":"37aec41c81021cd4cc8f34491ee75de2e8340feada2d0096b107597fc4ac485d","src/macros.rs":"adb9773c157890381556ea83d7942dcc676f99eea71abbb6afeffee1e3f28960","src/nth.rs":"246fa83a3ab97a7bb617c97a976af77136652ce77ba8ccca22e144b213b61310","src/parser.rs":"87a77f21b232b6c6f81777918997bb1d0b5ec7094c28714b312d0510db6d80d5","src/rules_and_declarations.rs":"962f59aab8030b0d1202859ff841ed6254ce4bd4159eee5e915ccdf4b802f4d5","src/serializer.rs":"3dc1d9441c9602f26d34c0b209f6d3954814815b780c068f9dc3514d808de3d9","src/size_of_tests.rs":"a28664d44797519119d659eaf7e84e1789ef97e9e2c2d36630eb9f226c0cc0a6","src/tests.rs":"fb238e8d6cd7e55e205ed8121a343b3366ef2fcbaf51e566cad75b088717247e","src/tokenizer.rs":"69313044052400c0e444fb1f7e4c0f5578ffa649b153c81b234b899cf1617dc0","src/unicode_range.rs":"fbbd0f4b393944699730a6b0f945b2b2376fcea61fce2ea37190fb287793021a"},"package":"71773af1c6bbbafa27cba64f310b95fea1f87cd82d5a8cd827bd96b4559e5c48"} No newline at end of file {"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".travis.yml":"f1fb4b65964c81bc1240544267ea334f554ca38ae7a74d57066f4d47d2b5d568","Cargo.toml":"c128f8077cdbf09c666f7b1ee43265f12450168c36b97236d9e4eaaf48aa85cb","LICENSE":"fab3dd6bdab226f1c08630b1dd917e11fcb4ec5e1e020e2c16f83a0a13863e85","README.md":"c5781e673335f37ed3d7acb119f8ed33efdf6eb75a7094b7da2abe0c3230adb8","build.rs":"950bcc47a196f07f99f59637c28cc65e02a885130011f90a2b2608248b4724a2","build/match_byte.rs":"89e8b941af74df2c204abf808672d3ff278bdec75abc918c41a843260b924677","docs/.nojekyll":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","docs/404.html":"025861f76f8d1f6d67c20ab624c6e418f4f824385e2dd8ad8732c4ea563c6a2e","docs/index.html":"025861f76f8d1f6d67c20ab624c6e418f4f824385e2dd8ad8732c4ea563c6a2e","src/color.rs":"422a2e934b06a2cca7beef7afeab42bdca81a73eb27afcbdb3d2a98db892590b","src/cow_rc_str.rs":"541216f8ef74ee3cc5cbbc1347e5f32ed66588c401851c9a7d68b867aede1de0","src/from_bytes.rs":"331fe63af2123ae3675b61928a69461b5ac77799fff3ce9978c55cf2c558f4ff","src/lib.rs":"37aec41c81021cd4cc8f34491ee75de2e8340feada2d0096b107597fc4ac485d","src/macros.rs":"adb9773c157890381556ea83d7942dcc676f99eea71abbb6afeffee1e3f28960","src/nth.rs":"246fa83a3ab97a7bb617c97a976af77136652ce77ba8ccca22e144b213b61310","src/parser.rs":"8ee54664ccf12f0f58f8d94959f9e2b8c8e780eb6f9650d202cead1776807699","src/rules_and_declarations.rs":"962f59aab8030b0d1202859ff841ed6254ce4bd4159eee5e915ccdf4b802f4d5","src/serializer.rs":"3dc1d9441c9602f26d34c0b209f6d3954814815b780c068f9dc3514d808de3d9","src/size_of_tests.rs":"a28664d44797519119d659eaf7e84e1789ef97e9e2c2d36630eb9f226c0cc0a6","src/tests.rs":"fe7f3ba5a50c21a23fdab6ed85e2ef2a80b23b62e1b6671252095d0330bb0ed7","src/tokenizer.rs":"f2953020e608bd1730fc192a1a7e6f6a960e2e4f3be9b49860cf348d89520c78","src/unicode_range.rs":"fbbd0f4b393944699730a6b0f945b2b2376fcea61fce2ea37190fb287793021a"},"package":"e88f0308699ff4e42b2ae57f170673f180a5b41f59364c95ae5c0c8022dbcbd1"} No newline at end of file
third_party/rust/cssparser/Cargo.toml +21 −21 Original line number Diff line number Diff line Loading @@ -12,7 +12,7 @@ [package] name = "cssparser" version = "0.20.2" version = "0.21.0" authors = ["Simon Sapin <simon.sapin@exyr.org>"] build = "build.rs" exclude = ["src/css-parsing-tests/**", "src/big-data-url.css"] Loading @@ -22,48 +22,48 @@ readme = "README.md" keywords = ["css", "syntax", "parser"] license = "MPL-2.0" repository = "https://github.com/servo/rust-cssparser" [dependencies.procedural-masquerade] version = "0.1" [dependencies.itoa] version = "0.3" [dependencies.heapsize] version = ">= 0.3, < 0.5" optional = true [dependencies.dtoa-short] version = "0.3" [dependencies.phf] version = "0.7" [dependencies.itoa] version = "0.3" [dependencies.heapsize] version = ">= 0.3, < 0.5" optional = true [dependencies.dtoa-short] version = "0.3" [dependencies.smallvec] version = "0.4.3" [dependencies.serde] version = "1.0" optional = true [dependencies.smallvec] version = "0.4.3" [dependencies.cssparser-macros] version = "0.3" [dependencies.procedural-masquerade] version = "0.1" [dependencies.matches] version = "0.1" [dev-dependencies.difference] version = "1.0" [dependencies.cssparser-macros] [dev-dependencies.rustc-serialize] version = "0.3" [dev-dependencies.encoding_rs] version = "0.7" [dev-dependencies.rustc-serialize] [build-dependencies.quote] version = "0.3" [dev-dependencies.difference] version = "1.0" [build-dependencies.syn] version = "0.11" [build-dependencies.quote] version = "0.3" [features] bench = [] dummy_match_byte = [] bench = []
third_party/rust/cssparser/src/parser.rs +1 −1 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ impl ParserState { pub fn source_location(&self) -> SourceLocation { SourceLocation { line: self.current_line_number, column: (self.position - self.current_line_start_position) as u32, column: (self.position - self.current_line_start_position + 1) as u32, } } } Loading
third_party/rust/cssparser/src/tests.rs +30 −30 Original line number Diff line number Diff line Loading @@ -498,29 +498,29 @@ fn line_numbers() { "b\"" )); let mut input = Parser::new(&mut input); assert_eq!(input.current_source_location(), SourceLocation { line: 0, column: 0 }); assert_eq!(input.current_source_location(), SourceLocation { line: 0, column: 1 }); assert_eq!(input.next_including_whitespace(), Ok(&Token::Ident("fo00o".into()))); assert_eq!(input.current_source_location(), SourceLocation { line: 1, column: 2 }); assert_eq!(input.next_including_whitespace(), Ok(&Token::WhiteSpace(" "))); assert_eq!(input.current_source_location(), SourceLocation { line: 1, column: 3 }); assert_eq!(input.next_including_whitespace(), Ok(&Token::WhiteSpace(" "))); assert_eq!(input.current_source_location(), SourceLocation { line: 1, column: 4 }); assert_eq!(input.next_including_whitespace(), Ok(&Token::Ident("bar".into()))); assert_eq!(input.current_source_location(), SourceLocation { line: 1, column: 6 }); assert_eq!(input.current_source_location(), SourceLocation { line: 1, column: 7 }); assert_eq!(input.next_including_whitespace_and_comments(), Ok(&Token::Comment("\n"))); assert_eq!(input.current_source_location(), SourceLocation { line: 2, column: 2 }); assert_eq!(input.current_source_location(), SourceLocation { line: 2, column: 3 }); assert_eq!(input.next_including_whitespace(), Ok(&Token::Ident("baz".into()))); assert_eq!(input.current_source_location(), SourceLocation { line: 2, column: 5 }); assert_eq!(input.current_source_location(), SourceLocation { line: 2, column: 6 }); let state = input.state(); assert_eq!(input.next_including_whitespace(), Ok(&Token::WhiteSpace("\r\n\n"))); assert_eq!(input.current_source_location(), SourceLocation { line: 4, column: 0 }); assert_eq!(input.current_source_location(), SourceLocation { line: 4, column: 1 }); assert_eq!(state.source_location(), SourceLocation { line: 2, column: 5 }); assert_eq!(state.source_location(), SourceLocation { line: 2, column: 6 }); assert_eq!(input.next_including_whitespace(), Ok(&Token::UnquotedUrl("u".into()))); assert_eq!(input.current_source_location(), SourceLocation { line: 6, column: 1 }); assert_eq!(input.current_source_location(), SourceLocation { line: 6, column: 2 }); assert_eq!(input.next_including_whitespace(), Ok(&Token::QuotedString("ab".into()))); assert_eq!(input.current_source_location(), SourceLocation { line: 7, column: 2 }); assert_eq!(input.current_source_location(), SourceLocation { line: 7, column: 3 }); assert!(input.next_including_whitespace().is_err()); } Loading Loading @@ -1000,14 +1000,14 @@ fn parser_maintains_current_line() { fn parser_with_line_number_offset() { let mut input = ParserInput::new_with_line_number_offset("ident\nident", 72); let mut parser = Parser::new(&mut input); assert_eq!(parser.current_source_location(), SourceLocation { line: 72, column: 0 }); assert_eq!(parser.current_source_location(), SourceLocation { line: 72, column: 1 }); assert_eq!(parser.next_including_whitespace_and_comments(), Ok(&Token::Ident("ident".into()))); assert_eq!(parser.current_source_location(), SourceLocation { line: 72, column: 5 }); assert_eq!(parser.current_source_location(), SourceLocation { line: 72, column: 6 }); assert_eq!(parser.next_including_whitespace_and_comments(), Ok(&Token::WhiteSpace("\n".into()))); assert_eq!(parser.current_source_location(), SourceLocation { line: 73, column: 0 }); assert_eq!(parser.current_source_location(), SourceLocation { line: 73, column: 1 }); assert_eq!(parser.next_including_whitespace_and_comments(), Ok(&Token::Ident("ident".into()))); assert_eq!(parser.current_source_location(), SourceLocation { line: 73, column: 5 }); assert_eq!(parser.current_source_location(), SourceLocation { line: 73, column: 6 }); } #[test] Loading Loading @@ -1088,24 +1088,24 @@ fn utf16_columns() { // the column is in units of UTF-16, the 4-byte sequence results // in two columns. let tests = vec![ ("", 0), ("ascii", 5), ("/*QΡ✈🆒*/", 9), ("'QΡ✈🆒*'", 8), ("\"\\\"'QΡ✈🆒*'", 11), ("\\Q\\Ρ\\✈\\🆒", 9), ("QΡ✈🆒", 5), ("QΡ✈🆒\\Q\\Ρ\\✈\\🆒", 14), ("newline\r\nQΡ✈🆒", 5), ("url(QΡ✈🆒\\Q\\Ρ\\✈\\🆒)", 19), ("url(QΡ✈🆒)", 10), ("url(\r\nQΡ✈🆒\\Q\\Ρ\\✈\\🆒)", 15), ("url(\r\nQΡ✈🆒\\Q\\Ρ\\✈\\🆒", 14), ("url(\r\nQΡ✈🆒\\Q\\Ρ\\✈\\🆒 x", 16), ("QΡ✈🆒()", 7), ("", 1), ("ascii", 6), ("/*QΡ✈🆒*/", 10), ("'QΡ✈🆒*'", 9), ("\"\\\"'QΡ✈🆒*'", 12), ("\\Q\\Ρ\\✈\\🆒", 10), ("QΡ✈🆒", 6), ("QΡ✈🆒\\Q\\Ρ\\✈\\🆒", 15), ("newline\r\nQΡ✈🆒", 6), ("url(QΡ✈🆒\\Q\\Ρ\\✈\\🆒)", 20), ("url(QΡ✈🆒)", 11), ("url(\r\nQΡ✈🆒\\Q\\Ρ\\✈\\🆒)", 16), ("url(\r\nQΡ✈🆒\\Q\\Ρ\\✈\\🆒", 15), ("url(\r\nQΡ✈🆒\\Q\\Ρ\\✈\\🆒 x", 17), ("QΡ✈🆒()", 8), // Test that under/over-flow of current_line_start_position is // handled properly; see the special case in consume_4byte_intro. ("🆒", 2), ("🆒", 3), ]; for test in tests { Loading
third_party/rust/cssparser/src/tokenizer.rs +3 −3 Original line number Diff line number Diff line Loading @@ -276,7 +276,7 @@ impl<'a> Tokenizer<'a> { pub fn current_source_location(&self) -> SourceLocation { SourceLocation { line: self.current_line_number, column: (self.position - self.current_line_start_position) as u32, column: (self.position - self.current_line_start_position + 1) as u32, } } Loading Loading @@ -521,8 +521,8 @@ pub struct SourceLocation { /// The line number, starting at 0 for the first line, unless `with_first_line_number` was used. pub line: u32, /// The column number within a line, starting at 0 for first the character of the line. /// Column numbers are in units of UTF-16 characters. /// The column number within a line, starting at 1 for first the character of the line. /// Column numbers are counted in UTF-16 code units. pub column: u32, } Loading