When does history expansion happen?
From bash manual
Enclosing characters in double quotes (‘"’) preserves the literal value of all characters within the quotes, with the exception of ‘$’, ‘`’, ‘\’, and, when history expansion is enabled, ‘!’.
Since double quotes are recognized at parsing stage by the parser, is it correct that history expansion must happen after parsing?
If yes, when does it happen with respect to shell expansions such as brace expansion, parameter expansion, filename expansion, etc?
But I think that history expansion is provided by the readline of the shell, so is processed before lexical analysis and parsing? Just like auto-completion in shell. Am I missing something?