[fpc-pascal] Breaking Pascal source lines

Bernd Oppolzer bernd.oppolzer at t-online.de
Fri Sep 6 18:16:31 CEST 2013


Am 06.09.2013 15:10, schrieb Mark Morgan Lloyd:
> I'm sure there isn't a single "right" answer to this question, but if 
> transferring Pascal source to a system that enforces short lines (e.g. 
> 78 chars + CRLF) what's the best automatic breaking rule?
>
> One possibility is obviously to break after the rightmost space, but 
> is it valid to break after e.g. . (if not followed by a digit), ^ and 
> possibly others?
>
> Syntax errors are acceptable. Truncation isn't.
>
To keep the syntax correct, you can break after every symbol, that is:

not inside identifiers,
not inside numbers (including floating point constants)
not inside quoted strings

but anywhere else

I am using a Pascal pretty print program, that knows
about the syntax (a little) and outputs the source in
lines of 72 chars at most - this limit can be modified via parameter, IIRC.

But: at the moment it accepts only classical Pascal syntax (my extension
of Stanford P4) - no FPC. So it makes not much sense to share it.
But I compiled it with FPC recently, and it ran without problems on 
Windows.

Kind regards

Bernd




More information about the fpc-pascal mailing list