Skip to content

Commit 22146ce

Browse files
committed
Upgrade to rustc 0a4c136d6 2014-09-23
1 parent fa619d4 commit 22146ce

File tree

7 files changed

+26
-26
lines changed

7 files changed

+26
-26
lines changed

src/ast.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub enum ComponentValue {
3232
AtKeyword(String),
3333
Hash(String),
3434
IDHash(String), // Hash that is a valid ID selector.
35-
String(String),
35+
QuotedString(String),
3636
URL(String),
3737
Delim(char),
3838
Number(NumericValue),
@@ -107,15 +107,15 @@ pub struct AtRule {
107107

108108
#[deriving(PartialEq)]
109109
pub enum DeclarationListItem {
110-
Declaration(Declaration),
110+
Declaration_(Declaration),
111111
// A better idea for a name that means "at-rule" but is not "AtRule"?
112112
DeclAtRule(AtRule),
113113
}
114114

115115
#[deriving(PartialEq)]
116116
pub enum Rule {
117-
QualifiedRule(QualifiedRule),
118-
AtRule(AtRule),
117+
QualifiedRule_(QualifiedRule),
118+
AtRule_(AtRule),
119119
}
120120

121121
#[deriving(PartialEq)]
@@ -172,7 +172,7 @@ pub trait MoveSkipWhitespaceIterable {
172172

173173
impl MoveSkipWhitespaceIterable for Vec<ComponentValue> {
174174
fn move_skip_whitespace(self) -> MoveSkipWhitespaceIterator {
175-
MoveSkipWhitespaceIterator{ iter_with_whitespace: self.move_iter() }
175+
MoveSkipWhitespaceIterator{ iter_with_whitespace: self.into_iter() }
176176
}
177177
}
178178

src/color.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ impl fmt::Show for RGBA {
2727
#[deriving(Clone, PartialEq)]
2828
pub enum Color {
2929
CurrentColor,
30-
RGBA(RGBA),
30+
RGBAColor(RGBA),
3131
}
3232

3333

@@ -199,11 +199,11 @@ fn parse_color_keyword(value: &str) -> Result<Color, ()> {
199199
"whitesmoke" => (245., 245., 245.),
200200
"yellowgreen" => (154., 205., 50.),
201201

202-
"transparent" => return Ok(RGBA(RGBA { red: 0., green: 0., blue: 0., alpha: 0. })),
202+
"transparent" => return Ok(RGBAColor(RGBA { red: 0., green: 0., blue: 0., alpha: 0. })),
203203
"currentcolor" => return Ok(CurrentColor),
204204
_ => return Err(()),
205205
};
206-
Ok(RGBA(RGBA { red: r / 255., green: g / 255., blue: b / 255., alpha: 1. }))
206+
Ok(RGBAColor(RGBA { red: r / 255., green: g / 255., blue: b / 255., alpha: 1. }))
207207
}
208208

209209

@@ -222,7 +222,7 @@ fn parse_color_hash(value: &str) -> Result<Color, ()> {
222222
)
223223
macro_rules! to_rgba(
224224
($r: expr, $g: expr, $b: expr,) => {
225-
Ok(RGBA(RGBA { red: $r as f32 / 255.,
225+
Ok(RGBAColor(RGBA { red: $r as f32 / 255.,
226226
green: $g as f32 / 255.,
227227
blue: $b as f32 / 255.,
228228
alpha: 1. }))
@@ -336,7 +336,7 @@ fn parse_color_function(name: &str, arguments: &[ComponentValue])
336336
1.
337337
};
338338
if iter.next().is_none() {
339-
Ok(RGBA(RGBA { red: red, green: green, blue: blue, alpha: alpha }))
339+
Ok(RGBAColor(RGBA { red: red, green: green, blue: blue, alpha: alpha }))
340340
} else {
341341
Err(())
342342
}

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub use parser::{parse_stylesheet_rules, StylesheetParser,
2323
parse_declaration_list, DeclarationListParser,
2424
parse_one_rule, parse_one_declaration, parse_one_component_value};
2525
pub use from_bytes::{decode_stylesheet_bytes, parse_stylesheet_rules_from_bytes};
26-
pub use color::{RGBA, Color, CurrentColor};
26+
pub use color::{RGBA, Color, CurrentColor, RGBAColor};
2727
pub use nth::parse_nth;
2828
pub use serializer::{ToCss, serialize_identifier, serialize_string};
2929

src/parser.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,9 @@ impl<T: Iterator<Node>> Iterator<Result<Rule, SyntaxError>> for StylesheetParser
119119
for_iter!(iter, (component_value, location), {
120120
match component_value {
121121
WhiteSpace | CDO | CDC => (),
122-
AtKeyword(name) => return Some(Ok(AtRule(parse_at_rule(iter, name, location)))),
122+
AtKeyword(name) => return Some(Ok(AtRule_(parse_at_rule(iter, name, location)))),
123123
_ => return Some(match parse_qualified_rule(iter, component_value, location) {
124-
Ok(rule) => Ok(QualifiedRule(rule)),
124+
Ok(rule) => Ok(QualifiedRule_(rule)),
125125
Err(e) => Err(e),
126126
}),
127127
}
@@ -137,9 +137,9 @@ impl<T: Iterator<Node>> Iterator<Result<Rule, SyntaxError>> for RuleListParser<T
137137
for_iter!(iter, (component_value, location), {
138138
match component_value {
139139
WhiteSpace => (),
140-
AtKeyword(name) => return Some(Ok(AtRule(parse_at_rule(iter, name, location)))),
140+
AtKeyword(name) => return Some(Ok(AtRule_(parse_at_rule(iter, name, location)))),
141141
_ => return Some(match parse_qualified_rule(iter, component_value, location) {
142-
Ok(rule) => Ok(QualifiedRule(rule)),
142+
Ok(rule) => Ok(QualifiedRule_(rule)),
143143
Err(e) => Err(e),
144144
}),
145145
}
@@ -159,7 +159,7 @@ for DeclarationListParser<T> {
159159
AtKeyword(name)
160160
=> return Some(Ok(DeclAtRule(parse_at_rule(iter, name, location)))),
161161
_ => return Some(match parse_declaration(iter, component_value, location) {
162-
Ok(declaration) => Ok(Declaration(declaration)),
162+
Ok(declaration) => Ok(Declaration_(declaration)),
163163
Err(e) => {
164164
// Find the end of the declaration
165165
for (v, _) in *iter { if v == Semicolon { break } }

src/serializer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub fn to_css_push(component_value: &ComponentValue, css: &mut String) {
2222
css.push_char('#');
2323
serialize_identifier(value.as_slice(), css);
2424
}
25-
String(ref value) => serialize_string(value.as_slice(), css),
25+
QuotedString(ref value) => serialize_string(value.as_slice(), css),
2626
URL(ref value) => {
2727
css.push_str("url(");
2828
serialize_string(value.as_slice(), css);

src/tests.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ fn run_raw_json_tests(json_data: &str, run: |json::Json, json::Json|) {
8282
};
8383
assert!(items.len() % 2 == 0);
8484
let mut input = None;
85-
for item in items.move_iter() {
85+
for item in items.into_iter() {
8686
match (&input, item) {
8787
(&None, json_obj) => input = Some(json_obj),
8888
(&Some(_), expected) => {
@@ -189,7 +189,7 @@ fn stylesheet_from_bytes() {
189189
assert_json_eq(result, expected, json::Object(map).to_string());
190190
});
191191

192-
fn get_string<'a>(map: &'a json::Object, key: &String) -> Option<&'a str> {
192+
fn get_string<'a>(map: &'a json::JsonObject, key: &String) -> Option<&'a str> {
193193
match map.find(key) {
194194
Some(&json::String(ref s)) => Some(s.as_slice()),
195195
Some(&json::Null) => None,
@@ -227,7 +227,7 @@ fn color3_hsl() {
227227
fn color3_keywords() {
228228
run_color_tests(include_str!("css-parsing-tests/color3_keywords.json"), |c| {
229229
match c {
230-
Some(RGBA(RGBA { red: r, green: g, blue: b, alpha: a }))
230+
Some(RGBAColor(RGBA { red: r, green: g, blue: b, alpha: a }))
231231
=> vec!(r * 255., g * 255., b * 255., a).to_json(),
232232
Some(CurrentColor) => JString!("currentColor"),
233233
None => json::Null,
@@ -329,7 +329,7 @@ impl ToJson for SyntaxError {
329329
impl ToJson for Color {
330330
fn to_json(&self) -> json::Json {
331331
match *self {
332-
RGBA(RGBA { red: r, green: g, blue: b, alpha: a }) => vec!(r, g, b, a).to_json(),
332+
RGBAColor(RGBA { red: r, green: g, blue: b, alpha: a }) => vec!(r, g, b, a).to_json(),
333333
CurrentColor => JString!("currentColor"),
334334
}
335335
}
@@ -339,8 +339,8 @@ impl ToJson for Color {
339339
impl ToJson for Rule {
340340
fn to_json(&self) -> json::Json {
341341
match *self {
342-
QualifiedRule(ref rule) => rule.to_json(),
343-
AtRule(ref rule) => rule.to_json(),
342+
QualifiedRule_(ref rule) => rule.to_json(),
343+
AtRule_(ref rule) => rule.to_json(),
344344
}
345345
}
346346
}
@@ -349,7 +349,7 @@ impl ToJson for Rule {
349349
impl ToJson for DeclarationListItem {
350350
fn to_json(&self) -> json::Json {
351351
match *self {
352-
Declaration(ref declaration) => declaration.to_json(),
352+
Declaration_(ref declaration) => declaration.to_json(),
353353
DeclAtRule(ref at_rule) => at_rule.to_json(),
354354
}
355355
}
@@ -414,7 +414,7 @@ impl ToJson for ComponentValue {
414414
Hash(ref value) => JList!(JString!("hash"), value.to_json(),
415415
JString!("unrestricted")),
416416
IDHash(ref value) => JList!(JString!("hash"), value.to_json(), JString!("id")),
417-
String(ref value) => JList!(JString!("string"), value.to_json()),
417+
QuotedString(ref value) => JList!(JString!("string"), value.to_json()),
418418
URL(ref value) => JList!(JString!("url"), value.to_json()),
419419
Delim('\\') => JString!("\\"),
420420
Delim(value) => json::String(String::from_char(1, value)),

src/tokenizer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ fn consume_block_with_location(tokenizer: &mut Tokenizer, ending_token: Componen
307307

308308
fn consume_string(tokenizer: &mut Tokenizer, single_quote: bool) -> ComponentValue {
309309
match consume_quoted_string(tokenizer, single_quote) {
310-
Ok(value) => String(value),
310+
Ok(value) => QuotedString(value),
311311
Err(()) => BadString
312312
}
313313
}

0 commit comments

Comments
 (0)