meriyah: Incorrect line number reported when file has LF for line separator
Similarly to #37 I now find that under some conditions the line number is incorrect when the file uses LF for line separators. Specifically, it again appears related to single-line comments, this time, being out by -1 for every SLC which is followed by at least one blank line. In the examples following, there is a missing =
in the function’s variable assignment.
Out by -4:
0001 // Single line comment
0002
0003 // Single line comment
0004
0005 // Single line comment
0006
0007 // Single line comment
0008
0009 function handleAutocomplete() {
0010 var prp this.props; // <= error on this line
0011
0012 for(let xa=0; xa<100; xa++) {;}
0013 }
ERROR : C:/Data/user/lawrence/programming/build/esvalidate/test-lf.js:~: [6:41]: Unexpected token: 'this'
Out by -3:
0001 // Single line comment
0002
0003 // Single line comment
0004
0005 // Single line comment
0006
0007 function handleAutocomplete() {
0008 var prp this.props; // <= error on this line
0009
0010 for(let xa=0; xa<100; xa++) {;}
0011 }
ERROR : C:/Data/user/lawrence/programming/build/esvalidate/test-lf.js:~: [5:41]: Unexpected token: 'this'
and so on.
This does not happen for CRLF line endings. I can induce any syntax error in a file with SLC’s and it is consistently misreported.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 37 (36 by maintainers)
Commits related to this issue
- fix(chore): improved line and coloumn tracking - #46 — committed to meriyah/meriyah by KFlash 5 years ago
- fix(lexer): fixed CRLF issues - #46 — committed to meriyah/meriyah by KFlash 5 years ago
Take your time 😃 Do it if and when you can. I have some huge critical RL issues to handle now so I have no time for anything anymore it seems.
cc / @nchanged