I'm working on defining a grammar using ANTLR4 and Java. For Integers, I want a number that mat be preceeded by a minus sign. I know it is possible to do it like this:
integer: '-' (DIGIT)* | DIGIT* ;
But I was wondering if there is a symbol (similar to the *) that assures a the minus sign occurs zero or one time:
integer: ('-')<some symbol here> (DIGIT)* ;