[fpc-pascal] Breaking Pascal source lines

Howard Page-Clark hdpc at talktalk.net
Fri Sep 6 17:07:09 CEST 2013


On 06/09/2013 14:10, Mark Morgan Lloyd wrote:
> 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.
>
Is it valid...? Yes.
The compiler largely ignores line endings and line breaks (since they're 
inserted mainly for formatting, not syntax purposes).
One exception is string constants, so your parser will have to track the 
"'" character and ensure a corresponding later match within the short 
line, or else insert a forced concatenation.
The code

type
PInteger = ^
integer;

has readability shortcomings, but compiles without a murmur.



More information about the fpc-pascal mailing list