Upgrade to rustc 0.8-pre (0a677bc 2013-08-14 10:35:12 -0700)

This commit is contained in:
Simon Sapin 2013-08-16 14:48:52 +01:00
parent b5860f407f
commit 8fec26174b
9 changed files with 27 additions and 31 deletions

View file

@ -8,7 +8,7 @@ use cssparser::{SyntaxError, SourceLocation};
pub struct ErrorLoggerIterator<I>(I);
impl<T, I: Iterator<Result<T, SyntaxError>>> Iterator<T> for ErrorLoggerIterator<I> {
pub fn next(&mut self) -> Option<T> {
fn next(&mut self) -> Option<T> {
for result in **self {
match result {
Ok(v) => return Some(v),

View file

@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use std::ascii::to_ascii_lower;
use std::ascii::StrAsciiExt;
use cssparser::*;
use errors::{ErrorLoggerIterator, log_css_error};
use stylesheets::{CSSRule, CSSMediaRule, parse_style_rule, parse_nested_at_rule};
@ -60,7 +60,7 @@ pub fn parse_media_rule(rule: AtRule, parent_rules: &mut ~[CSSRule],
match rule {
QualifiedRule(rule) => parse_style_rule(rule, &mut rules, namespaces),
AtRule(rule) => parse_nested_at_rule(
to_ascii_lower(rule.name), rule, &mut rules, namespaces),
rule.name.to_ascii_lower(), rule, &mut rules, namespaces),
}
}
parent_rules.push(CSSMediaRule(MediaRule {
@ -80,8 +80,7 @@ pub fn parse_media_query_list(input: &[ComponentValue]) -> MediaQueryList {
loop {
let mq = match next {
Some(&Ident(ref value)) => {
let media_type: &str = to_ascii_lower(value.as_slice());
match media_type {
match value.to_ascii_lower().as_slice() {
"screen" => Some(MediaQuery{ media_type: MediaType(Screen) }),
"print" => Some(MediaQuery{ media_type: MediaType(Print) }),
"all" => Some(MediaQuery{ media_type: All }),

View file

@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use std::ascii::to_ascii_lower;
use std::ascii::StrAsciiExt;
use cssparser::*;
@ -15,7 +15,7 @@ pub fn one_component_value<'a>(input: &'a [ComponentValue]) -> Option<&'a Compon
pub fn get_ident_lower(component_value: &ComponentValue) -> Option<~str> {
match component_value {
&Ident(ref value) => Some(to_ascii_lower(value.as_slice())),
&Ident(ref value) => Some(value.to_ascii_lower()),
_ => None,
}
}

View file

@ -11,7 +11,7 @@ pub type Integer = i64;
pub mod specified {
use std::ascii::{to_ascii_lower, eq_ignore_ascii_case};
use std::ascii::StrAsciiExt;
use cssparser::*;
use super::{Integer, Float};
@ -50,7 +50,7 @@ pub mod specified {
Length::parse_internal(input, /* negative_ok = */ false)
}
pub fn parse_dimension(value: Float, unit: &str) -> Option<Length> {
match to_ascii_lower(unit).as_slice() {
match unit.to_ascii_lower().as_slice() {
"px" => Some(Length::from_px(value)),
"in" => Some(Au((value * AU_PER_IN) as Integer)),
"cm" => Some(Au((value * AU_PER_CM) as Integer)),
@ -106,8 +106,8 @@ pub mod specified {
=> Length::parse_dimension(value.value, unit.as_slice()).map_move(Length_),
&ast::Percentage(ref value) if negative_ok || value.value >= 0.
=> Some(Percentage_(value.value)),
&Number(ref value) if value.value == 0. => Some(Length_(Au(0))),
&Ident(ref value) if eq_ignore_ascii_case(value.as_slice(), "auto") => Some(Auto),
&Number(ref value) if value.value == 0. => Some(Length_(Au(0))),
&Ident(ref value) if value.eq_ignore_ascii_case("auto") => Some(Auto),
_ => None
}
}

View file

@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
pub use std::ascii::{to_ascii_lower, eq_ignore_ascii_case};
use std::ascii::StrAsciiExt;
pub use std::iterator;
pub use std::option;
pub use cssparser::*;
@ -84,7 +84,7 @@ single_type!(border_left_style, BorderStyle)
pub fn parse_border_width(component_value: &ComponentValue) -> Option<specified::Length> {
match component_value {
&Ident(ref value) => match to_ascii_lower(value.as_slice()).as_slice() {
&Ident(ref value) => match value.to_ascii_lower().as_slice() {
"thin" => Some(specified::Length::from_px(1.)),
"medium" => Some(specified::Length::from_px(3.)),
"thick" => Some(specified::Length::from_px(5.)),
@ -154,7 +154,7 @@ pub mod line_height {
=> Some(Percentage(value.value)),
&Dimension(ref value, ref unit) if value.value >= 0.
=> specified::Length::parse_dimension(value.value, unit.as_slice()).map_move(Length),
&Ident(ref value) if eq_ignore_ascii_case(value.as_slice(), "auto")
&Ident(ref value) if value.eq_ignore_ascii_case("auto")
=> Some(Normal),
_ => None,
}
@ -213,7 +213,7 @@ pub mod font_family {
Some(&String(ref value)) => add!(FamilyName(value.to_owned())),
Some(&Ident(ref value)) => {
let value = value.as_slice();
match to_ascii_lower(value).as_slice() {
match value.to_ascii_lower().as_slice() {
"serif" => add!(Serif),
"sans-serif" => add!(SansSerif),
"cursive" => add!(Cursive),
@ -273,7 +273,7 @@ pub mod font_weight {
}
pub fn from_component_value(input: &ComponentValue) -> Option<SpecifiedValue> {
match input {
&Ident(ref value) => match to_ascii_lower(value.as_slice()).as_slice() {
&Ident(ref value) => match value.to_ascii_lower().as_slice() {
"bold" => Some(Weight700),
"normal" => Some(Weight400),
"bolder" => Some(Bolder),

View file

@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use std::ascii::to_ascii_lower;
use std::ascii::StrAsciiExt;
use cssparser::*;
use errors::{ErrorLoggerIterator, log_css_error};
@ -28,7 +28,7 @@ pub fn parse_property_declaration_list(input: ~[Node]) -> PropertyDeclarationBlo
rule.location, fmt!("Unsupported at-rule in declaration list: @%s", rule.name)),
Declaration(Declaration{ location: l, name: n, value: v, important: i}) => {
let list = if i { &mut important } else { &mut normal };
if !parse_one_property_declaration(to_ascii_lower(n), v, list) {
if !parse_one_property_declaration(n.to_ascii_lower(), v, list) {
log_css_error(l, "Invalid property declaration")
}
}

View file

@ -208,7 +208,7 @@ shorthand!(font [
// font-style, font-weight and font-variant.
// Leaves the values to None, 'normal' is the initial value for each of them.
if get_ident_lower(component_value).filtered(
|v| eq_ignore_ascii_case(v.as_slice(), "normal")).is_some() {
|v| v.eq_ignore_ascii_case("normal")).is_some() {
nb_normals += 1;
loop;
}

View file

@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use std::{vec, iterator};
use std::ascii::to_ascii_lower;
use std::ascii::StrAsciiExt;
use cssparser::*;
use namespaces::NamespaceMap;
@ -230,7 +230,7 @@ fn parse_type_selector(iter: &mut Iter, namespaces: &NamespaceMap)
}
match local_name {
Some(name) => simple_selectors.push(LocalNameSelector{
lowercase_name: to_ascii_lower(name),
lowercase_name: name.to_ascii_lower(),
cased_name: name,
}),
None => (),
@ -366,7 +366,7 @@ fn parse_attribute_selector(content: ~[ComponentValue], namespaces: &NamespaceMa
Some(Some((_, None))) => fail!("Implementation error, this should not happen."),
Some(Some((namespace, Some(local_name)))) => AttrSelector {
namespace: namespace,
lowercase_name: to_ascii_lower(local_name),
lowercase_name: local_name.to_ascii_lower(),
cased_name: local_name,
},
};
@ -394,8 +394,7 @@ fn parse_attribute_selector(content: ~[ComponentValue], namespaces: &NamespaceMa
fn parse_simple_pseudo_class(name: ~str) -> Option<Either<SimpleSelector, PseudoElement>> {
let lower_name: &str = to_ascii_lower(name);
match lower_name {
match name.to_ascii_lower().as_slice() {
"root" => Some(Left(Root)),
"empty" => Some(Left(Empty)),
@ -412,8 +411,7 @@ fn parse_simple_pseudo_class(name: ~str) -> Option<Either<SimpleSelector, Pseudo
fn parse_functional_pseudo_class(name: ~str, arguments: ~[ComponentValue],
namespaces: &NamespaceMap, inside_negation: bool)
-> Option<SimpleSelector> {
let lower_name: &str = to_ascii_lower(name);
match lower_name {
match name.to_ascii_lower().as_slice() {
"lang" => parse_lang(arguments),
"nth-child" => parse_nth(arguments).map(|&(a, b)| NthChild(a, b)),
"not" => if inside_negation { None } else { parse_negation(arguments, namespaces) },
@ -423,8 +421,7 @@ fn parse_functional_pseudo_class(name: ~str, arguments: ~[ComponentValue],
fn parse_pseudo_element(name: ~str) -> Option<PseudoElement> {
let lower_name: &str = to_ascii_lower(name);
match lower_name {
match name.to_ascii_lower().as_slice() {
// All supported pseudo-elements
"before" => Some(Before),
"after" => Some(After),

View file

@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use std::iterator::Iterator;
use std::ascii::to_ascii_lower;
use std::ascii::StrAsciiExt;
use cssparser::*;
use selectors;
use properties;
@ -49,8 +49,8 @@ fn parse_stylesheet(css: &str) -> Stylesheet {
parse_style_rule(rule, &mut rules, &namespaces)
},
AtRule(rule) => {
let lower_name: &str = to_ascii_lower(rule.name);
match lower_name {
let lower_name = rule.name.to_ascii_lower();
match lower_name.as_slice() {
"charset" => {
if state > STATE_CHARSET {
log_css_error(rule.location, "@charset must be the first rule")