Created
February 11, 2017 15:04
-
-
Save karan1276/8844c4643ef621faaba6ed60f1a7ebd1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum ShadowSpecifiedValue { | |
None, | |
struct Shadow shdw | |
} | |
struct Shadow { | |
... | |
} | |
pub fn parse(context: &ParserContext, input: &mut Parser) -> Result<Shadow, ()> { | |
if input.try(|input| input.expect_ident_matching("none")).is_ok() { | |
ok(ShadowSpecifiedValue::None) | |
} else { | |
try!(Length::parse(input).map(ShadowSpecifiedValue::shdw::offset_x); | |
try!(Length::parse(input).map(ShadowSpecifiedValue::shdw::offset_y); | |
try!(Length::parse_nonnegative(input).map(ShadowSpecifiedValue::shdw::blur_radius); | |
try!(Length::parse(input).map(ShadowSpecifiedValue::shdw::spread_radius); | |
try!(CSSColor::parse(input).map(ShadowSpecifiedValue::shdw::color); | |
if input.try(|input| input.expect_ident_matching("inset")).is_ok() { | |
ShadowSpecifiedValue::shdw::inset = true; | |
} else{ | |
ShadowSpecifiedValue::shdw::inset = false; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment