Skip to main content

parse_map

Function parse_map 

Source
pub fn parse_map(text: &str) -> Result<Grid, ParseError>
Expand description

Parses a Moving AI .map file into a Grid.

The header lists type, height and width (one key value pair per line, in any order) and ends with the line map. Then follow height rows of width cells: ., G and S are free; @, O, T and W are blocked. Trailing empty lines are ignored, and so are carriage returns at line ends.

ยงErrors

Returns a ParseError with the 1-based line number and a ParseErrorKind: a missing or unknown header field or a bad number, a zero size, a row of the wrong length, an unknown cell, or too few or too many rows.