Install Intellij's Grammar-Kit plugin which comes with a forked version of JFlex.
WARNING: We have custom tokens! The act of generating JFlex lexer itself will not yield all tokens required by databinding! It is important that you follow the instructions below.
db.bnf defines the grammar and most of the tokens for data-binding expressions used inside layout files.
After edits, generate the lexer (only if tokens changed).
Right click on _DbLexer.flex and select Run JFlex Generator.
Right click on db.bnf and select Generate Parser Code.