mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
style: Revert try -> r#try change.
Since we're in an inconsistent state because mako files weren't updated, and it's really really ugly.
This commit is contained in:
parent
155caba595
commit
212b3e1311
47 changed files with 326 additions and 336 deletions
|
@ -45,11 +45,11 @@ impl Parse for InitialLetter {
|
|||
context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
if input.r#try(|i| i.expect_ident_matching("normal")).is_ok() {
|
||||
if input.try(|i| i.expect_ident_matching("normal")).is_ok() {
|
||||
return Ok(GenericInitialLetter::Normal);
|
||||
}
|
||||
let size = Number::parse_at_least_one(context, input)?;
|
||||
let sink = input.r#try(|i| Integer::parse_positive(context, i)).ok();
|
||||
let sink = input.try(|i| Integer::parse_positive(context, i)).ok();
|
||||
Ok(GenericInitialLetter::Specified(size, sink))
|
||||
}
|
||||
}
|
||||
|
@ -81,10 +81,10 @@ impl Parse for LineHeight {
|
|||
context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
if let Ok(number) = input.r#try(|i| NonNegativeNumber::parse(context, i)) {
|
||||
if let Ok(number) = input.try(|i| NonNegativeNumber::parse(context, i)) {
|
||||
return Ok(GenericLineHeight::Number(number));
|
||||
}
|
||||
if let Ok(nlop) = input.r#try(|i| NonNegativeLengthOrPercentage::parse(context, i)) {
|
||||
if let Ok(nlop) = input.try(|i| NonNegativeLengthOrPercentage::parse(context, i)) {
|
||||
return Ok(GenericLineHeight::Length(nlop));
|
||||
}
|
||||
let location = input.current_source_location();
|
||||
|
@ -215,7 +215,7 @@ impl Parse for TextOverflow {
|
|||
) -> Result<TextOverflow, ParseError<'i>> {
|
||||
let first = TextOverflowSide::parse(context, input)?;
|
||||
let second = input
|
||||
.r#try(|input| TextOverflowSide::parse(context, input))
|
||||
.try(|input| TextOverflowSide::parse(context, input))
|
||||
.ok();
|
||||
Ok(TextOverflow { first, second })
|
||||
}
|
||||
|
@ -295,14 +295,14 @@ macro_rules! impl_text_decoration_line {
|
|||
) -> Result<TextDecorationLine, ParseError<'i>> {
|
||||
let mut result = TextDecorationLine::NONE;
|
||||
if input
|
||||
.r#try(|input| input.expect_ident_matching("none"))
|
||||
.try(|input| input.expect_ident_matching("none"))
|
||||
.is_ok()
|
||||
{
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
loop {
|
||||
let result = input.r#try(|input| {
|
||||
let result = input.try(|input| {
|
||||
let ident = input.expect_ident().map_err(|_| ())?;
|
||||
match_ignore_ascii_case! { ident,
|
||||
$(
|
||||
|
@ -444,7 +444,7 @@ impl Parse for TextAlign {
|
|||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
// MozCenterOrInherit cannot be parsed, only set directly on the elements
|
||||
if let Ok(key) = input.r#try(TextAlignKeyword::parse) {
|
||||
if let Ok(key) = input.try(TextAlignKeyword::parse) {
|
||||
return Ok(TextAlign::Keyword(key));
|
||||
}
|
||||
#[cfg(feature = "gecko")]
|
||||
|
@ -678,22 +678,22 @@ impl Parse for TextEmphasisStyle {
|
|||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
if input
|
||||
.r#try(|input| input.expect_ident_matching("none"))
|
||||
.try(|input| input.expect_ident_matching("none"))
|
||||
.is_ok()
|
||||
{
|
||||
return Ok(TextEmphasisStyle::None);
|
||||
}
|
||||
|
||||
if let Ok(s) = input.r#try(|i| i.expect_string().map(|s| s.as_ref().to_owned())) {
|
||||
if let Ok(s) = input.try(|i| i.expect_string().map(|s| s.as_ref().to_owned())) {
|
||||
// Handle <string>
|
||||
return Ok(TextEmphasisStyle::String(s));
|
||||
}
|
||||
|
||||
// Handle a pair of keywords
|
||||
let mut shape = input.r#try(TextEmphasisShapeKeyword::parse).ok();
|
||||
let fill = input.r#try(TextEmphasisFillMode::parse).ok();
|
||||
let mut shape = input.try(TextEmphasisShapeKeyword::parse).ok();
|
||||
let fill = input.try(TextEmphasisFillMode::parse).ok();
|
||||
if shape.is_none() {
|
||||
shape = input.r#try(TextEmphasisShapeKeyword::parse).ok();
|
||||
shape = input.try(TextEmphasisShapeKeyword::parse).ok();
|
||||
}
|
||||
|
||||
// At least one of shape or fill must be handled
|
||||
|
@ -793,7 +793,7 @@ impl Parse for TextEmphasisPosition {
|
|||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
if let Ok(horizontal) =
|
||||
input.r#try(|input| TextEmphasisHorizontalWritingModeValue::parse(input))
|
||||
input.try(|input| TextEmphasisHorizontalWritingModeValue::parse(input))
|
||||
{
|
||||
let vertical = TextEmphasisVerticalWritingModeValue::parse(input)?;
|
||||
Ok(TextEmphasisPosition(horizontal, vertical))
|
||||
|
@ -845,7 +845,7 @@ impl Parse for MozTabSize {
|
|||
context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
if let Ok(number) = input.r#try(|i| NonNegativeNumber::parse(context, i)) {
|
||||
if let Ok(number) = input.try(|i| NonNegativeNumber::parse(context, i)) {
|
||||
// Numbers need to be parsed first because `0` must be recognised
|
||||
// as the number `0` and not the length `0px`.
|
||||
return Ok(GenericMozTabSize::Number(number));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue