If you want to allow identifiers either between '(' and ')' or without parentheses, you could simply use two alternatives for that instead of the ?
operator:
'(' identifier ')' | identifier
Note that this will only allow one set of parentheses. To allow an arbitrary number, you'd use a recursive rule like this:
identfiierWithParens
: '(' identifierWithParens ')'
| identifier
;
Since in most languages, arbitrary expressions can be enclosed in parentheses (and identifiers only can when they're used as expressions or other entities that can be parenthesized like this), you'd usually handle this as part of your expression
rule instead:
expression
: identifier
| '(' expression ')'
| // other types of expression
;