I occasionally have to deal with files which contain lots of text content across a large range of natural/geographic languages. It was always hampering me to write definitions because of overlap and ambiguity between structure and content in these files. The key learning was ANTLR lexical modes.
I am still very much a beginner in ANTLR development but this key feature helped my confidence to use ANTLR more.
1 Like
Conceptually I believe I ‘get’ lexical modes, but haven’t had to use them (shied away from them?) as yet. Your comment about overlap between structure and content, and by implication separating structure and content, I think helps.
Just take a look at tomita-parser/README.md at master · yandex/tomita-parser (github.com)
Unfortunately, all good enough presentations are in Russian but the main idea is clear enough.