Skip to main content

parse_points

Function parse_points 

Source
pub fn parse_points(source: &str, file: &str) -> Result<Vec<PointType>, Error>
Expand description

Reads every point type declared in source.

file is only used to label errors. Points come in the order of their declarations. A file without points gives an empty list. The functions of the file are skipped without being read, since crate::parse reads them and reports their errors; but what is skipped must have the shape #[..]* fn NAME (..) -> Sign {..}, or it is an error at its position, so no declaration is lost.

§Limits

No input makes this function panic or overflow the stack of the calling thread. The only limit is the nesting of brackets, at most 32 deep, counting the parentheses of the expression of a point; sums, products and runs of unary minus are read in loops and may be of any length.

§Errors

Returns the first problem found, at the offending token: a token that the grammar does not allow, a type other than F64x3 and f64, a name that is a Rust keyword or is defined twice, an unused parameter, a name that is not a parameter, a product of two F64x3, a sum of an F64x3 and an f64, an expression that is not an F64x3, or a where clause over an F64x3.