private UserAgentContext parseUserAgent(MutableUserAgent userAgent) {
        String userAgentString = EvilManualUseragentStringHacks.fixIt(userAgent.getUserAgentString());

        CodePointCharStream input = CharStreams.fromString(userAgentString);
        UserAgentLexer lexer = new UserAgentLexer(input);

        CommonTokenStream tokens = new CommonTokenStream(lexer);

        UserAgentParser parser = new UserAgentParser(tokens);

        if (!verbose) {
            lexer.removeErrorListeners();
            parser.removeErrorListeners();
        }
        lexer.addErrorListener(userAgent);
        parser.addErrorListener(userAgent);

        return parser.userAgent();
    }
Parse the useragent and return every part that was found.

@param userAgent The useragent instance that needs to be parsed
@return If the parse was valid (i.e. were there any parser errors: true=valid; false=has errors
analyzer/src/main/java/nl/basjes/parse/useragent/parse/UserAgentTreeFlattener.java