Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 89 additions & 2 deletions collector/compile-benchmarks/html5ever/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions collector/compile-benchmarks/html5ever/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

name = "html5ever"
version = "0.5.4"
authors = [ "The html5ever Project Developers" ]
authors = ["The html5ever Project Developers"]
license = "MIT / Apache-2.0"
repository = "https://github.com/servo/html5ever"
description = "High-performance browser-grade HTML5 parser"
Expand Down Expand Up @@ -35,7 +35,8 @@ rustc-test = "0.1.3"

[build-dependencies]
phf_codegen = "0.7.3"
rustc-serialize = "0.3.15"
serde_json = "1"
serde = { version = "1", features = ["derive"] }
html5ever_macros = { version = "0.2.6", path = "macros", optional = true }

[profile.dev]
Expand Down
12 changes: 3 additions & 9 deletions collector/compile-benchmarks/html5ever/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(rustc_encodable_decodable)]

extern crate phf_codegen;
extern crate rustc_serialize;

use rustc_serialize::json::{Json, Decoder};
use rustc_serialize::Decodable;
use std::collections::HashMap;
use std::env;
use std::fs::File;
Expand Down Expand Up @@ -99,14 +94,13 @@ fn check_hash(from: &Path, to: &Path) -> Result<(), String> {

fn named_entities_to_phf(from: &Path, to: &Path) {
// A struct matching the entries in entities.json.
#[derive(RustcDecodable)]
#[derive(serde::Deserialize)]
struct CharRef {
codepoints: Vec<u32>,
//characters: String, // Present in the file but we don't need it
}

let json = Json::from_reader(&mut File::open(from).unwrap()).unwrap();
let entities: HashMap<String, CharRef> = Decodable::decode(&mut Decoder::new(json)).unwrap();
let entities: HashMap<String, CharRef> = serde_json::from_reader(&mut File::open(from).unwrap()).unwrap();
let mut entities: HashMap<&str, (u32, u32)> = entities.iter().map(|(name, char_ref)| {
assert!(name.starts_with("&"));
assert!(char_ref.codepoints.len() <= 2);
Expand All @@ -115,7 +109,7 @@ fn named_entities_to_phf(from: &Path, to: &Path) {

// Add every missing prefix of those keys, mapping to NULL characters.
for key in entities.keys().cloned().collect::<Vec<_>>() {
for n in 1 .. key.len() {
for n in 1..key.len() {
entities.entry(&key[..n]).or_insert((0, 0));
}
}
Expand Down
45 changes: 31 additions & 14 deletions collector/compile-benchmarks/piston-image/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading