Instaparse: Is negation supported?

53 Views Asked by At

The - operator is supposed to support negation, but I can't get it to work:

raw-type = "DINT" | "REAL" | "SINT" | "BIT"
custom-type = - raw-type

Every time I try I get the error: RuntimeException - occurs on the right-hand side of your grammar, but not on the left instaparse.cfg/check-grammar (cfg.clj:252). It doesn't seem to matter where I put the -.

So how to get past this error? Or is there another way of doing the custom-type above?

1

There are 1 best solutions below

0
puzzler On

! is negation. Use ! rather than -.