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::{
|
||||
PResult, Parser,
|
||||
ascii::{newline, till_line_ending},
|
||||
combinator::{alt, repeat, separated},
|
||||
combinator::{alt, opt, repeat, separated},
|
||||
};
|
||||
|
||||
fn main() {
|
||||
|
@ -230,10 +230,10 @@ fn parse(input: &str) -> PResult<Board> {
|
|||
let mut gdir = Dir::N;
|
||||
let mut loc = Loc(0, 0);
|
||||
|
||||
let mut input = input;
|
||||
let cells: Vec<Vec<Cell>> = separated(1.., parse_line, newline)
|
||||
.parse_next(&mut input)
|
||||
.unwrap();
|
||||
let (cells, _): (Vec<Vec<Cell>>, _) =
|
||||
winnow::combinator::seq!(separated(1.., parse_line, newline), opt(newline))
|
||||
.parse(input)
|
||||
.unwrap();
|
||||
|
||||
for (row, line) in cells.iter().enumerate() {
|
||||
for (col, cell) in line.iter().enumerate() {
|
||||
|
|
Loading…
Reference in a new issue