Quantifier extends RegexSyntaxElement { public Modifier getModifier() { return modifier; } protected  Quantifier(RegexSource source, IndexRange range, Modifier modifier); abstract int getMinimumRepetitions(); @CheckForNull abstract Integer getMaximumRepetitions(); Modifier getModifier(); boolean isOpenEnded(); abstract boolean isFixed();  }
@Test void testReluctantStar() { RegexTree regex = assertSuccessfulParse("x*?"); RepetitionTree repetition = assertType(RepetitionTree.class, regex); assertPlainCharacter('x', repetition.getElement()); SimpleQuantifier quantifier = assertType(SimpleQuantifier.class, repetition.getQuantifier()); assertEquals(SimpleQuantifier.Kind.STAR, quantifier.getKind(), "Quantifier should be a Kleene star."); assertEquals(Quantifier.Modifier.RELUCTANT, quantifier.getModifier(), "Quantifier should be reluctant."); }
@Test void testPossessiveStar() { RegexTree regex = assertSuccessfulParse("x*+"); RepetitionTree repetition = assertType(RepetitionTree.class, regex); assertPlainCharacter('x', repetition.getElement()); SimpleQuantifier quantifier = assertType(SimpleQuantifier.class, repetition.getQuantifier()); assertEquals(SimpleQuantifier.Kind.STAR, quantifier.getKind(), "Quantifier should be a Kleene star."); assertEquals(Quantifier.Modifier.POSSESSIVE, quantifier.getModifier(), "Quantifier should be possessive."); }