I came across something similar when programming Antlr grammar to parse Cobol sources. Cobol has some characteristics, such as yours (fixed columns, columns are significant, etc.).
The only solution I found for this problem was to βpre-processβ the input and turned it into something that Antlr can analyze without problems!
Example: in Cobol, an asterisk in column 7 indicates that the line is a comment line; I changed it (the asterisk itself) to βββ and indicated in my grammar that βββ means that this line is a comment line.
source share