rusty
rusty copied to clipboard
Panic on enum syntax error
The compiler panics, when using an equal (=) instead of an assignment (:=) operator in an enum type definition. For example
TYPE State:
(
Idle := 0,
Running = 1, // This should be :=
);
END_TYPE
will panic in the pre-processor with the following message
thread 'main' panicked at compiler/plc_ast/src/pre_processor.rs:81:61:
expected assignment
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
We should catch these as part of a syntax error in the parser.
can i check this out?
sure. I think the issue is somewhere here:
https://github.com/PLC-lang/rusty/blob/51efb1efb29147337bc29465f8761b9fdf053c87/src/parser.rs#L1157-L1176
Line 1164 allows a coma separated list of any expression. I think it should only expect a coma separated list of Identifiers and/or Assignments.