How can I deal with statements split across lines with a continuation character like Fortran or COBOL or the C preprocessor?

Terence Parr

In COBOL, source statements are still restricted to 80 columns with source sequence numbers in columns 1-6, then the indicator column in column 7, etc. If you had a long statement, you would code it out through column 72 on line 1, then put a hyphen in column 7 on line 2, and continue your statement anywhere after column 11 on line 2. Any language element may be split right down the middle to span lines 1 and 2, even identifiers.

[Ter has to think about this one...]

Well, one easy way to handle this is to simply make a character input stream that converts _ followed by to a space. The lexer won't know the difference then.