void (PsiBuilder builder, IElementType endToken) { final PsiBuilder.Marker marker = builder.mark(); builder.advanceLexer(); final IElementType next = builder.getTokenType(); final Boolean named; if (next == RegExpTT.NAME) { builder.advanceLexer(); named = true; } else if (next == RegExpTT.NUMBER) { builder.advanceLexer(); named = false; } else { named = null; builder.error(RegExpBundle.message("parse.error.group.name.or.number.expected")); parsePattern(builder); } checkMatches(builder, endToken, RegExpBundle.message("parse.error.unclosed.group.reference")); if (named == Boolean.TRUE) { marker.done(RegExpElementTypes.NAMED_GROUP_REF); } else if (named == Boolean.FALSE) { marker.done(RegExpElementTypes.BACKREF); } else { marker.drop(); } }