src/main/java/com/github/fge/grappa/parsers/BaseParser.java
@Cached
    @DontLabel
    public Rule firstOf(final Object[] rules)
    {
        Objects.requireNonNull(rules, "rules");
        if (rules.length == 1)
            return toRule(rules[0]);

        final Collection<String> strings = new ArrayList<>();

        for (final Object object: rules) {
            if (!(object instanceof String))
                return new FirstOfMatcher(toRules(rules));
            strings.add((String) object);
        }

        return trie(strings);
    }
@Cached
    @DontLabel
    public Rule firstOf(final Object[] rules)
    {
        Objects.requireNonNull(rules, "rules");
        if (rules.length == 1)
            return toRule(rules[0]);

        final Collection<String> strings = new ArrayList<>();

        for (final Object object: rules) {
            if (!(object instanceof String))
                return new FirstOfMatcher(toRules(rules));
            strings.add((String) object);
        }

        return trie(strings);
    }
@ Cached @ DontLabel public Rule firstOf ( final Object [ ] rules ) { Objects . requireNonNull ( rules , "rules" ) ; if ( rules . length == 1 ) return toRule ( rules [ 0 ] ) ; final Collection < String > strings = new ArrayList <> ( ) ; for ( final Object object : rules ) { if ( ! ( object instanceof String ) ) return new FirstOfMatcher ( toRules ( rules ) ) ; strings . add ( ( String ) object ) ; } return trie ( strings ) ; }
Match the first rule of a series of rules

<p>When one rule matches, all others are ignored.</p>

@param rules the subrules
@return a rule
Match the first rule of a series of rules