This bug appears to be present pre-version 4 too. I can reproduce the behaviour. If label has been seen/lexed then there is no hang. There is no hang if I change the filename to use another lexer.
I will trace some values in the LexLua label code and then report back.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Okay, in the label scanner (LexLua.cpp:134-172), commenting out the "skip over spaces/tabs" while loops eliminates the hang. So I am cautiously guessing that it may be an issue with the lexer runner. I will spend some time on this later today etc, but I am not quite fluent with stuff beyond the lexer(s).
Instead of GetRelative(), perhaps I can/should use SafeGetCharAt() with a non-space 2nd argument.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
So I think whatever the interaction between LexLua and its runner, the "skip over spaces/tabs" while loops are dangerous with the default 2nd argument of SafeGetCharAt(). My bad. I will have to change that. Probably get the end of line position and limit scanning to that range only.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Its an infinite loop when skipping over the final "::". SciTE is asking for the range of the label text to be lexed which ends just before the "::". There is an sc.ForwardBytes(2) call to move past the "::" which calls Forward but it refuses to move forward as it is at the end of the range being lexed.
While this could be avoided by forcing lexing to the line end (either in SciTE or Scintilla), its better to ensure ForwardBytes always returns by exiting its loop if calling Forward doesn't advance currentPos.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Works for me. ForwardBytes() is only present in LexLua and LexPerl. I will check the code and also the whitespace scanning loops and report back this week, perhaps in a separate update ticket.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Nothing else to change from me. No problem with forward scanning of whitespace, it will end when GetRelative() returns zeros. Guess I am feeling a bit paranoid. Instead I will shift to #1952 and try to get that done this week.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This bug appears to be present pre-version 4 too. I can reproduce the behaviour. If label has been seen/lexed then there is no hang. There is no hang if I change the filename to use another lexer.
I will trace some values in the LexLua label code and then report back.
Okay, in the label scanner (LexLua.cpp:134-172), commenting out the "skip over spaces/tabs" while loops eliminates the hang. So I am cautiously guessing that it may be an issue with the lexer runner. I will spend some time on this later today etc, but I am not quite fluent with stuff beyond the lexer(s).
Instead of GetRelative(), perhaps I can/should use SafeGetCharAt() with a non-space 2nd argument.
So I think whatever the interaction between LexLua and its runner, the "skip over spaces/tabs" while loops are dangerous with the default 2nd argument of SafeGetCharAt(). My bad. I will have to change that. Probably get the end of line position and limit scanning to that range only.
Hi Kein-Hong,
Its an infinite loop when skipping over the final "::". SciTE is asking for the range of the label text to be lexed which ends just before the "::". There is an sc.ForwardBytes(2) call to move past the "::" which calls Forward but it refuses to move forward as it is at the end of the range being lexed.
While this could be avoided by forcing lexing to the line end (either in SciTE or Scintilla), its better to ensure ForwardBytes always returns by exiting its loop if calling Forward doesn't advance currentPos.
Oh OK, I assume you will change ForwardBytes?
I will fix the "skip over spaces/tabs" while loops in LexLua, since they are an infinite loop risk too.
Yes, I'll fix ForwarBytes.
Proposed change to ForwardBytes
Works for me. ForwardBytes() is only present in LexLua and LexPerl. I will check the code and also the whitespace scanning loops and report back this week, perhaps in a separate update ticket.
Committed fix as [daf991].
ForwardBytes was added with [00a8f3] by me in 2013.
Related
Commit: [00a8f3]
Commit: [daf991]
Nothing else to change from me. No problem with forward scanning of whitespace, it will end when GetRelative() returns zeros. Guess I am feeling a bit paranoid. Instead I will shift to #1952 and try to get that done this week.