@Override
    public @NonNull List<@NonNull SyntaxFragment> parseSyntax(final @Nullable Method method, final @NonNull String syntax) {
        final StringTokenizer stringTokenizer = new StringTokenizer(syntax, " ");
        final List<SyntaxFragment> syntaxFragments = new ArrayList<>();
        while (stringTokenizer.hasMoreTokens()) {
            final String token = stringTokenizer.nextToken();
            String major;
            List<String> minor = new ArrayList<>();
            ArgumentMode mode;
            if (PATTERN_ARGUMENT_REQUIRED.test(token)) {
                major = token.substring(1, token.length() - 1);
                mode = ArgumentMode.REQUIRED;
            } else if (PATTERN_ARGUMENT_OPTIONAL.test(token)) {
                major = token.substring(1, token.length() - 1);
                mode = ArgumentMode.OPTIONAL;
            } else if (PATTERN_ARGUMENT_LITERAL.test(token)) {
                final String[] literals = token.split("\\|");
                /* Actually use the other literals as well */
                major = literals[0];
                minor.addAll(Arrays.asList(literals).subList(1, literals.length));
                mode = ArgumentMode.LITERAL;
            } else {
                throw new IllegalArgumentException(String.format("Unrecognizable syntax token '%s'", syntax));
            }
            syntaxFragments.add(new SyntaxFragment(major, minor, mode));
        }
        return syntaxFragments;
    }
Parses command syntax into syntax fragments.
cloud-annotations/src/main/java/org/incendo/cloud/annotations/SyntaxParserImpl.java