archives

« Bugzilla Issues Index

#4141 — How implementations should handle line numbers is partially defined.


In normative section 11.3,

>> The sequence <CR><LF> is commonly used as a line
>> terminator. It should be considered a single SourceCharacter
>> for the purpose of reporting line numbers.

Whereas how single other line terminator sequence should affecting line number reporting is not defined. We should either define it or remove this sentence if we don't care. This is probably also problematic for ES5 as well.

In the newest V8 and SpiderMonkey, all other LineTerminatorSequence choices will increase line number by 1. But old V8 will not increase line number unless an <LF> is seen.


The intent isn't to tell implementations how to number lines. It's just saying that how ever implementations choose to number lines they "should" treat <CR><LF> as logically a single line terminator.

Whether or not it or any other line terminator increments the line number count is up to an implementation.

A more prescriptive definition of line numbering could be proposed for future editions of ES