[fpc-pascal] Breaking Pascal source lines

Mark Morgan Lloyd markMLl.fpc-pascal at telemetry.co.uk
Fri Sep 6 17:54:22 CEST 2013


Howard Page-Clark wrote:
> 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

Also single-line comments are obviously broken by wrap, i.e. preceded by //

I can cope without trying to parse for strings etc., since I think that 
in all cases compiling a broken string would result in a syntax error.

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]



More information about the fpc-pascal mailing list