error operator-decl
What it means#
A user-defined operator must satisfy §5.3: its symbol is built from the allowed characters and does not coincide with a built-in operator or delimiter, does not start with // or /*; the fixity is infixl N, infixr N, infix N with N between 1 and 12, or prefix; there are no postfix operators.
Example#
data Parser<T> { value: T }
impl Parser<T> { fn orElse(other: Parser<T>) -> Parser<T> => self }
operator <|> <T>(a: Parser<T>, b: Parser<T>) -> Parser<T> infixl 15 => a.orElse(b) // <- operator-decl (level must be 1-12)error
operator-decl
How to fix#
data Parser<T> { value: T }
impl Parser<T> { fn orElse(other: Parser<T>) -> Parser<T> => self }
operator <|> <T>(a: Parser<T>, b: Parser<T>) -> Parser<T> infixl 3 => a.orElse(b)Choose a free symbol and a level between 1 and 12 from the table in §5.2.