tidy the parser
This commit is contained in:
parent
53816fed73
commit
0dbc07cc94
1 changed files with 5 additions and 5 deletions
|
@ -6,7 +6,7 @@ use std::{
|
||||||
use winnow::{
|
use winnow::{
|
||||||
PResult, Parser,
|
PResult, Parser,
|
||||||
ascii::{newline, till_line_ending},
|
ascii::{newline, till_line_ending},
|
||||||
combinator::{alt, repeat, separated},
|
combinator::{alt, opt, repeat, separated},
|
||||||
};
|
};
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
@ -230,9 +230,9 @@ fn parse(input: &str) -> PResult<Board> {
|
||||||
let mut gdir = Dir::N;
|
let mut gdir = Dir::N;
|
||||||
let mut loc = Loc(0, 0);
|
let mut loc = Loc(0, 0);
|
||||||
|
|
||||||
let mut input = input;
|
let (cells, _): (Vec<Vec<Cell>>, _) =
|
||||||
let cells: Vec<Vec<Cell>> = separated(1.., parse_line, newline)
|
winnow::combinator::seq!(separated(1.., parse_line, newline), opt(newline))
|
||||||
.parse_next(&mut input)
|
.parse(input)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
for (row, line) in cells.iter().enumerate() {
|
for (row, line) in cells.iter().enumerate() {
|
||||||
|
|
Loading…
Reference in a new issue