Skip to main content

Module operator_migration

Module operator_migration 

Source
Expand description

Rewrite source written for the pre-0.11 operator grammar.

The old grammar spelled ranges a to b (inclusive) and a to b exclusive, placed range formation just above |>, and bound ?? tighter than +. migrate_legacy_operators parses a file under OperatorGrammar::LEGACY, rewrites every range to a..=b or a..b, and inserts parentheses wherever the current grammar would group an operand differently. It then parses the result under the current grammar and refuses the rewrite unless both trees match, so a migrated file always keeps its meaning. Interpolation holes are migrated in place.

Enums§

OperatorMigrationError
Why a file could not be migrated.

Functions§

migrate_legacy_operators
Migrate source. Returns Ok(None) when the file needs no change.