-
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
LexInno: Fix style handling of unterminated strings, message sections, and avoid terminating comments between CR and LF #29
Conversation
Tried to create name isMessages to boolean for Messages and CustomMessages sections similar to existing isCode name for Code section. isMessages does change from false to true like isCode does, though no matter where I put the isMessages condition, it has no effect on the styling. The buffer may need adjustments and anything I tried still had no effect. Before the for loop, I declared isMessages:
and then where isCode is tested :
That sets isMessages to true or false. Tested with printf() output and changes to true and false correct. Something is going on in the for loop that I do not understand. I suspect it has something to do with the buffer. My experience with C++ is little. Perhaps someone with better experience than me knows how to do this. |
Lexers are called incrementally over portions of the file as text is scrolled into view. State set up for one portion does not automatically flow to the next portion. Any state that must be remembered for a line can be placed in |
Avoid comments in example as lexer changes style between \r and \n for comments.
Changes to lexers should include a simple testable example file under I have added a small example There was an attribute problem with |
I happened to wrote a lexer for Inno Setup 6.2 recently, source (not compiles with lexilla's lexlib) is at https://github.com/zufuliu/notepad2/blob/master/scintilla/lexers/LexInno.cxx, you can test latest builds for notepad2 from https://github.com/zufuliu/notepad2/actions or https://ci.appveyor.com/project/zufuliu/notepad2. Following missing features are implemented:
The code is written from scratch (using |
Multiple fixes achieved for the inno lexer.
The EOL as default style fixed for both Would you like me to commit these separately into this PR? If you are going to squash commit then it may not matter, though may make viewing them easier if separate. This is before and after fixes: Bozo colours as the person who did the Lua styling commented. Helps to highlight the issues. Script: #define app_copyright "Copyright 1999, app corporation"
; comment
; comment
[Setup]
AppName=MyApp
AppCopyright={#app_copyright}
WizardSmallImageFile=WizardSmallImageFile.bmp
OnlyBelowVersion=6.01
[Files]
Source: "app.exe"; DestDir: "{tmp}"; OnlyBelowVersion: 6.01
[INI]
Key: "version"; String: "1.0"; "unterminated
Key: "version"; String: "1.0"; 'unterminated
[Registry]
Root: HKLM; ValueType: string
[CustomMessages]
keyname =Other tasks:'not string
[Messages]
keyname="{#app_copyright}"not string
[Code]
// comment
// comment
(* comment *)
(* comment *)
function ShouldInstallComCtlUpdate: Boolean;
begin
Result := False;
Log('string');
IsEscaped('\'good', '\\\'good', '\\'bad');
end; |
I generally preferred isolated separate commits for each feature or fix as that makes it easier to trace bugs back and understand what was changed and why. |
@nyamatongwe Pushed all fixes I have. I get 404 clicking on the committed links list here. |
These changes have been committed with test cases added. 8971000 made the automatic tester work as properties had to be applied to CRLF tests. |
I think C style backslash escape sequences should be disabled by default, as it's only enabled after See examples at https://github.com/jrsoftware/issrc/blob/main/Examples/AllPagesExample.iss#L76 InputDirWizardPage.Values[0] := 'C:\'; Edit: the option is
https://github.com/jrsoftware/issrc/blob/main/Files/ISPPBuiltins.iss#L22 |
Thanks for checking that pragma option. You are correct with your thinking. As mentioned at FreePascal:
C-style esacaping is only a inno pragma option which is not enabled by default. StackOverflow also has a topic on it. My error in thinking C-style escapes were default. :( I may need to commit 2 more fixes.
I need a little time to test to ensure this is done correct. I am not sure if the lexer can account for inno pragma options if not set with the default. I have no current knowledge of handling inno pragma options in the lexer code. |
…as is not pragma default
ScintillaOrg#29 Added missing trailing newline to fix the last commit.
@nyamatongwe I pulled the PR and x.iss was missing a final newline which I did another commit to resolve. Without, TestLexers.exe will create *.new files. The conflict I had to resolve may have contributed to losing the newline. Sorry for the extra effort needed by you to fix this. |
Reverted the backslash change with e3d269b which should be equivalent to the 4 above commits. |
Looks good to me. TestLexers.exe passed. LexInno.cxx diffs good. The branch conflict probably does not need fix as the commits are done. If you agree is OK, can close the PR as done when you are ready. Perhaps the closed PRs that have individual commits to master could be labeled as MergesDone, CommitsDone or something similar so as not to appear as a rejected PR. Just an idea. Reminder: SciTEHistory.html has |
Fixed issues with Parameters: and with Keywords= with anchoring the words to trailing
:
and=
characters.Tested with https://github.com/XhmikosR/notepad2-mod/blob/master/distrib/notepad2_setup.iss
Note the emphasised bolding in fixes.
Fixed in Setup section:
to
Value should be default style in this case.
Fixed in CustomMessages section:
and
and
Unterminated strings should be Default style in CustomMessages and Messages sections.
tasks
should be Default style, not Parameter style.Fixed in Tasks and InstallDelete sections:
and
OnlyBelowVersion
should be Parameter style, not as Keyword style. Even though in latest inno.properties, may be coloured the same.Note
The test inno script has no Registry section to show the fix of
String:
as Parameter style in INI section andstring;
as Default style in Registry section, which is what lead to to these fixes as mentioned at SourceForge.