--- a/js/rust/Cargo.lock
+++ b/js/rust/Cargo.lock
@@ -18,28 +18,29 @@ source = "registry+https://github.com/ru
dependencies = [
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "bindgen"
-version = "0.32.2"
+version = "0.32.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cexpr 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"clang-sys 0.21.1 (registry+https://github.com/rust-lang/crates.io-index)",
"clap 2.29.0 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"peeking_take_while 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
+ "proc-macro2 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "quote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"which 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "bitflags"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -107,17 +108,17 @@ source = "registry+https://github.com/ru
name = "glob"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "js"
version = "0.1.4"
dependencies = [
- "bindgen 0.32.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "bindgen 0.32.3 (registry+https://github.com/rust-lang/crates.io-index)",
"cmake 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
"glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"mozjs_sys 0.0.0",
"num-traits 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -214,19 +215,30 @@ version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "pkg-config"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
+name = "proc-macro2"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
name = "quote"
-version = "0.3.15"
+version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "proc-macro2 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
+]
[[package]]
name = "regex"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"aho-corasick 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
"memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -272,16 +284,21 @@ dependencies = [
]
[[package]]
name = "unicode-width"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
+name = "unicode-xid"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
name = "unreachable"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -321,17 +338,17 @@ source = "registry+https://github.com/ru
name = "winapi-build"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[metadata]
"checksum aho-corasick 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "500909c4f87a9e52355b26626d890833e9e1d53ac566db76c36faa984b889699"
"checksum ansi_term 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6b3568b48b7cefa6b8ce125f9bb4989e52fbcc29ebea88df04cc7c5f12f70455"
"checksum atty 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d912da0db7fa85514874458ca3651fe2cddace8d0b0505571dbdcd41ab490159"
-"checksum bindgen 0.32.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6ed9557522980fcdb4986097c2ea9d2504eafa7e5818f393110205b5325a52ce"
+"checksum bindgen 0.32.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8b242e11a8f446f5fc7b76b37e81d737cabca562a927bd33766dac55b5f1177f"
"checksum bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b3c30d3802dfb7281680d6285f2ccdaa8c2d8fee41f93805dba5c4cf50dc23cf"
"checksum cexpr 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "393a5f0088efbe41f9d1fcd062f24e83c278608420e62109feb2c8abee07de7d"
"checksum cfg-if 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d0c47d456a36ebf0536a6705c83c1cbbcb9255fbc1d905a6ded104f479268a29"
"checksum clang-sys 0.21.1 (registry+https://github.com/rust-lang/crates.io-index)" = "00048189ee171715296dfe3b2fcfd439563c7bfec0d98d3976ce3402d62c8f07"
"checksum clap 2.29.0 (registry+https://github.com/rust-lang/crates.io-index)" = "110d43e343eb29f4f51c1db31beb879d546db27998577e5715270a54bcf41d3f"
"checksum cmake 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)" = "b8ebbb35d3dc9cd09497168f33de1acb79b265d350ab0ac34133b98f8509af1f"
"checksum env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3ddf21e73e016298f5cb37d6ef8e8da8e39f91f9ec8b0df44b7deb16a9f8cd5b"
"checksum gcc 0.3.54 (registry+https://github.com/rust-lang/crates.io-index)" = "5e33ec290da0d127825013597dbdfc28bee4964690c7ce1166cbc2a7bd08b1bb"
@@ -344,24 +361,26 @@ source = "registry+https://github.com/ru
"checksum libz-sys 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)" = "3fdd64ef8ee652185674455c1d450b83cbc8ad895625d543b5324d923f82e4d8"
"checksum log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "880f77541efa6e5cc74e76910c9884d9859683118839d6a1dc3b11e63512565b"
"checksum memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a"
"checksum nom 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a5b8c256fd9471521bcb84c3cdba98921497f1a331cbc15b8030fc63b82050ce"
"checksum num-traits 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "cacfcab5eb48250ee7d0c7896b51a2c5eec99c1feea5f32025635f5ae4b00070"
"checksum num_cpus 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "514f0d73e64be53ff320680ca671b64fe3fb91da01e1ae2ddc99eb51d453b20d"
"checksum peeking_take_while 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
"checksum pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "3a8b4c6b8165cd1a1cd4b9b120978131389f64bdaf456435caa41e630edba903"
-"checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a"
+"checksum proc-macro2 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d1cb7aaaa4bf022ec2b14ff2f2ba1643a22f3cee88df014a85e14b392282c61d"
+"checksum quote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1eca14c727ad12702eb4b6bfb5a232287dcf8385cb8ca83a3eeaf6519c44c408"
"checksum regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1731164734096285ec2a5ec7fea5248ae2f5485b3feeb0115af4fda2183b2d1b"
"checksum regex-syntax 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ad890a5eef7953f55427c50575c680c42841653abd2b028b68cd223d157f62db"
"checksum strsim 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b4d15c810519a91cf877e7e36e63fe068815c678181439f2f29e2562147c3694"
"checksum textwrap 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c0b59b6b4b44d867f1370ef1bd91bfb262bf07bf0ae65c202ea2fbc16153b693"
"checksum thread-id 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8df7875b676fddfadffd96deea3b1124e5ede707d4884248931077518cf1f773"
"checksum thread_local 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c85048c6260d17cf486ceae3282d9fb6b90be220bf5b28c400f5485ffc29f0c7"
"checksum unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "bf3a113775714a22dcb774d8ea3655c53a32debae63a063acc00a91cc586245f"
+"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
"checksum unreachable 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1f2ae5ddb18e1c92664717616dd9549dde73f539f01bd7b77c2edb2446bdff91"
"checksum utf8-ranges 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "662fab6525a98beff2921d7f61a39e7d59e0b425ebc7d0d9e66d316e55124122"
"checksum vcpkg 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9e0a7d8bed3178a8fb112199d466eeca9ed09a14ba8ad67718179b4fd5487d0b"
"checksum vec_map 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "887b5b631c2ad01628bbbaa7dd4c869f80d3186688f8d0b6f58774fbe324988c"
"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
"checksum which 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4be6cfa54dab45266e98b5d7be2f8ce959ddd49abd141a05d52dce4b07f803bb"
"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
--- a/js/rust/Cargo.toml
+++ b/js/rust/Cargo.toml
@@ -3,17 +3,17 @@ name = "js"
version = "0.1.4"
authors = ["The Servo Project Developers"]
build = "build.rs"
license = "MPL-2.0"
[build-dependencies]
env_logger = "0.4"
log = "0.3"
-bindgen = "0.32.2"
+bindgen = "0.32.3"
cmake = "0.1"
glob = "0.2.11"
[[test]]
name = "callback"
[[test]]
name = "enumerate"
[[test]]
--- a/servo/components/style/Cargo.toml
+++ b/servo/components/style/Cargo.toml
@@ -70,12 +70,12 @@ unicode-bidi = "0.3"
unicode-segmentation = "1.0"
[target.'cfg(windows)'.dependencies]
kernel32-sys = "0.2"
[build-dependencies]
lazy_static = "1"
log = "0.3"
-bindgen = { version = "0.32.2", optional = true }
+bindgen = { version = "0.32.3", optional = true }
regex = {version = "0.2", optional = true}
walkdir = "1.0"
toml = {version = "0.2.1", optional = true, default-features = false}
--- a/third_party/rust/bindgen/.cargo-checksum.json
+++ b/third_party/rust/bindgen/.cargo-checksum.json
@@ -1,1 +1,1 @@
-{"files":{"Cargo.toml":"1373d611f13384cfb380e67f4553d83428094168d0149d464af4b9e49015057c","build.rs":"032a1c51963894a421b0535f9227796d88768ac5f665a81d2edced69dc6d106a","src/callbacks.rs":"c5c4e5bc8c49cb191d1b100339772fdc7dd1dbf5025a9de1ecaafb70f86cb48f","src/clang.rs":"c816d5291ccdc1d4ba028ae817ef385048e1fb8443911d026af5c721a6d57854","src/codegen/bitfield_unit.rs":"bd1a19701f1766d0bae3bcb97d7c3cb3881d4b182c56b8f4dfd24b7cc87b5338","src/codegen/bitfield_unit_tests.rs":"2073ac6a36e0bc9afaef5b1207966817c8fb7a1a9f6368c3b1b8f79822efbfba","src/codegen/error.rs":"2613af1d833377fd4a70719f4a09951d9d45dc9227827b9a2a938a1bcaaea2dd","src/codegen/helpers.rs":"bcb951f320fd0948e341d8eabdb58567296d77bf1ae5040c05d967e6435a15d5","src/codegen/impl_debug.rs":"e2ffd5b6ed936698aa4b9e7e3459d353383792707ad51f829a18a822f69cab0e","src/codegen/impl_partialeq.rs":"e86050b98f57fa4496dbde0beea319a89e46290309d274f626361779549b95bd","src/codegen/mod.rs":"4efd9f819f2417e76235fdbb61f9f66a5bbb3ac0a402f69a8826ebf9ce9276e1","src/codegen/struct_layout.rs":"3c4b2b4543c6aa1da03f7522ad7f831e95dc146cf5edd08ebd5facb1305daddb","src/extra_assertions.rs":"449549c4a7a50c3f0b06332452b2fb6c9b23f31ca8e5e1656fe6c7f21e8ef7fa","src/features.rs":"8c2148a6f922ca9cb0de2dd3ad77c4dd5734c4c219a5bea9d6b22c4367acb187","src/ir/analysis/derive_copy.rs":"c8d700dcde2419d2687377a7cb1024ad3722bbcb83d0b1031618f57d484793b4","src/ir/analysis/derive_debug.rs":"1d6621c0fa5d899310cc175cb99703606ed34fd7f7ad77bb60f012f25ba504af","src/ir/analysis/derive_default.rs":"3af97eaa9bdc91a0bded060b393d0bb23ef9dcf59a7a6ed7d79814f35f73b66a","src/ir/analysis/derive_hash.rs":"c8a95040352b3d10f8edb46f6ae513d4f15ec87197668b1fc1d7cf2cb416054f","src/ir/analysis/derive_partialeq_or_partialord.rs":"1f7c097bde85ebb4082a3a318a753db13e8b4733fa1433dcc054f137dc0e6c2d","src/ir/analysis/has_destructor.rs":"d9aaaceba580b48eb0df4e5537b34b417c51ccdfeb8f6b72484f3bf4992317fe","src/ir/analysis/has_float.rs":"2a0465503d2c8247eaf916bd6a03594f3dc0370533d9a7c58cc5afb86693816c","src/ir/analysis/has_type_param_in_array.rs":"fcb1c78b6000f1f5eb8d8147e2afdaba9eb0e3a81b61e72537048dfdbeea7bcd","src/ir/analysis/has_vtable.rs":"37765e954ef792e369a58ccfe1d827a00fe9bce680466da1d6523671b94b6c92","src/ir/analysis/mod.rs":"ea5ace45c77e855674bb565ba0fef556f60e3293b0ddcf11d3a5a6ec15ab0648","src/ir/analysis/sizedness.rs":"3d3c8bde40604d53bb64273a3cbd8c55936a7dfe1de9b2ba92fc2c45572624b4","src/ir/analysis/template_params.rs":"5c6ee7a251a321ef5733e2e7ac3264621b4181268babcc008b69dbfc37691fb1","src/ir/annotations.rs":"ef106afcbe6084c18bd13a37ee3c1cdc9596bfb055db8c773d81f8f15fec3208","src/ir/comment.rs":"36f2a1d3970fdbf3d72c1f094043902747cde395215bdf7e9103926d9df011fd","src/ir/comp.rs":"461ae606b0f49638c1f78c627da4837949dd367d3589d92a7f7d05eca7028796","src/ir/context.rs":"05258f113012a923d1e0516aee2c60769757727c2e1aa7a6101e17ef8db1f944","src/ir/derive.rs":"1fd6ad621e3c60b950acbd51fbe386d1f0fadb7c1889c723245afff45e42e143","src/ir/dot.rs":"eca03a493a7fe48044b832c37c71d51f1bd4e8689feb6f1cb8bc0422541c7284","src/ir/enum_ty.rs":"63cf8ba48858e2f02b58cd437d763cc18ddf6a841044cafdd51687c28ace1862","src/ir/function.rs":"6d6d011df29ccf1c0c1db39ceb0acb70e9dda61282d45b6eb5bc4581543a2588","src/ir/int.rs":"1f61a472288afe489d9320bc8b13920333ece57891ae8570b4c4f25ab50688e6","src/ir/item.rs":"527b9a006dd1865cb77bac7e0e3826904c71b3b77679bcf7cd4ea63791dfa5ec","src/ir/item_kind.rs":"13048962657436a757ff9483d96f2ce351ec5f827ecab4921ed643f6f115c497","src/ir/layout.rs":"e3d1adf1ad2fa5bd96530cdd5097db3d9cc7b44d33ec23a04fcfccecd9cf4469","src/ir/mod.rs":"2eae90f207fad2e45957ec9287064992a419e3fc916aba84faff2ea25cbeb5ee","src/ir/module.rs":"c4d90bf38fe3672e01923734ccbdb7951ea929949d5f413a9c2aee12395a5094","src/ir/objc.rs":"05068c4fbf42429c4ac2a233c874f18ffcf7dc1744398e400a5a48d0e7a972f2","src/ir/template.rs":"bcd750450a4df0200a6e7958f9c96a09b91e3ccd29c60712f2b9d3458f1234aa","src/ir/traversal.rs":"a108f2b2a1b3d2e679274eead8cf6f8fc78454e88943527d56bb30b5f071f104","src/ir/ty.rs":"4d5f1b2e11f6fb7df3348bdab7775cdfa209e136afe84a7b0e862068e53e7183","src/ir/var.rs":"f6eb7a29b262c2eb8615612f207f251097e4bcbcb523f53dcad174ec6d11f4ce","src/lib.rs":"9f6136c49ec1118cf0eec474534db63a1190cf93717bfbf10a95b5a73411b8f6","src/log_stubs.rs":"6dfdd908b7c6453da416cf232893768f9480e551ca4add0858ef88bf71ee6ceb","src/main.rs":"fa0a21b4aca4df72896f911de3ee252bec87abb4c871e39b53e90923181a1658","src/options.rs":"c31da7f76035a7831073e44773bfbe796840403b88db7ae58a49b688cd90aef6","src/parse.rs":"be7d13cc84fae79ec7b3aa9e77063fa475a48d74a854423e2c72d75006a25202","src/regex_set.rs":"a55241f2117f15729d174790f386e255fcb224b692325bbe6716dbb1d6874881","src/time.rs":"a02befb48d10dcc31e3f9571b2fa1c40f97fafe6f6ae7d7fc4f8fd01f1a169ba"},"package":"6ed9557522980fcdb4986097c2ea9d2504eafa7e5818f393110205b5325a52ce"}
\ No newline at end of file
+{"files":{"Cargo.toml":"9194dcdbb9477b1f4311debaad3ad044f721be054574416734ba09d2d7194a81","build.rs":"032a1c51963894a421b0535f9227796d88768ac5f665a81d2edced69dc6d106a","src/callbacks.rs":"c5c4e5bc8c49cb191d1b100339772fdc7dd1dbf5025a9de1ecaafb70f86cb48f","src/clang.rs":"c816d5291ccdc1d4ba028ae817ef385048e1fb8443911d026af5c721a6d57854","src/codegen/bitfield_unit.rs":"bd1a19701f1766d0bae3bcb97d7c3cb3881d4b182c56b8f4dfd24b7cc87b5338","src/codegen/bitfield_unit_tests.rs":"2073ac6a36e0bc9afaef5b1207966817c8fb7a1a9f6368c3b1b8f79822efbfba","src/codegen/error.rs":"2613af1d833377fd4a70719f4a09951d9d45dc9227827b9a2a938a1bcaaea2dd","src/codegen/helpers.rs":"15407de2a521043d456fddc0934757a8da0a5decac3ecdf93b669b27fb6a6be2","src/codegen/impl_debug.rs":"e2ffd5b6ed936698aa4b9e7e3459d353383792707ad51f829a18a822f69cab0e","src/codegen/impl_partialeq.rs":"9f3c6aaa8da01ecad0c4d4d8996f6d20c00b8cf68d7620654b7d42d6a23725d9","src/codegen/mod.rs":"c7d933cab870d798bfa8fb6ea3d5768832c6e5fbae741994a3b6ce2c96b159ec","src/codegen/struct_layout.rs":"9edf0bbd0a3d17a93e188f9aba42bdf5bd938eca9c50e9c509977923eb16ef11","src/extra_assertions.rs":"449549c4a7a50c3f0b06332452b2fb6c9b23f31ca8e5e1656fe6c7f21e8ef7fa","src/features.rs":"8c2148a6f922ca9cb0de2dd3ad77c4dd5734c4c219a5bea9d6b22c4367acb187","src/ir/analysis/derive_copy.rs":"c8d700dcde2419d2687377a7cb1024ad3722bbcb83d0b1031618f57d484793b4","src/ir/analysis/derive_debug.rs":"1d6621c0fa5d899310cc175cb99703606ed34fd7f7ad77bb60f012f25ba504af","src/ir/analysis/derive_default.rs":"3af97eaa9bdc91a0bded060b393d0bb23ef9dcf59a7a6ed7d79814f35f73b66a","src/ir/analysis/derive_hash.rs":"c8a95040352b3d10f8edb46f6ae513d4f15ec87197668b1fc1d7cf2cb416054f","src/ir/analysis/derive_partialeq_or_partialord.rs":"1f7c097bde85ebb4082a3a318a753db13e8b4733fa1433dcc054f137dc0e6c2d","src/ir/analysis/has_destructor.rs":"d9aaaceba580b48eb0df4e5537b34b417c51ccdfeb8f6b72484f3bf4992317fe","src/ir/analysis/has_float.rs":"2a0465503d2c8247eaf916bd6a03594f3dc0370533d9a7c58cc5afb86693816c","src/ir/analysis/has_type_param_in_array.rs":"fcb1c78b6000f1f5eb8d8147e2afdaba9eb0e3a81b61e72537048dfdbeea7bcd","src/ir/analysis/has_vtable.rs":"37765e954ef792e369a58ccfe1d827a00fe9bce680466da1d6523671b94b6c92","src/ir/analysis/mod.rs":"ea5ace45c77e855674bb565ba0fef556f60e3293b0ddcf11d3a5a6ec15ab0648","src/ir/analysis/sizedness.rs":"3d3c8bde40604d53bb64273a3cbd8c55936a7dfe1de9b2ba92fc2c45572624b4","src/ir/analysis/template_params.rs":"5c6ee7a251a321ef5733e2e7ac3264621b4181268babcc008b69dbfc37691fb1","src/ir/annotations.rs":"ef106afcbe6084c18bd13a37ee3c1cdc9596bfb055db8c773d81f8f15fec3208","src/ir/comment.rs":"36f2a1d3970fdbf3d72c1f094043902747cde395215bdf7e9103926d9df011fd","src/ir/comp.rs":"461ae606b0f49638c1f78c627da4837949dd367d3589d92a7f7d05eca7028796","src/ir/context.rs":"870e2743cc7b547c04b20205354aa1c3b8c70f4d393db37288dd72ab6997104d","src/ir/derive.rs":"1fd6ad621e3c60b950acbd51fbe386d1f0fadb7c1889c723245afff45e42e143","src/ir/dot.rs":"eca03a493a7fe48044b832c37c71d51f1bd4e8689feb6f1cb8bc0422541c7284","src/ir/enum_ty.rs":"63cf8ba48858e2f02b58cd437d763cc18ddf6a841044cafdd51687c28ace1862","src/ir/function.rs":"2eb054ae04ef8067b020717c82d055c9f9853c8b31e14de6319be85656d88cf2","src/ir/int.rs":"1f61a472288afe489d9320bc8b13920333ece57891ae8570b4c4f25ab50688e6","src/ir/item.rs":"527b9a006dd1865cb77bac7e0e3826904c71b3b77679bcf7cd4ea63791dfa5ec","src/ir/item_kind.rs":"13048962657436a757ff9483d96f2ce351ec5f827ecab4921ed643f6f115c497","src/ir/layout.rs":"e3d1adf1ad2fa5bd96530cdd5097db3d9cc7b44d33ec23a04fcfccecd9cf4469","src/ir/mod.rs":"2eae90f207fad2e45957ec9287064992a419e3fc916aba84faff2ea25cbeb5ee","src/ir/module.rs":"c4d90bf38fe3672e01923734ccbdb7951ea929949d5f413a9c2aee12395a5094","src/ir/objc.rs":"6516f60b71a8b652e618c64cd4eac6e8bfaa561a3c159cfc44d15bf216b1224f","src/ir/template.rs":"bcd750450a4df0200a6e7958f9c96a09b91e3ccd29c60712f2b9d3458f1234aa","src/ir/traversal.rs":"a108f2b2a1b3d2e679274eead8cf6f8fc78454e88943527d56bb30b5f071f104","src/ir/ty.rs":"4d5f1b2e11f6fb7df3348bdab7775cdfa209e136afe84a7b0e862068e53e7183","src/ir/var.rs":"f6eb7a29b262c2eb8615612f207f251097e4bcbcb523f53dcad174ec6d11f4ce","src/lib.rs":"439d0f5c4e2c6df76c71856fdbddf03657c677fe341760a4305f4a240b6fee2b","src/log_stubs.rs":"6dfdd908b7c6453da416cf232893768f9480e551ca4add0858ef88bf71ee6ceb","src/main.rs":"fa0a21b4aca4df72896f911de3ee252bec87abb4c871e39b53e90923181a1658","src/options.rs":"c31da7f76035a7831073e44773bfbe796840403b88db7ae58a49b688cd90aef6","src/parse.rs":"be7d13cc84fae79ec7b3aa9e77063fa475a48d74a854423e2c72d75006a25202","src/regex_set.rs":"a55241f2117f15729d174790f386e255fcb224b692325bbe6716dbb1d6874881","src/time.rs":"a02befb48d10dcc31e3f9571b2fa1c40f97fafe6f6ae7d7fc4f8fd01f1a169ba"},"package":"8b242e11a8f446f5fc7b76b37e81d737cabca562a927bd33766dac55b5f1177f"}
\ No newline at end of file
--- a/third_party/rust/bindgen/Cargo.toml
+++ b/third_party/rust/bindgen/Cargo.toml
@@ -7,17 +7,17 @@
#
# If you believe there's an error in this file please file an
# issue against the rust-lang/cargo repository. If you're
# editing this file be aware that the upstream Cargo.toml
# will likely look very different (and much more reasonable)
[package]
name = "bindgen"
-version = "0.32.2"
+version = "0.32.3"
authors = ["Jyun-Yan You <jyyou.tw@gmail.com>", "Emilio Cobos Álvarez <emilio@crisal.io>", "Nick Fitzgerald <fitzgen@gmail.com>", "The Servo project developers"]
build = "build.rs"
include = ["Cargo.toml", "build.rs", "src/*.rs", "src/**/*.rs"]
description = "Automatically generates Rust FFI bindings to C and C++ libraries."
documentation = "https://docs.rs/bindgen"
readme = "README.md"
keywords = ["bindings", "ffi", "code-generation"]
categories = ["external-ffi-bindings", "development-tools::ffi"]
@@ -53,18 +53,21 @@ version = "1"
[dependencies.log]
version = "0.3"
optional = true
[dependencies.peeking_take_while]
version = "0.1.2"
+[dependencies.proc-macro2]
+version = "0.2"
+
[dependencies.quote]
-version = "0.3.15"
+version = "0.4"
[dependencies.regex]
version = "0.2"
[dependencies.which]
version = "1.0.2"
[dev-dependencies.clap]
version = "2"
--- a/third_party/rust/bindgen/src/codegen/helpers.rs
+++ b/third_party/rust/bindgen/src/codegen/helpers.rs
@@ -1,54 +1,53 @@
//! Helpers for code generation that don't need macro expansion.
use ir::context::BindgenContext;
use ir::layout::Layout;
use quote;
+use proc_macro2;
use std::mem;
pub mod attributes {
use quote;
+ use proc_macro2;
pub fn repr(which: &str) -> quote::Tokens {
- let which = quote::Ident::new(which);
+ let which = proc_macro2::Term::intern(which);
quote! {
#[repr( #which )]
}
}
pub fn repr_list(which_ones: &[&str]) -> quote::Tokens {
- let which_ones = which_ones.iter().cloned().map(quote::Ident::new);
+ let which_ones = which_ones.iter().cloned().map(proc_macro2::Term::intern);
quote! {
#[repr( #( #which_ones ),* )]
}
}
pub fn derives(which_ones: &[&str]) -> quote::Tokens {
- let which_ones = which_ones.iter().cloned().map(quote::Ident::new);
+ let which_ones = which_ones.iter().cloned().map(proc_macro2::Term::intern);
quote! {
#[derive( #( #which_ones ),* )]
}
}
pub fn inline() -> quote::Tokens {
quote! {
#[inline]
}
}
pub fn doc(comment: String) -> quote::Tokens {
// Doc comments are already preprocessed into nice `///` formats by the
// time they get here. Just make sure that we have newlines around it so
// that nothing else gets wrapped into the comment.
- let mut tokens = quote! {};
- tokens.append("\n");
- tokens.append(comment);
- tokens.append("\n");
- tokens
+ let comment = proc_macro2::Literal::doccomment(&comment);
+ quote! {#comment}
}
pub fn link_name(name: &str) -> quote::Tokens {
// LLVM mangles the name by default but it's already mangled.
// Prefixing the name with \u{1} should tell LLVM to not mangle it.
let name = format!("\u{1}{}", name);
quote! {
#[link_name = #name]
@@ -68,17 +67,17 @@ pub fn blob(layout: Layout) -> quote::To
let ty_name = match opaque.known_rust_type_for_array() {
Some(ty) => ty,
None => {
warn!("Found unknown alignment on code generation!");
"u8"
}
};
- let ty_name = quote::Ident::new(ty_name);
+ let ty_name = proc_macro2::Term::intern(ty_name);
let data_len = opaque.array_size().unwrap_or(layout.size);
if data_len == 1 {
quote! {
#ty_name
}
} else {
@@ -98,39 +97,40 @@ pub fn integer_type(layout: Layout) -> O
}
}
/// Generates a bitfield allocation unit type for a type with the given `Layout`.
pub fn bitfield_unit(ctx: &BindgenContext, layout: Layout) -> quote::Tokens {
let mut tokens = quote! {};
if ctx.options().enable_cxx_namespaces {
- tokens.append(quote! { root:: });
+ tokens.append_all(quote! { root:: });
}
let align = match layout.align {
n if n >= 8 => quote! { u64 },
4 => quote! { u32 },
2 => quote! { u16 },
_ => quote! { u8 },
};
let size = layout.size;
- tokens.append(quote! {
+ tokens.append_all(quote! {
__BindgenBitfieldUnit<[u8; #size], #align>
});
tokens
}
pub mod ast_ty {
use ir::context::BindgenContext;
use ir::function::FunctionSig;
use ir::ty::FloatKind;
use quote;
+ use proc_macro2;
pub fn raw_type(ctx: &BindgenContext, name: &str) -> quote::Tokens {
let ident = ctx.rust_ident_raw(name);
match ctx.options().ctypes_prefix {
Some(ref prefix) => {
let prefix = ctx.rust_ident_raw(prefix.as_str());
quote! {
#prefix::#ident
@@ -161,59 +161,48 @@ pub mod ast_ty {
(FloatKind::Double, false) |
(FloatKind::LongDouble, false) => raw_type(ctx, "c_double"),
(FloatKind::Float128, _) => quote! { [u8; 16] },
}
}
pub fn int_expr(val: i64) -> quote::Tokens {
// Don't use quote! { #val } because that adds the type suffix.
- let mut tokens = quote! {};
- tokens.append(val.to_string());
- tokens
+ let val = proc_macro2::Literal::integer(val);
+ quote!(#val)
}
pub fn uint_expr(val: u64) -> quote::Tokens {
// Don't use quote! { #val } because that adds the type suffix.
- let mut tokens = quote! {};
- tokens.append(val.to_string());
- tokens
+ let val = proc_macro2::Term::intern(&val.to_string());
+ quote!(#val)
}
pub fn byte_array_expr(bytes: &[u8]) -> quote::Tokens {
let mut bytes: Vec<_> = bytes.iter().cloned().collect();
bytes.push(0);
- quote! {
- #bytes
- }
+ quote! { [ #(#bytes),* ] }
}
pub fn cstr_expr(mut string: String) -> quote::Tokens {
string.push('\0');
- let b = quote::ByteStr(&string);
+ let b = proc_macro2::Literal::byte_string(&string.as_bytes());
quote! {
#b
}
}
pub fn float_expr(
ctx: &BindgenContext,
f: f64,
) -> Result<quote::Tokens, ()> {
if f.is_finite() {
- let mut string = f.to_string();
+ let val = proc_macro2::Literal::float(f);
- // So it gets properly recognised as a floating point constant.
- if !string.contains('.') {
- string.push('.');
- }
-
- let mut tokens = quote! {};
- tokens.append(string);
- return Ok(tokens);
+ return Ok(quote!(#val));
}
let prefix = ctx.trait_prefix();
if f.is_nan() {
return Ok(quote! {
::#prefix::f64::NAN
});
--- a/third_party/rust/bindgen/src/codegen/impl_partialeq.rs
+++ b/third_party/rust/bindgen/src/codegen/impl_partialeq.rs
@@ -1,14 +1,15 @@
use ir::comp::{CompInfo, CompKind, Field, FieldMethods};
use ir::context::BindgenContext;
use ir::item::{IsOpaque, Item};
use ir::ty::{TypeKind, RUST_DERIVE_IN_ARRAY_LIMIT};
use quote;
+use proc_macro2;
/// Generate a manual implementation of `PartialEq` trait for the
/// specified compound type.
pub fn gen_partialeq_impl(
ctx: &BindgenContext,
comp_info: &CompInfo,
item: &Item,
ty_for_impl: "e::Tokens,
@@ -66,17 +67,17 @@ pub fn gen_partialeq_impl(
Some(quote! {
fn eq(&self, other: & #ty_for_impl) -> bool {
#( #tokens )&&*
}
})
}
fn gen_field(ctx: &BindgenContext, ty_item: &Item, name: &str) -> quote::Tokens {
- fn quote_equals(name_ident: quote::Ident) -> quote::Tokens {
+ fn quote_equals(name_ident: proc_macro2::Term) -> quote::Tokens {
quote! { self.#name_ident == other.#name_ident }
}
let name_ident = ctx.rust_ident(name);
let ty = ty_item.expect_type();
match *ty.kind() {
TypeKind::Void |
--- a/third_party/rust/bindgen/src/codegen/mod.rs
+++ b/third_party/rust/bindgen/src/codegen/mod.rs
@@ -33,16 +33,17 @@ use ir::item_kind::ItemKind;
use ir::layout::Layout;
use ir::module::Module;
use ir::objc::{ObjCInterface, ObjCMethod};
use ir::template::{AsTemplateParam, TemplateInstantiation, TemplateParameters};
use ir::ty::{Type, TypeKind};
use ir::var::Var;
use quote;
+use proc_macro2;
use std::borrow::Cow;
use std::cell::Cell;
use std::collections::{HashSet, VecDeque};
use std::collections::hash_map::{Entry, HashMap};
use std::fmt::Write;
use std::iter;
use std::mem;
@@ -70,17 +71,17 @@ fn root_import(ctx: &BindgenContext, mod
let mut path = top_level_path(ctx, module);
let root = ctx.root_module().canonical_name(ctx);
let root_ident = ctx.rust_ident(&root);
path.push(quote! { #root_ident });
let mut tokens = quote! {};
- tokens.append_separated(path, "::");
+ tokens.append_separated(path, proc_macro2::Term::intern("::"));
quote! {
#[allow(unused_imports)]
use #tokens ;
}
}
struct CodegenResult<'a> {
@@ -304,17 +305,17 @@ impl AppendImplicitTemplateParams for qu
return;
}
let params = params.into_iter().map(|p| {
p.try_to_rust_ty(ctx, &())
.expect("template params cannot fail to be a rust type")
});
- self.append(quote! {
+ self.append_all(quote! {
< #( #params ),* >
});
}
}
}
trait CodeGenerator {
/// Extra information from the caller.
@@ -555,29 +556,22 @@ impl CodeGenerator for Var {
} else {
let mut attrs = vec![];
if let Some(mangled) = self.mangled_name() {
attrs.push(attributes::link_name(mangled));
} else if canonical_name != self.name() {
attrs.push(attributes::link_name(self.name()));
}
- let mut tokens = quote! {
- extern "C"
- };
- tokens.append("{\n");
- if !attrs.is_empty() {
- tokens.append_separated(attrs, "\n");
- tokens.append("\n");
- }
- tokens.append("pub static mut ");
- tokens.append(quote! { #canonical_ident });
- tokens.append(" : ");
- tokens.append(quote! { #ty });
- tokens.append(";\n}");
+ let mut tokens = quote!(
+ extern "C" {
+ #(#attrs)*
+ pub static mut #canonical_ident: #ty;
+ }
+ );
result.push(tokens);
}
}
}
impl CodeGenerator for Type {
type Extra = Item;
@@ -687,40 +681,40 @@ impl CodeGenerator for Type {
let mut tokens = if let Some(comment) = item.comment(ctx) {
attributes::doc(comment)
} else {
quote! {}
};
// We prefer using `pub use` over `pub type` because of:
// https://github.com/rust-lang/rust/issues/26264
- if inner_rust_type.as_str()
+ if inner_rust_type.to_string()
.chars()
.all(|c| match c {
// These are the only characters allowed in simple
// paths, eg `good::dogs::Bront`.
'A'...'Z' | 'a'...'z' | '0'...'9' | ':' | '_' | ' ' => true,
_ => false,
}) &&
outer_params.is_none() &&
inner_item.expect_type().canonical_type(ctx).is_enum()
{
- tokens.append(quote! {
+ tokens.append_all(quote! {
pub use
});
let path = top_level_path(ctx, item);
- tokens.append_separated(path, "::");
- tokens.append(quote! {
+ tokens.append_separated(path, proc_macro2::Term::intern("::"));
+ tokens.append_all(quote! {
:: #inner_rust_type as #rust_name ;
});
result.push(tokens);
return;
}
- tokens.append(quote! {
+ tokens.append_all(quote! {
pub type #rust_name
});
if let Some(params) = outer_params {
let params: Vec<_> = params.into_iter()
.filter_map(|p| p.as_template_param(ctx, &()))
.collect();
if params.iter().any(|p| ctx.resolve_type(*p).is_invalid_type_param()) {
@@ -733,22 +727,22 @@ impl CodeGenerator for Type {
}
let params = params.iter()
.map(|p| {
p.try_to_rust_ty(ctx, &())
.expect("type parameters can always convert to rust ty OK")
});
- tokens.append(quote! {
+ tokens.append_all(quote! {
< #( #params ),* >
});
}
- tokens.append(quote! {
+ tokens.append_all(quote! {
= #inner_rust_type ;
});
result.push(tokens);
}
TypeKind::Enum(ref ei) => ei.codegen(ctx, result, item),
TypeKind::ObjCId | TypeKind::ObjCSel => {
result.saw_objc();
@@ -1055,21 +1049,21 @@ impl<'a> FieldCodegen<'a> for FieldData
let is_private = self.annotations().private_fields().unwrap_or(
fields_should_be_private,
);
let accessor_kind =
self.annotations().accessor_kind().unwrap_or(accessor_kind);
if is_private {
- field.append(quote! {
+ field.append_all(quote! {
#field_ident : #ty ,
});
} else {
- field.append(quote! {
+ field.append_all(quote! {
pub #field_ident : #ty ,
});
}
fields.extend(Some(field));
// TODO: Factor the following code out, please!
if accessor_kind == FieldAccessorKind::None {
@@ -1119,17 +1113,17 @@ impl<'a> FieldCodegen<'a> for FieldData
}
}));
}
}
impl BitfieldUnit {
/// Get the constructor name for this bitfield unit.
fn ctor_name(&self) -> quote::Tokens {
- let ctor_name = quote::Ident::new(format!("new_bitfield_{}", self.nth()));
+ let ctor_name = proc_macro2::Term::intern(&format!("new_bitfield_{}", self.nth()));
quote! {
#ctor_name
}
}
}
impl Bitfield {
/// Extend an under construction bitfield unit constructor with this
@@ -1150,17 +1144,17 @@ impl Bitfield {
"Bitfield without layout? Gah!",
);
let bitfield_int_ty = helpers::blob(bitfield_ty_layout);
let offset = self.offset_into_unit();
let width = self.width() as u8;
let prefix = ctx.trait_prefix();
- ctor_impl.append(quote! {
+ ctor_impl.append_all(quote! {
__bindgen_bitfield_unit.set(
#offset,
#width,
{
let #param_name: #bitfield_int_ty = unsafe {
::#prefix::mem::transmute(#param_name)
};
#param_name as u64
@@ -1318,17 +1312,17 @@ impl<'a> FieldCodegen<'a> for Bitfield {
(unit_field_name, bitfield_representable_as_int): (&'a str, &mut bool),
) where
F: Extend<quote::Tokens>,
M: Extend<quote::Tokens>,
{
let prefix = ctx.trait_prefix();
let getter_name = bitfield_getter_name(ctx, self);
let setter_name = bitfield_setter_name(ctx, self);
- let unit_field_ident = quote::Ident::new(unit_field_name);
+ let unit_field_ident = proc_macro2::Term::intern(unit_field_name);
let bitfield_ty_item = ctx.resolve_item(self.ty());
let bitfield_ty = bitfield_ty_item.expect_type();
let bitfield_ty_layout = bitfield_ty.layout(ctx).expect(
"Bitfield without layout? Gah!",
);
let bitfield_int_ty = match helpers::integer_type(bitfield_ty_layout) {
@@ -1723,17 +1717,17 @@ impl CodeGenerator for CompInfo {
}
} else {
quote! {
#( #attributes )*
pub struct #canonical_ident
}
};
- tokens.append(quote! {
+ tokens.append_all(quote! {
#generics {
#( #fields )*
}
});
result.push(tokens);
// Generate the inner types and all that stuff.
//
@@ -1746,31 +1740,31 @@ impl CodeGenerator for CompInfo {
}
// NOTE: Some unexposed attributes (like alignment attributes) may
// affect layout, so we're bad and pray to the gods for avoid sending
// all the tests to shit when parsing things like max_align_t.
if self.found_unknown_attr() {
warn!(
"Type {} has an unkown attribute that may affect layout",
- canonical_ident
+ canonical_ident.as_str()
);
}
if used_template_params.is_none() {
if !is_opaque {
for var in self.inner_vars() {
ctx.resolve_item(*var).codegen(ctx, result, &());
}
}
if ctx.options().layout_tests {
if let Some(layout) = layout {
let fn_name =
- format!("bindgen_test_layout_{}", canonical_ident);
+ format!("bindgen_test_layout_{}", canonical_ident.as_str());
let fn_name = ctx.rust_ident_raw(fn_name);
let prefix = ctx.trait_prefix();
let size_of_expr = quote! {
::#prefix::mem::size_of::<#canonical_ident>()
};
let align_of_expr = quote! {
::#prefix::mem::align_of::<#canonical_ident>()
};
@@ -2139,16 +2133,18 @@ impl EnumVariation {
_ => false
}
}
}
/// A helper type to construct different enum variations.
enum EnumBuilder<'a> {
Rust {
+ attrs: Vec<quote::Tokens>,
+ ident: proc_macro2::Term,
tokens: quote::Tokens,
emitted_any_variants: bool,
},
Bitfield {
canonical_name: &'a str,
tokens: quote::Tokens,
},
Consts(Vec<quote::Tokens>),
@@ -2162,51 +2158,49 @@ impl<'a> EnumBuilder<'a> {
/// Create a new enum given an item builder, a canonical name, a name for
/// the representation, and which variation it should be generated as.
fn new(
name: &'a str,
attrs: Vec<quote::Tokens>,
repr: quote::Tokens,
enum_variation: EnumVariation
) -> Self {
- let ident = quote::Ident::new(name);
+ let ident = proc_macro2::Term::intern(name);
match enum_variation {
EnumVariation::Bitfield => {
EnumBuilder::Bitfield {
canonical_name: name,
tokens: quote! {
#( #attrs )*
pub struct #ident (pub #repr);
},
}
}
EnumVariation::Rust => {
- let mut tokens = quote! {
- #( #attrs )*
- pub enum #ident
- };
- tokens.append("{");
+ let tokens = quote!();
EnumBuilder::Rust {
+ attrs,
+ ident,
tokens,
emitted_any_variants: false,
}
}
EnumVariation::Consts => {
EnumBuilder::Consts(vec![
quote! {
pub type #ident = #repr;
}
])
}
EnumVariation::ModuleConsts => {
- let ident = quote::Ident::new(CONSTIFIED_ENUM_MODULE_REPR_NAME);
+ let ident = proc_macro2::Term::intern(CONSTIFIED_ENUM_MODULE_REPR_NAME);
let type_definition = quote! {
pub type #ident = #repr;
};
EnumBuilder::ModuleConsts {
module_name: name,
module_items: vec![type_definition],
}
@@ -2225,19 +2219,21 @@ impl<'a> EnumBuilder<'a> {
) -> Self {
let variant_name = ctx.rust_mangle(variant.name());
let expr = match variant.val() {
EnumVariantValue::Signed(v) => helpers::ast_ty::int_expr(v),
EnumVariantValue::Unsigned(v) => helpers::ast_ty::uint_expr(v),
};
match self {
- EnumBuilder::Rust { tokens, emitted_any_variants: _ } => {
+ EnumBuilder::Rust { attrs, ident, tokens, emitted_any_variants: _ } => {
let name = ctx.rust_ident(variant_name);
EnumBuilder::Rust {
+ attrs,
+ ident,
tokens: quote! {
#tokens
#name = #expr,
},
emitted_any_variants: true,
}
}
@@ -2294,22 +2290,29 @@ impl<'a> EnumBuilder<'a> {
fn build<'b>(
self,
ctx: &BindgenContext,
rust_ty: quote::Tokens,
result: &mut CodegenResult<'b>,
) -> quote::Tokens {
match self {
- EnumBuilder::Rust { mut tokens, emitted_any_variants } => {
- if !emitted_any_variants {
- tokens.append(quote! { __bindgen_cannot_repr_c_on_empty_enum = 0 });
- }
- tokens.append("}");
- tokens
+ EnumBuilder::Rust { attrs, ident, tokens, emitted_any_variants } => {
+ let variants = if !emitted_any_variants {
+ quote!(__bindgen_cannot_repr_c_on_empty_enum = 0)
+ } else {
+ tokens
+ };
+
+ quote! (
+ #( #attrs )*
+ pub enum #ident {
+ #variants
+ }
+ )
}
EnumBuilder::Bitfield {
canonical_name,
tokens,
} => {
let rust_ty_name = ctx.rust_ident_raw(canonical_name);
let prefix = ctx.trait_prefix();
@@ -2455,28 +2458,28 @@ impl CodeGenerator for Enum {
&["Debug", "Copy", "Clone", "PartialEq", "Eq", "Hash"],
));
}
fn add_constant<'a>(
ctx: &BindgenContext,
enum_: &Type,
// Only to avoid recomputing every time.
- enum_canonical_name: "e::Ident,
+ enum_canonical_name: &proc_macro2::Term,
// May be the same as "variant" if it's because the
// enum is unnamed and we still haven't seen the
// value.
variant_name: &str,
- referenced_name: "e::Ident,
+ referenced_name: &proc_macro2::Term,
enum_rust_ty: quote::Tokens,
result: &mut CodegenResult<'a>,
) {
let constant_name = if enum_.name().is_some() {
if ctx.options().prepend_enum_name {
- format!("{}_{}", enum_canonical_name, variant_name)
+ format!("{}_{}", enum_canonical_name.as_str(), variant_name)
} else {
variant_name.into()
}
} else {
variant_name.into()
};
let constant_name = ctx.rust_ident(constant_name);
@@ -2494,17 +2497,17 @@ impl CodeGenerator for Enum {
let mut builder = EnumBuilder::new(
&name,
attrs,
repr,
variation
);
// A map where we keep a value -> variant relation.
- let mut seen_values = HashMap::<_, quote::Ident>::new();
+ let mut seen_values = HashMap::<_, proc_macro2::Term>::new();
let enum_rust_ty = item.to_rust_ty_or_opaque(ctx, &());
let is_toplevel = item.is_toplevel(ctx);
// Used to mangle the constants we generate in the unnamed-enum case.
let parent_canonical_name = if is_toplevel {
None
} else {
Some(item.parent_id().canonical_name(ctx))
@@ -2593,37 +2596,37 @@ impl CodeGenerator for Enum {
variant.force_constification()
{
let mangled_name = if is_toplevel {
variant_name.clone()
} else {
let parent_name =
parent_canonical_name.as_ref().unwrap();
- quote::Ident::new(
- format!(
+ proc_macro2::Term::intern(
+ &format!(
"{}_{}",
parent_name,
- variant_name
+ variant_name.as_str()
)
)
};
add_constant(
ctx,
enum_ty,
&ident,
- mangled_name.as_ref(),
+ mangled_name.as_str(),
&variant_name,
enum_rust_ty.clone(),
result,
);
}
- entry.insert(quote::Ident::new(variant_name));
+ entry.insert(variant_name);
}
}
}
let item = builder.build(ctx, enum_rust_ty, result);
result.push(item);
}
}
@@ -2941,20 +2944,19 @@ impl TryToRustTy for Type {
}
TypeKind::Array(item, len) => {
let ty = item.try_to_rust_ty(ctx, &())?;
Ok(quote! {
[ #ty ; #len ]
})
}
TypeKind::Enum(..) => {
- let mut tokens = quote! {};
let path = item.namespace_aware_canonical_path(ctx);
- tokens.append_separated(path.into_iter().map(quote::Ident::new), "::");
- Ok(tokens)
+ let path = proc_macro2::Term::intern(&path.join("::"));
+ Ok(quote!(#path))
}
TypeKind::TemplateInstantiation(ref inst) => {
inst.try_to_rust_ty(ctx, item)
}
TypeKind::ResolvedTypeRef(inner) => inner.try_to_rust_ty(ctx, &()),
TypeKind::TemplateAlias(..) |
TypeKind::Alias(..) => {
let template_params = item.used_template_params(ctx)
@@ -3066,17 +3068,17 @@ impl TryToRustTy for TemplateInstantiati
let def = self.template_definition()
.into_resolver()
.through_type_refs()
.resolve(ctx);
let mut ty = quote! {};
let def_path = def.namespace_aware_canonical_path(ctx);
- ty.append_separated(def_path.into_iter().map(|p| ctx.rust_ident(p)), "::");
+ ty.append_separated(def_path.into_iter().map(|p| ctx.rust_ident(p)), proc_macro2::Term::intern("::"));
let def_params = match def.self_template_params(ctx) {
Some(params) => params,
None => {
// This can happen if we generated an opaque type for a partial
// template specialization, and we've hit an instantiation of
// that partial specialization.
extra_assert!(
@@ -3240,26 +3242,20 @@ impl CodeGenerator for Function {
canonical_name,
self
);
}
abi => abi,
};
let ident = ctx.rust_ident(canonical_name);
- let mut tokens = quote! { extern #abi };
- tokens.append("{\n");
- if !attributes.is_empty() {
- tokens.append_separated(attributes, "\n");
- tokens.append("\n");
- }
- tokens.append(quote! {
+ let tokens = quote!( extern #abi {
+ #(#attributes)*
pub fn #ident ( #( #args ),* ) #ret;
});
- tokens.append("\n}");
result.push(tokens);
}
}
fn objc_method_codegen(
ctx: &BindgenContext,
method: &ObjCMethod,
@@ -3285,17 +3281,17 @@ fn objc_method_codegen(
};
let methods_and_args = method.format_method_call(&fn_args);
let body = if method.is_class_method() {
let class_name = class_name
.expect("Generating a class method without class name?")
.to_owned();
- let expect_msg = format!("Couldn't find {}", class_name);
+ let expect_msg = proc_macro2::Literal::string(&format!("Couldn't find {}", class_name));
quote! {
msg_send!(objc::runtime::Class::get(#class_name).expect(#expect_msg), #methods_and_args)
}
} else {
quote! {
msg_send!(self, #methods_and_args)
}
};
@@ -3411,21 +3407,22 @@ pub(crate) fn codegen(context: BindgenCo
mod utils {
use super::{ToRustTyOrOpaque, error};
use ir::context::BindgenContext;
use ir::function::FunctionSig;
use ir::item::{Item, ItemCanonicalPath};
use ir::ty::TypeKind;
use quote;
+ use proc_macro2;
use std::mem;
pub fn prepend_bitfield_unit_type(result: &mut Vec<quote::Tokens>) {
- let mut bitfield_unit_type = quote! {};
- bitfield_unit_type.append(include_str!("./bitfield_unit.rs"));
+ let bitfield_unit_type = proc_macro2::Term::intern(include_str!("./bitfield_unit.rs"));
+ let bitfield_unit_type = quote!(#bitfield_unit_type);
let items = vec![bitfield_unit_type];
let old_items = mem::replace(result, items);
result.extend(old_items);
}
pub fn prepend_objc_header(
ctx: &BindgenContext,
@@ -3641,20 +3638,21 @@ mod utils {
let old_items = mem::replace(result, items);
result.extend(old_items.into_iter());
}
pub fn build_path(
item: &Item,
ctx: &BindgenContext,
) -> error::Result<quote::Tokens> {
+ use proc_macro2;
let path = item.namespace_aware_canonical_path(ctx);
-
- let mut tokens = quote! {};
- tokens.append_separated(path.into_iter().map(quote::Ident::new), "::");
+ let path = proc_macro2::Term::intern(&path.join("::"));
+ let tokens = quote! {#path};
+ //tokens.append_separated(path, "::");
Ok(tokens)
}
fn primitive_ty(ctx: &BindgenContext, name: &str) -> quote::Tokens {
let ident = ctx.rust_ident_raw(name);
quote! {
#ident
--- a/third_party/rust/bindgen/src/codegen/struct_layout.rs
+++ b/third_party/rust/bindgen/src/codegen/struct_layout.rs
@@ -2,16 +2,17 @@
use super::helpers;
use ir::comp::CompInfo;
use ir::context::BindgenContext;
use ir::layout::Layout;
use ir::ty::{Type, TypeKind};
use quote;
+use proc_macro2;
use std::cmp;
use std::mem;
/// Trace the layout of struct.
#[derive(Debug)]
pub struct StructLayoutTracker<'a> {
name: &'a str,
ctx: &'a BindgenContext,
@@ -301,17 +302,17 @@ impl<'a> StructLayoutTracker<'a> {
}
fn padding_field(&mut self, layout: Layout) -> quote::Tokens {
let ty = helpers::blob(layout);
let padding_count = self.padding_count;
self.padding_count += 1;
- let padding_field_name = quote::Ident::new(format!("__bindgen_padding_{}", padding_count));
+ let padding_field_name = proc_macro2::Term::intern(&format!("__bindgen_padding_{}", padding_count));
self.max_field_align = cmp::max(self.max_field_align, layout.align);
quote! {
pub #padding_field_name : #ty ,
}
}
--- a/third_party/rust/bindgen/src/ir/context.rs
+++ b/third_party/rust/bindgen/src/ir/context.rs
@@ -19,17 +19,17 @@ use super::ty::{FloatKind, Type, TypeKin
use super::function::Function;
use super::super::time::Timer;
use BindgenOptions;
use callbacks::ParseCallbacks;
use cexpr;
use clang::{self, Cursor};
use clang_sys;
use parse::ClangItemParser;
-use quote;
+use proc_macro2;
use std::borrow::Cow;
use std::cell::Cell;
use std::collections::{HashMap, HashSet, hash_map};
use std::collections::btree_map::{self, BTreeMap};
use std::iter::IntoIterator;
use std::mem;
/// An identifier for some kind of IR item.
@@ -876,29 +876,29 @@ impl BindgenContext {
s = s.replace("$", "_");
s.push_str("_");
return Cow::Owned(s);
}
Cow::Borrowed(name)
}
/// Returns a mangled name as a rust identifier.
- pub fn rust_ident<S>(&self, name: S) -> quote::Ident
+ pub fn rust_ident<S>(&self, name: S) -> proc_macro2::Term
where
S: AsRef<str>
{
self.rust_ident_raw(self.rust_mangle(name.as_ref()))
}
/// Returns a mangled name as a rust identifier.
- pub fn rust_ident_raw<T>(&self, name: T) -> quote::Ident
+ pub fn rust_ident_raw<T>(&self, name: T) -> proc_macro2::Term
where
- T: Into<quote::Ident>
+ T: AsRef<str>
{
- name.into()
+ proc_macro2::Term::intern(name.as_ref())
}
/// Iterate over all items that have been defined.
pub fn items<'a>(&'a self) -> btree_map::Iter<'a, ItemId, Item> {
self.items.iter()
}
/// Have we collected all unresolved type references yet?
@@ -2316,17 +2316,17 @@ impl BindgenContext {
};
self.whitelisted = Some(whitelisted);
self.codegen_items = Some(codegen_items);
}
/// Convenient method for getting the prefix to use for most traits in
/// codegen depending on the `use_core` option.
- pub fn trait_prefix(&self) -> quote::Ident {
+ pub fn trait_prefix(&self) -> proc_macro2::Term {
if self.options().use_core {
self.rust_ident_raw("core")
} else {
self.rust_ident_raw("std")
}
}
/// Call if a binden complex is generated
--- a/third_party/rust/bindgen/src/ir/function.rs
+++ b/third_party/rust/bindgen/src/ir/function.rs
@@ -188,17 +188,17 @@ impl Abi {
Abi::Unknown(..) => true,
_ => false,
}
}
}
impl quote::ToTokens for Abi {
fn to_tokens(&self, tokens: &mut quote::Tokens) {
- tokens.append(match *self {
+ tokens.append_all(match *self {
Abi::C => quote! { "C" },
Abi::Stdcall => quote! { "stdcall" },
Abi::Fastcall => quote! { "fastcall" },
Abi::ThisCall => quote! { "thiscall" },
Abi::Aapcs => quote! { "aapcs" },
Abi::Win64 => quote! { "win64" },
Abi::Unknown(cc) => panic!(
"Cannot turn unknown calling convention to tokens: {:?}",
--- a/third_party/rust/bindgen/src/ir/objc.rs
+++ b/third_party/rust/bindgen/src/ir/objc.rs
@@ -8,16 +8,17 @@ use clang;
use clang_sys::CXChildVisit_Continue;
use clang_sys::CXCursor_ObjCCategoryDecl;
use clang_sys::CXCursor_ObjCClassMethodDecl;
use clang_sys::CXCursor_ObjCClassRef;
use clang_sys::CXCursor_ObjCInstanceMethodDecl;
use clang_sys::CXCursor_ObjCProtocolDecl;
use clang_sys::CXCursor_ObjCProtocolRef;
use quote;
+use proc_macro2;
/// Objective C interface as used in TypeKind
///
/// Also protocols and categories are parsed as this type
#[derive(Debug)]
pub struct ObjCInterface {
/// The name
/// like, NSObject
@@ -211,17 +212,17 @@ impl ObjCMethod {
self.is_class_method
}
/// Formats the method call
pub fn format_method_call(&self, args: &[quote::Tokens]) -> quote::Tokens {
let split_name: Vec<_> = self.name
.split(':')
.filter(|p| !p.is_empty())
- .map(quote::Ident::new)
+ .map(proc_macro2::Term::intern)
.collect();
// No arguments
if args.len() == 0 && split_name.len() == 1 {
let name = &split_name[0];
return quote! {
#name
};
@@ -234,19 +235,20 @@ impl ObjCMethod {
args,
split_name
);
}
// Get arguments without type signatures to pass to `msg_send!`
let mut args_without_types = vec![];
for arg in args.iter() {
- let name_and_sig: Vec<&str> = arg.as_str().split(' ').collect();
+ let arg = arg.to_string();
+ let name_and_sig: Vec<&str> = arg.split(' ').collect();
let name = name_and_sig[0];
- args_without_types.push(quote::Ident::new(name))
+ args_without_types.push(proc_macro2::Term::intern(name))
};
let args = split_name
.into_iter()
.zip(args_without_types)
.map(|(arg, arg_val)| quote! { #arg : #arg_val });
quote! {
--- a/third_party/rust/bindgen/src/lib.rs
+++ b/third_party/rust/bindgen/src/lib.rs
@@ -18,16 +18,17 @@ extern crate cexpr;
#[allow(unused_extern_crates)]
extern crate cfg_if;
extern crate clang_sys;
#[macro_use]
extern crate lazy_static;
extern crate peeking_take_while;
#[macro_use]
extern crate quote;
+extern crate proc_macro2;
extern crate regex;
extern crate which;
#[cfg(feature = "logging")]
#[macro_use]
extern crate log;
#[cfg(not(feature = "logging"))]
@@ -1073,16 +1074,22 @@ impl Builder {
/// Set the absolute path to the rustfmt configuration file, if None, the standard rustfmt
/// options are used.
pub fn rustfmt_configuration_file(mut self, path: Option<PathBuf>) -> Self {
self = self.rustfmt_bindings(true);
self.options.rustfmt_configuration_file = path;
self
}
+ /// Sets an explicit path to rustfmt, to be used when rustfmt is enabled.
+ pub fn with_rustfmt<P: Into<PathBuf>>(mut self, path: P) -> Self {
+ self.options.rustfmt_path = Some(path.into());
+ self
+ }
+
/// Generate the Rust bindings using the options built up thus far.
pub fn generate(mut self) -> Result<Bindings, ()> {
self.options.input_header = self.input_headers.pop();
self.options.clang_args.extend(
self.input_headers
.drain(..)
.flat_map(|header| {
iter::once("-include".into()).chain(iter::once(header))
@@ -1210,16 +1217,19 @@ struct BindgenOptions {
/// The set of types that have been blacklisted and should not appear
/// anywhere in the generated code.
blacklisted_types: RegexSet,
/// The set of types that should be treated as opaque structures in the
/// generated code.
opaque_types: RegexSet,
+ /// The explicit rustfmt path.
+ rustfmt_path: Option<PathBuf>,
+
/// The set of types that we should have bindings for in the generated
/// code.
///
/// This includes all types transitively reachable from any type in this
/// set. One might think of whitelisted types/vars/functions as GC roots,
/// and the generated Rust code as including everything that gets marked.
whitelisted_types: RegexSet,
@@ -1435,16 +1445,17 @@ impl Default for BindgenOptions {
fn default() -> BindgenOptions {
let rust_target = RustTarget::default();
BindgenOptions {
rust_target: rust_target,
rust_features: rust_target.into(),
blacklisted_types: Default::default(),
opaque_types: Default::default(),
+ rustfmt_path: Default::default(),
whitelisted_types: Default::default(),
whitelisted_functions: Default::default(),
whitelisted_vars: Default::default(),
bitfield_enums: Default::default(),
rustified_enums: Default::default(),
constified_enum_modules: Default::default(),
builtins: false,
links: vec![],
@@ -1677,25 +1688,25 @@ impl Bindings {
writer.write(line.as_bytes())?;
writer.write("\n".as_bytes())?;
}
if !self.options.raw_lines.is_empty() {
writer.write("\n".as_bytes())?;
}
- let bindings = self.module.as_str().to_string();
+ let bindings = self.module.to_string();
match self.rustfmt_generated_string(&bindings) {
Ok(rustfmt_bindings) => {
writer.write(rustfmt_bindings.as_bytes())?;
},
Err(err) => {
eprintln!("{:?}", err);
- writer.write(bindings.as_str().as_bytes())?;
+ writer.write(bindings.as_bytes())?;
},
}
Ok(())
}
/// Checks if rustfmt_bindings is set and runs rustfmt on the string
fn rustfmt_generated_string<'a>(
&self,
@@ -1703,20 +1714,29 @@ impl Bindings {
) -> io::Result<Cow<'a, str>> {
let _t = time::Timer::new("rustfmt_generated_string")
.with_output(self.options.time_phases);
if !self.options.rustfmt_bindings {
return Ok(Cow::Borrowed(source));
}
- let rustfmt = which::which("rustfmt")
- .map_err(|e| io::Error::new(io::ErrorKind::Other, e.to_owned()))?;
+ let rustfmt = match self.options.rustfmt_path {
+ Some(ref p) => Cow::Borrowed(p),
+ None => {
+ let path = which::which("rustfmt")
+ .map_err(|e| {
+ io::Error::new(io::ErrorKind::Other, e.to_owned())
+ })?;
- let mut cmd = Command::new(rustfmt);
+ Cow::Owned(path)
+ }
+ };
+
+ let mut cmd = Command::new(&*rustfmt);
cmd
.stdin(Stdio::piped())
.stdout(Stdio::piped());
if let Some(path) = self.options
.rustfmt_configuration_file
.as_ref()
new file mode 100644
--- /dev/null
+++ b/third_party/rust/proc-macro2/.cargo-checksum.json
@@ -0,0 +1,1 @@
+{"files":{".travis.yml":"e455a0ed5c3dd056d31f4c7be088bc94f21cab6595a23f2f015b1efc0ac2b55c","Cargo.toml":"0b700f1e7b8ba76ce4678d36b6906d38455e88f51085ea9f120d6ca63f13d5d7","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"adf2e822923878c2ebf4a0a782898c598fc6f57a3af905b85d57fc716c836687","src/lib.rs":"fbae25504264b185d877fb8784d4d88333ea34a7cbeddca3277dc8421f179933","src/macros.rs":"414505e520b8d705b4ce5a64ec2e82d6d1af0b88567454169486a668fbc1e9c8","src/stable.rs":"6363c4c0ef989c2ec81aa75be71c69a103d45a1de439f3f3bcb6806d8a78a172","src/strnom.rs":"1baded8543a9930798fb16092fe51e9074591902e327e0f94eb1c908a6370de9","src/unstable.rs":"110d27103e37427b3d1dcb45b6ba9dc9f5641a255766a43d5db0f4fd10a341ed","tests/test.rs":"9e75d5289abc1dc58c1df00ae051d8c3cd2c0d7830cca5ad689007c05acffe26"},"package":"d1cb7aaaa4bf022ec2b14ff2f2ba1643a22f3cee88df014a85e14b392282c61d"}
\ No newline at end of file
new file mode 100644
--- /dev/null
+++ b/third_party/rust/proc-macro2/.travis.yml
@@ -0,0 +1,31 @@
+language: rust
+sudo: false
+
+matrix:
+ include:
+ - rust: 1.15.0
+ - rust: stable
+ - rust: beta
+ - rust: nightly
+ before_script:
+ - pip install 'travis-cargo<0.2' --user && export PATH=$HOME/.local/bin:$PATH
+ script:
+ - cargo test
+ - cargo build --features nightly
+ - RUSTFLAGS='--cfg procmacro2_semver_exempt' cargo test
+ - RUSTFLAGS='--cfg procmacro2_semver_exempt' cargo build --features nightly
+ - RUSTFLAGS='--cfg procmacro2_semver_exempt' cargo doc --no-deps
+ after_success:
+ - travis-cargo --only nightly doc-upload
+
+script:
+ - cargo test
+ - RUSTFLAGS='--cfg procmacro2_semver_exempt' cargo test
+env:
+ global:
+ - TRAVIS_CARGO_NIGHTLY_FEATURE=""
+ - secure: "NAsZghAVTAksrm4WP4I66VmD2wW0eRbwB+ZKHUQfvbgUaCRvVdp4WBbWXGU/f/yHgDFWZwljWR4iPMiBwAK8nZsQFRuLFdHrOOHqbkj639LLdT9A07s1zLMB1GfR1fDttzrGhm903pbT2yxSyqqpahGYM7TaGDYYmKYIk4XyVNA5F5Sk7RI+rCecKraoYDeUEFbjWWYtU2FkEXsELEKj0emX5reWkR+wja3QokFcRZ25+Zd2dRC0K8W5QcY2UokLzKncBMCTC5q70H616S3r/9qW67Si1njsJ7RzP0NlZQUNQ/VCvwr4LCr9w+AD9i1SZtXxuux77tWEWSJvBzUc82dDMUv/floJuF7HTulSxxQoRm+fbzpXj9mgaJNiUHXru6ZRTCRVRUSXpcAco94bVoy/jnjrTe3jgAIZK5w14zA8yLw1Jxof31DlbcWORxgF+6fnY2nKPRN2oiQ50+jm1AuGDZX59/wMiu1QlkjOBHtikHp+u+7mp3SkkM04DvuQ/tWODQQnOOtrA0EB3i5H1zeTSnUcmbJufUljWWOvF1QYII08MccqwfG1KWbpobvdu+cV2iVhkq/lNCEL3Ai101CnmSCnMz+9oK/XxYOrx2TnaD9ootOKgnk7XWxF19GZecQx6O2hHTouxvB/0KcRPGWmMWl0H88f3T/Obql8bG8="
+
+notifications:
+ email:
+ on_success: never
new file mode 100644
--- /dev/null
+++ b/third_party/rust/proc-macro2/Cargo.toml
@@ -0,0 +1,31 @@
+# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
+#
+# When uploading crates to the registry Cargo will automatically
+# "normalize" Cargo.toml files for maximal compatibility
+# with all versions of Cargo and also rewrite `path` dependencies
+# to registry (e.g. crates.io) dependencies
+#
+# If you believe there's an error in this file please file an
+# issue against the rust-lang/cargo repository. If you're
+# editing this file be aware that the upstream Cargo.toml
+# will likely look very different (and much more reasonable)
+
+[package]
+name = "proc-macro2"
+version = "0.2.2"
+authors = ["Alex Crichton <alex@alexcrichton.com>"]
+description = "A stable implementation of the upcoming new `proc_macro` API. Comes with an\noption, off by default, to also reimplement itself in terms of the upstream\nunstable API.\n"
+homepage = "https://github.com/alexcrichton/proc-macro2"
+documentation = "https://docs.rs/proc-macro2"
+readme = "README.md"
+keywords = ["macros"]
+license = "MIT/Apache-2.0"
+repository = "https://github.com/alexcrichton/proc-macro2"
+
+[lib]
+doctest = false
+[dependencies.unicode-xid]
+version = "0.1"
+
+[features]
+nightly = []
new file mode 100644
--- /dev/null
+++ b/third_party/rust/proc-macro2/LICENSE-APACHE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+Copyright [yyyy] [name of copyright owner]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
new file mode 100644
--- /dev/null
+++ b/third_party/rust/proc-macro2/LICENSE-MIT
@@ -0,0 +1,25 @@
+Copyright (c) 2014 Alex Crichton
+
+Permission is hereby granted, free of charge, to any
+person obtaining a copy of this software and associated
+documentation files (the "Software"), to deal in the
+Software without restriction, including without
+limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software
+is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice
+shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
+ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
+TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
+SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
new file mode 100644
--- /dev/null
+++ b/third_party/rust/proc-macro2/README.md
@@ -0,0 +1,98 @@
+# proc-macro2
+
+[](https://travis-ci.org/alexcrichton/proc-macro2)
+[](https://crates.io/crates/proc-macro2)
+[](https://docs.rs/proc-macro2)
+
+A small shim over the `proc_macro` crate in the compiler intended to multiplex
+the current stable interface (as of 2017-07-05) and the [upcoming richer
+interface][upcoming].
+
+[upcoming]: https://github.com/rust-lang/rust/pull/40939
+
+The upcoming support has features like:
+
+* Span information on tokens
+* No need to go in/out through strings
+* Structured input/output
+
+The hope is that libraries ported to `proc_macro2` will be trivial to port to
+the real `proc_macro` crate once the support on nightly is stabilize.
+
+## Usage
+
+This crate by default compiles on the stable version of the compiler. It only
+uses the stable surface area of the `proc_macro` crate upstream in the compiler
+itself. Usage is done via:
+
+```toml
+[dependencies]
+proc-macro2 = "0.2"
+```
+
+followed by
+
+```rust
+extern crate proc_macro;
+extern crate proc_macro2;
+
+#[proc_macro_derive(MyDerive)]
+pub fn my_derive(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
+ let input: proc_macro2::TokenStream = input.into();
+
+ let output: proc_macro2::TokenStream = {
+ /* transform input */
+ };
+
+ output.into()
+}
+```
+
+If you'd like you can enable the `nightly` feature in this crate. This will
+cause it to compile against the **unstable and nightly-only** features of the
+`proc_macro` crate. This in turn requires a nightly compiler. This should help
+preserve span information, however, coming in from the compiler itself.
+
+You can enable this feature via:
+
+```toml
+[dependencies]
+proc-macro2 = { version = "0.2", features = ["nightly"] }
+```
+
+
+## Unstable Features
+
+`proc-macro2` supports exporting some methods from `proc_macro` which are
+currently highly unstable, and may not be stabilized in the first pass of
+`proc_macro` stabilizations. These features are not exported by default. Minor
+versions of `proc-macro2` may make breaking changes to them at any time.
+
+To enable these features, the `procmacro2_semver_exempt` config flag must be
+passed to rustc.
+
+```
+RUSTFLAGS='--cfg procmacro2_semver_exempt' cargo build
+```
+
+Note that this must not only be done for your crate, but for any crate that
+depends on your crate. This infectious nature is intentional, as it serves as a
+reminder that you are outside of the normal semver guarantees.
+
+
+# License
+
+This project is licensed under either of
+
+ * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
+ http://www.apache.org/licenses/LICENSE-2.0)
+ * MIT license ([LICENSE-MIT](LICENSE-MIT) or
+ http://opensource.org/licenses/MIT)
+
+at your option.
+
+### Contribution
+
+Unless you explicitly state otherwise, any contribution intentionally submitted
+for inclusion in Serde by you, as defined in the Apache-2.0 license, shall be
+dual licensed as above, without any additional terms or conditions.
new file mode 100644
--- /dev/null
+++ b/third_party/rust/proc-macro2/src/lib.rs
@@ -0,0 +1,337 @@
+//! A "shim crate" intended to multiplex the `proc_macro` API on to stable Rust.
+//!
+//! Procedural macros in Rust operate over the upstream
+//! `proc_macro::TokenStream` type. This type currently is quite conservative
+//! and exposed no internal implementation details. Nightly compilers, however,
+//! contain a much richer interface. This richer interface allows fine-grained
+//! inspection of the token stream which avoids stringification/re-lexing and
+//! also preserves span information.
+//!
+//! The upcoming APIs added to `proc_macro` upstream are the foundation for
+//! productive procedural macros in the ecosystem. To help prepare the ecosystem
+//! for using them this crate serves to both compile on stable and nightly and
+//! mirrors the API-to-be. The intention is that procedural macros which switch
+//! to use this crate will be trivially able to switch to the upstream
+//! `proc_macro` crate once its API stabilizes.
+//!
+//! In the meantime this crate also has a `nightly` Cargo feature which
+//! enables it to reimplement itself with the unstable API of `proc_macro`.
+//! This'll allow immediate usage of the beneficial upstream API, particularly
+//! around preserving span information.
+
+// Proc-macro2 types in rustdoc of other crates get linked to here.
+#![doc(html_root_url = "https://docs.rs/proc-macro2/0.2.2")]
+
+#![cfg_attr(feature = "nightly", feature(proc_macro))]
+
+extern crate proc_macro;
+
+#[cfg(not(feature = "nightly"))]
+extern crate unicode_xid;
+
+use std::fmt;
+use std::str::FromStr;
+use std::iter::FromIterator;
+
+#[macro_use]
+#[cfg(not(feature = "nightly"))]
+mod strnom;
+
+#[path = "stable.rs"]
+#[cfg(not(feature = "nightly"))]
+mod imp;
+#[path = "unstable.rs"]
+#[cfg(feature = "nightly")]
+mod imp;
+
+#[macro_use]
+mod macros;
+
+#[derive(Clone)]
+pub struct TokenStream(imp::TokenStream);
+
+pub struct LexError(imp::LexError);
+
+impl FromStr for TokenStream {
+ type Err = LexError;
+
+ fn from_str(src: &str) -> Result<TokenStream, LexError> {
+ match src.parse() {
+ Ok(e) => Ok(TokenStream(e)),
+ Err(e) => Err(LexError(e)),
+ }
+ }
+}
+
+impl From<proc_macro::TokenStream> for TokenStream {
+ fn from(inner: proc_macro::TokenStream) -> TokenStream {
+ TokenStream(inner.into())
+ }
+}
+
+impl From<TokenStream> for proc_macro::TokenStream {
+ fn from(inner: TokenStream) -> proc_macro::TokenStream {
+ inner.0.into()
+ }
+}
+
+impl From<TokenTree> for TokenStream {
+ fn from(tree: TokenTree) -> TokenStream {
+ TokenStream(tree.into())
+ }
+}
+
+impl<T: Into<TokenStream>> FromIterator<T> for TokenStream {
+ fn from_iter<I: IntoIterator<Item = T>>(streams: I) -> Self {
+ TokenStream(streams.into_iter().map(|t| t.into().0).collect())
+ }
+}
+
+impl IntoIterator for TokenStream {
+ type Item = TokenTree;
+ type IntoIter = TokenTreeIter;
+
+ fn into_iter(self) -> TokenTreeIter {
+ TokenTreeIter(self.0.into_iter())
+ }
+}
+
+impl TokenStream {
+ pub fn empty() -> TokenStream {
+ TokenStream(imp::TokenStream::empty())
+ }
+
+ pub fn is_empty(&self) -> bool {
+ self.0.is_empty()
+ }
+}
+
+// Returned by reference, so we can't easily wrap it.
+#[cfg(procmacro2_semver_exempt)]
+pub use imp::FileName;
+
+#[cfg(procmacro2_semver_exempt)]
+#[derive(Clone, PartialEq, Eq)]
+pub struct SourceFile(imp::SourceFile);
+
+#[cfg(procmacro2_semver_exempt)]
+impl SourceFile {
+ /// Get the path to this source file as a string.
+ pub fn path(&self) -> &FileName {
+ self.0.path()
+ }
+
+ pub fn is_real(&self) -> bool {
+ self.0.is_real()
+ }
+}
+
+#[cfg(procmacro2_semver_exempt)]
+impl AsRef<FileName> for SourceFile {
+ fn as_ref(&self) -> &FileName {
+ self.0.path()
+ }
+}
+
+#[cfg(procmacro2_semver_exempt)]
+impl fmt::Debug for SourceFile {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ self.0.fmt(f)
+ }
+}
+
+#[cfg(procmacro2_semver_exempt)]
+pub struct LineColumn {
+ pub line: usize,
+ pub column: usize,
+}
+
+#[derive(Copy, Clone)]
+pub struct Span(imp::Span);
+
+impl Span {
+ pub fn call_site() -> Span {
+ Span(imp::Span::call_site())
+ }
+
+ pub fn def_site() -> Span {
+ Span(imp::Span::def_site())
+ }
+
+ /// Creates a new span with the same line/column information as `self` but
+ /// that resolves symbols as though it were at `other`.
+ pub fn resolved_at(&self, other: Span) -> Span {
+ Span(self.0.resolved_at(other.0))
+ }
+
+ /// Creates a new span with the same name resolution behavior as `self` but
+ /// with the line/column information of `other`.
+ pub fn located_at(&self, other: Span) -> Span {
+ Span(self.0.located_at(other.0))
+ }
+
+ /// This method is only available when the `"nightly"` feature is enabled.
+ #[cfg(feature = "nightly")]
+ pub fn unstable(self) -> proc_macro::Span {
+ self.0.unstable()
+ }
+
+ #[cfg(procmacro2_semver_exempt)]
+ pub fn source_file(&self) -> SourceFile {
+ SourceFile(self.0.source_file())
+ }
+
+ #[cfg(procmacro2_semver_exempt)]
+ pub fn start(&self) -> LineColumn {
+ let imp::LineColumn{ line, column } = self.0.start();
+ LineColumn { line: line, column: column }
+ }
+
+ #[cfg(procmacro2_semver_exempt)]
+ pub fn end(&self) -> LineColumn {
+ let imp::LineColumn{ line, column } = self.0.end();
+ LineColumn { line: line, column: column }
+ }
+
+ #[cfg(procmacro2_semver_exempt)]
+ pub fn join(&self, other: Span) -> Option<Span> {
+ self.0.join(other.0).map(Span)
+ }
+}
+
+#[derive(Clone, Debug)]
+pub struct TokenTree {
+ pub span: Span,
+ pub kind: TokenNode,
+}
+
+impl From<TokenNode> for TokenTree {
+ fn from(kind: TokenNode) -> TokenTree {
+ TokenTree { span: Span::def_site(), kind: kind }
+ }
+}
+
+impl fmt::Display for TokenTree {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ TokenStream::from(self.clone()).fmt(f)
+ }
+}
+
+#[derive(Clone, Debug)]
+pub enum TokenNode {
+ Group(Delimiter, TokenStream),
+ Term(Term),
+ Op(char, Spacing),
+ Literal(Literal),
+}
+
+#[derive(Copy, Clone, Debug, Eq, PartialEq)]
+pub enum Delimiter {
+ Parenthesis,
+ Brace,
+ Bracket,
+ None,
+}
+
+#[derive(Copy, Clone)]
+pub struct Term(imp::Term);
+
+impl Term {
+ pub fn intern(string: &str) -> Term {
+ Term(imp::Term::intern(string))
+ }
+
+ pub fn as_str(&self) -> &str {
+ self.0.as_str()
+ }
+}
+
+#[derive(Copy, Clone, Debug, Eq, PartialEq)]
+pub enum Spacing {
+ Alone,
+ Joint,
+}
+
+#[derive(Clone)]
+pub struct Literal(imp::Literal);
+
+macro_rules! int_literals {
+ ($($kind:ident,)*) => ($(
+ pub fn $kind(n: $kind) -> Literal {
+ Literal(n.into())
+ }
+ )*)
+}
+
+impl Literal {
+ pub fn integer(s: i64) -> Literal {
+ Literal(imp::Literal::integer(s))
+ }
+
+ int_literals! {
+ u8, u16, u32, u64, usize,
+ i8, i16, i32, i64, isize,
+ }
+
+ pub fn float(f: f64) -> Literal {
+ Literal(imp::Literal::float(f))
+ }
+
+ pub fn f64(f: f64) -> Literal {
+ Literal(f.into())
+ }
+
+ pub fn f32(f: f32) -> Literal {
+ Literal(f.into())
+ }
+
+ pub fn string(string: &str) -> Literal {
+ Literal(string.into())
+ }
+
+ pub fn character(ch: char) -> Literal {
+ Literal(ch.into())
+ }
+
+ pub fn byte_string(s: &[u8]) -> Literal {
+ Literal(imp::Literal::byte_string(s))
+ }
+
+ // =======================================================================
+ // Not present upstream in proc_macro yet
+
+ pub fn byte_char(b: u8) -> Literal {
+ Literal(imp::Literal::byte_char(b))
+ }
+
+ pub fn doccomment(s: &str) -> Literal {
+ Literal(imp::Literal::doccomment(s))
+ }
+
+ pub fn raw_string(s: &str, pounds: usize) -> Literal {
+ Literal(imp::Literal::raw_string(s, pounds))
+ }
+
+ pub fn raw_byte_string(s: &str, pounds: usize) -> Literal {
+ Literal(imp::Literal::raw_byte_string(s, pounds))
+ }
+}
+
+pub struct TokenTreeIter(imp::TokenTreeIter);
+
+impl Iterator for TokenTreeIter {
+ type Item = TokenTree;
+
+ fn next(&mut self) -> Option<TokenTree> {
+ self.0.next()
+ }
+}
+
+forward_fmt!(Debug for LexError);
+forward_fmt!(Debug for Literal);
+forward_fmt!(Debug for Span);
+forward_fmt!(Debug for Term);
+forward_fmt!(Debug for TokenTreeIter);
+forward_fmt!(Debug for TokenStream);
+forward_fmt!(Display for Literal);
+forward_fmt!(Display for TokenStream);
new file mode 100644
--- /dev/null
+++ b/third_party/rust/proc-macro2/src/macros.rs
@@ -0,0 +1,9 @@
+macro_rules! forward_fmt {
+ ($tr:ident for $ty:ident) => {
+ impl ::std::fmt::$tr for $ty {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+ ::std::fmt::$tr::fmt(&self.0, f)
+ }
+ }
+ }
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/proc-macro2/src/stable.rs
@@ -0,0 +1,1206 @@
+use std::ascii;
+use std::borrow::Borrow;
+use std::cell::RefCell;
+#[cfg(procmacro2_semver_exempt)]
+use std::cmp;
+use std::collections::HashMap;
+use std::fmt;
+use std::iter;
+use std::marker::PhantomData;
+use std::rc::Rc;
+use std::str::FromStr;
+use std::vec;
+
+use proc_macro;
+use unicode_xid::UnicodeXID;
+use strnom::{Cursor, PResult, skip_whitespace, block_comment, whitespace, word_break};
+
+use {TokenTree, TokenNode, Delimiter, Spacing};
+
+#[derive(Clone, Debug)]
+pub struct TokenStream {
+ inner: Vec<TokenTree>,
+}
+
+#[derive(Debug)]
+pub struct LexError;
+
+impl TokenStream {
+ pub fn empty() -> TokenStream {
+ TokenStream { inner: Vec::new() }
+ }
+
+ pub fn is_empty(&self) -> bool {
+ self.inner.len() == 0
+ }
+}
+
+#[cfg(procmacro2_semver_exempt)]
+fn get_cursor(src: &str) -> Cursor {
+ // Create a dummy file & add it to the codemap
+ CODEMAP.with(|cm| {
+ let mut cm = cm.borrow_mut();
+ let name = format!("<parsed string {}>", cm.files.len());
+ let span = cm.add_file(&name, src);
+ Cursor {
+ rest: src,
+ off: span.lo,
+ }
+ })
+}
+
+#[cfg(not(procmacro2_semver_exempt))]
+fn get_cursor(src: &str) -> Cursor {
+ Cursor {
+ rest: src,
+ }
+}
+
+impl FromStr for TokenStream {
+ type Err = LexError;
+
+ fn from_str(src: &str) -> Result<TokenStream, LexError> {
+ // Create a dummy file & add it to the codemap
+ let cursor = get_cursor(src);
+
+ match token_stream(cursor) {
+ Ok((input, output)) => {
+ if skip_whitespace(input).len() != 0 {
+ Err(LexError)
+ } else {
+ Ok(output.0)
+ }
+ }
+ Err(LexError) => Err(LexError),
+ }
+ }
+}
+
+impl fmt::Display for TokenStream {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ let mut joint = false;
+ for (i, tt) in self.inner.iter().enumerate() {
+ if i != 0 && !joint {
+ write!(f, " ")?;
+ }
+ joint = false;
+ match tt.kind {
+ TokenNode::Group(delim, ref stream) => {
+ let (start, end) = match delim {
+ Delimiter::Parenthesis => ("(", ")"),
+ Delimiter::Brace => ("{", "}"),
+ Delimiter::Bracket => ("[", "]"),
+ Delimiter::None => ("", ""),
+ };
+ if stream.0.inner.len() == 0 {
+ write!(f, "{} {}", start, end)?
+ } else {
+ write!(f, "{} {} {}", start, stream, end)?
+ }
+ }
+ TokenNode::Term(ref sym) => write!(f, "{}", sym.as_str())?,
+ TokenNode::Op(ch, ref op) => {
+ write!(f, "{}", ch)?;
+ match *op {
+ Spacing::Alone => {}
+ Spacing::Joint => joint = true,
+ }
+ }
+ TokenNode::Literal(ref literal) => {
+ write!(f, "{}", literal)?;
+ // handle comments
+ if (literal.0).0.starts_with("/") {
+ write!(f, "\n")?;
+ }
+ }
+ }
+ }
+
+ Ok(())
+ }
+}
+
+impl From<proc_macro::TokenStream> for TokenStream {
+ fn from(inner: proc_macro::TokenStream) -> TokenStream {
+ inner.to_string().parse().expect("compiler token stream parse failed")
+ }
+}
+
+impl From<TokenStream> for proc_macro::TokenStream {
+ fn from(inner: TokenStream) -> proc_macro::TokenStream {
+ inner.to_string().parse().expect("failed to parse to compiler tokens")
+ }
+}
+
+
+impl From<TokenTree> for TokenStream {
+ fn from(tree: TokenTree) -> TokenStream {
+ TokenStream { inner: vec![tree] }
+ }
+}
+
+impl iter::FromIterator<TokenStream> for TokenStream {
+ fn from_iter<I: IntoIterator<Item=TokenStream>>(streams: I) -> Self {
+ let mut v = Vec::new();
+
+ for stream in streams.into_iter() {
+ v.extend(stream.inner);
+ }
+
+ TokenStream { inner: v }
+ }
+}
+
+pub type TokenTreeIter = vec::IntoIter<TokenTree>;
+
+impl IntoIterator for TokenStream {
+ type Item = TokenTree;
+ type IntoIter = TokenTreeIter;
+
+ fn into_iter(self) -> TokenTreeIter {
+ self.inner.into_iter()
+ }
+}
+
+#[cfg(procmacro2_semver_exempt)]
+#[derive(Clone, PartialEq, Eq, Debug)]
+pub struct FileName(String);
+
+#[cfg(procmacro2_semver_exempt)]
+impl fmt::Display for FileName {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ self.0.fmt(f)
+ }
+}
+
+#[cfg(procmacro2_semver_exempt)]
+#[derive(Clone, PartialEq, Eq)]
+pub struct SourceFile {
+ name: FileName,
+}
+
+#[cfg(procmacro2_semver_exempt)]
+impl SourceFile {
+ /// Get the path to this source file as a string.
+ pub fn path(&self) -> &FileName {
+ &self.name
+ }
+
+ pub fn is_real(&self) -> bool {
+ // XXX(nika): Support real files in the future?
+ false
+ }
+}
+
+#[cfg(procmacro2_semver_exempt)]
+impl AsRef<FileName> for SourceFile {
+ fn as_ref(&self) -> &FileName {
+ self.path()
+ }
+}
+
+#[cfg(procmacro2_semver_exempt)]
+impl fmt::Debug for SourceFile {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ f.debug_struct("SourceFile")
+ .field("path", &self.path())
+ .field("is_real", &self.is_real())
+ .finish()
+ }
+}
+
+#[cfg(procmacro2_semver_exempt)]
+#[derive(Clone, Copy, Debug, PartialEq, Eq)]
+pub struct LineColumn {
+ pub line: usize,
+ pub column: usize,
+}
+
+#[cfg(procmacro2_semver_exempt)]
+thread_local! {
+ static CODEMAP: RefCell<Codemap> = RefCell::new(Codemap {
+ // NOTE: We start with a single dummy file which all call_site() and
+ // def_site() spans reference.
+ files: vec![FileInfo {
+ name: "<unspecified>".to_owned(),
+ span: Span { lo: 0, hi: 0 },
+ lines: vec![0],
+ }],
+ });
+}
+
+#[cfg(procmacro2_semver_exempt)]
+struct FileInfo {
+ name: String,
+ span: Span,
+ lines: Vec<usize>,
+}
+
+#[cfg(procmacro2_semver_exempt)]
+impl FileInfo {
+ fn offset_line_column(&self, offset: usize) -> LineColumn {
+ assert!(self.span_within(Span { lo: offset as u32, hi: offset as u32 }));
+ let offset = offset - self.span.lo as usize;
+ match self.lines.binary_search(&offset) {
+ Ok(found) => LineColumn {
+ line: found + 1,
+ column: 0
+ },
+ Err(idx) => LineColumn {
+ line: idx,
+ column: offset - self.lines[idx - 1]
+ },
+ }
+ }
+
+ fn span_within(&self, span: Span) -> bool {
+ span.lo >= self.span.lo && span.hi <= self.span.hi
+ }
+}
+
+/// Computes the offsets of each line in the given source string.
+#[cfg(procmacro2_semver_exempt)]
+fn lines_offsets(s: &str) -> Vec<usize> {
+ let mut lines = vec![0];
+ let mut prev = 0;
+ while let Some(len) = s[prev..].find('\n') {
+ prev += len + 1;
+ lines.push(prev);
+ }
+ lines
+}
+
+#[cfg(procmacro2_semver_exempt)]
+struct Codemap {
+ files: Vec<FileInfo>,
+}
+
+#[cfg(procmacro2_semver_exempt)]
+impl Codemap {
+ fn next_start_pos(&self) -> u32 {
+ // Add 1 so there's always space between files.
+ //
+ // We'll always have at least 1 file, as we initialize our files list
+ // with a dummy file.
+ self.files.last().unwrap().span.hi + 1
+ }
+
+ fn add_file(&mut self, name: &str, src: &str) -> Span {
+ let lines = lines_offsets(src);
+ let lo = self.next_start_pos();
+ // XXX(nika): Shouild we bother doing a checked cast or checked add here?
+ let span = Span { lo: lo, hi: lo + (src.len() as u32) };
+
+ self.files.push(FileInfo {
+ name: name.to_owned(),
+ span: span,
+ lines: lines,
+ });
+
+ span
+ }
+
+ fn fileinfo(&self, span: Span) -> &FileInfo {
+ for file in &self.files {
+ if file.span_within(span) {
+ return file;
+ }
+ }
+ panic!("Invalid span with no related FileInfo!");
+ }
+}
+
+#[derive(Clone, Copy, Debug)]
+pub struct Span {
+ #[cfg(procmacro2_semver_exempt)]
+ lo: u32,
+ #[cfg(procmacro2_semver_exempt)]
+ hi: u32,
+}
+
+impl Span {
+ #[cfg(not(procmacro2_semver_exempt))]
+ pub fn call_site() -> Span {
+ Span {}
+ }
+
+ #[cfg(procmacro2_semver_exempt)]
+ pub fn call_site() -> Span {
+ Span { lo: 0, hi: 0 }
+ }
+
+ pub fn def_site() -> Span {
+ Span::call_site()
+ }
+
+ pub fn resolved_at(&self, _other: Span) -> Span {
+ // Stable spans consist only of line/column information, so
+ // `resolved_at` and `located_at` only select which span the
+ // caller wants line/column information from.
+ *self
+ }
+
+ pub fn located_at(&self, other: Span) -> Span {
+ other
+ }
+
+ #[cfg(procmacro2_semver_exempt)]
+ pub fn source_file(&self) -> SourceFile {
+ CODEMAP.with(|cm| {
+ let cm = cm.borrow();
+ let fi = cm.fileinfo(*self);
+ SourceFile {
+ name: FileName(fi.name.clone()),
+ }
+ })
+ }
+
+ #[cfg(procmacro2_semver_exempt)]
+ pub fn start(&self) -> LineColumn {
+ CODEMAP.with(|cm| {
+ let cm = cm.borrow();
+ let fi = cm.fileinfo(*self);
+ fi.offset_line_column(self.lo as usize)
+ })
+ }
+
+ #[cfg(procmacro2_semver_exempt)]
+ pub fn end(&self) -> LineColumn {
+ CODEMAP.with(|cm| {
+ let cm = cm.borrow();
+ let fi = cm.fileinfo(*self);
+ fi.offset_line_column(self.hi as usize)
+ })
+ }
+
+ #[cfg(procmacro2_semver_exempt)]
+ pub fn join(&self, other: Span) -> Option<Span> {
+ CODEMAP.with(|cm| {
+ let cm = cm.borrow();
+ // If `other` is not within the same FileInfo as us, return None.
+ if !cm.fileinfo(*self).span_within(other) {
+ return None;
+ }
+ Some(Span {
+ lo: cmp::min(self.lo, other.lo),
+ hi: cmp::max(self.hi, other.hi),
+ })
+ })
+ }
+}
+
+#[derive(Copy, Clone)]
+pub struct Term {
+ intern: usize,
+ not_send_sync: PhantomData<*const ()>,
+}
+
+thread_local!(static SYMBOLS: RefCell<Interner> = RefCell::new(Interner::new()));
+
+impl Term {
+ pub fn intern(string: &str) -> Term {
+ Term {
+ intern: SYMBOLS.with(|s| s.borrow_mut().intern(string)),
+ not_send_sync: PhantomData,
+ }
+ }
+
+ pub fn as_str(&self) -> &str {
+ SYMBOLS.with(|interner| {
+ let interner = interner.borrow();
+ let s = interner.get(self.intern);
+ unsafe {
+ &*(s as *const str)
+ }
+ })
+ }
+}
+
+impl fmt::Debug for Term {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ f.debug_tuple("Term").field(&self.as_str()).finish()
+ }
+}
+
+struct Interner {
+ string_to_index: HashMap<MyRc, usize>,
+ index_to_string: Vec<Rc<String>>,
+}
+
+#[derive(Hash, Eq, PartialEq)]
+struct MyRc(Rc<String>);
+
+impl Borrow<str> for MyRc {
+ fn borrow(&self) -> &str {
+ &self.0
+ }
+}
+
+impl Interner {
+ fn new() -> Interner {
+ Interner {
+ string_to_index: HashMap::new(),
+ index_to_string: Vec::new(),
+ }
+ }
+
+ fn intern(&mut self, s: &str) -> usize {
+ if let Some(&idx) = self.string_to_index.get(s) {
+ return idx
+ }
+ let s = Rc::new(s.to_string());
+ self.index_to_string.push(s.clone());
+ self.string_to_index.insert(MyRc(s), self.index_to_string.len() - 1);
+ self.index_to_string.len() - 1
+ }
+
+ fn get(&self, idx: usize) -> &str {
+ &self.index_to_string[idx]
+ }
+}
+
+#[derive(Clone, Debug)]
+pub struct Literal(String);
+
+impl Literal {
+ pub fn byte_char(byte: u8) -> Literal {
+ match byte {
+ 0 => Literal(format!("b'\\0'")),
+ b'\"' => Literal(format!("b'\"'")),
+ n => {
+ let mut escaped = "b'".to_string();
+ escaped.extend(ascii::escape_default(n).map(|c| c as char));
+ escaped.push('\'');
+ Literal(escaped)
+ }
+ }
+ }
+
+ pub fn byte_string(bytes: &[u8]) -> Literal {
+ let mut escaped = "b\"".to_string();
+ for b in bytes {
+ match *b {
+ b'\0' => escaped.push_str(r"\0"),
+ b'\t' => escaped.push_str(r"\t"),
+ b'\n' => escaped.push_str(r"\n"),
+ b'\r' => escaped.push_str(r"\r"),
+ b'"' => escaped.push_str("\\\""),
+ b'\\' => escaped.push_str("\\\\"),
+ b'\x20' ... b'\x7E' => escaped.push(*b as char),
+ _ => escaped.push_str(&format!("\\x{:02X}", b)),
+ }
+ }
+ escaped.push('"');
+ Literal(escaped)
+ }
+
+ pub fn doccomment(s: &str) -> Literal {
+ Literal(s.to_string())
+ }
+
+ pub fn float(n: f64) -> Literal {
+ if !n.is_finite() {
+ panic!("Invalid float literal {}", n);
+ }
+ let mut s = n.to_string();
+ if !s.contains('.') {
+ s += ".0";
+ }
+ Literal(s)
+ }
+
+ pub fn integer(s: i64) -> Literal {
+ Literal(s.to_string())
+ }
+
+ pub fn raw_string(s: &str, pounds: usize) -> Literal {
+ let mut ret = format!("r");
+ ret.extend((0..pounds).map(|_| "#"));
+ ret.push('"');
+ ret.push_str(s);
+ ret.push('"');
+ ret.extend((0..pounds).map(|_| "#"));
+ Literal(ret)
+ }
+
+ pub fn raw_byte_string(s: &str, pounds: usize) -> Literal {
+ let mut ret = format!("br");
+ ret.extend((0..pounds).map(|_| "#"));
+ ret.push('"');
+ ret.push_str(s);
+ ret.push('"');
+ ret.extend((0..pounds).map(|_| "#"));
+ Literal(ret)
+ }
+}
+
+impl fmt::Display for Literal {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ self.0.fmt(f)
+ }
+}
+
+macro_rules! ints {
+ ($($t:ty,)*) => {$(
+ impl From<$t> for Literal {
+ fn from(t: $t) -> Literal {
+ Literal(format!(concat!("{}", stringify!($t)), t))
+ }
+ }
+ )*}
+}
+
+ints! {
+ u8, u16, u32, u64, usize,
+ i8, i16, i32, i64, isize,
+}
+
+macro_rules! floats {
+ ($($t:ty,)*) => {$(
+ impl From<$t> for Literal {
+ fn from(t: $t) -> Literal {
+ assert!(!t.is_nan());
+ assert!(!t.is_infinite());
+ Literal(format!(concat!("{}", stringify!($t)), t))
+ }
+ }
+ )*}
+}
+
+floats! {
+ f32, f64,
+}
+
+impl<'a> From<&'a str> for Literal {
+ fn from(t: &'a str) -> Literal {
+ let mut s = t.chars().flat_map(|c| c.escape_default()).collect::<String>();
+ s.push('"');
+ s.insert(0, '"');
+ Literal(s)
+ }
+}
+
+impl From<char> for Literal {
+ fn from(t: char) -> Literal {
+ Literal(format!("'{}'", t.escape_default().collect::<String>()))
+ }
+}
+
+named!(token_stream -> ::TokenStream, map!(
+ many0!(token_tree),
+ |trees| ::TokenStream(TokenStream { inner: trees })
+));
+
+#[cfg(not(procmacro2_semver_exempt))]
+fn token_tree(input: Cursor) -> PResult<TokenTree> {
+ let (input, kind) = token_kind(input)?;
+ Ok((input, TokenTree {
+ span: ::Span(Span {}),
+ kind: kind,
+ }))
+}
+
+#[cfg(procmacro2_semver_exempt)]
+fn token_tree(input: Cursor) -> PResult<TokenTree> {
+ let input = skip_whitespace(input);
+ let lo = input.off;
+ let (input, kind) = token_kind(input)?;
+ let hi = input.off;
+ Ok((input, TokenTree {
+ span: ::Span(Span {
+ lo: lo,
+ hi: hi,
+ }),
+ kind: kind,
+ }))
+}
+
+named!(token_kind -> TokenNode, alt!(
+ map!(delimited, |(d, s)| TokenNode::Group(d, s))
+ |
+ map!(literal, TokenNode::Literal) // must be before symbol
+ |
+ symbol
+ |
+ map!(op, |(op, kind)| TokenNode::Op(op, kind))
+));
+
+named!(delimited -> (Delimiter, ::TokenStream), alt!(
+ delimited!(
+ punct!("("),
+ token_stream,
+ punct!(")")
+ ) => { |ts| (Delimiter::Parenthesis, ts) }
+ |
+ delimited!(
+ punct!("["),
+ token_stream,
+ punct!("]")
+ ) => { |ts| (Delimiter::Bracket, ts) }
+ |
+ delimited!(
+ punct!("{"),
+ token_stream,
+ punct!("}")
+ ) => { |ts| (Delimiter::Brace, ts) }
+));
+
+fn symbol(mut input: Cursor) -> PResult<TokenNode> {
+ input = skip_whitespace(input);
+
+ let mut chars = input.char_indices();
+
+ let lifetime = input.starts_with("'");
+ if lifetime {
+ chars.next();
+ }
+
+ match chars.next() {
+ Some((_, ch)) if UnicodeXID::is_xid_start(ch) || ch == '_' => {}
+ _ => return Err(LexError),
+ }
+
+ let mut end = input.len();
+ for (i, ch) in chars {
+ if !UnicodeXID::is_xid_continue(ch) {
+ end = i;
+ break;
+ }
+ }
+
+ if lifetime && &input.rest[..end] != "'static" && KEYWORDS.contains(&&input.rest[1..end]) {
+ Err(LexError)
+ } else {
+ let a = &input.rest[..end];
+ if a == "_" {
+ Ok((input.advance(end), TokenNode::Op('_', Spacing::Alone)))
+ } else {
+ Ok((input.advance(end), TokenNode::Term(::Term::intern(a))))
+ }
+ }
+}
+
+// From https://github.com/rust-lang/rust/blob/master/src/libsyntax_pos/symbol.rs
+static KEYWORDS: &'static [&'static str] = &[
+ "abstract", "alignof", "as", "become", "box", "break", "const", "continue",
+ "crate", "do", "else", "enum", "extern", "false", "final", "fn", "for",
+ "if", "impl", "in", "let", "loop", "macro", "match", "mod", "move", "mut",
+ "offsetof", "override", "priv", "proc", "pub", "pure", "ref", "return",
+ "self", "Self", "sizeof", "static", "struct", "super", "trait", "true",
+ "type", "typeof", "unsafe", "unsized", "use", "virtual", "where", "while",
+ "yield",
+];
+
+fn literal(input: Cursor) -> PResult<::Literal> {
+ let input_no_ws = skip_whitespace(input);
+
+ match literal_nocapture(input_no_ws) {
+ Ok((a, ())) => {
+ let start = input.len() - input_no_ws.len();
+ let len = input_no_ws.len() - a.len();
+ let end = start + len;
+ Ok((a, ::Literal(Literal(input.rest[start..end].to_string()))))
+ }
+ Err(LexError) => Err(LexError),
+ }
+}
+
+named!(literal_nocapture -> (), alt!(
+ string
+ |
+ byte_string
+ |
+ byte
+ |
+ character
+ |
+ float
+ |
+ int
+ |
+ doc_comment
+));
+
+named!(string -> (), alt!(
+ quoted_string
+ |
+ preceded!(
+ punct!("r"),
+ raw_string
+ ) => { |_| () }
+));
+
+named!(quoted_string -> (), delimited!(
+ punct!("\""),
+ cooked_string,
+ tag!("\"")
+));
+
+fn cooked_string(input: Cursor) -> PResult<()> {
+ let mut chars = input.char_indices().peekable();
+ while let Some((byte_offset, ch)) = chars.next() {
+ match ch {
+ '"' => {
+ return Ok((input.advance(byte_offset), ()));
+ }
+ '\r' => {
+ if let Some((_, '\n')) = chars.next() {
+ // ...
+ } else {
+ break;
+ }
+ }
+ '\\' => {
+ match chars.next() {
+ Some((_, 'x')) => {
+ if !backslash_x_char(&mut chars) {
+ break
+ }
+ }
+ Some((_, 'n')) |
+ Some((_, 'r')) |
+ Some((_, 't')) |
+ Some((_, '\\')) |
+ Some((_, '\'')) |
+ Some((_, '"')) |
+ Some((_, '0')) => {}
+ Some((_, 'u')) => {
+ if !backslash_u(&mut chars) {
+ break
+ }
+ }
+ Some((_, '\n')) | Some((_, '\r')) => {
+ while let Some(&(_, ch)) = chars.peek() {
+ if ch.is_whitespace() {
+ chars.next();
+ } else {
+ break;
+ }
+ }
+ }
+ _ => break,
+ }
+ }
+ _ch => {}
+ }
+ }
+ Err(LexError)
+}
+
+named!(byte_string -> (), alt!(
+ delimited!(
+ punct!("b\""),
+ cooked_byte_string,
+ tag!("\"")
+ ) => { |_| () }
+ |
+ preceded!(
+ punct!("br"),
+ raw_string
+ ) => { |_| () }
+));
+
+fn cooked_byte_string(mut input: Cursor) -> PResult<()> {
+ let mut bytes = input.bytes().enumerate();
+ 'outer: while let Some((offset, b)) = bytes.next() {
+ match b {
+ b'"' => {
+ return Ok((input.advance(offset), ()));
+ }
+ b'\r' => {
+ if let Some((_, b'\n')) = bytes.next() {
+ // ...
+ } else {
+ break;
+ }
+ }
+ b'\\' => {
+ match bytes.next() {
+ Some((_, b'x')) => {
+ if !backslash_x_byte(&mut bytes) {
+ break
+ }
+ }
+ Some((_, b'n')) |
+ Some((_, b'r')) |
+ Some((_, b't')) |
+ Some((_, b'\\')) |
+ Some((_, b'0')) |
+ Some((_, b'\'')) |
+ Some((_, b'"')) => {}
+ Some((newline, b'\n')) |
+ Some((newline, b'\r')) => {
+ let rest = input.advance(newline + 1);
+ for (offset, ch) in rest.char_indices() {
+ if !ch.is_whitespace() {
+ input = rest.advance(offset);
+ bytes = input.bytes().enumerate();
+ continue 'outer;
+ }
+ }
+ break;
+ }
+ _ => break,
+ }
+ }
+ b if b < 0x80 => {}
+ _ => break,
+ }
+ }
+ Err(LexError)
+}
+
+fn raw_string(input: Cursor) -> PResult<()> {
+ let mut chars = input.char_indices();
+ let mut n = 0;
+ while let Some((byte_offset, ch)) = chars.next() {
+ match ch {
+ '"' => {
+ n = byte_offset;
+ break;
+ }
+ '#' => {}
+ _ => return Err(LexError),
+ }
+ }
+ for (byte_offset, ch) in chars {
+ match ch {
+ '"' if input.advance(byte_offset + 1).starts_with(&input.rest[..n]) => {
+ let rest = input.advance(byte_offset + 1 + n);
+ return Ok((rest, ()))
+ }
+ '\r' => {}
+ _ => {}
+ }
+ }
+ Err(LexError)
+}
+
+named!(byte -> (), do_parse!(
+ punct!("b") >>
+ tag!("'") >>
+ cooked_byte >>
+ tag!("'") >>
+ (())
+));
+
+fn cooked_byte(input: Cursor) -> PResult<()> {
+ let mut bytes = input.bytes().enumerate();
+ let ok = match bytes.next().map(|(_, b)| b) {
+ Some(b'\\') => {
+ match bytes.next().map(|(_, b)| b) {
+ Some(b'x') => backslash_x_byte(&mut bytes),
+ Some(b'n') |
+ Some(b'r') |
+ Some(b't') |
+ Some(b'\\') |
+ Some(b'0') |
+ Some(b'\'') |
+ Some(b'"') => true,
+ _ => false,
+ }
+ }
+ b => b.is_some(),
+ };
+ if ok {
+ match bytes.next() {
+ Some((offset, _)) => {
+ if input.chars().as_str().is_char_boundary(offset) {
+ Ok((input.advance(offset), ()))
+ } else {
+ Err(LexError)
+ }
+ }
+ None => Ok((input.advance(input.len()), ())),
+ }
+ } else {
+ Err(LexError)
+ }
+}
+
+named!(character -> (), do_parse!(
+ punct!("'") >>
+ cooked_char >>
+ tag!("'") >>
+ (())
+));
+
+fn cooked_char(input: Cursor) -> PResult<()> {
+ let mut chars = input.char_indices();
+ let ok = match chars.next().map(|(_, ch)| ch) {
+ Some('\\') => {
+ match chars.next().map(|(_, ch)| ch) {
+ Some('x') => backslash_x_char(&mut chars),
+ Some('u') => backslash_u(&mut chars),
+ Some('n') |
+ Some('r') |
+ Some('t') |
+ Some('\\') |
+ Some('0') |
+ Some('\'') |
+ Some('"') => true,
+ _ => false,
+ }
+ }
+ ch => ch.is_some(),
+ };
+ if ok {
+ match chars.next() {
+ Some((idx, _)) => Ok((input.advance(idx), ())),
+ None => Ok((input.advance(input.len()), ())),
+ }
+ } else {
+ Err(LexError)
+ }
+}
+
+macro_rules! next_ch {
+ ($chars:ident @ $pat:pat $(| $rest:pat)*) => {
+ match $chars.next() {
+ Some((_, ch)) => match ch {
+ $pat $(| $rest)* => ch,
+ _ => return false,
+ },
+ None => return false
+ }
+ };
+}
+
+fn backslash_x_char<I>(chars: &mut I) -> bool
+ where I: Iterator<Item = (usize, char)>
+{
+ next_ch!(chars @ '0'...'7');
+ next_ch!(chars @ '0'...'9' | 'a'...'f' | 'A'...'F');
+ true
+}
+
+fn backslash_x_byte<I>(chars: &mut I) -> bool
+ where I: Iterator<Item = (usize, u8)>
+{
+ next_ch!(chars @ b'0'...b'9' | b'a'...b'f' | b'A'...b'F');
+ next_ch!(chars @ b'0'...b'9' | b'a'...b'f' | b'A'...b'F');
+ true
+}
+
+fn backslash_u<I>(chars: &mut I) -> bool
+ where I: Iterator<Item = (usize, char)>
+{
+ next_ch!(chars @ '{');
+ next_ch!(chars @ '0'...'9' | 'a'...'f' | 'A'...'F');
+ loop {
+ let c = next_ch!(chars @ '0'...'9' | 'a'...'f' | 'A'...'F' | '_' | '}');
+ if c == '}' {
+ return true;
+ }
+ }
+}
+
+fn float(input: Cursor) -> PResult<()> {
+ let (rest, ()) = float_digits(input)?;
+ for suffix in &["f32", "f64"] {
+ if rest.starts_with(suffix) {
+ return word_break(rest.advance(suffix.len()));
+ }
+ }
+ word_break(rest)
+}
+
+fn float_digits(input: Cursor) -> PResult<()> {
+ let mut chars = input.chars().peekable();
+ match chars.next() {
+ Some(ch) if ch >= '0' && ch <= '9' => {}
+ _ => return Err(LexError),
+ }
+
+ let mut len = 1;
+ let mut has_dot = false;
+ let mut has_exp = false;
+ while let Some(&ch) = chars.peek() {
+ match ch {
+ '0'...'9' | '_' => {
+ chars.next();
+ len += 1;
+ }
+ '.' => {
+ if has_dot {
+ break;
+ }
+ chars.next();
+ if chars.peek()
+ .map(|&ch| ch == '.' || UnicodeXID::is_xid_start(ch))
+ .unwrap_or(false) {
+ return Err(LexError);
+ }
+ len += 1;
+ has_dot = true;
+ }
+ 'e' | 'E' => {
+ chars.next();
+ len += 1;
+ has_exp = true;
+ break;
+ }
+ _ => break,
+ }
+ }
+
+ let rest = input.advance(len);
+ if !(has_dot || has_exp || rest.starts_with("f32") || rest.starts_with("f64")) {
+ return Err(LexError);
+ }
+
+ if has_exp {
+ let mut has_exp_value = false;
+ while let Some(&ch) = chars.peek() {
+ match ch {
+ '+' | '-' => {
+ if has_exp_value {
+ break;
+ }
+ chars.next();
+ len += 1;
+ }
+ '0'...'9' => {
+ chars.next();
+ len += 1;
+ has_exp_value = true;
+ }
+ '_' => {
+ chars.next();
+ len += 1;
+ }
+ _ => break,
+ }
+ }
+ if !has_exp_value {
+ return Err(LexError);
+ }
+ }
+
+ Ok((input.advance(len), ()))
+}
+
+fn int(input: Cursor) -> PResult<()> {
+ let (rest, ()) = digits(input)?;
+ for suffix in &[
+ "isize",
+ "i8",
+ "i16",
+ "i32",
+ "i64",
+ "i128",
+ "usize",
+ "u8",
+ "u16",
+ "u32",
+ "u64",
+ "u128",
+ ] {
+ if rest.starts_with(suffix) {
+ return word_break(rest.advance(suffix.len()));
+ }
+ }
+ word_break(rest)
+}
+
+fn digits(mut input: Cursor) -> PResult<()> {
+ let base = if input.starts_with("0x") {
+ input = input.advance(2);
+ 16
+ } else if input.starts_with("0o") {
+ input = input.advance(2);
+ 8
+ } else if input.starts_with("0b") {
+ input = input.advance(2);
+ 2
+ } else {
+ 10
+ };
+
+ let mut len = 0;
+ let mut empty = true;
+ for b in input.bytes() {
+ let digit = match b {
+ b'0'...b'9' => (b - b'0') as u64,
+ b'a'...b'f' => 10 + (b - b'a') as u64,
+ b'A'...b'F' => 10 + (b - b'A') as u64,
+ b'_' => {
+ if empty && base == 10 {
+ return Err(LexError);
+ }
+ len += 1;
+ continue;
+ }
+ _ => break,
+ };
+ if digit >= base {
+ return Err(LexError);
+ }
+ len += 1;
+ empty = false;
+ }
+ if empty {
+ Err(LexError)
+ } else {
+ Ok((input.advance(len), ()))
+ }
+}
+
+fn op(input: Cursor) -> PResult<(char, Spacing)> {
+ let input = skip_whitespace(input);
+ match op_char(input) {
+ Ok((rest, ch)) => {
+ let kind = match op_char(rest) {
+ Ok(_) => Spacing::Joint,
+ Err(LexError) => Spacing::Alone,
+ };
+ Ok((rest, (ch, kind)))
+ }
+ Err(LexError) => Err(LexError),
+ }
+}
+
+fn op_char(input: Cursor) -> PResult<char> {
+ let mut chars = input.chars();
+ let first = match chars.next() {
+ Some(ch) => ch,
+ None => {
+ return Err(LexError);
+ }
+ };
+ let recognized = "~!@#$%^&*-=+|;:,<.>/?";
+ if recognized.contains(first) {
+ Ok((input.advance(first.len_utf8()), first))
+ } else {
+ Err(LexError)
+ }
+}
+
+named!(doc_comment -> (), alt!(
+ do_parse!(
+ punct!("//!") >>
+ take_until!("\n") >>
+ (())
+ )
+ |
+ do_parse!(
+ option!(whitespace) >>
+ peek!(tag!("/*!")) >>
+ block_comment >>
+ (())
+ )
+ |
+ do_parse!(
+ punct!("///") >>
+ not!(tag!("/")) >>
+ take_until!("\n") >>
+ (())
+ )
+ |
+ do_parse!(
+ option!(whitespace) >>
+ peek!(tuple!(tag!("/**"), not!(tag!("*")))) >>
+ block_comment >>
+ (())
+ )
+));
new file mode 100644
--- /dev/null
+++ b/third_party/rust/proc-macro2/src/strnom.rs
@@ -0,0 +1,447 @@
+//! Adapted from [`nom`](https://github.com/Geal/nom).
+
+use std::str::{Chars, CharIndices, Bytes};
+
+use unicode_xid::UnicodeXID;
+
+use imp::LexError;
+
+#[derive(Copy, Clone, Eq, PartialEq)]
+pub struct Cursor<'a> {
+ pub rest: &'a str,
+ #[cfg(procmacro2_semver_exempt)]
+ pub off: u32,
+}
+
+impl<'a> Cursor<'a> {
+ #[cfg(not(procmacro2_semver_exempt))]
+ pub fn advance(&self, amt: usize) -> Cursor<'a> {
+ Cursor {
+ rest: &self.rest[amt..],
+ }
+ }
+ #[cfg(procmacro2_semver_exempt)]
+ pub fn advance(&self, amt: usize) -> Cursor<'a> {
+ Cursor {
+ rest: &self.rest[amt..],
+ off: self.off + (amt as u32),
+ }
+ }
+
+ pub fn find(&self, p: char) -> Option<usize> {
+ self.rest.find(p)
+ }
+
+ pub fn starts_with(&self, s: &str) -> bool {
+ self.rest.starts_with(s)
+ }
+
+ pub fn is_empty(&self) -> bool {
+ self.rest.is_empty()
+ }
+
+ pub fn len(&self) -> usize {
+ self.rest.len()
+ }
+
+ pub fn as_bytes(&self) -> &'a [u8] {
+ self.rest.as_bytes()
+ }
+
+ pub fn bytes(&self) -> Bytes<'a> {
+ self.rest.bytes()
+ }
+
+ pub fn chars(&self) -> Chars<'a> {
+ self.rest.chars()
+ }
+
+ pub fn char_indices(&self) -> CharIndices<'a> {
+ self.rest.char_indices()
+ }
+}
+
+pub type PResult<'a, O> = Result<(Cursor<'a>, O), LexError>;
+
+pub fn whitespace(input: Cursor) -> PResult<()> {
+ if input.is_empty() {
+ return Err(LexError);
+ }
+
+ let bytes = input.as_bytes();
+ let mut i = 0;
+ while i < bytes.len() {
+ let s = input.advance(i);
+ if bytes[i] == b'/' {
+ if s.starts_with("//") && (!s.starts_with("///") || s.starts_with("////")) &&
+ !s.starts_with("//!") {
+ if let Some(len) = s.find('\n') {
+ i += len + 1;
+ continue;
+ }
+ break;
+ } else if s.starts_with("/**/") {
+ i += 4;
+ continue
+ } else if s.starts_with("/*") && (!s.starts_with("/**") || s.starts_with("/***")) &&
+ !s.starts_with("/*!") {
+ let (_, com) = block_comment(s)?;
+ i += com.len();
+ continue;
+ }
+ }
+ match bytes[i] {
+ b' ' | 0x09...0x0d => {
+ i += 1;
+ continue;
+ }
+ b if b <= 0x7f => {}
+ _ => {
+ let ch = s.chars().next().unwrap();
+ if is_whitespace(ch) {
+ i += ch.len_utf8();
+ continue;
+ }
+ }
+ }
+ return if i > 0 {
+ Ok((s, ()))
+ } else {
+ Err(LexError)
+ };
+ }
+ Ok((input.advance(input.len()), ()))
+}
+
+pub fn block_comment(input: Cursor) -> PResult<&str> {
+ if !input.starts_with("/*") {
+ return Err(LexError);
+ }
+
+ let mut depth = 0;
+ let bytes = input.as_bytes();
+ let mut i = 0;
+ let upper = bytes.len() - 1;
+ while i < upper {
+ if bytes[i] == b'/' && bytes[i + 1] == b'*' {
+ depth += 1;
+ i += 1; // eat '*'
+ } else if bytes[i] == b'*' && bytes[i + 1] == b'/' {
+ depth -= 1;
+ if depth == 0 {
+ return Ok((input.advance(i + 2), &input.rest[..i + 2]));
+ }
+ i += 1; // eat '/'
+ }
+ i += 1;
+ }
+ Err(LexError)
+}
+
+pub fn skip_whitespace(input: Cursor) -> Cursor {
+ match whitespace(input) {
+ Ok((rest, _)) => rest,
+ Err(LexError) => input,
+ }
+}
+
+fn is_whitespace(ch: char) -> bool {
+ // Rust treats left-to-right mark and right-to-left mark as whitespace
+ ch.is_whitespace() || ch == '\u{200e}' || ch == '\u{200f}'
+}
+
+pub fn word_break(input: Cursor) -> PResult<()> {
+ match input.chars().next() {
+ Some(ch) if UnicodeXID::is_xid_continue(ch) => Err(LexError),
+ Some(_) | None => Ok((input, ())),
+ }
+}
+
+macro_rules! named {
+ ($name:ident -> $o:ty, $submac:ident!( $($args:tt)* )) => {
+ fn $name<'a>(i: Cursor<'a>) -> $crate::strnom::PResult<'a, $o> {
+ $submac!(i, $($args)*)
+ }
+ };
+}
+
+macro_rules! alt {
+ ($i:expr, $e:ident | $($rest:tt)*) => {
+ alt!($i, call!($e) | $($rest)*)
+ };
+
+ ($i:expr, $subrule:ident!( $($args:tt)*) | $($rest:tt)*) => {
+ match $subrule!($i, $($args)*) {
+ res @ Ok(_) => res,
+ _ => alt!($i, $($rest)*)
+ }
+ };
+
+ ($i:expr, $subrule:ident!( $($args:tt)* ) => { $gen:expr } | $($rest:tt)+) => {
+ match $subrule!($i, $($args)*) {
+ Ok((i, o)) => Ok((i, $gen(o))),
+ Err(LexError) => alt!($i, $($rest)*)
+ }
+ };
+
+ ($i:expr, $e:ident => { $gen:expr } | $($rest:tt)*) => {
+ alt!($i, call!($e) => { $gen } | $($rest)*)
+ };
+
+ ($i:expr, $e:ident => { $gen:expr }) => {
+ alt!($i, call!($e) => { $gen })
+ };
+
+ ($i:expr, $subrule:ident!( $($args:tt)* ) => { $gen:expr }) => {
+ match $subrule!($i, $($args)*) {
+ Ok((i, o)) => Ok((i, $gen(o))),
+ Err(LexError) => Err(LexError),
+ }
+ };
+
+ ($i:expr, $e:ident) => {
+ alt!($i, call!($e))
+ };
+
+ ($i:expr, $subrule:ident!( $($args:tt)*)) => {
+ $subrule!($i, $($args)*)
+ };
+}
+
+macro_rules! do_parse {
+ ($i:expr, ( $($rest:expr),* )) => {
+ Ok(($i, ( $($rest),* )))
+ };
+
+ ($i:expr, $e:ident >> $($rest:tt)*) => {
+ do_parse!($i, call!($e) >> $($rest)*)
+ };
+
+ ($i:expr, $submac:ident!( $($args:tt)* ) >> $($rest:tt)*) => {
+ match $submac!($i, $($args)*) {
+ Err(LexError) => Err(LexError),
+ Ok((i, _)) => do_parse!(i, $($rest)*),
+ }
+ };
+
+ ($i:expr, $field:ident : $e:ident >> $($rest:tt)*) => {
+ do_parse!($i, $field: call!($e) >> $($rest)*)
+ };
+
+ ($i:expr, $field:ident : $submac:ident!( $($args:tt)* ) >> $($rest:tt)*) => {
+ match $submac!($i, $($args)*) {
+ Err(LexError) => Err(LexError),
+ Ok((i, o)) => {
+ let $field = o;
+ do_parse!(i, $($rest)*)
+ },
+ }
+ };
+}
+
+macro_rules! peek {
+ ($i:expr, $submac:ident!( $($args:tt)* )) => {
+ match $submac!($i, $($args)*) {
+ Ok((_, o)) => Ok(($i, o)),
+ Err(LexError) => Err(LexError),
+ }
+ };
+}
+
+macro_rules! call {
+ ($i:expr, $fun:expr $(, $args:expr)*) => {
+ $fun($i $(, $args)*)
+ };
+}
+
+macro_rules! option {
+ ($i:expr, $f:expr) => {
+ match $f($i) {
+ Ok((i, o)) => Ok((i, Some(o))),
+ Err(LexError) => Ok(($i, None)),
+ }
+ };
+}
+
+macro_rules! take_until {
+ ($i:expr, $substr:expr) => {{
+ if $substr.len() > $i.len() {
+ Err(LexError)
+ } else {
+ let substr_vec: Vec<char> = $substr.chars().collect();
+ let mut window: Vec<char> = vec![];
+ let mut offset = $i.len();
+ let mut parsed = false;
+ for (o, c) in $i.char_indices() {
+ window.push(c);
+ if window.len() > substr_vec.len() {
+ window.remove(0);
+ }
+ if window == substr_vec {
+ parsed = true;
+ window.pop();
+ let window_len: usize = window.iter()
+ .map(|x| x.len_utf8())
+ .fold(0, |x, y| x + y);
+ offset = o - window_len;
+ break;
+ }
+ }
+ if parsed {
+ Ok(($i.advance(offset), &$i.rest[..offset]))
+ } else {
+ Err(LexError)
+ }
+ }
+ }};
+}
+
+macro_rules! tuple {
+ ($i:expr, $($rest:tt)*) => {
+ tuple_parser!($i, (), $($rest)*)
+ };
+}
+
+/// Do not use directly. Use `tuple!`.
+macro_rules! tuple_parser {
+ ($i:expr, ($($parsed:tt),*), $e:ident, $($rest:tt)*) => {
+ tuple_parser!($i, ($($parsed),*), call!($e), $($rest)*)
+ };
+
+ ($i:expr, (), $submac:ident!( $($args:tt)* ), $($rest:tt)*) => {
+ match $submac!($i, $($args)*) {
+ Err(LexError) => Err(LexError),
+ Ok((i, o)) => tuple_parser!(i, (o), $($rest)*),
+ }
+ };
+
+ ($i:expr, ($($parsed:tt)*), $submac:ident!( $($args:tt)* ), $($rest:tt)*) => {
+ match $submac!($i, $($args)*) {
+ Err(LexError) => Err(LexError),
+ Ok((i, o)) => tuple_parser!(i, ($($parsed)* , o), $($rest)*),
+ }
+ };
+
+ ($i:expr, ($($parsed:tt),*), $e:ident) => {
+ tuple_parser!($i, ($($parsed),*), call!($e))
+ };
+
+ ($i:expr, (), $submac:ident!( $($args:tt)* )) => {
+ $submac!($i, $($args)*)
+ };
+
+ ($i:expr, ($($parsed:expr),*), $submac:ident!( $($args:tt)* )) => {
+ match $submac!($i, $($args)*) {
+ Err(LexError) => Err(LexError),
+ Ok((i, o)) => Ok((i, ($($parsed),*, o)))
+ }
+ };
+
+ ($i:expr, ($($parsed:expr),*)) => {
+ Ok(($i, ($($parsed),*)))
+ };
+}
+
+macro_rules! not {
+ ($i:expr, $submac:ident!( $($args:tt)* )) => {
+ match $submac!($i, $($args)*) {
+ Ok((_, _)) => Err(LexError),
+ Err(LexError) => Ok(($i, ())),
+ }
+ };
+}
+
+macro_rules! tag {
+ ($i:expr, $tag:expr) => {
+ if $i.starts_with($tag) {
+ Ok(($i.advance($tag.len()), &$i.rest[..$tag.len()]))
+ } else {
+ Err(LexError)
+ }
+ };
+}
+
+macro_rules! punct {
+ ($i:expr, $punct:expr) => {
+ $crate::strnom::punct($i, $punct)
+ };
+}
+
+/// Do not use directly. Use `punct!`.
+pub fn punct<'a>(input: Cursor<'a>, token: &'static str) -> PResult<'a, &'a str> {
+ let input = skip_whitespace(input);
+ if input.starts_with(token) {
+ Ok((input.advance(token.len()), token))
+ } else {
+ Err(LexError)
+ }
+}
+
+macro_rules! preceded {
+ ($i:expr, $submac:ident!( $($args:tt)* ), $submac2:ident!( $($args2:tt)* )) => {
+ match tuple!($i, $submac!($($args)*), $submac2!($($args2)*)) {
+ Ok((remaining, (_, o))) => Ok((remaining, o)),
+ Err(LexError) => Err(LexError),
+ }
+ };
+
+ ($i:expr, $submac:ident!( $($args:tt)* ), $g:expr) => {
+ preceded!($i, $submac!($($args)*), call!($g))
+ };
+}
+
+macro_rules! delimited {
+ ($i:expr, $submac:ident!( $($args:tt)* ), $($rest:tt)+) => {
+ match tuple_parser!($i, (), $submac!($($args)*), $($rest)*) {
+ Err(LexError) => Err(LexError),
+ Ok((i1, (_, o, _))) => Ok((i1, o))
+ }
+ };
+}
+
+macro_rules! map {
+ ($i:expr, $submac:ident!( $($args:tt)* ), $g:expr) => {
+ match $submac!($i, $($args)*) {
+ Err(LexError) => Err(LexError),
+ Ok((i, o)) => Ok((i, call!(o, $g)))
+ }
+ };
+
+ ($i:expr, $f:expr, $g:expr) => {
+ map!($i, call!($f), $g)
+ };
+}
+
+macro_rules! many0 {
+ ($i:expr, $f:expr) => {{
+ let ret;
+ let mut res = ::std::vec::Vec::new();
+ let mut input = $i;
+
+ loop {
+ if input.is_empty() {
+ ret = Ok((input, res));
+ break;
+ }
+
+ match $f(input) {
+ Err(LexError) => {
+ ret = Ok((input, res));
+ break;
+ }
+ Ok((i, o)) => {
+ // loop trip must always consume (otherwise infinite loops)
+ if i.len() == input.len() {
+ ret = Err(LexError);
+ break;
+ }
+
+ res.push(o);
+ input = i;
+ }
+ }
+ }
+
+ ret
+ }};
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/proc-macro2/src/unstable.rs
@@ -0,0 +1,406 @@
+use std::ascii;
+use std::fmt;
+use std::iter;
+use std::str::FromStr;
+
+use proc_macro;
+
+use {TokenTree, TokenNode, Delimiter, Spacing};
+
+#[derive(Clone)]
+pub struct TokenStream(proc_macro::TokenStream);
+
+pub struct LexError(proc_macro::LexError);
+
+impl TokenStream {
+ pub fn empty() -> TokenStream {
+ TokenStream(proc_macro::TokenStream::empty())
+ }
+
+ pub fn is_empty(&self) -> bool {
+ self.0.is_empty()
+ }
+}
+
+impl FromStr for TokenStream {
+ type Err = LexError;
+
+ fn from_str(src: &str) -> Result<TokenStream, LexError> {
+ Ok(TokenStream(src.parse().map_err(LexError)?))
+ }
+}
+
+impl fmt::Display for TokenStream {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ self.0.fmt(f)
+ }
+}
+
+impl From<proc_macro::TokenStream> for TokenStream {
+ fn from(inner: proc_macro::TokenStream) -> TokenStream {
+ TokenStream(inner)
+ }
+}
+
+impl From<TokenStream> for proc_macro::TokenStream {
+ fn from(inner: TokenStream) -> proc_macro::TokenStream {
+ inner.0
+ }
+}
+
+impl From<TokenTree> for TokenStream {
+ fn from(tree: TokenTree) -> TokenStream {
+ TokenStream(proc_macro::TokenTree {
+ span: (tree.span.0).0,
+ kind: match tree.kind {
+ TokenNode::Group(delim, s) => {
+ let delim = match delim {
+ Delimiter::Parenthesis => proc_macro::Delimiter::Parenthesis,
+ Delimiter::Bracket => proc_macro::Delimiter::Bracket,
+ Delimiter::Brace => proc_macro::Delimiter::Brace,
+ Delimiter::None => proc_macro::Delimiter::None,
+ };
+ proc_macro::TokenNode::Group(delim, (s.0).0)
+ }
+ TokenNode::Op(ch, kind) => {
+ let kind = match kind {
+ Spacing::Joint => proc_macro::Spacing::Joint,
+ Spacing::Alone => proc_macro::Spacing::Alone,
+ };
+ proc_macro::TokenNode::Op(ch, kind)
+ }
+ TokenNode::Term(s) => {
+ proc_macro::TokenNode::Term((s.0).0)
+ }
+ TokenNode::Literal(l) => {
+ proc_macro::TokenNode::Literal((l.0).0)
+ }
+ },
+ }.into())
+ }
+}
+
+impl iter::FromIterator<TokenStream> for TokenStream {
+ fn from_iter<I: IntoIterator<Item=TokenStream>>(streams: I) -> Self {
+ let streams = streams.into_iter().map(|s| s.0);
+ TokenStream(streams.collect::<proc_macro::TokenStream>())
+ }
+}
+
+impl fmt::Debug for TokenStream {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ self.0.fmt(f)
+ }
+}
+
+impl fmt::Debug for LexError {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ self.0.fmt(f)
+ }
+}
+
+pub struct TokenTreeIter(proc_macro::TokenTreeIter);
+
+impl IntoIterator for TokenStream {
+ type Item = TokenTree;
+ type IntoIter = TokenTreeIter;
+
+ fn into_iter(self) -> TokenTreeIter {
+ TokenTreeIter(self.0.into_iter())
+ }
+}
+
+impl Iterator for TokenTreeIter {
+ type Item = TokenTree;
+
+ fn next(&mut self) -> Option<TokenTree> {
+ let token = match self.0.next() {
+ Some(n) => n,
+ None => return None,
+ };
+ Some(TokenTree {
+ span: ::Span(Span(token.span)),
+ kind: match token.kind {
+ proc_macro::TokenNode::Group(delim, s) => {
+ let delim = match delim {
+ proc_macro::Delimiter::Parenthesis => Delimiter::Parenthesis,
+ proc_macro::Delimiter::Bracket => Delimiter::Bracket,
+ proc_macro::Delimiter::Brace => Delimiter::Brace,
+ proc_macro::Delimiter::None => Delimiter::None,
+ };
+ TokenNode::Group(delim, ::TokenStream(TokenStream(s)))
+ }
+ proc_macro::TokenNode::Op(ch, kind) => {
+ let kind = match kind {
+ proc_macro::Spacing::Joint => Spacing::Joint,
+ proc_macro::Spacing::Alone => Spacing::Alone,
+ };
+ TokenNode::Op(ch, kind)
+ }
+ proc_macro::TokenNode::Term(s) => {
+ TokenNode::Term(::Term(Term(s)))
+ }
+ proc_macro::TokenNode::Literal(l) => {
+ TokenNode::Literal(::Literal(Literal(l)))
+ }
+ },
+ })
+ }
+
+ fn size_hint(&self) -> (usize, Option<usize>) {
+ self.0.size_hint()
+ }
+}
+
+impl fmt::Debug for TokenTreeIter {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ f.debug_struct("TokenTreeIter").finish()
+ }
+}
+
+#[cfg(procmacro2_semver_exempt)]
+#[derive(Clone, PartialEq, Eq)]
+pub struct FileName(String);
+
+#[cfg(procmacro2_semver_exempt)]
+impl fmt::Display for FileName {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ self.0.fmt(f)
+ }
+}
+
+// NOTE: We have to generate our own filename object here because we can't wrap
+// the one provided by proc_macro.
+#[cfg(procmacro2_semver_exempt)]
+#[derive(Clone, PartialEq, Eq)]
+pub struct SourceFile(proc_macro::SourceFile, FileName);
+
+#[cfg(procmacro2_semver_exempt)]
+impl SourceFile {
+ fn new(sf: proc_macro::SourceFile) -> Self {
+ let filename = FileName(sf.path().to_string());
+ SourceFile(sf, filename)
+ }
+
+ /// Get the path to this source file as a string.
+ pub fn path(&self) -> &FileName {
+ &self.1
+ }
+
+ pub fn is_real(&self) -> bool {
+ self.0.is_real()
+ }
+}
+
+#[cfg(procmacro2_semver_exempt)]
+impl AsRef<FileName> for SourceFile {
+ fn as_ref(&self) -> &FileName {
+ self.path()
+ }
+}
+
+#[cfg(procmacro2_semver_exempt)]
+impl fmt::Debug for SourceFile {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ self.0.fmt(f)
+ }
+}
+
+#[cfg(procmacro2_semver_exempt)]
+pub struct LineColumn {
+ pub line: usize,
+ pub column: usize,
+}
+
+#[derive(Copy, Clone)]
+pub struct Span(proc_macro::Span);
+
+impl From<proc_macro::Span> for ::Span {
+ fn from(proc_span: proc_macro::Span) -> ::Span {
+ ::Span(Span(proc_span))
+ }
+}
+
+impl Span {
+ pub fn call_site() -> Span {
+ Span(proc_macro::Span::call_site())
+ }
+
+ pub fn def_site() -> Span {
+ Span(proc_macro::Span::def_site())
+ }
+
+ pub fn resolved_at(&self, other: Span) -> Span {
+ Span(self.0.resolved_at(other.0))
+ }
+
+ pub fn located_at(&self, other: Span) -> Span {
+ Span(self.0.located_at(other.0))
+ }
+
+ pub fn unstable(self) -> proc_macro::Span {
+ self.0
+ }
+
+ #[cfg(procmacro2_semver_exempt)]
+ pub fn source_file(&self) -> SourceFile {
+ SourceFile::new(self.0.source_file())
+ }
+
+ #[cfg(procmacro2_semver_exempt)]
+ pub fn start(&self) -> LineColumn {
+ let proc_macro::LineColumn{ line, column } = self.0.start();
+ LineColumn { line, column }
+ }
+
+ #[cfg(procmacro2_semver_exempt)]
+ pub fn end(&self) -> LineColumn {
+ let proc_macro::LineColumn{ line, column } = self.0.end();
+ LineColumn { line, column }
+ }
+
+ #[cfg(procmacro2_semver_exempt)]
+ pub fn join(&self, other: Span) -> Option<Span> {
+ self.0.join(other.0).map(Span)
+ }
+}
+
+impl fmt::Debug for Span {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ self.0.fmt(f)
+ }
+}
+
+#[derive(Copy, Clone)]
+pub struct Term(proc_macro::Term);
+
+impl Term {
+ pub fn intern(string: &str) -> Term {
+ Term(proc_macro::Term::intern(string))
+ }
+
+ pub fn as_str(&self) -> &str {
+ self.0.as_str()
+ }
+}
+
+impl fmt::Debug for Term {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ self.0.fmt(f)
+ }
+}
+
+#[derive(Clone)]
+pub struct Literal(proc_macro::Literal);
+
+impl Literal {
+ pub fn byte_char(byte: u8) -> Literal {
+ match byte {
+ 0 => Literal(to_literal("b'\\0'")),
+ b'\"' => Literal(to_literal("b'\"'")),
+ n => {
+ let mut escaped = "b'".to_string();
+ escaped.extend(ascii::escape_default(n).map(|c| c as char));
+ escaped.push('\'');
+ Literal(to_literal(&escaped))
+ }
+ }
+ }
+
+ pub fn byte_string(bytes: &[u8]) -> Literal {
+ Literal(proc_macro::Literal::byte_string(bytes))
+ }
+
+ pub fn doccomment(s: &str) -> Literal {
+ Literal(to_literal(s))
+ }
+
+ pub fn float(s: f64) -> Literal {
+ Literal(proc_macro::Literal::float(s))
+ }
+
+ pub fn integer(s: i64) -> Literal {
+ Literal(proc_macro::Literal::integer(s.into()))
+ }
+
+ pub fn raw_string(s: &str, pounds: usize) -> Literal {
+ let mut ret = format!("r");
+ ret.extend((0..pounds).map(|_| "#"));
+ ret.push('"');
+ ret.push_str(s);
+ ret.push('"');
+ ret.extend((0..pounds).map(|_| "#"));
+ Literal(to_literal(&ret))
+ }
+
+ pub fn raw_byte_string(s: &str, pounds: usize) -> Literal {
+ let mut ret = format!("br");
+ ret.extend((0..pounds).map(|_| "#"));
+ ret.push('"');
+ ret.push_str(s);
+ ret.push('"');
+ ret.extend((0..pounds).map(|_| "#"));
+ Literal(to_literal(&ret))
+ }
+}
+
+impl fmt::Display for Literal {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ self.0.fmt(f)
+ }
+}
+
+impl fmt::Debug for Literal {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ self.0.fmt(f)
+ }
+}
+
+fn to_literal(s: &str) -> proc_macro::Literal {
+ let stream = s.parse::<proc_macro::TokenStream>().unwrap();
+ match stream.into_iter().next().unwrap().kind {
+ proc_macro::TokenNode::Literal(l) => l,
+ _ => unreachable!(),
+ }
+}
+
+macro_rules! ints {
+ ($($t:ident,)*) => {$(
+ impl From<$t> for Literal {
+ fn from(t: $t) -> Literal {
+ Literal(proc_macro::Literal::$t(t))
+ }
+ }
+ )*}
+}
+
+ints! {
+ u8, u16, u32, u64, usize,
+ i8, i16, i32, i64, isize,
+}
+
+macro_rules! floats {
+ ($($t:ident,)*) => {$(
+ impl From<$t> for Literal {
+ fn from(t: $t) -> Literal {
+ Literal(proc_macro::Literal::$t(t))
+ }
+ }
+ )*}
+}
+
+floats! {
+ f32, f64,
+}
+
+impl<'a> From<&'a str> for Literal {
+ fn from(t: &'a str) -> Literal {
+ Literal(proc_macro::Literal::string(t))
+ }
+}
+
+impl From<char> for Literal {
+ fn from(t: char) -> Literal {
+ Literal(proc_macro::Literal::character(t))
+ }
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/proc-macro2/tests/test.rs
@@ -0,0 +1,179 @@
+extern crate proc_macro2;
+
+use std::str;
+
+use proc_macro2::{Term, Literal, TokenStream};
+
+#[cfg(procmacro2_semver_exempt)]
+use proc_macro2::TokenNode;
+
+#[cfg(procmacro2_semver_exempt)]
+#[cfg(not(feature = "nightly"))]
+use proc_macro2::Span;
+
+#[test]
+fn symbols() {
+ assert_eq!(Term::intern("foo").as_str(), "foo");
+ assert_eq!(Term::intern("bar").as_str(), "bar");
+}
+
+#[test]
+fn literals() {
+ assert_eq!(Literal::string("foo").to_string(), "\"foo\"");
+ assert_eq!(Literal::string("\"").to_string(), "\"\\\"\"");
+ assert_eq!(Literal::float(10.0).to_string(), "10.0");
+}
+
+#[test]
+fn roundtrip() {
+ fn roundtrip(p: &str) {
+ println!("parse: {}", p);
+ let s = p.parse::<TokenStream>().unwrap().to_string();
+ println!("first: {}", s);
+ let s2 = s.to_string().parse::<TokenStream>().unwrap().to_string();
+ assert_eq!(s, s2);
+ }
+ roundtrip("a");
+ roundtrip("<<");
+ roundtrip("<<=");
+ roundtrip("
+ /// a
+ wut
+ ");
+ roundtrip("
+ 1
+ 1.0
+ 1f32
+ 2f64
+ 1usize
+ 4isize
+ 4e10
+ 1_000
+ 1_0i32
+ 8u8
+ 9
+ 0
+ 0xffffffffffffffffffffffffffffffff
+ ");
+ roundtrip("'a");
+ roundtrip("'static");
+ roundtrip("'\\u{10__FFFF}'");
+ roundtrip("\"\\u{10_F0FF__}foo\\u{1_0_0_0__}\"");
+}
+
+#[test]
+fn fail() {
+ fn fail(p: &str) {
+ if p.parse::<TokenStream>().is_ok() {
+ panic!("should have failed to parse: {}", p);
+ }
+ }
+ fail("1x");
+ fail("1u80");
+ fail("1f320");
+ fail("' static");
+ fail("'mut");
+}
+
+#[cfg(procmacro2_semver_exempt)]
+#[test]
+fn span_test() {
+ fn check_spans(p: &str, mut lines: &[(usize, usize, usize, usize)]) {
+ let ts = p.parse::<TokenStream>().unwrap();
+ check_spans_internal(ts, &mut lines);
+ }
+
+ fn check_spans_internal(
+ ts: TokenStream,
+ lines: &mut &[(usize, usize, usize, usize)],
+ ) {
+ for i in ts {
+ if let Some((&(sline, scol, eline, ecol), rest)) = lines.split_first() {
+ *lines = rest;
+
+ let start = i.span.start();
+ assert_eq!(start.line, sline, "sline did not match for {}", i);
+ assert_eq!(start.column, scol, "scol did not match for {}", i);
+
+ let end = i.span.end();
+ assert_eq!(end.line, eline, "eline did not match for {}", i);
+ assert_eq!(end.column, ecol, "ecol did not match for {}", i);
+
+ match i.kind {
+ TokenNode::Group(_, stream) =>
+ check_spans_internal(stream, lines),
+ _ => {}
+ }
+ }
+ }
+ }
+
+ check_spans("\
+/// This is a document comment
+testing 123
+{
+ testing 234
+}", &[
+ (1, 0, 1, 30),
+ (2, 0, 2, 7),
+ (2, 8, 2, 11),
+ (3, 0, 5, 1),
+ (4, 2, 4, 9),
+ (4, 10, 4, 13),
+]);
+}
+
+#[cfg(procmacro2_semver_exempt)]
+#[cfg(not(feature = "nightly"))]
+#[test]
+fn default_span() {
+ let start = Span::call_site().start();
+ assert_eq!(start.line, 1);
+ assert_eq!(start.column, 0);
+ let end = Span::call_site().end();
+ assert_eq!(end.line, 1);
+ assert_eq!(end.column, 0);
+ let source_file = Span::call_site().source_file();
+ assert_eq!(source_file.path().to_string(), "<unspecified>");
+ assert!(!source_file.is_real());
+}
+
+#[cfg(procmacro2_semver_exempt)]
+#[test]
+fn span_join() {
+ let source1 =
+ "aaa\nbbb".parse::<TokenStream>().unwrap().into_iter().collect::<Vec<_>>();
+ let source2 =
+ "ccc\nddd".parse::<TokenStream>().unwrap().into_iter().collect::<Vec<_>>();
+
+ assert!(source1[0].span.source_file() != source2[0].span.source_file());
+ assert_eq!(source1[0].span.source_file(), source1[1].span.source_file());
+
+ let joined1 = source1[0].span.join(source1[1].span);
+ let joined2 = source1[0].span.join(source2[0].span);
+ assert!(joined1.is_some());
+ assert!(joined2.is_none());
+
+ let start = joined1.unwrap().start();
+ let end = joined1.unwrap().end();
+ assert_eq!(start.line, 1);
+ assert_eq!(start.column, 0);
+ assert_eq!(end.line, 2);
+ assert_eq!(end.column, 3);
+
+ assert_eq!(joined1.unwrap().source_file(), source1[0].span.source_file());
+}
+
+#[test]
+fn no_panic() {
+ let s = str::from_utf8(b"b\'\xc2\x86 \x00\x00\x00^\"").unwrap();
+ assert!(s.parse::<proc_macro2::TokenStream>().is_err());
+}
+
+#[test]
+fn tricky_doc_commaent() {
+ let stream = "/**/".parse::<proc_macro2::TokenStream>().unwrap();
+ let tokens = stream.into_iter().collect::<Vec<_>>();
+ assert!(tokens.is_empty(), "not empty -- {:?}", tokens);
+}
+
copy from third_party/rust/quote/.cargo-checksum.json
copy to third_party/rust/quote-0.3.15/.cargo-checksum.json
copy from third_party/rust/quote/Cargo.toml
copy to third_party/rust/quote-0.3.15/Cargo.toml
new file mode 100644
--- /dev/null
+++ b/third_party/rust/quote-0.3.15/LICENSE-APACHE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+Copyright [yyyy] [name of copyright owner]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
new file mode 100644
--- /dev/null
+++ b/third_party/rust/quote-0.3.15/LICENSE-MIT
@@ -0,0 +1,25 @@
+Copyright (c) 2016 The Rust Project Developers
+
+Permission is hereby granted, free of charge, to any
+person obtaining a copy of this software and associated
+documentation files (the "Software"), to deal in the
+Software without restriction, including without
+limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software
+is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice
+shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
+ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
+TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
+SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
copy from third_party/rust/quote/README.md
copy to third_party/rust/quote-0.3.15/README.md
rename from third_party/rust/quote/src/ident.rs
rename to third_party/rust/quote-0.3.15/src/ident.rs
copy from third_party/rust/quote/src/lib.rs
copy to third_party/rust/quote-0.3.15/src/lib.rs
copy from third_party/rust/quote/src/to_tokens.rs
copy to third_party/rust/quote-0.3.15/src/to_tokens.rs
copy from third_party/rust/quote/src/tokens.rs
copy to third_party/rust/quote-0.3.15/src/tokens.rs
copy from third_party/rust/quote/tests/test.rs
copy to third_party/rust/quote-0.3.15/tests/test.rs
--- a/third_party/rust/quote/.cargo-checksum.json
+++ b/third_party/rust/quote/.cargo-checksum.json
@@ -1,1 +1,1 @@
-{"files":{"Cargo.toml":"983b4a016a497eded8adc6a23963343693ab4520826a1bc916e6f8448c9bb309","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"c9a75f18b9ab2927829a208fc6aa2cf4e63b8420887ba29cdb265d6619ae82d5","README.md":"3390fa1362c73052a268ae97a4777c5bcd8e991f866f9cce88ddde8d0963fd4d","src/ident.rs":"830077b64dce8c8ede1fb6ab664cae72f5496f4ab6be21a5b4e3b5e4e57ec425","src/lib.rs":"f799c898057a4e8e1620b32c70e13d3fee7af3a0352a5a4a1da6393942d21cc7","src/to_tokens.rs":"a871cb84506fa9e0783ac29617d686327ce5d05a9711a3a10833430b00345ccc","src/tokens.rs":"9a6010d7c0c6ccbe8b7bb1dae99722c91fc0559ea6ac6ea03ab2baafc2ec77ae","tests/test.rs":"8951d46b62d6922cc5fc130759be9723a862947738dda25cc84ff8cfdfebf729"},"package":"7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a"}
\ No newline at end of file
+{"files":{"Cargo.toml":"c8e98953df6fdcc4bdf6a1b7d970c214e8f5eb0f21da327d1c0916735303cd3a","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"c9a75f18b9ab2927829a208fc6aa2cf4e63b8420887ba29cdb265d6619ae82d5","README.md":"f1812dcc3e666d6bebca97f3739058e1bd8de1a2542c9a8cb258d0a259bd59e1","src/lib.rs":"b63a044edeff7ae12d0733e0a7fe64babf9b593b624fa753639ad3f340f24031","src/to_tokens.rs":"3b7fe0934ce2d9c23d9851ec624349cfa6e9d5cd9ed31c67f25cecce50dc218f","src/tokens.rs":"963474535197c1a79bf60af570470e7a89dce43546ee3186920197fdb40bdd9b","tests/test.rs":"8db237707035f55af7c7ef82c2c3892a048411963dccd019da0148bacae8c3d2"},"package":"1eca14c727ad12702eb4b6bfb5a232287dcf8385cb8ca83a3eeaf6519c44c408"}
\ No newline at end of file
--- a/third_party/rust/quote/Cargo.toml
+++ b/third_party/rust/quote/Cargo.toml
@@ -1,10 +1,24 @@
+# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
+#
+# When uploading crates to the registry Cargo will automatically
+# "normalize" Cargo.toml files for maximal compatibility
+# with all versions of Cargo and also rewrite `path` dependencies
+# to registry (e.g. crates.io) dependencies
+#
+# If you believe there's an error in this file please file an
+# issue against the rust-lang/cargo repository. If you're
+# editing this file be aware that the upstream Cargo.toml
+# will likely look very different (and much more reasonable)
+
[package]
name = "quote"
-version = "0.3.15" # don't forget to update version in readme for breaking changes
+version = "0.4.2"
authors = ["David Tolnay <dtolnay@gmail.com>"]
-license = "MIT/Apache-2.0"
+include = ["Cargo.toml", "src/**/*.rs", "tests/**/*.rs", "README.md", "LICENSE-APACHE", "LICENSE-MIT"]
description = "Quasi-quoting macro quote!(...)"
-repository = "https://github.com/dtolnay/quote"
documentation = "https://docs.rs/quote/"
keywords = ["syn"]
-include = ["Cargo.toml", "src/**/*.rs", "tests/**/*.rs", "README.md", "LICENSE-APACHE", "LICENSE-MIT"]
+license = "MIT/Apache-2.0"
+repository = "https://github.com/dtolnay/quote"
+[dependencies.proc-macro2]
+version = "0.2"
--- a/third_party/rust/quote/README.md
+++ b/third_party/rust/quote/README.md
@@ -1,55 +1,68 @@
Rust Quasi-Quoting
==================
[](https://travis-ci.org/dtolnay/quote)
[](https://crates.io/crates/quote)
[](https://docs.rs/quote/)
-Quasi-quoting without a Syntex dependency, intended for use with [Macros
-1.1](https://github.com/rust-lang/rfcs/blob/master/text/1681-macros-1.1.md).
+This crate provides the [`quote!`] macro for turning Rust syntax tree data
+structures into tokens of source code.
+
+[`quote!`]: https://docs.rs/quote/0.4/quote/macro.quote.html
+
+Procedural macros in Rust receive a stream of tokens as input, execute arbitrary
+Rust code to determine how to manipulate those tokens, and produce a stream of
+tokens to hand back to the compiler to compile into the caller's crate.
+Quasi-quoting is a solution to one piece of that -- producing tokens to return
+to the compiler.
+
+The idea of quasi-quoting is that we write *code* that we treat as *data*.
+Within the `quote!` macro, we can write what looks like code to our text editor
+or IDE. We get all the benefits of the editor's brace matching, syntax
+highlighting, indentation, and maybe autocompletion. But rather than compiling
+that as code into the current crate, we can treat it as data, pass it around,
+mutate it, and eventually hand it back to the compiler as tokens to compile into
+the macro caller's crate.
+
+This crate is motivated by the procedural macro use case, but is a
+general-purpose Rust quasi-quoting library and is not specific to procedural
+macros.
+
+*Version requirement: Quote supports any compiler version back to Rust's very
+first support for procedural macros in Rust 1.15.0.*
```toml
[dependencies]
-quote = "0.3"
+quote = "0.4"
```
```rust
#[macro_use]
extern crate quote;
```
-## What is quasi-quoting?
-
-Quasi-quoting is a way of writing code and treating it as data, similar to
-writing code inside of a double-quoted string literal except more friendly to
-your text editor or IDE. It does not get in the way of syntax highlighting,
-brace matching, indentation, or autocompletion, all of which you would lose by
-writing code inside of double quotes.
-
-Check out
-[my meetup talk](https://air.mozilla.org/rust-meetup-december-2016-12-15/)
-on the topic to learn more about the use case. Start the video at 3:00.
-
-This crate is motivated by the Macros 1.1 use case, but is a general-purpose
-Rust quasi-quoting library and is not specific to procedural macros.
-
## Syntax
-The quote crate provides a `quote!` macro within which you can write Rust code
-that gets packaged into a `quote::Tokens` and can be treated as data. You should
-think of `quote::Tokens` as representing a fragment of Rust source code. Call
-`to_string()` or `as_str()` on a Tokens to get back the fragment of source code
-as a string.
+The quote crate provides a [`quote!`] macro within which you can write Rust code
+that gets packaged into a [`quote::Tokens`] and can be treated as data. You
+should think of `Tokens` as representing a fragment of Rust source code. Call
+`to_string()` on a `Tokens` to get back the fragment of source code as a string,
+or call `into()` to stream them as a `TokenStream` back to the compiler in a
+procedural macro.
+
+[`quote::Tokens`]: https://docs.rs/quote/0.4/quote/struct.Tokens.html
Within the `quote!` macro, interpolation is done with `#var`. Any type
-implementing the `quote::ToTokens` trait can be interpolated. This includes most
-Rust primitive types as well as most of the syntax tree types from
-[`syn`](https://github.com/dtolnay/syn).
+implementing the [`quote::ToTokens`] trait can be interpolated. This includes
+most Rust primitive types as well as most of the syntax tree types from [`syn`].
+
+[`quote::ToTokens`]: https://docs.rs/quote/0.4/quote/trait.ToTokens.html
+[`syn`]: https://github.com/dtolnay/syn
```rust
let tokens = quote! {
struct SerializeWith #generics #where_clause {
value: &'a #field_ty,
phantom: ::std::marker::PhantomData<#item_ty>,
}
@@ -63,29 +76,47 @@ let tokens = quote! {
SerializeWith {
value: #value,
phantom: ::std::marker::PhantomData::<#item_ty>,
}
};
```
-Repetition is done using `#(...)*` or `#(...),*` very similar to `macro_rules!`:
+## Repetition
-- `#(#var)*` - no separators
-- `#(#var),*` - the character before the asterisk is used as a separator
-- `#( struct #var; )*` - the repetition can contain other things
-- `#( #k => println!("{}", #v), )*` - even multiple interpolations
+Repetition is done using `#(...)*` or `#(...),*` similar to `macro_rules!`. This
+iterates through the elements of any variable interpolated within the repetition
+and inserts a copy of the repetition body for each one. The variables in an
+interpolation may be anything that implements `IntoIterator`, including `Vec` or
+a pre-existing iterator.
+
+- `#(#var)*` — no separators
+- `#(#var),*` — the character before the asterisk is used as a separator
+- `#( struct #var; )*` — the repetition can contain other things
+- `#( #k => println!("{}", #v), )*` — even multiple interpolations
-Tokens can be interpolated into other quotes:
+Note that there is a difference between `#(#var ,)*` and `#(#var),*`—the latter
+does not produce a trailing comma. This matches the behavior of delimiters in
+`macro_rules!`.
+
+## Hygiene
-```rust
-let t = quote! { /* ... */ };
-return quote! { /* ... */ #t /* ... */ };
-```
+Any interpolated tokens preserve the `Span` information provided by their
+`ToTokens` implementation. Tokens that originate within a `quote!` invocation
+are spanned with [`Span::def_site()`].
+
+[`Span::def_site()`]: https://docs.rs/proc-macro2/0.2/proc_macro2/struct.Span.html#method.def_site
+
+A different span can be provided explicitly through the [`quote_spanned!`]
+macro.
+
+[`quote_spanned!`]: https://docs.rs/quote/0.4/quote/macro.quote_spanned.html
+
+### Recursion limit
The `quote!` macro relies on deep recursion so some large invocations may fail
with "recursion limit reached" when you compile. If it fails, bump up the
recursion limit by adding `#![recursion_limit = "128"]` to your crate. An even
higher limit may be necessary for especially large invocations. You don't need
this unless the compiler tells you that you need it.
## License
--- a/third_party/rust/quote/src/lib.rs
+++ b/third_party/rust/quote/src/lib.rs
@@ -1,24 +1,70 @@
-//! Quasi-quoting without a Syntex dependency, intended for use with [Macros
-//! 1.1](https://github.com/rust-lang/rfcs/blob/master/text/1681-macros-1.1.md).
+//! This crate provides the [`quote!`] macro for turning Rust syntax tree data
+//! structures into tokens of source code.
+//!
+//! [`quote!`]: macro.quote.html
+//!
+//! Procedural macros in Rust receive a stream of tokens as input, execute
+//! arbitrary Rust code to determine how to manipulate those tokens, and produce
+//! a stream of tokens to hand back to the compiler to compile into the caller's
+//! crate. Quasi-quoting is a solution to one piece of that -- producing tokens
+//! to return to the compiler.
+//!
+//! The idea of quasi-quoting is that we write *code* that we treat as *data*.
+//! Within the `quote!` macro, we can write what looks like code to our text
+//! editor or IDE. We get all the benefits of the editor's brace matching,
+//! syntax highlighting, indentation, and maybe autocompletion. But rather than
+//! compiling that as code into the current crate, we can treat it as data, pass
+//! it around, mutate it, and eventually hand it back to the compiler as tokens
+//! to compile into the macro caller's crate.
+//!
+//! This crate is motivated by the procedural macro use case, but is a
+//! general-purpose Rust quasi-quoting library and is not specific to procedural
+//! macros.
+//!
+//! *Version requirement: Quote supports any compiler version back to Rust's
+//! very first support for procedural macros in Rust 1.15.0.*
//!
//! ```toml
//! [dependencies]
-//! quote = "0.3"
+//! quote = "0.4"
//! ```
//!
-//! ```rust,ignore
+//! ```
//! #[macro_use]
//! extern crate quote;
+//! #
+//! # fn main() {}
//! ```
//!
-//! Interpolation is done with `#var`:
+//! # Example
+//!
+//! The following quasi-quoted block of code is something you might find in [a]
+//! procedural macro having to do with data structure serialization. The `#var`
+//! syntax performs interpolation of runtime variables into the quoted tokens.
+//! Check out the documentation of the [`quote!`] macro for more detail about
+//! the syntax. See also the [`quote_spanned!`] macro which is important for
+//! implementing hygienic procedural macros.
+//!
+//! [a]: https://serde.rs/
+//! [`quote_spanned!`]: macro.quote_spanned.html
//!
-//! ```text
+//! ```
+//! # #[macro_use]
+//! # extern crate quote;
+//! #
+//! # fn main() {
+//! # let generics = "";
+//! # let where_clause = "";
+//! # let field_ty = "";
+//! # let item_ty = "";
+//! # let path = "";
+//! # let value = "";
+//! #
//! let tokens = quote! {
//! struct SerializeWith #generics #where_clause {
//! value: &'a #field_ty,
//! phantom: ::std::marker::PhantomData<#item_ty>,
//! }
//!
//! impl #generics serde::Serialize for SerializeWith #generics #where_clause {
//! fn serialize<S>(&self, s: &mut S) -> Result<(), S::Error>
@@ -28,61 +74,251 @@
//! }
//! }
//!
//! SerializeWith {
//! value: #value,
//! phantom: ::std::marker::PhantomData::<#item_ty>,
//! }
//! };
+//! #
+//! # }
//! ```
//!
-//! Repetition is done using `#(...)*` or `#(...),*` very similar to `macro_rules!`:
-//!
-//! - `#(#var)*` - no separators
-//! - `#(#var),*` - the character before the asterisk is used as a separator
-//! - `#( struct #var; )*` - the repetition can contain other things
-//! - `#( #k => println!("{}", #v), )*` - even multiple interpolations
-//!
-//! The return type of `quote!` is `quote::Tokens`. Tokens can be interpolated into
-//! other quotes:
+//! ## Recursion limit
//!
-//! ```text
-//! let t = quote! { /* ... */ };
-//! return quote! { /* ... */ #t /* ... */ };
-//! ```
-//!
-//! Call `to_string()` or `as_str()` on a Tokens to get a `String` or `&str` of Rust
-//! code.
-//!
-//! The `quote!` macro relies on deep recursion so some large invocations may fail
-//! with "recursion limit reached" when you compile. If it fails, bump up the
-//! recursion limit by adding `#![recursion_limit = "128"]` to your crate. An even
-//! higher limit may be necessary for especially large invocations.
+//! The `quote!` macro relies on deep recursion so some large invocations may
+//! fail with "recursion limit reached" when you compile. If it fails, bump up
+//! the recursion limit by adding `#![recursion_limit = "128"]` to your crate.
+//! An even higher limit may be necessary for especially large invocations.
+
+// Quote types in rustdoc of other crates get linked to here.
+#![doc(html_root_url = "https://docs.rs/quote/0.4.2")]
+
+extern crate proc_macro2;
+extern crate proc_macro;
mod tokens;
pub use tokens::Tokens;
mod to_tokens;
-pub use to_tokens::{ToTokens, ByteStr, Hex};
+pub use to_tokens::ToTokens;
+
+// Not public API.
+#[doc(hidden)]
+pub mod __rt {
+ // Not public API.
+ pub use proc_macro2::*;
-mod ident;
-pub use ident::Ident;
+ // Not public API.
+ pub fn parse(tokens: &mut ::Tokens, span: Span, s: &str) {
+ let s: TokenStream = s.parse().expect("invalid token stream");
+ tokens.append_all(s.into_iter().map(|mut t| {
+ t.span = span;
+ t
+ }));
+ }
+
+ // Not public API.
+ pub fn append_kind(tokens: &mut ::Tokens, span: Span, kind: TokenNode) {
+ tokens.append(TokenTree {
+ span: span,
+ kind: kind,
+ })
+ }
+}
/// The whole point.
+///
+/// Performs variable interpolation against the input and produces it as
+/// [`Tokens`]. For returning tokens to the compiler in a procedural macro, use
+/// `into()` to build a `TokenStream`.
+///
+/// [`Tokens`]: struct.Tokens.html
+///
+/// # Interpolation
+///
+/// Variable interpolation is done with `#var` (similar to `$var` in
+/// `macro_rules!` macros). This grabs the `var` variable that is currently in
+/// scope and inserts it in that location in the output tokens. The variable
+/// must implement the [`ToTokens`] trait.
+///
+/// [`ToTokens`]: trait.ToTokens.html
+///
+/// Repetition is done using `#(...)*` or `#(...),*` again similar to
+/// `macro_rules!`. This iterates through the elements of any variable
+/// interpolated within the repetition and inserts a copy of the repetition body
+/// for each one. The variables in an interpolation may be anything that
+/// implements `IntoIterator`, including `Vec` or a pre-existing iterator.
+///
+/// - `#(#var)*` — no separators
+/// - `#(#var),*` — the character before the asterisk is used as a separator
+/// - `#( struct #var; )*` — the repetition can contain other tokens
+/// - `#( #k => println!("{}", #v), )*` — even multiple interpolations
+///
+/// # Hygiene
+///
+/// Any interpolated tokens preserve the `Span` information provided by their
+/// `ToTokens` implementation. Tokens that originate within the `quote!`
+/// invocation are spanned with [`Span::def_site()`].
+///
+/// [`Span::def_site()`]: https://docs.rs/proc-macro2/0.2/proc_macro2/struct.Span.html#method.def_site
+///
+/// A different span can be provided through the [`quote_spanned!`] macro.
+///
+/// [`quote_spanned!`]: macro.quote_spanned.html
+///
+/// # Example
+///
+/// ```
+/// extern crate proc_macro;
+///
+/// #[macro_use]
+/// extern crate quote;
+///
+/// use proc_macro::TokenStream;
+///
+/// # const IGNORE_TOKENS: &'static str = stringify! {
+/// #[proc_macro_derive(HeapSize)]
+/// # };
+/// pub fn derive_heap_size(input: TokenStream) -> TokenStream {
+/// // Parse the input and figure out what implementation to generate...
+/// # const IGNORE_TOKENS: &'static str = stringify! {
+/// let name = /* ... */;
+/// let expr = /* ... */;
+/// # };
+/// #
+/// # let name = 0;
+/// # let expr = 0;
+///
+/// let expanded = quote! {
+/// // The generated impl.
+/// impl ::heapsize::HeapSize for #name {
+/// fn heap_size_of_children(&self) -> usize {
+/// #expr
+/// }
+/// }
+/// };
+///
+/// // Hand the output tokens back to the compiler.
+/// expanded.into()
+/// }
+/// #
+/// # fn main() {}
+/// ```
#[macro_export]
macro_rules! quote {
- () => {
- $crate::Tokens::new()
- };
+ ($($tt:tt)*) => (quote_spanned!($crate::__rt::Span::def_site()=> $($tt)*));
+}
- ($($tt:tt)+) => {
+/// Same as `quote!`, but applies a given span to all tokens originating within
+/// the macro invocation.
+///
+/// # Syntax
+///
+/// A span expression of type [`Span`], followed by `=>`, followed by the tokens
+/// to quote. The span expression should be brief -- use a variable for anything
+/// more than a few characters. There should be no space before the `=>` token.
+///
+/// [`Span`]: https://docs.rs/proc-macro2/0.2/proc_macro2/struct.Span.html
+///
+/// ```
+/// # #[macro_use]
+/// # extern crate quote;
+/// # extern crate proc_macro2;
+/// #
+/// # use proc_macro2::Span;
+/// #
+/// # fn main() {
+/// # const IGNORE_TOKENS: &'static str = stringify! {
+/// let span = /* ... */;
+/// # };
+/// # let span = Span::call_site();
+/// # let init = 0;
+///
+/// // On one line, use parentheses.
+/// let tokens = quote_spanned!(span=> Box::into_raw(Box::new(#init)));
+///
+/// // On multiple lines, place the span at the top and use braces.
+/// let tokens = quote_spanned! {span=>
+/// Box::into_raw(Box::new(#init))
+/// };
+/// # }
+/// ```
+///
+/// # Hygiene
+///
+/// Any interpolated tokens preserve the `Span` information provided by their
+/// `ToTokens` implementation. Tokens that originate within the `quote_spanned!`
+/// invocation are spanned with the given span argument.
+///
+/// # Example
+///
+/// The following procedural macro code uses `quote_spanned!` to assert that a
+/// particular Rust type implements the [`Sync`] trait so that references can be
+/// safely shared between threads.
+///
+/// [`Sync`]: https://doc.rust-lang.org/std/marker/trait.Sync.html
+///
+/// ```
+/// # #[macro_use]
+/// # extern crate quote;
+/// # extern crate proc_macro2;
+/// #
+/// # use quote::{Tokens, ToTokens};
+/// # use proc_macro2::Span;
+/// #
+/// # struct Type;
+/// #
+/// # impl Type {
+/// # fn span(&self) -> Span {
+/// # Span::call_site()
+/// # }
+/// # }
+/// #
+/// # impl ToTokens for Type {
+/// # fn to_tokens(&self, _tokens: &mut Tokens) {}
+/// # }
+/// #
+/// # fn main() {
+/// # let ty = Type;
+/// # let def_site = Span::def_site();
+/// #
+/// let ty_span = ty.span().resolved_at(def_site);
+/// let assert_sync = quote_spanned! {ty_span=>
+/// struct _AssertSync where #ty: Sync;
+/// };
+/// # }
+/// ```
+///
+/// If the assertion fails, the user will see an error like the following. The
+/// input span of their type is hightlighted in the error.
+///
+/// ```text
+/// error[E0277]: the trait bound `*const (): std::marker::Sync` is not satisfied
+/// --> src/main.rs:10:21
+/// |
+/// 10 | static ref PTR: *const () = &();
+/// | ^^^^^^^^^ `*const ()` cannot be shared between threads safely
+/// ```
+///
+/// In this example it is important for the where-clause to be spanned with the
+/// line/column information of the user's input type so that error messages are
+/// placed appropriately by the compiler. But it is also incredibly important
+/// that `Sync` resolves at the macro definition site and not the macro call
+/// site. If we resolve `Sync` at the same span that the user's type is going to
+/// be resolved, then they could bypass our check by defining their own trait
+/// named `Sync` that is implemented for their type.
+#[macro_export]
+macro_rules! quote_spanned {
+ ($span:expr=> $($tt:tt)*) => {
{
let mut _s = $crate::Tokens::new();
- quote_each_token!(_s $($tt)*);
+ let _span = $span;
+ quote_each_token!(_s _span $($tt)*);
_s
}
};
}
// Extract the names of all #metavariables and pass them to the $finish macro.
//
// in: pounded_var_names!(then () a #b c #( #d )* #e)
@@ -179,74 +415,87 @@ macro_rules! multi_zip_expr {
(($done:expr)) => {
$done
};
}
#[macro_export]
#[doc(hidden)]
macro_rules! quote_each_token {
- ($tokens:ident) => {};
+ ($tokens:ident $span:ident) => {};
- ($tokens:ident # ! $($rest:tt)*) => {
- $tokens.append("#");
- $tokens.append("!");
- quote_each_token!($tokens $($rest)*);
+ ($tokens:ident $span:ident # ! $($rest:tt)*) => {
+ quote_each_token!($tokens $span #);
+ quote_each_token!($tokens $span !);
+ quote_each_token!($tokens $span $($rest)*);
};
- ($tokens:ident # ( $($inner:tt)* ) * $($rest:tt)*) => {
+ ($tokens:ident $span:ident # ( $($inner:tt)* ) * $($rest:tt)*) => {
for pounded_var_names!(nested_tuples_pat () $($inner)*)
in pounded_var_names!(multi_zip_expr () $($inner)*) {
- quote_each_token!($tokens $($inner)*);
+ quote_each_token!($tokens $span $($inner)*);
}
- quote_each_token!($tokens $($rest)*);
+ quote_each_token!($tokens $span $($rest)*);
};
- ($tokens:ident # ( $($inner:tt)* ) $sep:tt * $($rest:tt)*) => {
+ ($tokens:ident $span:ident # ( $($inner:tt)* ) $sep:tt * $($rest:tt)*) => {
for (_i, pounded_var_names!(nested_tuples_pat () $($inner)*))
in pounded_var_names!(multi_zip_expr () $($inner)*).into_iter().enumerate() {
if _i > 0 {
- $tokens.append(stringify!($sep));
+ quote_each_token!($tokens $span $sep);
}
- quote_each_token!($tokens $($inner)*);
+ quote_each_token!($tokens $span $($inner)*);
}
- quote_each_token!($tokens $($rest)*);
+ quote_each_token!($tokens $span $($rest)*);
};
- ($tokens:ident # [ $($inner:tt)* ] $($rest:tt)*) => {
- $tokens.append("#");
- $tokens.append("[");
- quote_each_token!($tokens $($inner)*);
- $tokens.append("]");
- quote_each_token!($tokens $($rest)*);
+ ($tokens:ident $span:ident # [ $($inner:tt)* ] $($rest:tt)*) => {
+ quote_each_token!($tokens $span #);
+ $crate::__rt::append_kind(&mut $tokens,
+ $span,
+ $crate::__rt::TokenNode::Group(
+ $crate::__rt::Delimiter::Bracket,
+ quote_spanned!($span=> $($inner)*).into()
+ ));
+ quote_each_token!($tokens $span $($rest)*);
};
- ($tokens:ident # $first:ident $($rest:tt)*) => {
+ ($tokens:ident $span:ident # $first:ident $($rest:tt)*) => {
$crate::ToTokens::to_tokens(&$first, &mut $tokens);
- quote_each_token!($tokens $($rest)*);
+ quote_each_token!($tokens $span $($rest)*);
};
- ($tokens:ident ( $($first:tt)* ) $($rest:tt)*) => {
- $tokens.append("(");
- quote_each_token!($tokens $($first)*);
- $tokens.append(")");
- quote_each_token!($tokens $($rest)*);
+ ($tokens:ident $span:ident ( $($first:tt)* ) $($rest:tt)*) => {
+ $crate::__rt::append_kind(&mut $tokens,
+ $span,
+ $crate::__rt::TokenNode::Group(
+ $crate::__rt::Delimiter::Parenthesis,
+ quote_spanned!($span=> $($first)*).into()
+ ));
+ quote_each_token!($tokens $span $($rest)*);
};
- ($tokens:ident [ $($first:tt)* ] $($rest:tt)*) => {
- $tokens.append("[");
- quote_each_token!($tokens $($first)*);
- $tokens.append("]");
- quote_each_token!($tokens $($rest)*);
+ ($tokens:ident $span:ident [ $($first:tt)* ] $($rest:tt)*) => {
+ $crate::__rt::append_kind(&mut $tokens,
+ $span,
+ $crate::__rt::TokenNode::Group(
+ $crate::__rt::Delimiter::Bracket,
+ quote_spanned!($span=> $($first)*).into()
+ ));
+ quote_each_token!($tokens $span $($rest)*);
};
- ($tokens:ident { $($first:tt)* } $($rest:tt)*) => {
- $tokens.append("{");
- quote_each_token!($tokens $($first)*);
- $tokens.append("}");
- quote_each_token!($tokens $($rest)*);
+ ($tokens:ident $span:ident { $($first:tt)* } $($rest:tt)*) => {
+ $crate::__rt::append_kind(&mut $tokens,
+ $span,
+ $crate::__rt::TokenNode::Group(
+ $crate::__rt::Delimiter::Brace,
+ quote_spanned!($span=> $($first)*).into()
+ ));
+ quote_each_token!($tokens $span $($rest)*);
};
- ($tokens:ident $first:tt $($rest:tt)*) => {
- $tokens.append(stringify!($first));
- quote_each_token!($tokens $($rest)*);
+ ($tokens:ident $span:ident $first:tt $($rest:tt)*) => {
+ // TODO: this seems slow... special case some `:tt` arguments?
+ $crate::__rt::parse(&mut $tokens, $span, stringify!($first));
+ quote_each_token!($tokens $span $($rest)*);
};
}
--- a/third_party/rust/quote/src/to_tokens.rs
+++ b/third_party/rust/quote/src/to_tokens.rs
@@ -1,37 +1,85 @@
use super::Tokens;
use std::borrow::Cow;
-/// Types that can be interpolated inside a `quote!(...)` invocation.
+use proc_macro2::{Literal, Span, Term, TokenNode, TokenTree, TokenStream};
+
+fn tt(kind: TokenNode) -> TokenTree {
+ TokenTree {
+ span: Span::def_site(),
+ kind: kind,
+ }
+}
+
+/// Types that can be interpolated inside a [`quote!`] invocation.
+///
+/// [`quote!`]: macro.quote.html
pub trait ToTokens {
/// Write `self` to the given `Tokens`.
///
/// Example implementation for a struct representing Rust paths like
/// `std::cmp::PartialEq`:
///
- /// ```ignore
+ /// ```
+ /// extern crate quote;
+ /// use quote::{Tokens, ToTokens};
+ ///
+ /// extern crate proc_macro2;
+ /// use proc_macro2::{TokenTree, TokenNode, Spacing, Span};
+ ///
/// pub struct Path {
/// pub global: bool,
/// pub segments: Vec<PathSegment>,
/// }
///
/// impl ToTokens for Path {
/// fn to_tokens(&self, tokens: &mut Tokens) {
/// for (i, segment) in self.segments.iter().enumerate() {
/// if i > 0 || self.global {
- /// tokens.append("::");
+ /// // Double colon `::`
+ /// tokens.append(TokenTree {
+ /// span: Span::def_site(),
+ /// kind: TokenNode::Op(':', Spacing::Joint),
+ /// });
+ /// tokens.append(TokenTree {
+ /// span: Span::def_site(),
+ /// kind: TokenNode::Op(':', Spacing::Alone),
+ /// });
/// }
/// segment.to_tokens(tokens);
/// }
/// }
/// }
+ /// #
+ /// # pub struct PathSegment;
+ /// #
+ /// # impl ToTokens for PathSegment {
+ /// # fn to_tokens(&self, tokens: &mut Tokens) {
+ /// # unimplemented!()
+ /// # }
+ /// # }
+ /// #
+ /// # fn main() {}
/// ```
- fn to_tokens(&self, &mut Tokens);
+ fn to_tokens(&self, tokens: &mut Tokens);
+
+ /// Convert `self` directly into a `Tokens` object.
+ ///
+ /// This method is implicitly implemented using `to_tokens`, and acts as a
+ /// convenience method for consumers of the `ToTokens` trait.
+ fn into_tokens(self) -> Tokens
+ where
+ Self: Sized,
+ {
+ let mut tokens = Tokens::new();
+ self.to_tokens(&mut tokens);
+ tokens
+ }
}
impl<'a, T: ?Sized + ToTokens> ToTokens for &'a T {
fn to_tokens(&self, tokens: &mut Tokens) {
(**self).to_tokens(tokens);
}
}
@@ -52,306 +100,76 @@ impl<T: ToTokens> ToTokens for Option<T>
if let Some(ref t) = *self {
t.to_tokens(tokens);
}
}
}
impl ToTokens for str {
fn to_tokens(&self, tokens: &mut Tokens) {
- let mut escaped = "\"".to_string();
- for ch in self.chars() {
- match ch {
- '\0' => escaped.push_str(r"\0"),
- '\'' => escaped.push_str("'"),
- _ => escaped.extend(ch.escape_default().map(|c| c as char)),
- }
- }
- escaped.push('"');
-
- tokens.append(&escaped);
+ tokens.append(tt(TokenNode::Literal(Literal::string(self))));
}
}
impl ToTokens for String {
fn to_tokens(&self, tokens: &mut Tokens) {
self.as_str().to_tokens(tokens);
}
}
-impl ToTokens for char {
- fn to_tokens(&self, tokens: &mut Tokens) {
- match *self {
- '\0' => tokens.append(r"'\0'"),
- '"' => tokens.append("'\"'"),
- _ => tokens.append(&format!("{:?}", self)),
+macro_rules! primitive {
+ ($($t:ident)*) => ($(
+ impl ToTokens for $t {
+ fn to_tokens(&self, tokens: &mut Tokens) {
+ tokens.append(tt(TokenNode::Literal(Literal::$t(*self))));
+ }
}
- }
+ )*)
}
-/// Wrap a `&str` so it interpolates as a byte-string: `b"abc"`.
-#[derive(Debug)]
-pub struct ByteStr<'a>(pub &'a str);
+primitive! {
+ i8 i16 i32 i64 isize
+ u8 u16 u32 u64 usize
+ f32 f64
+}
-impl<'a> ToTokens for ByteStr<'a> {
+impl ToTokens for char {
fn to_tokens(&self, tokens: &mut Tokens) {
- let mut escaped = "b\"".to_string();
- for b in self.0.bytes() {
- match b {
- b'\0' => escaped.push_str(r"\0"),
- b'\t' => escaped.push_str(r"\t"),
- b'\n' => escaped.push_str(r"\n"),
- b'\r' => escaped.push_str(r"\r"),
- b'"' => escaped.push_str("\\\""),
- b'\\' => escaped.push_str("\\\\"),
- b'\x20' ... b'\x7E' => escaped.push(b as char),
- _ => escaped.push_str(&format!("\\x{:02X}", b)),
- }
- }
- escaped.push('"');
-
- tokens.append(&escaped);
+ tokens.append(tt(TokenNode::Literal(Literal::character(*self))));
}
}
-macro_rules! impl_to_tokens_display {
- ($ty:ty) => {
- impl ToTokens for $ty {
- fn to_tokens(&self, tokens: &mut Tokens) {
- tokens.append(&self.to_string());
- }
- }
- };
-}
-
-impl_to_tokens_display!(Tokens);
-impl_to_tokens_display!(bool);
-
-/// Wrap an integer so it interpolates as a hexadecimal.
-#[derive(Debug)]
-pub struct Hex<T>(pub T);
-
-macro_rules! impl_to_tokens_integer {
- ($ty:ty) => {
- impl ToTokens for $ty {
- fn to_tokens(&self, tokens: &mut Tokens) {
- tokens.append(&format!(concat!("{}", stringify!($ty)), self));
- }
- }
-
- impl ToTokens for Hex<$ty> {
- fn to_tokens(&self, tokens: &mut Tokens) {
- tokens.append(&format!(concat!("0x{:X}", stringify!($ty)), self.0));
- }
- }
- };
-}
-
-impl_to_tokens_integer!(i8);
-impl_to_tokens_integer!(i16);
-impl_to_tokens_integer!(i32);
-impl_to_tokens_integer!(i64);
-impl_to_tokens_integer!(isize);
-impl_to_tokens_integer!(u8);
-impl_to_tokens_integer!(u16);
-impl_to_tokens_integer!(u32);
-impl_to_tokens_integer!(u64);
-impl_to_tokens_integer!(usize);
-
-macro_rules! impl_to_tokens_floating {
- ($ty:ty) => {
- impl ToTokens for $ty {
- fn to_tokens(&self, tokens: &mut Tokens) {
- use std::num::FpCategory::*;
- match self.classify() {
- Zero | Subnormal | Normal => {
- tokens.append(&format!(concat!("{}", stringify!($ty)), self));
- }
- Nan => {
- tokens.append("::");
- tokens.append("std");
- tokens.append("::");
- tokens.append(stringify!($ty));
- tokens.append("::");
- tokens.append("NAN");
- }
- Infinite => {
- tokens.append("::");
- tokens.append("std");
- tokens.append("::");
- tokens.append(stringify!($ty));
- tokens.append("::");
- if self.is_sign_positive() {
- tokens.append("INFINITY");
- } else {
- tokens.append("NEG_INFINITY");
- }
- }
- }
- }
- }
- };
-}
-impl_to_tokens_floating!(f32);
-impl_to_tokens_floating!(f64);
-
-impl<T: ToTokens> ToTokens for [T] {
+impl ToTokens for bool {
fn to_tokens(&self, tokens: &mut Tokens) {
- tokens.append("[");
- for item in self {
- item.to_tokens(tokens);
- tokens.append(",");
- }
- tokens.append("]");
- }
-}
-
-impl<T: ToTokens> ToTokens for Vec<T> {
- fn to_tokens(&self, tokens: &mut Tokens) {
- self[..].to_tokens(tokens)
+ let word = if *self { "true" } else { "false" };
+ tokens.append(tt(TokenNode::Term(Term::intern(word))));
}
}
-macro_rules! array_impls {
- ($($N:expr)+) => {
- $(
- impl<T: ToTokens> ToTokens for [T; $N] {
- fn to_tokens(&self, tokens: &mut Tokens) {
- self[..].to_tokens(tokens)
- }
- }
- )+
+impl ToTokens for Term {
+ fn to_tokens(&self, tokens: &mut Tokens) {
+ tokens.append(tt(TokenNode::Term(*self)));
}
}
-array_impls! {
- 0 1 2 3 4 5 6 7 8 9
- 10 11 12 13 14 15 16 17 18 19
- 20 21 22 23 24 25 26 27 28 29
- 30 31 32
-}
-
-macro_rules! tuple_impls {
- ($(
- $Tuple:ident {
- $(($idx:tt) -> $T:ident)*
- }
- )+) => {
- $(
- impl<$($T: ToTokens),*> ToTokens for ($($T,)*) {
- fn to_tokens(&self, tokens: &mut Tokens) {
- tokens.append("(");
- $(
- self.$idx.to_tokens(tokens);
- tokens.append(",");
- )*
- tokens.append(")");
- }
- }
- )+
+impl ToTokens for Literal {
+ fn to_tokens(&self, tokens: &mut Tokens) {
+ tokens.append(tt(TokenNode::Literal(self.clone())));
}
}
-tuple_impls! {
- Tuple0 {}
- Tuple1 {
- (0) -> A
- }
- Tuple2 {
- (0) -> A
- (1) -> B
- }
- Tuple3 {
- (0) -> A
- (1) -> B
- (2) -> C
- }
- Tuple4 {
- (0) -> A
- (1) -> B
- (2) -> C
- (3) -> D
- }
- Tuple5 {
- (0) -> A
- (1) -> B
- (2) -> C
- (3) -> D
- (4) -> E
- }
- Tuple6 {
- (0) -> A
- (1) -> B
- (2) -> C
- (3) -> D
- (4) -> E
- (5) -> F
- }
- Tuple7 {
- (0) -> A
- (1) -> B
- (2) -> C
- (3) -> D
- (4) -> E
- (5) -> F
- (6) -> G
- }
- Tuple8 {
- (0) -> A
- (1) -> B
- (2) -> C
- (3) -> D
- (4) -> E
- (5) -> F
- (6) -> G
- (7) -> H
- }
- Tuple9 {
- (0) -> A
- (1) -> B
- (2) -> C
- (3) -> D
- (4) -> E
- (5) -> F
- (6) -> G
- (7) -> H
- (8) -> I
- }
- Tuple10 {
- (0) -> A
- (1) -> B
- (2) -> C
- (3) -> D
- (4) -> E
- (5) -> F
- (6) -> G
- (7) -> H
- (8) -> I
- (9) -> J
- }
- Tuple11 {
- (0) -> A
- (1) -> B
- (2) -> C
- (3) -> D
- (4) -> E
- (5) -> F
- (6) -> G
- (7) -> H
- (8) -> I
- (9) -> J
- (10) -> K
- }
- Tuple12 {
- (0) -> A
- (1) -> B
- (2) -> C
- (3) -> D
- (4) -> E
- (5) -> F
- (6) -> G
- (7) -> H
- (8) -> I
- (9) -> J
- (10) -> K
- (11) -> L
+impl ToTokens for TokenNode {
+ fn to_tokens(&self, tokens: &mut Tokens) {
+ tokens.append(tt(self.clone()));
}
}
+
+impl ToTokens for TokenTree {
+ fn to_tokens(&self, dst: &mut Tokens) {
+ dst.append(self.clone());
+ }
+}
+
+impl ToTokens for TokenStream {
+ fn to_tokens(&self, dst: &mut Tokens) {
+ dst.append_all(self.clone().into_iter());
+ }
+}
--- a/third_party/rust/quote/src/tokens.rs
+++ b/third_party/rust/quote/src/tokens.rs
@@ -1,47 +1,37 @@
use super::ToTokens;
-use std::fmt::{self, Display};
-use std::str::FromStr;
+use std::fmt::{self, Debug, Display};
+use std::hash::{Hash, Hasher};
+
+use proc_macro;
+use proc_macro2::{TokenStream, TokenTree};
-/// Tokens produced by a `quote!(...)` invocation.
-#[derive(Debug, Clone, Eq, PartialEq)]
-pub struct Tokens(String);
+/// Tokens produced by a [`quote!`] invocation.
+///
+/// [`quote!`]: macro.quote.html
+#[derive(Clone, Default)]
+pub struct Tokens {
+ tts: Vec<TokenTree>,
+}
impl Tokens {
/// Empty tokens.
pub fn new() -> Self {
- Tokens(String::new())
+ Tokens { tts: Vec::new() }
}
/// For use by `ToTokens` implementations.
///
- /// ```
- /// # #[macro_use] extern crate quote;
- /// # use quote::{Tokens, ToTokens};
- /// # fn main() {
- /// struct X;
- ///
- /// impl ToTokens for X {
- /// fn to_tokens(&self, tokens: &mut Tokens) {
- /// tokens.append("a");
- /// tokens.append("b");
- /// tokens.append("c");
- /// }
- /// }
- ///
- /// let tokens = quote!(#X);
- /// assert_eq!(tokens.as_str(), "a b c");
- /// # }
- /// ```
- pub fn append<T: AsRef<str>>(&mut self, token: T) {
- if !self.0.is_empty() && !token.as_ref().is_empty() {
- self.0.push(' ');
- }
- self.0.push_str(token.as_ref());
+ /// Appends the token specified to this list of tokens.
+ pub fn append<U>(&mut self, token: U)
+ where
+ U: Into<TokenTree>,
+ {
+ self.tts.push(token.into());
}
/// For use by `ToTokens` implementations.
///
/// ```
/// # #[macro_use] extern crate quote;
/// # use quote::{Tokens, ToTokens};
/// # fn main() {
@@ -49,108 +39,226 @@ impl Tokens {
///
/// impl ToTokens for X {
/// fn to_tokens(&self, tokens: &mut Tokens) {
/// tokens.append_all(&[true, false]);
/// }
/// }
///
/// let tokens = quote!(#X);
- /// assert_eq!(tokens.as_str(), "true false");
+ /// assert_eq!(tokens.to_string(), "true false");
/// # }
/// ```
pub fn append_all<T, I>(&mut self, iter: I)
- where T: ToTokens,
- I: IntoIterator<Item = T>
+ where
+ T: ToTokens,
+ I: IntoIterator<Item = T>,
{
for token in iter {
token.to_tokens(self);
}
}
/// For use by `ToTokens` implementations.
///
- /// ```
- /// # #[macro_use] extern crate quote;
- /// # use quote::{Tokens, ToTokens};
- /// # fn main() {
- /// struct X;
- ///
- /// impl ToTokens for X {
- /// fn to_tokens(&self, tokens: &mut Tokens) {
- /// tokens.append_separated(&[true, false], ",");
- /// }
- /// }
- ///
- /// let tokens = quote!(#X);
- /// assert_eq!(tokens.as_str(), "true , false");
- /// # }
- /// ```
- pub fn append_separated<T, I, S: AsRef<str>>(&mut self, iter: I, sep: S)
- where T: ToTokens,
- I: IntoIterator<Item = T>
+ /// Appends all of the items in the iterator `I`, separated by the tokens
+ /// `U`.
+ pub fn append_separated<T, I, U>(&mut self, iter: I, op: U)
+ where
+ T: ToTokens,
+ I: IntoIterator<Item = T>,
+ U: ToTokens,
{
for (i, token) in iter.into_iter().enumerate() {
if i > 0 {
- self.append(sep.as_ref());
+ op.to_tokens(self);
}
token.to_tokens(self);
}
}
/// For use by `ToTokens` implementations.
///
- /// ```
- /// # #[macro_use] extern crate quote;
- /// # use quote::{Tokens, ToTokens};
- /// # fn main() {
- /// struct X;
- ///
- /// impl ToTokens for X {
- /// fn to_tokens(&self, tokens: &mut Tokens) {
- /// tokens.append_terminated(&[true, false], ",");
- /// }
- /// }
- ///
- /// let tokens = quote!(#X);
- /// assert_eq!(tokens.as_str(), "true , false ,");
- /// # }
- /// ```
- pub fn append_terminated<T, I, S: AsRef<str>>(&mut self, iter: I, term: S)
- where T: ToTokens,
- I: IntoIterator<Item = T>
+ /// Appends all tokens in the iterator `I`, appending `U` after each
+ /// element, including after the last element of the iterator.
+ pub fn append_terminated<T, I, U>(&mut self, iter: I, term: U)
+ where
+ T: ToTokens,
+ I: IntoIterator<Item = T>,
+ U: ToTokens,
{
for token in iter {
token.to_tokens(self);
- self.append(term.as_ref());
+ term.to_tokens(self);
}
}
+}
+
+impl ToTokens for Tokens {
+ fn to_tokens(&self, dst: &mut Tokens) {
+ dst.tts.extend(self.tts.iter().cloned());
+ }
- pub fn as_str(&self) -> &str {
- &self.0
+ fn into_tokens(self) -> Tokens {
+ self
}
+}
- pub fn into_string(self) -> String {
- self.0
+impl From<Tokens> for TokenStream {
+ fn from(tokens: Tokens) -> TokenStream {
+ tokens.tts.into_iter().collect()
}
+}
- pub fn parse<T: FromStr>(&self) -> Result<T, T::Err> {
- FromStr::from_str(&self.0)
+impl From<Tokens> for proc_macro::TokenStream {
+ fn from(tokens: Tokens) -> proc_macro::TokenStream {
+ TokenStream::from(tokens).into()
}
}
-impl Default for Tokens {
- fn default() -> Self {
- Tokens::new()
+/// Allows a `Tokens` to be passed to `Tokens::append_all`.
+impl IntoIterator for Tokens {
+ type Item = TokenTree;
+ type IntoIter = private::IntoIter;
+
+ fn into_iter(self) -> Self::IntoIter {
+ private::into_iter(self.tts.into_iter())
+ }
+}
+
+mod private {
+ use std::vec;
+ use proc_macro2::TokenTree;
+
+ pub struct IntoIter(vec::IntoIter<TokenTree>);
+
+ pub fn into_iter(tts: vec::IntoIter<TokenTree>) -> IntoIter {
+ IntoIter(tts)
+ }
+
+ impl Iterator for IntoIter {
+ type Item = TokenTree;
+
+ fn next(&mut self) -> Option<Self::Item> {
+ self.0.next()
+ }
}
}
impl Display for Tokens {
- fn fmt(&self, formatter: &mut fmt::Formatter) -> Result<(), fmt::Error> {
- self.0.fmt(formatter)
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ Display::fmt(&TokenStream::from(self.clone()), formatter)
+ }
+}
+
+impl Debug for Tokens {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ struct DebugAsDisplay<'a, T: 'a>(&'a T);
+
+ impl<'a, T> Debug for DebugAsDisplay<'a, T>
+ where
+ T: Display,
+ {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ Display::fmt(self.0, formatter)
+ }
+ }
+
+ formatter
+ .debug_tuple("Tokens")
+ .field(&DebugAsDisplay(self))
+ .finish()
}
}
-impl AsRef<str> for Tokens {
- fn as_ref(&self) -> &str {
- &self.0
+fn tt_eq(a: &TokenTree, b: &TokenTree) -> bool {
+ use proc_macro2::{TokenNode, Delimiter, Spacing};
+
+ match (&a.kind, &b.kind) {
+ (&TokenNode::Group(d1, ref s1), &TokenNode::Group(d2, ref s2)) => {
+ match (d1, d2) {
+ (Delimiter::Parenthesis, Delimiter::Parenthesis)
+ | (Delimiter::Brace, Delimiter::Brace)
+ | (Delimiter::Bracket, Delimiter::Bracket)
+ | (Delimiter::None, Delimiter::None) => {}
+ _ => return false,
+ }
+
+ let s1 = s1.clone().into_iter();
+ let mut s2 = s2.clone().into_iter();
+
+ for item1 in s1 {
+ let item2 = match s2.next() {
+ Some(item) => item,
+ None => return false,
+ };
+ if !tt_eq(&item1, &item2) {
+ return false;
+ }
+ }
+ s2.next().is_none()
+ }
+ (&TokenNode::Op(o1, k1), &TokenNode::Op(o2, k2)) => {
+ o1 == o2 && match (k1, k2) {
+ (Spacing::Alone, Spacing::Alone) | (Spacing::Joint, Spacing::Joint) => true,
+ _ => false,
+ }
+ }
+ (&TokenNode::Literal(ref l1), &TokenNode::Literal(ref l2)) => {
+ l1.to_string() == l2.to_string()
+ }
+ (&TokenNode::Term(ref s1), &TokenNode::Term(ref s2)) => s1.as_str() == s2.as_str(),
+ _ => false,
}
}
+
+impl PartialEq for Tokens {
+ fn eq(&self, other: &Self) -> bool {
+ if self.tts.len() != other.tts.len() {
+ return false;
+ }
+
+ self.tts
+ .iter()
+ .zip(other.tts.iter())
+ .all(|(a, b)| tt_eq(a, b))
+ }
+}
+
+fn tt_hash<H: Hasher>(tt: &TokenTree, h: &mut H) {
+ use proc_macro2::{TokenNode, Delimiter, Spacing};
+
+ match tt.kind {
+ TokenNode::Group(delim, ref stream) => {
+ 0u8.hash(h);
+ match delim {
+ Delimiter::Parenthesis => 0u8.hash(h),
+ Delimiter::Brace => 1u8.hash(h),
+ Delimiter::Bracket => 2u8.hash(h),
+ Delimiter::None => 3u8.hash(h),
+ }
+
+ for item in stream.clone() {
+ tt_hash(&item, h);
+ }
+ 0xffu8.hash(h); // terminator w/ a variant we don't normally hash
+ }
+ TokenNode::Op(op, kind) => {
+ 1u8.hash(h);
+ op.hash(h);
+ match kind {
+ Spacing::Alone => 0u8.hash(h),
+ Spacing::Joint => 1u8.hash(h),
+ }
+ }
+ TokenNode::Literal(ref lit) => (2u8, lit.to_string()).hash(h),
+ TokenNode::Term(ref word) => (3u8, word.as_str()).hash(h),
+ }
+}
+
+impl<'a> Hash for Tokens {
+ fn hash<H: Hasher>(&self, h: &mut H) {
+ self.tts.len().hash(h);
+ for tt in &self.tts {
+ tt_hash(&tt, h);
+ }
+ }
+}
--- a/third_party/rust/quote/tests/test.rs
+++ b/third_party/rust/quote/tests/test.rs
@@ -1,87 +1,84 @@
-use std::{f32, f64};
+#![cfg_attr(feature = "cargo-clippy", allow(blacklisted_name))]
+
use std::borrow::Cow;
+extern crate proc_macro2;
#[macro_use]
extern crate quote;
+use proc_macro2::{Span, Term};
+
struct X;
impl quote::ToTokens for X {
fn to_tokens(&self, tokens: &mut quote::Tokens) {
- tokens.append("X");
+ tokens.append(proc_macro2::TokenTree {
+ kind: proc_macro2::TokenNode::Term(Term::intern("X")),
+ span: Span::def_site(),
+ });
}
}
#[test]
fn test_quote_impl() {
let tokens = quote!(
impl<'a, T: ToTokens> ToTokens for &'a T {
fn to_tokens(&self, tokens: &mut Tokens) {
(**self).to_tokens(tokens)
}
}
);
let expected = concat!(
"impl < 'a , T : ToTokens > ToTokens for & 'a T { ",
- "fn to_tokens ( & self , tokens : & mut Tokens ) { ",
- "( * * self ) . to_tokens ( tokens ) ",
- "} ",
+ "fn to_tokens ( & self , tokens : & mut Tokens ) { ",
+ "( * * self ) . to_tokens ( tokens ) ",
+ "} ",
"}"
);
- assert_eq!(expected, tokens.as_str());
-}
-
-#[test]
-fn test_append_tokens() {
- let mut tokens = quote!(let x =);
- tokens.append(quote!("Hello World!";));
-
- let expected = "let x = \"Hello World!\" ;";
-
- assert_eq!(expected, tokens.as_str());
+ assert_eq!(expected, tokens.to_string());
}
#[test]
fn test_substitution() {
let x = X;
let tokens = quote!(#x <#x> (#x) [#x] {#x});
let expected = "X < X > ( X ) [ X ] { X }";
- assert_eq!(expected, tokens.as_str());
+ assert_eq!(expected, tokens.to_string());
}
#[test]
fn test_iter() {
let primes = &[X, X, X, X];
- assert_eq!("X X X X", quote!(#(#primes)*).as_str());
+ assert_eq!("X X X X", quote!(#(#primes)*).to_string());
- assert_eq!("X , X , X , X ,", quote!(#(#primes,)*).as_str());
+ assert_eq!("X , X , X , X ,", quote!(#(#primes,)*).to_string());
- assert_eq!("X , X , X , X", quote!(#(#primes),*).as_str());
+ assert_eq!("X , X , X , X", quote!(#(#primes),*).to_string());
}
#[test]
fn test_advanced() {
let generics = quote!( <'a, T> );
let where_clause = quote!( where T: Serialize );
- let field_ty = quote!( String );
+ let field_ty = quote!(String);
- let item_ty = quote!( Cow<'a, str> );
+ let item_ty = quote!(Cow<'a, str>);
- let path = quote!( SomeTrait::serialize_with );
+ let path = quote!(SomeTrait::serialize_with);
- let value = quote!( self.x );
+ let value = quote!(self.x);
let tokens = quote! {
struct SerializeWith #generics #where_clause {
value: &'a #field_ty,
phantom: ::std::marker::PhantomData<#item_ty>,
}
impl #generics ::serde::Serialize for SerializeWith #generics #where_clause {
@@ -95,73 +92,33 @@ fn test_advanced() {
SerializeWith {
value: #value,
phantom: ::std::marker::PhantomData::<#item_ty>,
}
};
let expected = concat!(
"struct SerializeWith < 'a , T > where T : Serialize { ",
- "value : & 'a String , ",
- "phantom : :: std :: marker :: PhantomData < Cow < 'a , str > > , ",
+ "value : & 'a String , ",
+ "phantom : :: std :: marker :: PhantomData < Cow < 'a , str > > , ",
"} ",
"impl < 'a , T > :: serde :: Serialize for SerializeWith < 'a , T > where T : Serialize { ",
- "fn serialize < S > ( & self , s : & mut S ) -> Result < ( ) , S :: Error > ",
- "where S : :: serde :: Serializer ",
- "{ ",
- "SomeTrait :: serialize_with ( self . value , s ) ",
- "} ",
+ "fn serialize < S > ( & self , s : & mut S ) -> Result < ( ) , S :: Error > ",
+ "where S : :: serde :: Serializer ",
+ "{ ",
+ "SomeTrait :: serialize_with ( self . value , s ) ",
+ "} ",
"} ",
"SerializeWith { ",
- "value : self . x , ",
- "phantom : :: std :: marker :: PhantomData :: < Cow < 'a , str > > , ",
+ "value : self . x , ",
+ "phantom : :: std :: marker :: PhantomData :: < Cow < 'a , str > > , ",
"}"
);
- assert_eq!(expected, tokens.as_str());
-}
-
-#[test]
-fn test_unit() {
- let x = ();
- let tokens = quote!(#x);
- let expected = "( )";
- assert_eq!(expected, tokens.as_str());
-}
-
-#[test]
-fn test_tuple() {
- let x = ("foo", 4_u32);
- let tokens = quote!(#x);
- let expected = "( \"foo\" , 4u32 , )";
- assert_eq!(expected, tokens.as_str());
-}
-
-#[test]
-fn test_array() {
- let x: [u32; 3] = [1, 2, 3];
- let tokens = quote!(#x);
- let expected = "[ 1u32 , 2u32 , 3u32 , ]";
- assert_eq!(expected, tokens.as_str());
-}
-
-#[test]
-fn test_slice() {
- let x: &[u32] = &[1, 2, 3];
- let tokens = quote!(&#x); // Note: explicit `&`
- let expected = "& [ 1u32 , 2u32 , 3u32 , ]";
- assert_eq!(expected, tokens.as_str());
-}
-
-#[test]
-fn test_vec() {
- let x: Vec<u32> = vec![1, 2, 3];
- let tokens = quote!(vec!#x); // Note: explicit `vec!`
- let expected = "vec ! [ 1u32 , 2u32 , 3u32 , ]";
- assert_eq!(expected, tokens.as_str());
+ assert_eq!(expected, tokens.to_string());
}
#[test]
fn test_integer() {
let ii8 = -1i8;
let ii16 = -1i16;
let ii32 = -1i32;
let ii64 = -1i64;
@@ -172,189 +129,164 @@ fn test_integer() {
let uu64 = 1u64;
let uusize = 1usize;
let tokens = quote! {
#ii8 #ii16 #ii32 #ii64 #iisize
#uu8 #uu16 #uu32 #uu64 #uusize
};
let expected = "-1i8 -1i16 -1i32 -1i64 -1isize 1u8 1u16 1u32 1u64 1usize";
- assert_eq!(expected, tokens.as_str());
-}
-
-#[test]
-fn test_hex() {
- let hex = quote::Hex(0xFFFF_0000_u32);
- let tokens = quote!(#hex);
- let expected = "0xFFFF0000u32";
- assert_eq!(expected, tokens.as_str());
+ assert_eq!(expected, tokens.to_string());
}
#[test]
fn test_floating() {
- let e32 = 2.71828f32;
- let nan32 = f32::NAN;
- let inf32 = f32::INFINITY;
- let neginf32 = f32::NEG_INFINITY;
+ let e32 = 2.345f32;
- let e64 = 2.71828f64;
- let nan64 = f64::NAN;
- let inf64 = f64::INFINITY;
- let neginf64 = f64::NEG_INFINITY;
+ let e64 = 2.345f64;
let tokens = quote! {
- #e32 @ #nan32 @ #inf32 @ #neginf32
- #e64 @ #nan64 @ #inf64 @ #neginf64
+ #e32
+ #e64
};
- let expected = concat!(
- "2.71828f32 @ :: std :: f32 :: NAN @ :: std :: f32 :: INFINITY @ :: std :: f32 :: NEG_INFINITY ",
- "2.71828f64 @ :: std :: f64 :: NAN @ :: std :: f64 :: INFINITY @ :: std :: f64 :: NEG_INFINITY",
- );
- assert_eq!(expected, tokens.as_str());
+ let expected = concat!("2.345f32 2.345f64");
+ assert_eq!(expected, tokens.to_string());
}
#[test]
fn test_char() {
let zero = '\0';
let pound = '#';
let quote = '"';
let apost = '\'';
let newline = '\n';
let heart = '\u{2764}';
let tokens = quote! {
#zero #pound #quote #apost #newline #heart
};
- let expected = "'\\0' '#' '\"' '\\'' '\\n' '\u{2764}'";
- assert_eq!(expected, tokens.as_str());
+ let expected = "'\\u{0}' '#' '\\\"' '\\'' '\\n' '\\u{2764}'";
+ assert_eq!(expected, tokens.to_string());
}
#[test]
fn test_str() {
let s = "\0 a 'b \" c";
let tokens = quote!(#s);
- let expected = "\"\\0 a 'b \\\" c\"";
- assert_eq!(expected, tokens.as_str());
+ let expected = "\"\\u{0} a \\'b \\\" c\"";
+ assert_eq!(expected, tokens.to_string());
}
#[test]
fn test_string() {
let s = "\0 a 'b \" c".to_string();
let tokens = quote!(#s);
- let expected = "\"\\0 a 'b \\\" c\"";
- assert_eq!(expected, tokens.as_str());
-}
-
-#[test]
-fn test_byte_str() {
- let s = quote::ByteStr("\0 a 'b \" c");
- let tokens = quote!(#s);
- let expected = "b\"\\0 a 'b \\\" c\"";
- assert_eq!(expected, tokens.as_str());
-}
-
-#[test]
-fn test_byte_str_escape() {
- let s = quote::ByteStr("\u{3c3} \\ \" \n");
- let tokens = quote!(#s);
- let expected = "b\"\\xCF\\x83 \\\\ \\\" \\n\"";
- assert_eq!(expected, tokens.as_str());
+ let expected = "\"\\u{0} a \\'b \\\" c\"";
+ assert_eq!(expected, tokens.to_string());
}
#[test]
fn test_ident() {
- let foo = quote::Ident::from("Foo");
- let bar = quote::Ident::from(format!("Bar{}", 7));
+ let foo = Term::intern("Foo");
+ let bar = Term::intern(&format!("Bar{}", 7));
let tokens = quote!(struct #foo; enum #bar {});
let expected = "struct Foo ; enum Bar7 { }";
- assert_eq!(expected, tokens.as_str());
+ assert_eq!(expected, tokens.to_string());
}
#[test]
fn test_duplicate() {
let ch = 'x';
let tokens = quote!(#ch #ch);
let expected = "'x' 'x'";
- assert_eq!(expected, tokens.as_str());
+ assert_eq!(expected, tokens.to_string());
}
#[test]
fn test_fancy_repetition() {
let foo = vec!["a", "b"];
let bar = vec![true, false];
let tokens = quote! {
#(#foo: #bar),*
};
let expected = r#""a" : true , "b" : false"#;
- assert_eq!(expected, tokens.as_str());
+ assert_eq!(expected, tokens.to_string());
}
#[test]
fn test_nested_fancy_repetition() {
let nested = vec![vec!['a', 'b', 'c'], vec!['x', 'y', 'z']];
let tokens = quote! {
#(
#(#nested)*
),*
};
let expected = "'a' 'b' 'c' , 'x' 'y' 'z'";
- assert_eq!(expected, tokens.as_str());
+ assert_eq!(expected, tokens.to_string());
}
#[test]
fn test_empty_repetition() {
let tokens = quote!(#(a b)* #(c d),*);
- assert_eq!("", tokens.as_str());
+ assert_eq!("", tokens.to_string());
}
#[test]
fn test_variable_name_conflict() {
// The implementation of `#(...),*` uses the variable `_i` but it should be
// fine, if a little confusing when debugging.
let _i = vec!['a', 'b'];
let tokens = quote! { #(#_i),* };
let expected = "'a' , 'b'";
- assert_eq!(expected, tokens.as_str());
+ assert_eq!(expected, tokens.to_string());
}
#[test]
fn test_empty_quote() {
let tokens = quote!();
- assert_eq!("", tokens.as_str());
+ assert_eq!("", tokens.to_string());
}
#[test]
fn test_box_str() {
let b = "str".to_owned().into_boxed_str();
let tokens = quote! { #b };
- assert_eq!("\"str\"", tokens.as_str());
+ assert_eq!("\"str\"", tokens.to_string());
}
#[test]
fn test_cow() {
- let owned: Cow<quote::Ident> = Cow::Owned(quote::Ident::from("owned"));
+ let owned: Cow<Term> = Cow::Owned(Term::intern("owned"));
- let ident = quote::Ident::from("borrowed");
+ let ident = Term::intern("borrowed");
let borrowed = Cow::Borrowed(&ident);
let tokens = quote! { #owned #borrowed };
- assert_eq!("owned borrowed", tokens.as_str());
+ assert_eq!("owned borrowed", tokens.to_string());
}
#[test]
fn test_closure() {
- fn field_i(i: usize) -> quote::Ident {
- quote::Ident::new(format!("__field{}", i))
+ fn field_i(i: usize) -> Term {
+ Term::intern(&format!("__field{}", i))
}
let fields = (0usize..3)
.map(field_i as fn(_) -> _)
.map(|var| quote! { #var });
let tokens = quote! { #(#fields)* };
- assert_eq!("__field0 __field1 __field2", tokens.as_str());
+ assert_eq!("__field0 __field1 __field2", tokens.to_string());
}
+
+#[test]
+fn test_append_tokens() {
+ let mut a = quote!(a);
+ let b = quote!(b);
+ a.append_all(b);
+ assert_eq!("a b", a.to_string());
+}
copy from third_party/rust/unicode-xid/.cargo-checksum.json
copy to third_party/rust/unicode-xid-0.0.4/.cargo-checksum.json
new file mode 100644
--- /dev/null
+++ b/third_party/rust/unicode-xid-0.0.4/.travis.yml
@@ -0,0 +1,25 @@
+language: rust
+rust: 'nightly'
+sudo: false
+script:
+ - cargo build --verbose --features bench
+ - cargo test --verbose --features bench
+ - cargo bench --verbose --features bench
+ - cargo clean
+ - cargo build --verbose
+ - cargo test --verbose
+ - rustdoc --test README.md -L target/debug -L target/debug/deps
+ - cargo doc
+after_success: |
+ [ $TRAVIS_BRANCH = master ] &&
+ [ $TRAVIS_PULL_REQUEST = false ] &&
+ echo '<meta http-equiv=refresh content=0;url=unicode_xid/index.html>' > target/doc/index.html &&
+ pip install ghp-import --user $USER &&
+ $HOME/.local/bin/ghp-import -n target/doc &&
+ git push -qf https://${TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git gh-pages
+env:
+ global:
+ secure: gTlge+/OQlVkV0R+RThWXeN0aknmS7iUTPBMYKJyRdLz7T2vubw3w80a2CVE87JlpV87A5cVGD+LgR+AhYrhKtvqHb1brMDd99gylBBi2DfV7YapDSwSCuFgVR+FjZfJRcXBtI8po5urUZ84V0WLzRX8SyWqWgoD3oCkSL3Wp3w=
+notifications:
+ email:
+ on_success: never
new file mode 100644
--- /dev/null
+++ b/third_party/rust/unicode-xid-0.0.4/COPYRIGHT
@@ -0,0 +1,7 @@
+Licensed under the Apache License, Version 2.0
+<LICENSE-APACHE or
+http://www.apache.org/licenses/LICENSE-2.0> or the MIT
+license <LICENSE-MIT or http://opensource.org/licenses/MIT>,
+at your option. All files in the project carrying such
+notice may not be copied, modified, or distributed except
+according to those terms.
copy from third_party/rust/unicode-xid/Cargo.toml
copy to third_party/rust/unicode-xid-0.0.4/Cargo.toml
new file mode 100644
--- /dev/null
+++ b/third_party/rust/unicode-xid-0.0.4/LICENSE-APACHE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+Copyright [yyyy] [name of copyright owner]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
new file mode 100644
--- /dev/null
+++ b/third_party/rust/unicode-xid-0.0.4/LICENSE-MIT
@@ -0,0 +1,25 @@
+Copyright (c) 2015 The Rust Project Developers
+
+Permission is hereby granted, free of charge, to any
+person obtaining a copy of this software and associated
+documentation files (the "Software"), to deal in the
+Software without restriction, including without
+limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software
+is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice
+shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
+ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
+TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
+SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
new file mode 100644
--- /dev/null
+++ b/third_party/rust/unicode-xid-0.0.4/README.md
@@ -0,0 +1,34 @@
+# unicode-xid
+
+Determine if a `char` is a valid identifier for a parser and/or lexer according to
+[Unicode Standard Annex #31](http://www.unicode.org/reports/tr31/) rules.
+
+[](https://travis-ci.org/unicode-rs/unicode-xid)
+
+[Documentation](https://unicode-rs.github.io/unicode-xid/unicode_xid/index.html)
+
+```rust
+extern crate unicode_xid;
+
+use unicode_xid::UnicodeXID;
+
+fn main() {
+ let ch = 'a';
+ println!("Is {} a valid start of an identifier? {}", ch, UnicodeXID::is_xid_start(ch));
+}
+```
+
+# features
+
+unicode-xid supports a `no_std` feature. This eliminates dependence
+on std, and instead uses equivalent functions from core.
+
+# crates.io
+
+You can use this package in your project by adding the following
+to your `Cargo.toml`:
+
+```toml
+[dependencies]
+unicode-xid = "0.0.4"
+```
new file mode 100755
--- /dev/null
+++ b/third_party/rust/unicode-xid-0.0.4/scripts/unicode.py
@@ -0,0 +1,187 @@
+#!/usr/bin/env python
+#
+# Copyright 2011-2015 The Rust Project Developers. See the COPYRIGHT
+# file at the top-level directory of this distribution and at
+# http://rust-lang.org/COPYRIGHT.
+#
+# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+# option. This file may not be copied, modified, or distributed
+# except according to those terms.
+
+# This script uses the following Unicode tables:
+# - DerivedCoreProperties.txt
+# - ReadMe.txt
+#
+# Since this should not require frequent updates, we just store this
+# out-of-line and check the unicode.rs file into git.
+
+import fileinput, re, os, sys
+
+preamble = '''// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// NOTE: The following code was generated by "scripts/unicode.py", do not edit directly
+
+#![allow(missing_docs, non_upper_case_globals, non_snake_case)]
+'''
+
+def fetch(f):
+ if not os.path.exists(os.path.basename(f)):
+ os.system("curl -O http://www.unicode.org/Public/UNIDATA/%s"
+ % f)
+
+ if not os.path.exists(os.path.basename(f)):
+ sys.stderr.write("cannot load %s" % f)
+ exit(1)
+
+def group_cat(cat):
+ cat_out = []
+ letters = sorted(set(cat))
+ cur_start = letters.pop(0)
+ cur_end = cur_start
+ for letter in letters:
+ assert letter > cur_end, \
+ "cur_end: %s, letter: %s" % (hex(cur_end), hex(letter))
+ if letter == cur_end + 1:
+ cur_end = letter
+ else:
+ cat_out.append((cur_start, cur_end))
+ cur_start = cur_end = letter
+ cat_out.append((cur_start, cur_end))
+ return cat_out
+
+def ungroup_cat(cat):
+ cat_out = []
+ for (lo, hi) in cat:
+ while lo <= hi:
+ cat_out.append(lo)
+ lo += 1
+ return cat_out
+
+def format_table_content(f, content, indent):
+ line = " "*indent
+ first = True
+ for chunk in content.split(","):
+ if len(line) + len(chunk) < 98:
+ if first:
+ line += chunk
+ else:
+ line += ", " + chunk
+ first = False
+ else:
+ f.write(line + ",\n")
+ line = " "*indent + chunk
+ f.write(line)
+
+def load_properties(f, interestingprops):
+ fetch(f)
+ props = {}
+ re1 = re.compile("^ *([0-9A-F]+) *; *(\w+)")
+ re2 = re.compile("^ *([0-9A-F]+)\.\.([0-9A-F]+) *; *(\w+)")
+
+ for line in fileinput.input(os.path.basename(f)):
+ prop = None
+ d_lo = 0
+ d_hi = 0
+ m = re1.match(line)
+ if m:
+ d_lo = m.group(1)
+ d_hi = m.group(1)
+ prop = m.group(2)
+ else:
+ m = re2.match(line)
+ if m:
+ d_lo = m.group(1)
+ d_hi = m.group(2)
+ prop = m.group(3)
+ else:
+ continue
+ if interestingprops and prop not in interestingprops:
+ continue
+ d_lo = int(d_lo, 16)
+ d_hi = int(d_hi, 16)
+ if prop not in props:
+ props[prop] = []
+ props[prop].append((d_lo, d_hi))
+
+ # optimize if possible
+ for prop in props:
+ props[prop] = group_cat(ungroup_cat(props[prop]))
+
+ return props
+
+def escape_char(c):
+ return "'\\u{%x}'" % c
+
+def emit_bsearch_range_table(f):
+ f.write("""
+fn bsearch_range_table(c: char, r: &'static [(char,char)]) -> bool {
+ use core::cmp::Ordering::{Equal, Less, Greater};
+
+ r.binary_search_by(|&(lo,hi)| {
+ if lo <= c && c <= hi { Equal }
+ else if hi < c { Less }
+ else { Greater }
+ }).is_ok()
+}\n
+""")
+
+def emit_table(f, name, t_data, t_type = "&'static [(char, char)]", is_pub=True,
+ pfun=lambda x: "(%s,%s)" % (escape_char(x[0]), escape_char(x[1])), is_const=True):
+ pub_string = "const"
+ if not is_const:
+ pub_string = "let"
+ if is_pub:
+ pub_string = "pub " + pub_string
+ f.write(" %s %s: %s = &[\n" % (pub_string, name, t_type))
+ data = ""
+ first = True
+ for dat in t_data:
+ if not first:
+ data += ","
+ first = False
+ data += pfun(dat)
+ format_table_content(f, data, 8)
+ f.write("\n ];\n\n")
+
+def emit_property_module(f, mod, tbl, emit):
+ f.write("pub mod %s {\n" % mod)
+ for cat in sorted(emit):
+ emit_table(f, "%s_table" % cat, tbl[cat])
+ f.write(" pub fn %s(c: char) -> bool {\n" % cat)
+ f.write(" super::bsearch_range_table(c, %s_table)\n" % cat)
+ f.write(" }\n\n")
+ f.write("}\n\n")
+
+if __name__ == "__main__":
+ r = "tables.rs"
+ if os.path.exists(r):
+ os.remove(r)
+ with open(r, "w") as rf:
+ # write the file's preamble
+ rf.write(preamble)
+
+ # download and parse all the data
+ fetch("ReadMe.txt")
+ with open("ReadMe.txt") as readme:
+ pattern = "for Version (\d+)\.(\d+)\.(\d+) of the Unicode"
+ unicode_version = re.search(pattern, readme.read()).groups()
+ rf.write("""
+/// The version of [Unicode](http://www.unicode.org/)
+/// that this version of unicode-xid is based on.
+pub const UNICODE_VERSION: (u64, u64, u64) = (%s, %s, %s);
+""" % unicode_version)
+ emit_bsearch_range_table(rf)
+
+ want_derived = ["XID_Start", "XID_Continue"]
+ derived = load_properties("DerivedCoreProperties.txt", want_derived)
+ emit_property_module(rf, "derived_property", derived, want_derived)
new file mode 100644
--- /dev/null
+++ b/third_party/rust/unicode-xid-0.0.4/src/lib.rs
@@ -0,0 +1,87 @@
+// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Determine if a `char` is a valid identifier for a parser and/or lexer according to
+//! [Unicode Standard Annex #31](http://www.unicode.org/reports/tr31/) rules.
+//!
+//! ```rust
+//! extern crate unicode_xid;
+//!
+//! use unicode_xid::UnicodeXID;
+//!
+//! fn main() {
+//! let ch = 'a';
+//! println!("Is {} a valid start of an identifier? {}", ch, UnicodeXID::is_xid_start(ch));
+//! }
+//! ```
+//!
+//! # features
+//!
+//! unicode-xid supports a `no_std` feature. This eliminates dependence
+//! on std, and instead uses equivalent functions from core.
+//!
+//! # crates.io
+//!
+//! You can use this package in your project by adding the following
+//! to your `Cargo.toml`:
+//!
+//! ```toml
+//! [dependencies]
+//! unicode-xid = "0.0.4"
+//! ```
+
+#![deny(missing_docs, unsafe_code)]
+#![doc(html_logo_url = "https://unicode-rs.github.io/unicode-rs_sm.png",
+ html_favicon_url = "https://unicode-rs.github.io/unicode-rs_sm.png")]
+
+#![no_std]
+#![cfg_attr(feature = "bench", feature(test, unicode))]
+
+#[cfg(test)]
+#[macro_use]
+extern crate std;
+
+#[cfg(feature = "bench")]
+extern crate test;
+
+use tables::derived_property;
+pub use tables::UNICODE_VERSION;
+
+mod tables;
+
+#[cfg(test)]
+mod tests;
+
+/// Methods for determining if a character is a valid identifier character.
+pub trait UnicodeXID {
+ /// Returns whether the specified character satisfies the 'XID_Start'
+ /// Unicode property.
+ ///
+ /// 'XID_Start' is a Unicode Derived Property specified in
+ /// [UAX #31](http://unicode.org/reports/tr31/#NFKC_Modifications),
+ /// mostly similar to ID_Start but modified for closure under NFKx.
+ fn is_xid_start(self) -> bool;
+
+ /// Returns whether the specified `char` satisfies the 'XID_Continue'
+ /// Unicode property.
+ ///
+ /// 'XID_Continue' is a Unicode Derived Property specified in
+ /// [UAX #31](http://unicode.org/reports/tr31/#NFKC_Modifications),
+ /// mostly similar to 'ID_Continue' but modified for closure under NFKx.
+ fn is_xid_continue(self) -> bool;
+}
+
+impl UnicodeXID for char {
+ #[inline]
+ fn is_xid_start(self) -> bool { derived_property::XID_Start(self) }
+
+ #[inline]
+ fn is_xid_continue(self) -> bool { derived_property::XID_Continue(self) }
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/unicode-xid-0.0.4/src/tables.rs
@@ -0,0 +1,426 @@
+// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// NOTE: The following code was generated by "scripts/unicode.py", do not edit directly
+
+#![allow(missing_docs, non_upper_case_globals, non_snake_case)]
+
+/// The version of [Unicode](http://www.unicode.org/)
+/// that this version of unicode-xid is based on.
+pub const UNICODE_VERSION: (u64, u64, u64) = (9, 0, 0);
+
+fn bsearch_range_table(c: char, r: &'static [(char,char)]) -> bool {
+ use core::cmp::Ordering::{Equal, Less, Greater};
+
+ r.binary_search_by(|&(lo,hi)| {
+ if lo <= c && c <= hi { Equal }
+ else if hi < c { Less }
+ else { Greater }
+ }).is_ok()
+}
+
+pub mod derived_property {
+ pub const XID_Continue_table: &'static [(char, char)] = &[
+ ('\u{30}', '\u{39}'), ('\u{41}', '\u{5a}'), ('\u{5f}', '\u{5f}'), ('\u{61}', '\u{7a}'),
+ ('\u{aa}', '\u{aa}'), ('\u{b5}', '\u{b5}'), ('\u{b7}', '\u{b7}'), ('\u{ba}', '\u{ba}'),
+ ('\u{c0}', '\u{d6}'), ('\u{d8}', '\u{f6}'), ('\u{f8}', '\u{2c1}'), ('\u{2c6}', '\u{2d1}'),
+ ('\u{2e0}', '\u{2e4}'), ('\u{2ec}', '\u{2ec}'), ('\u{2ee}', '\u{2ee}'), ('\u{300}',
+ '\u{374}'), ('\u{376}', '\u{377}'), ('\u{37b}', '\u{37d}'), ('\u{37f}', '\u{37f}'),
+ ('\u{386}', '\u{38a}'), ('\u{38c}', '\u{38c}'), ('\u{38e}', '\u{3a1}'), ('\u{3a3}',
+ '\u{3f5}'), ('\u{3f7}', '\u{481}'), ('\u{483}', '\u{487}'), ('\u{48a}', '\u{52f}'),
+ ('\u{531}', '\u{556}'), ('\u{559}', '\u{559}'), ('\u{561}', '\u{587}'), ('\u{591}',
+ '\u{5bd}'), ('\u{5bf}', '\u{5bf}'), ('\u{5c1}', '\u{5c2}'), ('\u{5c4}', '\u{5c5}'),
+ ('\u{5c7}', '\u{5c7}'), ('\u{5d0}', '\u{5ea}'), ('\u{5f0}', '\u{5f2}'), ('\u{610}',
+ '\u{61a}'), ('\u{620}', '\u{669}'), ('\u{66e}', '\u{6d3}'), ('\u{6d5}', '\u{6dc}'),
+ ('\u{6df}', '\u{6e8}'), ('\u{6ea}', '\u{6fc}'), ('\u{6ff}', '\u{6ff}'), ('\u{710}',
+ '\u{74a}'), ('\u{74d}', '\u{7b1}'), ('\u{7c0}', '\u{7f5}'), ('\u{7fa}', '\u{7fa}'),
+ ('\u{800}', '\u{82d}'), ('\u{840}', '\u{85b}'), ('\u{8a0}', '\u{8b4}'), ('\u{8b6}',
+ '\u{8bd}'), ('\u{8d4}', '\u{8e1}'), ('\u{8e3}', '\u{963}'), ('\u{966}', '\u{96f}'),
+ ('\u{971}', '\u{983}'), ('\u{985}', '\u{98c}'), ('\u{98f}', '\u{990}'), ('\u{993}',
+ '\u{9a8}'), ('\u{9aa}', '\u{9b0}'), ('\u{9b2}', '\u{9b2}'), ('\u{9b6}', '\u{9b9}'),
+ ('\u{9bc}', '\u{9c4}'), ('\u{9c7}', '\u{9c8}'), ('\u{9cb}', '\u{9ce}'), ('\u{9d7}',
+ '\u{9d7}'), ('\u{9dc}', '\u{9dd}'), ('\u{9df}', '\u{9e3}'), ('\u{9e6}', '\u{9f1}'),
+ ('\u{a01}', '\u{a03}'), ('\u{a05}', '\u{a0a}'), ('\u{a0f}', '\u{a10}'), ('\u{a13}',
+ '\u{a28}'), ('\u{a2a}', '\u{a30}'), ('\u{a32}', '\u{a33}'), ('\u{a35}', '\u{a36}'),
+ ('\u{a38}', '\u{a39}'), ('\u{a3c}', '\u{a3c}'), ('\u{a3e}', '\u{a42}'), ('\u{a47}',
+ '\u{a48}'), ('\u{a4b}', '\u{a4d}'), ('\u{a51}', '\u{a51}'), ('\u{a59}', '\u{a5c}'),
+ ('\u{a5e}', '\u{a5e}'), ('\u{a66}', '\u{a75}'), ('\u{a81}', '\u{a83}'), ('\u{a85}',
+ '\u{a8d}'), ('\u{a8f}', '\u{a91}'), ('\u{a93}', '\u{aa8}'), ('\u{aaa}', '\u{ab0}'),
+ ('\u{ab2}', '\u{ab3}'), ('\u{ab5}', '\u{ab9}'), ('\u{abc}', '\u{ac5}'), ('\u{ac7}',
+ '\u{ac9}'), ('\u{acb}', '\u{acd}'), ('\u{ad0}', '\u{ad0}'), ('\u{ae0}', '\u{ae3}'),
+ ('\u{ae6}', '\u{aef}'), ('\u{af9}', '\u{af9}'), ('\u{b01}', '\u{b03}'), ('\u{b05}',
+ '\u{b0c}'), ('\u{b0f}', '\u{b10}'), ('\u{b13}', '\u{b28}'), ('\u{b2a}', '\u{b30}'),
+ ('\u{b32}', '\u{b33}'), ('\u{b35}', '\u{b39}'), ('\u{b3c}', '\u{b44}'), ('\u{b47}',
+ '\u{b48}'), ('\u{b4b}', '\u{b4d}'), ('\u{b56}', '\u{b57}'), ('\u{b5c}', '\u{b5d}'),
+ ('\u{b5f}', '\u{b63}'), ('\u{b66}', '\u{b6f}'), ('\u{b71}', '\u{b71}'), ('\u{b82}',
+ '\u{b83}'), ('\u{b85}', '\u{b8a}'), ('\u{b8e}', '\u{b90}'), ('\u{b92}', '\u{b95}'),
+ ('\u{b99}', '\u{b9a}'), ('\u{b9c}', '\u{b9c}'), ('\u{b9e}', '\u{b9f}'), ('\u{ba3}',
+ '\u{ba4}'), ('\u{ba8}', '\u{baa}'), ('\u{bae}', '\u{bb9}'), ('\u{bbe}', '\u{bc2}'),
+ ('\u{bc6}', '\u{bc8}'), ('\u{bca}', '\u{bcd}'), ('\u{bd0}', '\u{bd0}'), ('\u{bd7}',
+ '\u{bd7}'), ('\u{be6}', '\u{bef}'), ('\u{c00}', '\u{c03}'), ('\u{c05}', '\u{c0c}'),
+ ('\u{c0e}', '\u{c10}'), ('\u{c12}', '\u{c28}'), ('\u{c2a}', '\u{c39}'), ('\u{c3d}',
+ '\u{c44}'), ('\u{c46}', '\u{c48}'), ('\u{c4a}', '\u{c4d}'), ('\u{c55}', '\u{c56}'),
+ ('\u{c58}', '\u{c5a}'), ('\u{c60}', '\u{c63}'), ('\u{c66}', '\u{c6f}'), ('\u{c80}',
+ '\u{c83}'), ('\u{c85}', '\u{c8c}'), ('\u{c8e}', '\u{c90}'), ('\u{c92}', '\u{ca8}'),
+ ('\u{caa}', '\u{cb3}'), ('\u{cb5}', '\u{cb9}'), ('\u{cbc}', '\u{cc4}'), ('\u{cc6}',
+ '\u{cc8}'), ('\u{cca}', '\u{ccd}'), ('\u{cd5}', '\u{cd6}'), ('\u{cde}', '\u{cde}'),
+ ('\u{ce0}', '\u{ce3}'), ('\u{ce6}', '\u{cef}'), ('\u{cf1}', '\u{cf2}'), ('\u{d01}',
+ '\u{d03}'), ('\u{d05}', '\u{d0c}'), ('\u{d0e}', '\u{d10}'), ('\u{d12}', '\u{d3a}'),
+ ('\u{d3d}', '\u{d44}'), ('\u{d46}', '\u{d48}'), ('\u{d4a}', '\u{d4e}'), ('\u{d54}',
+ '\u{d57}'), ('\u{d5f}', '\u{d63}'), ('\u{d66}', '\u{d6f}'), ('\u{d7a}', '\u{d7f}'),
+ ('\u{d82}', '\u{d83}'), ('\u{d85}', '\u{d96}'), ('\u{d9a}', '\u{db1}'), ('\u{db3}',
+ '\u{dbb}'), ('\u{dbd}', '\u{dbd}'), ('\u{dc0}', '\u{dc6}'), ('\u{dca}', '\u{dca}'),
+ ('\u{dcf}', '\u{dd4}'), ('\u{dd6}', '\u{dd6}'), ('\u{dd8}', '\u{ddf}'), ('\u{de6}',
+ '\u{def}'), ('\u{df2}', '\u{df3}'), ('\u{e01}', '\u{e3a}'), ('\u{e40}', '\u{e4e}'),
+ ('\u{e50}', '\u{e59}'), ('\u{e81}', '\u{e82}'), ('\u{e84}', '\u{e84}'), ('\u{e87}',
+ '\u{e88}'), ('\u{e8a}', '\u{e8a}'), ('\u{e8d}', '\u{e8d}'), ('\u{e94}', '\u{e97}'),
+ ('\u{e99}', '\u{e9f}'), ('\u{ea1}', '\u{ea3}'), ('\u{ea5}', '\u{ea5}'), ('\u{ea7}',
+ '\u{ea7}'), ('\u{eaa}', '\u{eab}'), ('\u{ead}', '\u{eb9}'), ('\u{ebb}', '\u{ebd}'),
+ ('\u{ec0}', '\u{ec4}'), ('\u{ec6}', '\u{ec6}'), ('\u{ec8}', '\u{ecd}'), ('\u{ed0}',
+ '\u{ed9}'), ('\u{edc}', '\u{edf}'), ('\u{f00}', '\u{f00}'), ('\u{f18}', '\u{f19}'),
+ ('\u{f20}', '\u{f29}'), ('\u{f35}', '\u{f35}'), ('\u{f37}', '\u{f37}'), ('\u{f39}',
+ '\u{f39}'), ('\u{f3e}', '\u{f47}'), ('\u{f49}', '\u{f6c}'), ('\u{f71}', '\u{f84}'),
+ ('\u{f86}', '\u{f97}'), ('\u{f99}', '\u{fbc}'), ('\u{fc6}', '\u{fc6}'), ('\u{1000}',
+ '\u{1049}'), ('\u{1050}', '\u{109d}'), ('\u{10a0}', '\u{10c5}'), ('\u{10c7}', '\u{10c7}'),
+ ('\u{10cd}', '\u{10cd}'), ('\u{10d0}', '\u{10fa}'), ('\u{10fc}', '\u{1248}'), ('\u{124a}',
+ '\u{124d}'), ('\u{1250}', '\u{1256}'), ('\u{1258}', '\u{1258}'), ('\u{125a}', '\u{125d}'),
+ ('\u{1260}', '\u{1288}'), ('\u{128a}', '\u{128d}'), ('\u{1290}', '\u{12b0}'), ('\u{12b2}',
+ '\u{12b5}'), ('\u{12b8}', '\u{12be}'), ('\u{12c0}', '\u{12c0}'), ('\u{12c2}', '\u{12c5}'),
+ ('\u{12c8}', '\u{12d6}'), ('\u{12d8}', '\u{1310}'), ('\u{1312}', '\u{1315}'), ('\u{1318}',
+ '\u{135a}'), ('\u{135d}', '\u{135f}'), ('\u{1369}', '\u{1371}'), ('\u{1380}', '\u{138f}'),
+ ('\u{13a0}', '\u{13f5}'), ('\u{13f8}', '\u{13fd}'), ('\u{1401}', '\u{166c}'), ('\u{166f}',
+ '\u{167f}'), ('\u{1681}', '\u{169a}'), ('\u{16a0}', '\u{16ea}'), ('\u{16ee}', '\u{16f8}'),
+ ('\u{1700}', '\u{170c}'), ('\u{170e}', '\u{1714}'), ('\u{1720}', '\u{1734}'), ('\u{1740}',
+ '\u{1753}'), ('\u{1760}', '\u{176c}'), ('\u{176e}', '\u{1770}'), ('\u{1772}', '\u{1773}'),
+ ('\u{1780}', '\u{17d3}'), ('\u{17d7}', '\u{17d7}'), ('\u{17dc}', '\u{17dd}'), ('\u{17e0}',
+ '\u{17e9}'), ('\u{180b}', '\u{180d}'), ('\u{1810}', '\u{1819}'), ('\u{1820}', '\u{1877}'),
+ ('\u{1880}', '\u{18aa}'), ('\u{18b0}', '\u{18f5}'), ('\u{1900}', '\u{191e}'), ('\u{1920}',
+ '\u{192b}'), ('\u{1930}', '\u{193b}'), ('\u{1946}', '\u{196d}'), ('\u{1970}', '\u{1974}'),
+ ('\u{1980}', '\u{19ab}'), ('\u{19b0}', '\u{19c9}'), ('\u{19d0}', '\u{19da}'), ('\u{1a00}',
+ '\u{1a1b}'), ('\u{1a20}', '\u{1a5e}'), ('\u{1a60}', '\u{1a7c}'), ('\u{1a7f}', '\u{1a89}'),
+ ('\u{1a90}', '\u{1a99}'), ('\u{1aa7}', '\u{1aa7}'), ('\u{1ab0}', '\u{1abd}'), ('\u{1b00}',
+ '\u{1b4b}'), ('\u{1b50}', '\u{1b59}'), ('\u{1b6b}', '\u{1b73}'), ('\u{1b80}', '\u{1bf3}'),
+ ('\u{1c00}', '\u{1c37}'), ('\u{1c40}', '\u{1c49}'), ('\u{1c4d}', '\u{1c7d}'), ('\u{1c80}',
+ '\u{1c88}'), ('\u{1cd0}', '\u{1cd2}'), ('\u{1cd4}', '\u{1cf6}'), ('\u{1cf8}', '\u{1cf9}'),
+ ('\u{1d00}', '\u{1df5}'), ('\u{1dfb}', '\u{1f15}'), ('\u{1f18}', '\u{1f1d}'), ('\u{1f20}',
+ '\u{1f45}'), ('\u{1f48}', '\u{1f4d}'), ('\u{1f50}', '\u{1f57}'), ('\u{1f59}', '\u{1f59}'),
+ ('\u{1f5b}', '\u{1f5b}'), ('\u{1f5d}', '\u{1f5d}'), ('\u{1f5f}', '\u{1f7d}'), ('\u{1f80}',
+ '\u{1fb4}'), ('\u{1fb6}', '\u{1fbc}'), ('\u{1fbe}', '\u{1fbe}'), ('\u{1fc2}', '\u{1fc4}'),
+ ('\u{1fc6}', '\u{1fcc}'), ('\u{1fd0}', '\u{1fd3}'), ('\u{1fd6}', '\u{1fdb}'), ('\u{1fe0}',
+ '\u{1fec}'), ('\u{1ff2}', '\u{1ff4}'), ('\u{1ff6}', '\u{1ffc}'), ('\u{203f}', '\u{2040}'),
+ ('\u{2054}', '\u{2054}'), ('\u{2071}', '\u{2071}'), ('\u{207f}', '\u{207f}'), ('\u{2090}',
+ '\u{209c}'), ('\u{20d0}', '\u{20dc}'), ('\u{20e1}', '\u{20e1}'), ('\u{20e5}', '\u{20f0}'),
+ ('\u{2102}', '\u{2102}'), ('\u{2107}', '\u{2107}'), ('\u{210a}', '\u{2113}'), ('\u{2115}',
+ '\u{2115}'), ('\u{2118}', '\u{211d}'), ('\u{2124}', '\u{2124}'), ('\u{2126}', '\u{2126}'),
+ ('\u{2128}', '\u{2128}'), ('\u{212a}', '\u{2139}'), ('\u{213c}', '\u{213f}'), ('\u{2145}',
+ '\u{2149}'), ('\u{214e}', '\u{214e}'), ('\u{2160}', '\u{2188}'), ('\u{2c00}', '\u{2c2e}'),
+ ('\u{2c30}', '\u{2c5e}'), ('\u{2c60}', '\u{2ce4}'), ('\u{2ceb}', '\u{2cf3}'), ('\u{2d00}',
+ '\u{2d25}'), ('\u{2d27}', '\u{2d27}'), ('\u{2d2d}', '\u{2d2d}'), ('\u{2d30}', '\u{2d67}'),
+ ('\u{2d6f}', '\u{2d6f}'), ('\u{2d7f}', '\u{2d96}'), ('\u{2da0}', '\u{2da6}'), ('\u{2da8}',
+ '\u{2dae}'), ('\u{2db0}', '\u{2db6}'), ('\u{2db8}', '\u{2dbe}'), ('\u{2dc0}', '\u{2dc6}'),
+ ('\u{2dc8}', '\u{2dce}'), ('\u{2dd0}', '\u{2dd6}'), ('\u{2dd8}', '\u{2dde}'), ('\u{2de0}',
+ '\u{2dff}'), ('\u{3005}', '\u{3007}'), ('\u{3021}', '\u{302f}'), ('\u{3031}', '\u{3035}'),
+ ('\u{3038}', '\u{303c}'), ('\u{3041}', '\u{3096}'), ('\u{3099}', '\u{309a}'), ('\u{309d}',
+ '\u{309f}'), ('\u{30a1}', '\u{30fa}'), ('\u{30fc}', '\u{30ff}'), ('\u{3105}', '\u{312d}'),
+ ('\u{3131}', '\u{318e}'), ('\u{31a0}', '\u{31ba}'), ('\u{31f0}', '\u{31ff}'), ('\u{3400}',
+ '\u{4db5}'), ('\u{4e00}', '\u{9fd5}'), ('\u{a000}', '\u{a48c}'), ('\u{a4d0}', '\u{a4fd}'),
+ ('\u{a500}', '\u{a60c}'), ('\u{a610}', '\u{a62b}'), ('\u{a640}', '\u{a66f}'), ('\u{a674}',
+ '\u{a67d}'), ('\u{a67f}', '\u{a6f1}'), ('\u{a717}', '\u{a71f}'), ('\u{a722}', '\u{a788}'),
+ ('\u{a78b}', '\u{a7ae}'), ('\u{a7b0}', '\u{a7b7}'), ('\u{a7f7}', '\u{a827}'), ('\u{a840}',
+ '\u{a873}'), ('\u{a880}', '\u{a8c5}'), ('\u{a8d0}', '\u{a8d9}'), ('\u{a8e0}', '\u{a8f7}'),
+ ('\u{a8fb}', '\u{a8fb}'), ('\u{a8fd}', '\u{a8fd}'), ('\u{a900}', '\u{a92d}'), ('\u{a930}',
+ '\u{a953}'), ('\u{a960}', '\u{a97c}'), ('\u{a980}', '\u{a9c0}'), ('\u{a9cf}', '\u{a9d9}'),
+ ('\u{a9e0}', '\u{a9fe}'), ('\u{aa00}', '\u{aa36}'), ('\u{aa40}', '\u{aa4d}'), ('\u{aa50}',
+ '\u{aa59}'), ('\u{aa60}', '\u{aa76}'), ('\u{aa7a}', '\u{aac2}'), ('\u{aadb}', '\u{aadd}'),
+ ('\u{aae0}', '\u{aaef}'), ('\u{aaf2}', '\u{aaf6}'), ('\u{ab01}', '\u{ab06}'), ('\u{ab09}',
+ '\u{ab0e}'), ('\u{ab11}', '\u{ab16}'), ('\u{ab20}', '\u{ab26}'), ('\u{ab28}', '\u{ab2e}'),
+ ('\u{ab30}', '\u{ab5a}'), ('\u{ab5c}', '\u{ab65}'), ('\u{ab70}', '\u{abea}'), ('\u{abec}',
+ '\u{abed}'), ('\u{abf0}', '\u{abf9}'), ('\u{ac00}', '\u{d7a3}'), ('\u{d7b0}', '\u{d7c6}'),
+ ('\u{d7cb}', '\u{d7fb}'), ('\u{f900}', '\u{fa6d}'), ('\u{fa70}', '\u{fad9}'), ('\u{fb00}',
+ '\u{fb06}'), ('\u{fb13}', '\u{fb17}'), ('\u{fb1d}', '\u{fb28}'), ('\u{fb2a}', '\u{fb36}'),
+ ('\u{fb38}', '\u{fb3c}'), ('\u{fb3e}', '\u{fb3e}'), ('\u{fb40}', '\u{fb41}'), ('\u{fb43}',
+ '\u{fb44}'), ('\u{fb46}', '\u{fbb1}'), ('\u{fbd3}', '\u{fc5d}'), ('\u{fc64}', '\u{fd3d}'),
+ ('\u{fd50}', '\u{fd8f}'), ('\u{fd92}', '\u{fdc7}'), ('\u{fdf0}', '\u{fdf9}'), ('\u{fe00}',
+ '\u{fe0f}'), ('\u{fe20}', '\u{fe2f}'), ('\u{fe33}', '\u{fe34}'), ('\u{fe4d}', '\u{fe4f}'),
+ ('\u{fe71}', '\u{fe71}'), ('\u{fe73}', '\u{fe73}'), ('\u{fe77}', '\u{fe77}'), ('\u{fe79}',
+ '\u{fe79}'), ('\u{fe7b}', '\u{fe7b}'), ('\u{fe7d}', '\u{fe7d}'), ('\u{fe7f}', '\u{fefc}'),
+ ('\u{ff10}', '\u{ff19}'), ('\u{ff21}', '\u{ff3a}'), ('\u{ff3f}', '\u{ff3f}'), ('\u{ff41}',
+ '\u{ff5a}'), ('\u{ff66}', '\u{ffbe}'), ('\u{ffc2}', '\u{ffc7}'), ('\u{ffca}', '\u{ffcf}'),
+ ('\u{ffd2}', '\u{ffd7}'), ('\u{ffda}', '\u{ffdc}'), ('\u{10000}', '\u{1000b}'),
+ ('\u{1000d}', '\u{10026}'), ('\u{10028}', '\u{1003a}'), ('\u{1003c}', '\u{1003d}'),
+ ('\u{1003f}', '\u{1004d}'), ('\u{10050}', '\u{1005d}'), ('\u{10080}', '\u{100fa}'),
+ ('\u{10140}', '\u{10174}'), ('\u{101fd}', '\u{101fd}'), ('\u{10280}', '\u{1029c}'),
+ ('\u{102a0}', '\u{102d0}'), ('\u{102e0}', '\u{102e0}'), ('\u{10300}', '\u{1031f}'),
+ ('\u{10330}', '\u{1034a}'), ('\u{10350}', '\u{1037a}'), ('\u{10380}', '\u{1039d}'),
+ ('\u{103a0}', '\u{103c3}'), ('\u{103c8}', '\u{103cf}'), ('\u{103d1}', '\u{103d5}'),
+ ('\u{10400}', '\u{1049d}'), ('\u{104a0}', '\u{104a9}'), ('\u{104b0}', '\u{104d3}'),
+ ('\u{104d8}', '\u{104fb}'), ('\u{10500}', '\u{10527}'), ('\u{10530}', '\u{10563}'),
+ ('\u{10600}', '\u{10736}'), ('\u{10740}', '\u{10755}'), ('\u{10760}', '\u{10767}'),
+ ('\u{10800}', '\u{10805}'), ('\u{10808}', '\u{10808}'), ('\u{1080a}', '\u{10835}'),
+ ('\u{10837}', '\u{10838}'), ('\u{1083c}', '\u{1083c}'), ('\u{1083f}', '\u{10855}'),
+ ('\u{10860}', '\u{10876}'), ('\u{10880}', '\u{1089e}'), ('\u{108e0}', '\u{108f2}'),
+ ('\u{108f4}', '\u{108f5}'), ('\u{10900}', '\u{10915}'), ('\u{10920}', '\u{10939}'),
+ ('\u{10980}', '\u{109b7}'), ('\u{109be}', '\u{109bf}'), ('\u{10a00}', '\u{10a03}'),
+ ('\u{10a05}', '\u{10a06}'), ('\u{10a0c}', '\u{10a13}'), ('\u{10a15}', '\u{10a17}'),
+ ('\u{10a19}', '\u{10a33}'), ('\u{10a38}', '\u{10a3a}'), ('\u{10a3f}', '\u{10a3f}'),
+ ('\u{10a60}', '\u{10a7c}'), ('\u{10a80}', '\u{10a9c}'), ('\u{10ac0}', '\u{10ac7}'),
+ ('\u{10ac9}', '\u{10ae6}'), ('\u{10b00}', '\u{10b35}'), ('\u{10b40}', '\u{10b55}'),
+ ('\u{10b60}', '\u{10b72}'), ('\u{10b80}', '\u{10b91}'), ('\u{10c00}', '\u{10c48}'),
+ ('\u{10c80}', '\u{10cb2}'), ('\u{10cc0}', '\u{10cf2}'), ('\u{11000}', '\u{11046}'),
+ ('\u{11066}', '\u{1106f}'), ('\u{1107f}', '\u{110ba}'), ('\u{110d0}', '\u{110e8}'),
+ ('\u{110f0}', '\u{110f9}'), ('\u{11100}', '\u{11134}'), ('\u{11136}', '\u{1113f}'),
+ ('\u{11150}', '\u{11173}'), ('\u{11176}', '\u{11176}'), ('\u{11180}', '\u{111c4}'),
+ ('\u{111ca}', '\u{111cc}'), ('\u{111d0}', '\u{111da}'), ('\u{111dc}', '\u{111dc}'),
+ ('\u{11200}', '\u{11211}'), ('\u{11213}', '\u{11237}'), ('\u{1123e}', '\u{1123e}'),
+ ('\u{11280}', '\u{11286}'), ('\u{11288}', '\u{11288}'), ('\u{1128a}', '\u{1128d}'),
+ ('\u{1128f}', '\u{1129d}'), ('\u{1129f}', '\u{112a8}'), ('\u{112b0}', '\u{112ea}'),
+ ('\u{112f0}', '\u{112f9}'), ('\u{11300}', '\u{11303}'), ('\u{11305}', '\u{1130c}'),
+ ('\u{1130f}', '\u{11310}'), ('\u{11313}', '\u{11328}'), ('\u{1132a}', '\u{11330}'),
+ ('\u{11332}', '\u{11333}'), ('\u{11335}', '\u{11339}'), ('\u{1133c}', '\u{11344}'),
+ ('\u{11347}', '\u{11348}'), ('\u{1134b}', '\u{1134d}'), ('\u{11350}', '\u{11350}'),
+ ('\u{11357}', '\u{11357}'), ('\u{1135d}', '\u{11363}'), ('\u{11366}', '\u{1136c}'),
+ ('\u{11370}', '\u{11374}'), ('\u{11400}', '\u{1144a}'), ('\u{11450}', '\u{11459}'),
+ ('\u{11480}', '\u{114c5}'), ('\u{114c7}', '\u{114c7}'), ('\u{114d0}', '\u{114d9}'),
+ ('\u{11580}', '\u{115b5}'), ('\u{115b8}', '\u{115c0}'), ('\u{115d8}', '\u{115dd}'),
+ ('\u{11600}', '\u{11640}'), ('\u{11644}', '\u{11644}'), ('\u{11650}', '\u{11659}'),
+ ('\u{11680}', '\u{116b7}'), ('\u{116c0}', '\u{116c9}'), ('\u{11700}', '\u{11719}'),
+ ('\u{1171d}', '\u{1172b}'), ('\u{11730}', '\u{11739}'), ('\u{118a0}', '\u{118e9}'),
+ ('\u{118ff}', '\u{118ff}'), ('\u{11ac0}', '\u{11af8}'), ('\u{11c00}', '\u{11c08}'),
+ ('\u{11c0a}', '\u{11c36}'), ('\u{11c38}', '\u{11c40}'), ('\u{11c50}', '\u{11c59}'),
+ ('\u{11c72}', '\u{11c8f}'), ('\u{11c92}', '\u{11ca7}'), ('\u{11ca9}', '\u{11cb6}'),
+ ('\u{12000}', '\u{12399}'), ('\u{12400}', '\u{1246e}'), ('\u{12480}', '\u{12543}'),
+ ('\u{13000}', '\u{1342e}'), ('\u{14400}', '\u{14646}'), ('\u{16800}', '\u{16a38}'),
+ ('\u{16a40}', '\u{16a5e}'), ('\u{16a60}', '\u{16a69}'), ('\u{16ad0}', '\u{16aed}'),
+ ('\u{16af0}', '\u{16af4}'), ('\u{16b00}', '\u{16b36}'), ('\u{16b40}', '\u{16b43}'),
+ ('\u{16b50}', '\u{16b59}'), ('\u{16b63}', '\u{16b77}'), ('\u{16b7d}', '\u{16b8f}'),
+ ('\u{16f00}', '\u{16f44}'), ('\u{16f50}', '\u{16f7e}'), ('\u{16f8f}', '\u{16f9f}'),
+ ('\u{16fe0}', '\u{16fe0}'), ('\u{17000}', '\u{187ec}'), ('\u{18800}', '\u{18af2}'),
+ ('\u{1b000}', '\u{1b001}'), ('\u{1bc00}', '\u{1bc6a}'), ('\u{1bc70}', '\u{1bc7c}'),
+ ('\u{1bc80}', '\u{1bc88}'), ('\u{1bc90}', '\u{1bc99}'), ('\u{1bc9d}', '\u{1bc9e}'),
+ ('\u{1d165}', '\u{1d169}'), ('\u{1d16d}', '\u{1d172}'), ('\u{1d17b}', '\u{1d182}'),
+ ('\u{1d185}', '\u{1d18b}'), ('\u{1d1aa}', '\u{1d1ad}'), ('\u{1d242}', '\u{1d244}'),
+ ('\u{1d400}', '\u{1d454}'), ('\u{1d456}', '\u{1d49c}'), ('\u{1d49e}', '\u{1d49f}'),
+ ('\u{1d4a2}', '\u{1d4a2}'), ('\u{1d4a5}', '\u{1d4a6}'), ('\u{1d4a9}', '\u{1d4ac}'),
+ ('\u{1d4ae}', '\u{1d4b9}'), ('\u{1d4bb}', '\u{1d4bb}'), ('\u{1d4bd}', '\u{1d4c3}'),
+ ('\u{1d4c5}', '\u{1d505}'), ('\u{1d507}', '\u{1d50a}'), ('\u{1d50d}', '\u{1d514}'),
+ ('\u{1d516}', '\u{1d51c}'), ('\u{1d51e}', '\u{1d539}'), ('\u{1d53b}', '\u{1d53e}'),
+ ('\u{1d540}', '\u{1d544}'), ('\u{1d546}', '\u{1d546}'), ('\u{1d54a}', '\u{1d550}'),
+ ('\u{1d552}', '\u{1d6a5}'), ('\u{1d6a8}', '\u{1d6c0}'), ('\u{1d6c2}', '\u{1d6da}'),
+ ('\u{1d6dc}', '\u{1d6fa}'), ('\u{1d6fc}', '\u{1d714}'), ('\u{1d716}', '\u{1d734}'),
+ ('\u{1d736}', '\u{1d74e}'), ('\u{1d750}', '\u{1d76e}'), ('\u{1d770}', '\u{1d788}'),
+ ('\u{1d78a}', '\u{1d7a8}'), ('\u{1d7aa}', '\u{1d7c2}'), ('\u{1d7c4}', '\u{1d7cb}'),
+ ('\u{1d7ce}', '\u{1d7ff}'), ('\u{1da00}', '\u{1da36}'), ('\u{1da3b}', '\u{1da6c}'),
+ ('\u{1da75}', '\u{1da75}'), ('\u{1da84}', '\u{1da84}'), ('\u{1da9b}', '\u{1da9f}'),
+ ('\u{1daa1}', '\u{1daaf}'), ('\u{1e000}', '\u{1e006}'), ('\u{1e008}', '\u{1e018}'),
+ ('\u{1e01b}', '\u{1e021}'), ('\u{1e023}', '\u{1e024}'), ('\u{1e026}', '\u{1e02a}'),
+ ('\u{1e800}', '\u{1e8c4}'), ('\u{1e8d0}', '\u{1e8d6}'), ('\u{1e900}', '\u{1e94a}'),
+ ('\u{1e950}', '\u{1e959}'), ('\u{1ee00}', '\u{1ee03}'), ('\u{1ee05}', '\u{1ee1f}'),
+ ('\u{1ee21}', '\u{1ee22}'), ('\u{1ee24}', '\u{1ee24}'), ('\u{1ee27}', '\u{1ee27}'),
+ ('\u{1ee29}', '\u{1ee32}'), ('\u{1ee34}', '\u{1ee37}'), ('\u{1ee39}', '\u{1ee39}'),
+ ('\u{1ee3b}', '\u{1ee3b}'), ('\u{1ee42}', '\u{1ee42}'), ('\u{1ee47}', '\u{1ee47}'),
+ ('\u{1ee49}', '\u{1ee49}'), ('\u{1ee4b}', '\u{1ee4b}'), ('\u{1ee4d}', '\u{1ee4f}'),
+ ('\u{1ee51}', '\u{1ee52}'), ('\u{1ee54}', '\u{1ee54}'), ('\u{1ee57}', '\u{1ee57}'),
+ ('\u{1ee59}', '\u{1ee59}'), ('\u{1ee5b}', '\u{1ee5b}'), ('\u{1ee5d}', '\u{1ee5d}'),
+ ('\u{1ee5f}', '\u{1ee5f}'), ('\u{1ee61}', '\u{1ee62}'), ('\u{1ee64}', '\u{1ee64}'),
+ ('\u{1ee67}', '\u{1ee6a}'), ('\u{1ee6c}', '\u{1ee72}'), ('\u{1ee74}', '\u{1ee77}'),
+ ('\u{1ee79}', '\u{1ee7c}'), ('\u{1ee7e}', '\u{1ee7e}'), ('\u{1ee80}', '\u{1ee89}'),
+ ('\u{1ee8b}', '\u{1ee9b}'), ('\u{1eea1}', '\u{1eea3}'), ('\u{1eea5}', '\u{1eea9}'),
+ ('\u{1eeab}', '\u{1eebb}'), ('\u{20000}', '\u{2a6d6}'), ('\u{2a700}', '\u{2b734}'),
+ ('\u{2b740}', '\u{2b81d}'), ('\u{2b820}', '\u{2cea1}'), ('\u{2f800}', '\u{2fa1d}'),
+ ('\u{e0100}', '\u{e01ef}')
+ ];
+
+ pub fn XID_Continue(c: char) -> bool {
+ super::bsearch_range_table(c, XID_Continue_table)
+ }
+
+ pub const XID_Start_table: &'static [(char, char)] = &[
+ ('\u{41}', '\u{5a}'), ('\u{61}', '\u{7a}'), ('\u{aa}', '\u{aa}'), ('\u{b5}', '\u{b5}'),
+ ('\u{ba}', '\u{ba}'), ('\u{c0}', '\u{d6}'), ('\u{d8}', '\u{f6}'), ('\u{f8}', '\u{2c1}'),
+ ('\u{2c6}', '\u{2d1}'), ('\u{2e0}', '\u{2e4}'), ('\u{2ec}', '\u{2ec}'), ('\u{2ee}',
+ '\u{2ee}'), ('\u{370}', '\u{374}'), ('\u{376}', '\u{377}'), ('\u{37b}', '\u{37d}'),
+ ('\u{37f}', '\u{37f}'), ('\u{386}', '\u{386}'), ('\u{388}', '\u{38a}'), ('\u{38c}',
+ '\u{38c}'), ('\u{38e}', '\u{3a1}'), ('\u{3a3}', '\u{3f5}'), ('\u{3f7}', '\u{481}'),
+ ('\u{48a}', '\u{52f}'), ('\u{531}', '\u{556}'), ('\u{559}', '\u{559}'), ('\u{561}',
+ '\u{587}'), ('\u{5d0}', '\u{5ea}'), ('\u{5f0}', '\u{5f2}'), ('\u{620}', '\u{64a}'),
+ ('\u{66e}', '\u{66f}'), ('\u{671}', '\u{6d3}'), ('\u{6d5}', '\u{6d5}'), ('\u{6e5}',
+ '\u{6e6}'), ('\u{6ee}', '\u{6ef}'), ('\u{6fa}', '\u{6fc}'), ('\u{6ff}', '\u{6ff}'),
+ ('\u{710}', '\u{710}'), ('\u{712}', '\u{72f}'), ('\u{74d}', '\u{7a5}'), ('\u{7b1}',
+ '\u{7b1}'), ('\u{7ca}', '\u{7ea}'), ('\u{7f4}', '\u{7f5}'), ('\u{7fa}', '\u{7fa}'),
+ ('\u{800}', '\u{815}'), ('\u{81a}', '\u{81a}'), ('\u{824}', '\u{824}'), ('\u{828}',
+ '\u{828}'), ('\u{840}', '\u{858}'), ('\u{8a0}', '\u{8b4}'), ('\u{8b6}', '\u{8bd}'),
+ ('\u{904}', '\u{939}'), ('\u{93d}', '\u{93d}'), ('\u{950}', '\u{950}'), ('\u{958}',
+ '\u{961}'), ('\u{971}', '\u{980}'), ('\u{985}', '\u{98c}'), ('\u{98f}', '\u{990}'),
+ ('\u{993}', '\u{9a8}'), ('\u{9aa}', '\u{9b0}'), ('\u{9b2}', '\u{9b2}'), ('\u{9b6}',
+ '\u{9b9}'), ('\u{9bd}', '\u{9bd}'), ('\u{9ce}', '\u{9ce}'), ('\u{9dc}', '\u{9dd}'),
+ ('\u{9df}', '\u{9e1}'), ('\u{9f0}', '\u{9f1}'), ('\u{a05}', '\u{a0a}'), ('\u{a0f}',
+ '\u{a10}'), ('\u{a13}', '\u{a28}'), ('\u{a2a}', '\u{a30}'), ('\u{a32}', '\u{a33}'),
+ ('\u{a35}', '\u{a36}'), ('\u{a38}', '\u{a39}'), ('\u{a59}', '\u{a5c}'), ('\u{a5e}',
+ '\u{a5e}'), ('\u{a72}', '\u{a74}'), ('\u{a85}', '\u{a8d}'), ('\u{a8f}', '\u{a91}'),
+ ('\u{a93}', '\u{aa8}'), ('\u{aaa}', '\u{ab0}'), ('\u{ab2}', '\u{ab3}'), ('\u{ab5}',
+ '\u{ab9}'), ('\u{abd}', '\u{abd}'), ('\u{ad0}', '\u{ad0}'), ('\u{ae0}', '\u{ae1}'),
+ ('\u{af9}', '\u{af9}'), ('\u{b05}', '\u{b0c}'), ('\u{b0f}', '\u{b10}'), ('\u{b13}',
+ '\u{b28}'), ('\u{b2a}', '\u{b30}'), ('\u{b32}', '\u{b33}'), ('\u{b35}', '\u{b39}'),
+ ('\u{b3d}', '\u{b3d}'), ('\u{b5c}', '\u{b5d}'), ('\u{b5f}', '\u{b61}'), ('\u{b71}',
+ '\u{b71}'), ('\u{b83}', '\u{b83}'), ('\u{b85}', '\u{b8a}'), ('\u{b8e}', '\u{b90}'),
+ ('\u{b92}', '\u{b95}'), ('\u{b99}', '\u{b9a}'), ('\u{b9c}', '\u{b9c}'), ('\u{b9e}',
+ '\u{b9f}'), ('\u{ba3}', '\u{ba4}'), ('\u{ba8}', '\u{baa}'), ('\u{bae}', '\u{bb9}'),
+ ('\u{bd0}', '\u{bd0}'), ('\u{c05}', '\u{c0c}'), ('\u{c0e}', '\u{c10}'), ('\u{c12}',
+ '\u{c28}'), ('\u{c2a}', '\u{c39}'), ('\u{c3d}', '\u{c3d}'), ('\u{c58}', '\u{c5a}'),
+ ('\u{c60}', '\u{c61}'), ('\u{c80}', '\u{c80}'), ('\u{c85}', '\u{c8c}'), ('\u{c8e}',
+ '\u{c90}'), ('\u{c92}', '\u{ca8}'), ('\u{caa}', '\u{cb3}'), ('\u{cb5}', '\u{cb9}'),
+ ('\u{cbd}', '\u{cbd}'), ('\u{cde}', '\u{cde}'), ('\u{ce0}', '\u{ce1}'), ('\u{cf1}',
+ '\u{cf2}'), ('\u{d05}', '\u{d0c}'), ('\u{d0e}', '\u{d10}'), ('\u{d12}', '\u{d3a}'),
+ ('\u{d3d}', '\u{d3d}'), ('\u{d4e}', '\u{d4e}'), ('\u{d54}', '\u{d56}'), ('\u{d5f}',
+ '\u{d61}'), ('\u{d7a}', '\u{d7f}'), ('\u{d85}', '\u{d96}'), ('\u{d9a}', '\u{db1}'),
+ ('\u{db3}', '\u{dbb}'), ('\u{dbd}', '\u{dbd}'), ('\u{dc0}', '\u{dc6}'), ('\u{e01}',
+ '\u{e30}'), ('\u{e32}', '\u{e32}'), ('\u{e40}', '\u{e46}'), ('\u{e81}', '\u{e82}'),
+ ('\u{e84}', '\u{e84}'), ('\u{e87}', '\u{e88}'), ('\u{e8a}', '\u{e8a}'), ('\u{e8d}',
+ '\u{e8d}'), ('\u{e94}', '\u{e97}'), ('\u{e99}', '\u{e9f}'), ('\u{ea1}', '\u{ea3}'),
+ ('\u{ea5}', '\u{ea5}'), ('\u{ea7}', '\u{ea7}'), ('\u{eaa}', '\u{eab}'), ('\u{ead}',
+ '\u{eb0}'), ('\u{eb2}', '\u{eb2}'), ('\u{ebd}', '\u{ebd}'), ('\u{ec0}', '\u{ec4}'),
+ ('\u{ec6}', '\u{ec6}'), ('\u{edc}', '\u{edf}'), ('\u{f00}', '\u{f00}'), ('\u{f40}',
+ '\u{f47}'), ('\u{f49}', '\u{f6c}'), ('\u{f88}', '\u{f8c}'), ('\u{1000}', '\u{102a}'),
+ ('\u{103f}', '\u{103f}'), ('\u{1050}', '\u{1055}'), ('\u{105a}', '\u{105d}'), ('\u{1061}',
+ '\u{1061}'), ('\u{1065}', '\u{1066}'), ('\u{106e}', '\u{1070}'), ('\u{1075}', '\u{1081}'),
+ ('\u{108e}', '\u{108e}'), ('\u{10a0}', '\u{10c5}'), ('\u{10c7}', '\u{10c7}'), ('\u{10cd}',
+ '\u{10cd}'), ('\u{10d0}', '\u{10fa}'), ('\u{10fc}', '\u{1248}'), ('\u{124a}', '\u{124d}'),
+ ('\u{1250}', '\u{1256}'), ('\u{1258}', '\u{1258}'), ('\u{125a}', '\u{125d}'), ('\u{1260}',
+ '\u{1288}'), ('\u{128a}', '\u{128d}'), ('\u{1290}', '\u{12b0}'), ('\u{12b2}', '\u{12b5}'),
+ ('\u{12b8}', '\u{12be}'), ('\u{12c0}', '\u{12c0}'), ('\u{12c2}', '\u{12c5}'), ('\u{12c8}',
+ '\u{12d6}'), ('\u{12d8}', '\u{1310}'), ('\u{1312}', '\u{1315}'), ('\u{1318}', '\u{135a}'),
+ ('\u{1380}', '\u{138f}'), ('\u{13a0}', '\u{13f5}'), ('\u{13f8}', '\u{13fd}'), ('\u{1401}',
+ '\u{166c}'), ('\u{166f}', '\u{167f}'), ('\u{1681}', '\u{169a}'), ('\u{16a0}', '\u{16ea}'),
+ ('\u{16ee}', '\u{16f8}'), ('\u{1700}', '\u{170c}'), ('\u{170e}', '\u{1711}'), ('\u{1720}',
+ '\u{1731}'), ('\u{1740}', '\u{1751}'), ('\u{1760}', '\u{176c}'), ('\u{176e}', '\u{1770}'),
+ ('\u{1780}', '\u{17b3}'), ('\u{17d7}', '\u{17d7}'), ('\u{17dc}', '\u{17dc}'), ('\u{1820}',
+ '\u{1877}'), ('\u{1880}', '\u{18a8}'), ('\u{18aa}', '\u{18aa}'), ('\u{18b0}', '\u{18f5}'),
+ ('\u{1900}', '\u{191e}'), ('\u{1950}', '\u{196d}'), ('\u{1970}', '\u{1974}'), ('\u{1980}',
+ '\u{19ab}'), ('\u{19b0}', '\u{19c9}'), ('\u{1a00}', '\u{1a16}'), ('\u{1a20}', '\u{1a54}'),
+ ('\u{1aa7}', '\u{1aa7}'), ('\u{1b05}', '\u{1b33}'), ('\u{1b45}', '\u{1b4b}'), ('\u{1b83}',
+ '\u{1ba0}'), ('\u{1bae}', '\u{1baf}'), ('\u{1bba}', '\u{1be5}'), ('\u{1c00}', '\u{1c23}'),
+ ('\u{1c4d}', '\u{1c4f}'), ('\u{1c5a}', '\u{1c7d}'), ('\u{1c80}', '\u{1c88}'), ('\u{1ce9}',
+ '\u{1cec}'), ('\u{1cee}', '\u{1cf1}'), ('\u{1cf5}', '\u{1cf6}'), ('\u{1d00}', '\u{1dbf}'),
+ ('\u{1e00}', '\u{1f15}'), ('\u{1f18}', '\u{1f1d}'), ('\u{1f20}', '\u{1f45}'), ('\u{1f48}',
+ '\u{1f4d}'), ('\u{1f50}', '\u{1f57}'), ('\u{1f59}', '\u{1f59}'), ('\u{1f5b}', '\u{1f5b}'),
+ ('\u{1f5d}', '\u{1f5d}'), ('\u{1f5f}', '\u{1f7d}'), ('\u{1f80}', '\u{1fb4}'), ('\u{1fb6}',
+ '\u{1fbc}'), ('\u{1fbe}', '\u{1fbe}'), ('\u{1fc2}', '\u{1fc4}'), ('\u{1fc6}', '\u{1fcc}'),
+ ('\u{1fd0}', '\u{1fd3}'), ('\u{1fd6}', '\u{1fdb}'), ('\u{1fe0}', '\u{1fec}'), ('\u{1ff2}',
+ '\u{1ff4}'), ('\u{1ff6}', '\u{1ffc}'), ('\u{2071}', '\u{2071}'), ('\u{207f}', '\u{207f}'),
+ ('\u{2090}', '\u{209c}'), ('\u{2102}', '\u{2102}'), ('\u{2107}', '\u{2107}'), ('\u{210a}',
+ '\u{2113}'), ('\u{2115}', '\u{2115}'), ('\u{2118}', '\u{211d}'), ('\u{2124}', '\u{2124}'),
+ ('\u{2126}', '\u{2126}'), ('\u{2128}', '\u{2128}'), ('\u{212a}', '\u{2139}'), ('\u{213c}',
+ '\u{213f}'), ('\u{2145}', '\u{2149}'), ('\u{214e}', '\u{214e}'), ('\u{2160}', '\u{2188}'),
+ ('\u{2c00}', '\u{2c2e}'), ('\u{2c30}', '\u{2c5e}'), ('\u{2c60}', '\u{2ce4}'), ('\u{2ceb}',
+ '\u{2cee}'), ('\u{2cf2}', '\u{2cf3}'), ('\u{2d00}', '\u{2d25}'), ('\u{2d27}', '\u{2d27}'),
+ ('\u{2d2d}', '\u{2d2d}'), ('\u{2d30}', '\u{2d67}'), ('\u{2d6f}', '\u{2d6f}'), ('\u{2d80}',
+ '\u{2d96}'), ('\u{2da0}', '\u{2da6}'), ('\u{2da8}', '\u{2dae}'), ('\u{2db0}', '\u{2db6}'),
+ ('\u{2db8}', '\u{2dbe}'), ('\u{2dc0}', '\u{2dc6}'), ('\u{2dc8}', '\u{2dce}'), ('\u{2dd0}',
+ '\u{2dd6}'), ('\u{2dd8}', '\u{2dde}'), ('\u{3005}', '\u{3007}'), ('\u{3021}', '\u{3029}'),
+ ('\u{3031}', '\u{3035}'), ('\u{3038}', '\u{303c}'), ('\u{3041}', '\u{3096}'), ('\u{309d}',
+ '\u{309f}'), ('\u{30a1}', '\u{30fa}'), ('\u{30fc}', '\u{30ff}'), ('\u{3105}', '\u{312d}'),
+ ('\u{3131}', '\u{318e}'), ('\u{31a0}', '\u{31ba}'), ('\u{31f0}', '\u{31ff}'), ('\u{3400}',
+ '\u{4db5}'), ('\u{4e00}', '\u{9fd5}'), ('\u{a000}', '\u{a48c}'), ('\u{a4d0}', '\u{a4fd}'),
+ ('\u{a500}', '\u{a60c}'), ('\u{a610}', '\u{a61f}'), ('\u{a62a}', '\u{a62b}'), ('\u{a640}',
+ '\u{a66e}'), ('\u{a67f}', '\u{a69d}'), ('\u{a6a0}', '\u{a6ef}'), ('\u{a717}', '\u{a71f}'),
+ ('\u{a722}', '\u{a788}'), ('\u{a78b}', '\u{a7ae}'), ('\u{a7b0}', '\u{a7b7}'), ('\u{a7f7}',
+ '\u{a801}'), ('\u{a803}', '\u{a805}'), ('\u{a807}', '\u{a80a}'), ('\u{a80c}', '\u{a822}'),
+ ('\u{a840}', '\u{a873}'), ('\u{a882}', '\u{a8b3}'), ('\u{a8f2}', '\u{a8f7}'), ('\u{a8fb}',
+ '\u{a8fb}'), ('\u{a8fd}', '\u{a8fd}'), ('\u{a90a}', '\u{a925}'), ('\u{a930}', '\u{a946}'),
+ ('\u{a960}', '\u{a97c}'), ('\u{a984}', '\u{a9b2}'), ('\u{a9cf}', '\u{a9cf}'), ('\u{a9e0}',
+ '\u{a9e4}'), ('\u{a9e6}', '\u{a9ef}'), ('\u{a9fa}', '\u{a9fe}'), ('\u{aa00}', '\u{aa28}'),
+ ('\u{aa40}', '\u{aa42}'), ('\u{aa44}', '\u{aa4b}'), ('\u{aa60}', '\u{aa76}'), ('\u{aa7a}',
+ '\u{aa7a}'), ('\u{aa7e}', '\u{aaaf}'), ('\u{aab1}', '\u{aab1}'), ('\u{aab5}', '\u{aab6}'),
+ ('\u{aab9}', '\u{aabd}'), ('\u{aac0}', '\u{aac0}'), ('\u{aac2}', '\u{aac2}'), ('\u{aadb}',
+ '\u{aadd}'), ('\u{aae0}', '\u{aaea}'), ('\u{aaf2}', '\u{aaf4}'), ('\u{ab01}', '\u{ab06}'),
+ ('\u{ab09}', '\u{ab0e}'), ('\u{ab11}', '\u{ab16}'), ('\u{ab20}', '\u{ab26}'), ('\u{ab28}',
+ '\u{ab2e}'), ('\u{ab30}', '\u{ab5a}'), ('\u{ab5c}', '\u{ab65}'), ('\u{ab70}', '\u{abe2}'),
+ ('\u{ac00}', '\u{d7a3}'), ('\u{d7b0}', '\u{d7c6}'), ('\u{d7cb}', '\u{d7fb}'), ('\u{f900}',
+ '\u{fa6d}'), ('\u{fa70}', '\u{fad9}'), ('\u{fb00}', '\u{fb06}'), ('\u{fb13}', '\u{fb17}'),
+ ('\u{fb1d}', '\u{fb1d}'), ('\u{fb1f}', '\u{fb28}'), ('\u{fb2a}', '\u{fb36}'), ('\u{fb38}',
+ '\u{fb3c}'), ('\u{fb3e}', '\u{fb3e}'), ('\u{fb40}', '\u{fb41}'), ('\u{fb43}', '\u{fb44}'),
+ ('\u{fb46}', '\u{fbb1}'), ('\u{fbd3}', '\u{fc5d}'), ('\u{fc64}', '\u{fd3d}'), ('\u{fd50}',
+ '\u{fd8f}'), ('\u{fd92}', '\u{fdc7}'), ('\u{fdf0}', '\u{fdf9}'), ('\u{fe71}', '\u{fe71}'),
+ ('\u{fe73}', '\u{fe73}'), ('\u{fe77}', '\u{fe77}'), ('\u{fe79}', '\u{fe79}'), ('\u{fe7b}',
+ '\u{fe7b}'), ('\u{fe7d}', '\u{fe7d}'), ('\u{fe7f}', '\u{fefc}'), ('\u{ff21}', '\u{ff3a}'),
+ ('\u{ff41}', '\u{ff5a}'), ('\u{ff66}', '\u{ff9d}'), ('\u{ffa0}', '\u{ffbe}'), ('\u{ffc2}',
+ '\u{ffc7}'), ('\u{ffca}', '\u{ffcf}'), ('\u{ffd2}', '\u{ffd7}'), ('\u{ffda}', '\u{ffdc}'),
+ ('\u{10000}', '\u{1000b}'), ('\u{1000d}', '\u{10026}'), ('\u{10028}', '\u{1003a}'),
+ ('\u{1003c}', '\u{1003d}'), ('\u{1003f}', '\u{1004d}'), ('\u{10050}', '\u{1005d}'),
+ ('\u{10080}', '\u{100fa}'), ('\u{10140}', '\u{10174}'), ('\u{10280}', '\u{1029c}'),
+ ('\u{102a0}', '\u{102d0}'), ('\u{10300}', '\u{1031f}'), ('\u{10330}', '\u{1034a}'),
+ ('\u{10350}', '\u{10375}'), ('\u{10380}', '\u{1039d}'), ('\u{103a0}', '\u{103c3}'),
+ ('\u{103c8}', '\u{103cf}'), ('\u{103d1}', '\u{103d5}'), ('\u{10400}', '\u{1049d}'),
+ ('\u{104b0}', '\u{104d3}'), ('\u{104d8}', '\u{104fb}'), ('\u{10500}', '\u{10527}'),
+ ('\u{10530}', '\u{10563}'), ('\u{10600}', '\u{10736}'), ('\u{10740}', '\u{10755}'),
+ ('\u{10760}', '\u{10767}'), ('\u{10800}', '\u{10805}'), ('\u{10808}', '\u{10808}'),
+ ('\u{1080a}', '\u{10835}'), ('\u{10837}', '\u{10838}'), ('\u{1083c}', '\u{1083c}'),
+ ('\u{1083f}', '\u{10855}'), ('\u{10860}', '\u{10876}'), ('\u{10880}', '\u{1089e}'),
+ ('\u{108e0}', '\u{108f2}'), ('\u{108f4}', '\u{108f5}'), ('\u{10900}', '\u{10915}'),
+ ('\u{10920}', '\u{10939}'), ('\u{10980}', '\u{109b7}'), ('\u{109be}', '\u{109bf}'),
+ ('\u{10a00}', '\u{10a00}'), ('\u{10a10}', '\u{10a13}'), ('\u{10a15}', '\u{10a17}'),
+ ('\u{10a19}', '\u{10a33}'), ('\u{10a60}', '\u{10a7c}'), ('\u{10a80}', '\u{10a9c}'),
+ ('\u{10ac0}', '\u{10ac7}'), ('\u{10ac9}', '\u{10ae4}'), ('\u{10b00}', '\u{10b35}'),
+ ('\u{10b40}', '\u{10b55}'), ('\u{10b60}', '\u{10b72}'), ('\u{10b80}', '\u{10b91}'),
+ ('\u{10c00}', '\u{10c48}'), ('\u{10c80}', '\u{10cb2}'), ('\u{10cc0}', '\u{10cf2}'),
+ ('\u{11003}', '\u{11037}'), ('\u{11083}', '\u{110af}'), ('\u{110d0}', '\u{110e8}'),
+ ('\u{11103}', '\u{11126}'), ('\u{11150}', '\u{11172}'), ('\u{11176}', '\u{11176}'),
+ ('\u{11183}', '\u{111b2}'), ('\u{111c1}', '\u{111c4}'), ('\u{111da}', '\u{111da}'),
+ ('\u{111dc}', '\u{111dc}'), ('\u{11200}', '\u{11211}'), ('\u{11213}', '\u{1122b}'),
+ ('\u{11280}', '\u{11286}'), ('\u{11288}', '\u{11288}'), ('\u{1128a}', '\u{1128d}'),
+ ('\u{1128f}', '\u{1129d}'), ('\u{1129f}', '\u{112a8}'), ('\u{112b0}', '\u{112de}'),
+ ('\u{11305}', '\u{1130c}'), ('\u{1130f}', '\u{11310}'), ('\u{11313}', '\u{11328}'),
+ ('\u{1132a}', '\u{11330}'), ('\u{11332}', '\u{11333}'), ('\u{11335}', '\u{11339}'),
+ ('\u{1133d}', '\u{1133d}'), ('\u{11350}', '\u{11350}'), ('\u{1135d}', '\u{11361}'),
+ ('\u{11400}', '\u{11434}'), ('\u{11447}', '\u{1144a}'), ('\u{11480}', '\u{114af}'),
+ ('\u{114c4}', '\u{114c5}'), ('\u{114c7}', '\u{114c7}'), ('\u{11580}', '\u{115ae}'),
+ ('\u{115d8}', '\u{115db}'), ('\u{11600}', '\u{1162f}'), ('\u{11644}', '\u{11644}'),
+ ('\u{11680}', '\u{116aa}'), ('\u{11700}', '\u{11719}'), ('\u{118a0}', '\u{118df}'),
+ ('\u{118ff}', '\u{118ff}'), ('\u{11ac0}', '\u{11af8}'), ('\u{11c00}', '\u{11c08}'),
+ ('\u{11c0a}', '\u{11c2e}'), ('\u{11c40}', '\u{11c40}'), ('\u{11c72}', '\u{11c8f}'),
+ ('\u{12000}', '\u{12399}'), ('\u{12400}', '\u{1246e}'), ('\u{12480}', '\u{12543}'),
+ ('\u{13000}', '\u{1342e}'), ('\u{14400}', '\u{14646}'), ('\u{16800}', '\u{16a38}'),
+ ('\u{16a40}', '\u{16a5e}'), ('\u{16ad0}', '\u{16aed}'), ('\u{16b00}', '\u{16b2f}'),
+ ('\u{16b40}', '\u{16b43}'), ('\u{16b63}', '\u{16b77}'), ('\u{16b7d}', '\u{16b8f}'),
+ ('\u{16f00}', '\u{16f44}'), ('\u{16f50}', '\u{16f50}'), ('\u{16f93}', '\u{16f9f}'),
+ ('\u{16fe0}', '\u{16fe0}'), ('\u{17000}', '\u{187ec}'), ('\u{18800}', '\u{18af2}'),
+ ('\u{1b000}', '\u{1b001}'), ('\u{1bc00}', '\u{1bc6a}'), ('\u{1bc70}', '\u{1bc7c}'),
+ ('\u{1bc80}', '\u{1bc88}'), ('\u{1bc90}', '\u{1bc99}'), ('\u{1d400}', '\u{1d454}'),
+ ('\u{1d456}', '\u{1d49c}'), ('\u{1d49e}', '\u{1d49f}'), ('\u{1d4a2}', '\u{1d4a2}'),
+ ('\u{1d4a5}', '\u{1d4a6}'), ('\u{1d4a9}', '\u{1d4ac}'), ('\u{1d4ae}', '\u{1d4b9}'),
+ ('\u{1d4bb}', '\u{1d4bb}'), ('\u{1d4bd}', '\u{1d4c3}'), ('\u{1d4c5}', '\u{1d505}'),
+ ('\u{1d507}', '\u{1d50a}'), ('\u{1d50d}', '\u{1d514}'), ('\u{1d516}', '\u{1d51c}'),
+ ('\u{1d51e}', '\u{1d539}'), ('\u{1d53b}', '\u{1d53e}'), ('\u{1d540}', '\u{1d544}'),
+ ('\u{1d546}', '\u{1d546}'), ('\u{1d54a}', '\u{1d550}'), ('\u{1d552}', '\u{1d6a5}'),
+ ('\u{1d6a8}', '\u{1d6c0}'), ('\u{1d6c2}', '\u{1d6da}'), ('\u{1d6dc}', '\u{1d6fa}'),
+ ('\u{1d6fc}', '\u{1d714}'), ('\u{1d716}', '\u{1d734}'), ('\u{1d736}', '\u{1d74e}'),
+ ('\u{1d750}', '\u{1d76e}'), ('\u{1d770}', '\u{1d788}'), ('\u{1d78a}', '\u{1d7a8}'),
+ ('\u{1d7aa}', '\u{1d7c2}'), ('\u{1d7c4}', '\u{1d7cb}'), ('\u{1e800}', '\u{1e8c4}'),
+ ('\u{1e900}', '\u{1e943}'), ('\u{1ee00}', '\u{1ee03}'), ('\u{1ee05}', '\u{1ee1f}'),
+ ('\u{1ee21}', '\u{1ee22}'), ('\u{1ee24}', '\u{1ee24}'), ('\u{1ee27}', '\u{1ee27}'),
+ ('\u{1ee29}', '\u{1ee32}'), ('\u{1ee34}', '\u{1ee37}'), ('\u{1ee39}', '\u{1ee39}'),
+ ('\u{1ee3b}', '\u{1ee3b}'), ('\u{1ee42}', '\u{1ee42}'), ('\u{1ee47}', '\u{1ee47}'),
+ ('\u{1ee49}', '\u{1ee49}'), ('\u{1ee4b}', '\u{1ee4b}'), ('\u{1ee4d}', '\u{1ee4f}'),
+ ('\u{1ee51}', '\u{1ee52}'), ('\u{1ee54}', '\u{1ee54}'), ('\u{1ee57}', '\u{1ee57}'),
+ ('\u{1ee59}', '\u{1ee59}'), ('\u{1ee5b}', '\u{1ee5b}'), ('\u{1ee5d}', '\u{1ee5d}'),
+ ('\u{1ee5f}', '\u{1ee5f}'), ('\u{1ee61}', '\u{1ee62}'), ('\u{1ee64}', '\u{1ee64}'),
+ ('\u{1ee67}', '\u{1ee6a}'), ('\u{1ee6c}', '\u{1ee72}'), ('\u{1ee74}', '\u{1ee77}'),
+ ('\u{1ee79}', '\u{1ee7c}'), ('\u{1ee7e}', '\u{1ee7e}'), ('\u{1ee80}', '\u{1ee89}'),
+ ('\u{1ee8b}', '\u{1ee9b}'), ('\u{1eea1}', '\u{1eea3}'), ('\u{1eea5}', '\u{1eea9}'),
+ ('\u{1eeab}', '\u{1eebb}'), ('\u{20000}', '\u{2a6d6}'), ('\u{2a700}', '\u{2b734}'),
+ ('\u{2b740}', '\u{2b81d}'), ('\u{2b820}', '\u{2cea1}'), ('\u{2f800}', '\u{2fa1d}')
+ ];
+
+ pub fn XID_Start(c: char) -> bool {
+ super::bsearch_range_table(c, XID_Start_table)
+ }
+
+}
+
new file mode 100644
--- /dev/null
+++ b/third_party/rust/unicode-xid-0.0.4/src/tests.rs
@@ -0,0 +1,113 @@
+// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#[cfg(feature = "bench")]
+use std::iter;
+#[cfg(feature = "bench")]
+use test::Bencher;
+#[cfg(feature = "bench")]
+use std::prelude::v1::*;
+
+use super::UnicodeXID;
+
+#[cfg(feature = "bench")]
+#[bench]
+fn cargo_is_xid_start(b: &mut Bencher) {
+ let string = iter::repeat('a').take(4096).collect::<String>();
+
+ b.bytes = string.len() as u64;
+ b.iter(|| {
+ string.chars().all(UnicodeXID::is_xid_start)
+ });
+}
+
+#[cfg(feature = "bench")]
+#[bench]
+fn stdlib_is_xid_start(b: &mut Bencher) {
+ let string = iter::repeat('a').take(4096).collect::<String>();
+
+ b.bytes = string.len() as u64;
+ b.iter(|| {
+ string.chars().all(char::is_xid_start)
+ });
+}
+
+#[cfg(feature = "bench")]
+#[bench]
+fn cargo_xid_continue(b: &mut Bencher) {
+ let string = iter::repeat('a').take(4096).collect::<String>();
+
+ b.bytes = string.len() as u64;
+ b.iter(|| {
+ string.chars().all(UnicodeXID::is_xid_continue)
+ });
+}
+
+#[cfg(feature = "bench")]
+#[bench]
+fn stdlib_xid_continue(b: &mut Bencher) {
+ let string = iter::repeat('a').take(4096).collect::<String>();
+
+ b.bytes = string.len() as u64;
+ b.iter(|| {
+ string.chars().all(char::is_xid_continue)
+ });
+}
+
+#[test]
+fn test_is_xid_start() {
+ let chars = [
+ 'A', 'Z', 'a', 'z',
+ '\u{1000d}', '\u{10026}',
+ ];
+
+ for ch in &chars {
+ assert!(UnicodeXID::is_xid_start(*ch), "{}", ch);
+ }
+}
+
+#[test]
+fn test_is_not_xid_start() {
+ let chars = [
+ '\x00', '\x01',
+ '0', '9',
+ ' ', '[', '<', '{', '(',
+ '\u{02c2}', '\u{ffff}',
+ ];
+
+ for ch in &chars {
+ assert!(!UnicodeXID::is_xid_start(*ch), "{}", ch);
+ }
+}
+
+#[test]
+fn test_is_xid_continue() {
+ let chars = [
+ '0', '9', 'A', 'Z', 'a', 'z', '_',
+ '\u{1000d}', '\u{10026}',
+ ];
+
+ for ch in &chars {
+ assert!(UnicodeXID::is_xid_continue(*ch), "{}", ch);
+ }
+}
+
+#[test]
+fn test_is_not_xid_continue() {
+ let chars = [
+ '\x00', '\x01',
+ ' ', '[', '<', '{', '(',
+ '\u{02c2}', '\u{ffff}',
+ ];
+
+ for &ch in &chars {
+ assert!(!UnicodeXID::is_xid_continue(ch), "{}", ch);
+ }
+}
--- a/third_party/rust/unicode-xid/.cargo-checksum.json
+++ b/third_party/rust/unicode-xid/.cargo-checksum.json
@@ -1,1 +1,1 @@
-{"files":{".travis.yml":"f3e106aaaa534eb9090f1213ff5d0c7f9861ede7f1c973d9e0e13b4a84cb7791","COPYRIGHT":"23860c2a7b5d96b21569afedf033469bab9fe14a1b24a35068b8641c578ce24d","Cargo.toml":"1be08526c07c40136071faf603a382456ad1a6bafbb45d9ace01c52b50a9a55c","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"7b63ecd5f1902af1b63729947373683c32745c16a10e8e6292e2e2dcd7e90ae0","README.md":"67998486b32f4fe46abbbaa411b92528750e7f0e22452dc8a5b95d87d80fde75","scripts/unicode.py":"762eea92dd51238c6bf877570bde1149932ba15cf87be1618fc21cd53e941733","src/lib.rs":"4a89fadf452ae7c53536eaa4496f951a3153f8189dd1cbc532648731d30f0b11","src/tables.rs":"0643459b6ebeeed83aecd7604f0ea29c06bea7ce6c1cd9acd4988d27ace1ec53","src/tests.rs":"35a459382e190197e7b9a78832ae79f310b48a02a5b4227bf9bbc89d46c8deac"},"package":"8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc"}
\ No newline at end of file
+{"files":{".travis.yml":"f3e106aaaa534eb9090f1213ff5d0c7f9861ede7f1c973d9e0e13b4a84cb7791","COPYRIGHT":"23860c2a7b5d96b21569afedf033469bab9fe14a1b24a35068b8641c578ce24d","Cargo.toml":"aafcae4002bee71546a6aa40a97b9124a69f169ee7e3a9e3262338e32b4c2b9b","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"7b63ecd5f1902af1b63729947373683c32745c16a10e8e6292e2e2dcd7e90ae0","README.md":"67998486b32f4fe46abbbaa411b92528750e7f0e22452dc8a5b95d87d80fde75","scripts/unicode.py":"762eea92dd51238c6bf877570bde1149932ba15cf87be1618fc21cd53e941733","src/lib.rs":"4a89fadf452ae7c53536eaa4496f951a3153f8189dd1cbc532648731d30f0b11","src/tables.rs":"0643459b6ebeeed83aecd7604f0ea29c06bea7ce6c1cd9acd4988d27ace1ec53","src/tests.rs":"35a459382e190197e7b9a78832ae79f310b48a02a5b4227bf9bbc89d46c8deac"},"package":"fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"}
\ No newline at end of file
--- a/third_party/rust/unicode-xid/Cargo.toml
+++ b/third_party/rust/unicode-xid/Cargo.toml
@@ -1,12 +1,12 @@
[package]
name = "unicode-xid"
-version = "0.0.4"
+version = "0.1.0"
authors = ["erick.tryzelaar <erick.tryzelaar@gmail.com>",
"kwantam <kwantam@gmail.com>",
]
homepage = "https://github.com/unicode-rs/unicode-xid"
repository = "https://github.com/unicode-rs/unicode-xid"
documentation = "https://unicode-rs.github.io/unicode-xid"
license = "MIT/Apache-2.0"
--- a/toolkit/library/gtest/rust/Cargo.lock
+++ b/toolkit/library/gtest/rust/Cargo.lock
@@ -118,28 +118,29 @@ version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "bindgen"
-version = "0.32.2"
+version = "0.32.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cexpr 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"clang-sys 0.21.1 (registry+https://github.com/rust-lang/crates.io-index)",
"clap 2.29.0 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"peeking_take_while 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
+ "proc-macro2 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "quote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"which 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "bitflags"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1032,16 +1033,24 @@ dependencies = [
]
[[package]]
name = "precomputed-hash"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
+name = "proc-macro2"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
name = "procedural-masquerade"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "pulse"
version = "0.2.0"
dependencies = [
@@ -1057,16 +1066,24 @@ dependencies = [
]
[[package]]
name = "quote"
version = "0.3.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
+name = "quote"
+version = "0.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "proc-macro2 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
name = "rand"
version = "0.3.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"fuchsia-zircon 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -1245,17 +1262,17 @@ source = "registry+https://github.com/ru
[[package]]
name = "style"
version = "0.0.1"
dependencies = [
"app_units 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"arrayvec 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "bindgen 0.32.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "bindgen 0.32.3 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.23.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)",
"fallible 0.0.1",
"fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"hashglobe 0.1.0",
@@ -1478,16 +1495,21 @@ version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "unicode-xid"
version = "0.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
+name = "unicode-xid"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
name = "unreachable"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -1654,17 +1676,17 @@ dependencies = [
"checksum ansi_term 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6b3568b48b7cefa6b8ce125f9bb4989e52fbcc29ebea88df04cc7c5f12f70455"
"checksum app_units 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "29069a9b483f7780aebb55dafb360c6225eefdc1f98c8d336a65148fd10c37b1"
"checksum arrayvec 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2f0ef4a9820019a0c91d918918c93dc71d469f581a49b47ddc1d285d4270bbe2"
"checksum atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fb2dcb6e6d35f20276943cc04bb98e538b348d525a04ac79c10021561d202f21"
"checksum atty 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d912da0db7fa85514874458ca3651fe2cddace8d0b0505571dbdcd41ab490159"
"checksum binary-space-partition 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "88ceb0d16c4fd0e42876e298d7d3ce3780dd9ebdcbe4199816a32c77e08597ff"
"checksum bincode 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e103c8b299b28a9c6990458b7013dc4a8356a9b854c51b9883241f5866fac36e"
"checksum bincode 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9d3fb369af639822830328794eba2501b3479652fcd021b2aeb1ed4984202afd"
-"checksum bindgen 0.32.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6ed9557522980fcdb4986097c2ea9d2504eafa7e5818f393110205b5325a52ce"
+"checksum bindgen 0.32.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8b242e11a8f446f5fc7b76b37e81d737cabca562a927bd33766dac55b5f1177f"
"checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d"
"checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5"
"checksum bitflags 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f5cde24d1b2e2216a726368b2363a273739c91f4e3eb4e0dd12d672d396ad989"
"checksum bitreader 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "80b13e2ab064ff3aa0bdbf1eff533f9822dc37899821f5f98c67f263eab51707"
"checksum boxfnonce 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8380105befe91099e6f69206164072c05bc92427ff6aa8a5171388317346dd75"
"checksum byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "652805b7e73fada9d85e9a6682a4abd490cb52d96aeecc12e33a0de34dfd0d23"
"checksum bytes 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d828f97b58cc5de3e40c421d0cf2132d6b2da4ee0e11b8632fa838f0f9333ad6"
"checksum cexpr 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "393a5f0088efbe41f9d1fcd062f24e83c278608420e62109feb2c8abee07de7d"
@@ -1742,18 +1764,20 @@ dependencies = [
"checksum percent-encoding 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "de154f638187706bde41d9b4738748933d64e6b37bdbffc0b47a97d16a6ae356"
"checksum phf 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)" = "cb325642290f28ee14d8c6201159949a872f220c62af6e110a56ea914fbe42fc"
"checksum phf_codegen 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)" = "d62594c0bb54c464f633175d502038177e90309daf2e0158be42ed5f023ce88f"
"checksum phf_generator 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)" = "6b07ffcc532ccc85e3afc45865469bf5d9e4ef5bfcf9622e3cfe80c2d275ec03"
"checksum phf_shared 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)" = "07e24b0ca9643bdecd0632f2b3da6b1b89bbb0030e0b992afc1113b23a7bc2f2"
"checksum pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "3a8b4c6b8165cd1a1cd4b9b120978131389f64bdaf456435caa41e630edba903"
"checksum plane-split 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d2adb8d1523b2ddcd98275613e9bc04eef75b47a39e252e63733a3218ae3c1b7"
"checksum precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c"
+"checksum proc-macro2 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d1cb7aaaa4bf022ec2b14ff2f2ba1643a22f3cee88df014a85e14b392282c61d"
"checksum procedural-masquerade 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9f566249236c6ca4340f7ca78968271f0ed2b0f234007a61b66f9ecd0af09260"
"checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a"
+"checksum quote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1eca14c727ad12702eb4b6bfb5a232287dcf8385cb8ca83a3eeaf6519c44c408"
"checksum rand 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)" = "6475140dfd8655aeb72e1fd4b7a1cc1c202be65d71669476e392fe62532b9edd"
"checksum rayon 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b614fe08b6665cb9a231d07ac1364b0ef3cb3698f1239ee0c4c3a88a524f54c8"
"checksum rayon-core 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2c21a92a5dca958fb030787c1158446c6deb7f976399b72fa8074603f169e2a"
"checksum redox_syscall 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)" = "ab105df655884ede59d45b7070c8a65002d921461ee813a024558ca16030eea0"
"checksum regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1731164734096285ec2a5ec7fea5248ae2f5485b3feeb0115af4fda2183b2d1b"
"checksum regex-syntax 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ad890a5eef7953f55427c50575c680c42841653abd2b028b68cd223d157f62db"
"checksum runloop 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5d79b4b604167921892e84afbbaad9d5ad74e091bf6c511d9dbfb0593f09fabd"
"checksum same-file 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d931a44fdaa43b8637009e7632a02adc4f2b2e0733c08caa4cf00e8da4a117a7"
@@ -1784,16 +1808,17 @@ dependencies = [
"checksum tokio-uds 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "65ae5d255ce739e8537221ed2942e0445f4b3b813daebac1c0050ddaaa3587f9"
"checksum toml 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "736b60249cb25337bc196faa43ee12c705e426f3d55c214d73a4e7be06f92cb4"
"checksum uluru 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "519130f0ea964ba540a9d8af1373738c2226f1d465eda07e61db29feb5479db9"
"checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5"
"checksum unicode-normalization 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "51ccda9ef9efa3f7ef5d91e8f9b83bbe6955f9bf86aec89d5cce2c874625920f"
"checksum unicode-segmentation 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "18127285758f0e2c6cf325bb3f3d138a12fee27de4f23e146cd6a179f26c2cf3"
"checksum unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "bf3a113775714a22dcb774d8ea3655c53a32debae63a063acc00a91cc586245f"
"checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc"
+"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
"checksum unreachable 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1f2ae5ddb18e1c92664717616dd9549dde73f539f01bd7b77c2edb2446bdff91"
"checksum url 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fa35e768d4daf1d85733418a49fb42e10d7f633e394fccab4ab7aba897053fe2"
"checksum utf8-ranges 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "662fab6525a98beff2921d7f61a39e7d59e0b425ebc7d0d9e66d316e55124122"
"checksum vec_map 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "887b5b631c2ad01628bbbaa7dd4c869f80d3186688f8d0b6f58774fbe324988c"
"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
"checksum walkdir 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "bb08f9e670fab86099470b97cd2b252d6527f0b3cc1401acdb595ffc9dd288ff"
"checksum which 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4be6cfa54dab45266e98b5d7be2f8ce959ddd49abd141a05d52dce4b07f803bb"
"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
--- a/toolkit/library/rust/Cargo.lock
+++ b/toolkit/library/rust/Cargo.lock
@@ -118,28 +118,29 @@ version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "bindgen"
-version = "0.32.2"
+version = "0.32.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cexpr 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"clang-sys 0.21.1 (registry+https://github.com/rust-lang/crates.io-index)",
"clap 2.29.0 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"peeking_take_while 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
+ "proc-macro2 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "quote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"which 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "bitflags"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1019,16 +1020,24 @@ dependencies = [
]
[[package]]
name = "precomputed-hash"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
+name = "proc-macro2"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
name = "procedural-masquerade"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "pulse"
version = "0.2.0"
dependencies = [
@@ -1044,16 +1053,24 @@ dependencies = [
]
[[package]]
name = "quote"
version = "0.3.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
+name = "quote"
+version = "0.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "proc-macro2 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
name = "rand"
version = "0.3.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"fuchsia-zircon 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -1236,17 +1253,17 @@ source = "registry+https://github.com/ru
[[package]]
name = "style"
version = "0.0.1"
dependencies = [
"app_units 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"arrayvec 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "bindgen 0.32.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "bindgen 0.32.3 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.23.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)",
"fallible 0.0.1",
"fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"hashglobe 0.1.0",
@@ -1489,16 +1506,21 @@ version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "unicode-xid"
version = "0.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
+name = "unicode-xid"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
name = "unreachable"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -1656,17 +1678,17 @@ dependencies = [
"checksum ansi_term 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6b3568b48b7cefa6b8ce125f9bb4989e52fbcc29ebea88df04cc7c5f12f70455"
"checksum app_units 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "29069a9b483f7780aebb55dafb360c6225eefdc1f98c8d336a65148fd10c37b1"
"checksum arrayvec 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2f0ef4a9820019a0c91d918918c93dc71d469f581a49b47ddc1d285d4270bbe2"
"checksum atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fb2dcb6e6d35f20276943cc04bb98e538b348d525a04ac79c10021561d202f21"
"checksum atty 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d912da0db7fa85514874458ca3651fe2cddace8d0b0505571dbdcd41ab490159"
"checksum binary-space-partition 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "88ceb0d16c4fd0e42876e298d7d3ce3780dd9ebdcbe4199816a32c77e08597ff"
"checksum bincode 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e103c8b299b28a9c6990458b7013dc4a8356a9b854c51b9883241f5866fac36e"
"checksum bincode 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9d3fb369af639822830328794eba2501b3479652fcd021b2aeb1ed4984202afd"
-"checksum bindgen 0.32.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6ed9557522980fcdb4986097c2ea9d2504eafa7e5818f393110205b5325a52ce"
+"checksum bindgen 0.32.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8b242e11a8f446f5fc7b76b37e81d737cabca562a927bd33766dac55b5f1177f"
"checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d"
"checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5"
"checksum bitflags 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f5cde24d1b2e2216a726368b2363a273739c91f4e3eb4e0dd12d672d396ad989"
"checksum bitreader 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "80b13e2ab064ff3aa0bdbf1eff533f9822dc37899821f5f98c67f263eab51707"
"checksum boxfnonce 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8380105befe91099e6f69206164072c05bc92427ff6aa8a5171388317346dd75"
"checksum byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "652805b7e73fada9d85e9a6682a4abd490cb52d96aeecc12e33a0de34dfd0d23"
"checksum bytes 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d828f97b58cc5de3e40c421d0cf2132d6b2da4ee0e11b8632fa838f0f9333ad6"
"checksum cexpr 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "393a5f0088efbe41f9d1fcd062f24e83c278608420e62109feb2c8abee07de7d"
@@ -1744,18 +1766,20 @@ dependencies = [
"checksum percent-encoding 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "de154f638187706bde41d9b4738748933d64e6b37bdbffc0b47a97d16a6ae356"
"checksum phf 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)" = "cb325642290f28ee14d8c6201159949a872f220c62af6e110a56ea914fbe42fc"
"checksum phf_codegen 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)" = "d62594c0bb54c464f633175d502038177e90309daf2e0158be42ed5f023ce88f"
"checksum phf_generator 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)" = "6b07ffcc532ccc85e3afc45865469bf5d9e4ef5bfcf9622e3cfe80c2d275ec03"
"checksum phf_shared 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)" = "07e24b0ca9643bdecd0632f2b3da6b1b89bbb0030e0b992afc1113b23a7bc2f2"
"checksum pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "3a8b4c6b8165cd1a1cd4b9b120978131389f64bdaf456435caa41e630edba903"
"checksum plane-split 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d2adb8d1523b2ddcd98275613e9bc04eef75b47a39e252e63733a3218ae3c1b7"
"checksum precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c"
+"checksum proc-macro2 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d1cb7aaaa4bf022ec2b14ff2f2ba1643a22f3cee88df014a85e14b392282c61d"
"checksum procedural-masquerade 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9f566249236c6ca4340f7ca78968271f0ed2b0f234007a61b66f9ecd0af09260"
"checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a"
+"checksum quote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1eca14c727ad12702eb4b6bfb5a232287dcf8385cb8ca83a3eeaf6519c44c408"
"checksum rand 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)" = "6475140dfd8655aeb72e1fd4b7a1cc1c202be65d71669476e392fe62532b9edd"
"checksum rayon 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b614fe08b6665cb9a231d07ac1364b0ef3cb3698f1239ee0c4c3a88a524f54c8"
"checksum rayon-core 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2c21a92a5dca958fb030787c1158446c6deb7f976399b72fa8074603f169e2a"
"checksum redox_syscall 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)" = "ab105df655884ede59d45b7070c8a65002d921461ee813a024558ca16030eea0"
"checksum regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1731164734096285ec2a5ec7fea5248ae2f5485b3feeb0115af4fda2183b2d1b"
"checksum regex-syntax 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ad890a5eef7953f55427c50575c680c42841653abd2b028b68cd223d157f62db"
"checksum runloop 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5d79b4b604167921892e84afbbaad9d5ad74e091bf6c511d9dbfb0593f09fabd"
"checksum same-file 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d931a44fdaa43b8637009e7632a02adc4f2b2e0733c08caa4cf00e8da4a117a7"
@@ -1786,16 +1810,17 @@ dependencies = [
"checksum tokio-uds 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "65ae5d255ce739e8537221ed2942e0445f4b3b813daebac1c0050ddaaa3587f9"
"checksum toml 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "736b60249cb25337bc196faa43ee12c705e426f3d55c214d73a4e7be06f92cb4"
"checksum uluru 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "519130f0ea964ba540a9d8af1373738c2226f1d465eda07e61db29feb5479db9"
"checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5"
"checksum unicode-normalization 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "51ccda9ef9efa3f7ef5d91e8f9b83bbe6955f9bf86aec89d5cce2c874625920f"
"checksum unicode-segmentation 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "18127285758f0e2c6cf325bb3f3d138a12fee27de4f23e146cd6a179f26c2cf3"
"checksum unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "bf3a113775714a22dcb774d8ea3655c53a32debae63a063acc00a91cc586245f"
"checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc"
+"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
"checksum unreachable 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1f2ae5ddb18e1c92664717616dd9549dde73f539f01bd7b77c2edb2446bdff91"
"checksum url 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fa35e768d4daf1d85733418a49fb42e10d7f633e394fccab4ab7aba897053fe2"
"checksum utf8-ranges 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "662fab6525a98beff2921d7f61a39e7d59e0b425ebc7d0d9e66d316e55124122"
"checksum vec_map 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "887b5b631c2ad01628bbbaa7dd4c869f80d3186688f8d0b6f58774fbe324988c"
"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
"checksum walkdir 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "bb08f9e670fab86099470b97cd2b252d6527f0b3cc1401acdb595ffc9dd288ff"
"checksum which 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4be6cfa54dab45266e98b5d7be2f8ce959ddd49abd141a05d52dce4b07f803bb"
"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"