mirror of
https://github.com/zaphar/ucg.git
synced 2025-07-25 18:49:50 -04:00
FIX: Couldn't parse list indexes in a selector.
This commit is contained in:
parent
336dd5e5ea
commit
4d11d26e13
@ -294,7 +294,7 @@ fn selector_list(input: Span) -> IResult<Span, SelectorList> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let (rest, list) = if is_dot {
|
let (rest, list) = if is_dot {
|
||||||
let (rest, list) = match separated_list!(rest, dottok, barewordtok) {
|
let (rest, list) = match separated_list!(rest, dottok, alt!(barewordtok | digittok)) {
|
||||||
IResult::Done(rest, val) => {
|
IResult::Done(rest, val) => {
|
||||||
(rest, val)
|
(rest, val)
|
||||||
}
|
}
|
||||||
@ -642,6 +642,12 @@ mod test {
|
|||||||
Token::new("bar", 1, 5)] =>
|
Token::new("bar", 1, 5)] =>
|
||||||
1, 0)))
|
1, 0)))
|
||||||
);
|
);
|
||||||
|
assert_eq!(selector_value(LocatedSpan::new("foo.0 ")),
|
||||||
|
IResult::Done(LocatedSpan{fragment: "", offset: 6, line: 1},
|
||||||
|
Value::Selector(make_selector!(make_expr!("foo".to_string(), 1, 1) => [
|
||||||
|
Token::new("0", 1, 5)] =>
|
||||||
|
1, 0)))
|
||||||
|
);
|
||||||
assert_eq!(selector_value(LocatedSpan::new("foo.bar;")),
|
assert_eq!(selector_value(LocatedSpan::new("foo.bar;")),
|
||||||
IResult::Done(LocatedSpan{fragment: ";", offset: 7, line: 1},
|
IResult::Done(LocatedSpan{fragment: ";", offset: 7, line: 1},
|
||||||
Value::Selector(make_selector!(make_expr!("foo", 1, 1) =>
|
Value::Selector(make_selector!(make_expr!("foo", 1, 1) =>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user