Fix panic when progid is the last token by removing unwrap (#39)
* Fix panic when progid by removing unwrap * Incorporate PR feedback
This commit is contained in:
parent
c0c8de6eb9
commit
8e060950d5
@ -64,7 +64,12 @@ impl<'a> Parser<'a> {
|
|||||||
|
|
||||||
pub(super) fn parse_progid(&mut self) -> SassResult<String> {
|
pub(super) fn parse_progid(&mut self) -> SassResult<String> {
|
||||||
let mut string = String::new();
|
let mut string = String::new();
|
||||||
let mut span = self.toks.peek().unwrap().pos();
|
let mut span = match self.toks.peek() {
|
||||||
|
Some(token) => token.pos(),
|
||||||
|
None => {
|
||||||
|
return Err(("expected \"(\".", self.span_before).into());
|
||||||
|
}
|
||||||
|
};
|
||||||
while let Some(tok) = self.toks.next() {
|
while let Some(tok) = self.toks.next() {
|
||||||
span = span.merge(tok.pos());
|
span = span.merge(tok.pos());
|
||||||
match tok.kind {
|
match tok.kind {
|
||||||
|
@ -202,3 +202,7 @@ test!(
|
|||||||
"a {\n color: PrOgId:foo(fff);\n}\n",
|
"a {\n color: PrOgId:foo(fff);\n}\n",
|
||||||
"a {\n color: progid:foo(fff);\n}\n"
|
"a {\n color: progid:foo(fff);\n}\n"
|
||||||
);
|
);
|
||||||
|
error!(
|
||||||
|
progid_nothing_after,
|
||||||
|
"a { color: progid:", "Error: expected \"(\"."
|
||||||
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user