-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inno: Multiline comments and close with correct comment sequence #44
Comments
This appeared OK and passed tests on Windows so it was committed. However, it produces inconsistent results on Unix as shown in the Linux action https://github.com/ScintillaOrg/lexilla/runs/4479455090?check_suite_focus=true If run on a Unix system, a problem occurs with styling on line 39, the first multiline comment with the comment not flowing onto the next line.
It occurs when styling the file line by line with Unix-style '\n' line ends, not Windows '\r\n' line ends. I have not been able to reproduce this interactively yet. |
TestLexer.exe is quite useful for detecting issues. I did not consider a test file for each EOL sequence, as the styling was good in the editor and the CRLF test file, yet it has issues that TestLexer.exe can detect with the test file with the
Push forward is causing the character after the If I have tried different variations to push forward, though same results happen. Removal of the push forward seems the only reasonable solution. The push forward is not needed for the this lexer as processing the following asterisk or slash should not cause an issue. Difference: --- a/LexInno.cxx
+++ b/LexInno.cxx
@@ -151,18 +151,12 @@
// Start of a Pascal comment
state = SCE_INNO_COMMENT_PASCAL;
isCommentRound = true;
- // Push forward to the asterisk
- ch = chNext;
- chNext = styler[++i];
- styler.ColourTo(i, SCE_INNO_COMMENT_PASCAL);
+ styler.ColourTo(i + 1, SCE_INNO_COMMENT_PASCAL);
} else if (isCode && ch == '/' && chNext == '/') {
// Start of C-style comment
state = SCE_INNO_COMMENT_PASCAL;
isCommentSlash = true;
- // Push forward to the next slash
- ch = chNext;
- chNext = styler[++i];
- styler.ColourTo(i, SCE_INNO_COMMENT_PASCAL);
+ styler.ColourTo(i + 1, SCE_INNO_COMMENT_PASCAL);
} else if (!isMessages && ch == '"') {
// Start of a double-quote string
state = SCE_INNO_STRING_DOUBLE;
Attached files have CRLF line ends: |
Committed the above as a27851f. Also added testing of line-by-line lexing with Unix line ends so problems will be discovered on Windows before committing in the future. This isn't symmetrical - Windows line ends aren't checked on Unix yet. |
Included in 5.1.5 release. |
The Inno lexer uses default styling on multiline comments.
The C-like comment of
are single line comments, like in C.
The Pascal comments behave like the C type of
/* ... */
commentwhich can span multiple lines.
The current Inno lexer finds the EOL on the first comment line and so it may consider
{ ...
or(* ...
as default style if not closing
}
or*)
is found. The second comment line is going to be default style unless it starts with a known sequence to set a non default style.In explaining this, I just thought of a bug as the inno lexer allows these comments
as the code does not remember the opening sequence to know which closing sequence is required. Added
bool isCommentCurly
,bool isCommentRound
and renamedbool isCStyleComment
tobool isCommentSlash
. Now the closing sequence required can be known.Needed to use the line state functions to handle the multiline comments. Removed the
enum section{...}
as the related error messages were long and confusing so changed to more basicint const bitCode, bitMessages, bitCommentCurly, bitCommentRound
names.Minor tidy done with parameter spacing in the source which I hope is OK.
The behaviour is better so that comments and strings are styled during typing. Eliminated some of the go back a char with the styler.
Updated the test file
x.iss
with thex.iss.folded
andx.iss.styled
files. Snapshot included asx.png
which can be discarded after viewing.This is just the area with the comments:
Attached files have CRLF line ends:
inno.zip
Log:
The text was updated successfully, but these errors were encountered: