Menu

#1415 Update inno.properties

Committed
closed
nobody
5
2021-09-22
2021-09-09
No

This is an update to inno.properties which has not been done for many years. It is based on latest sources of Inno Setup v6.2.0.

I created a repository at Github to maintain a Python 3 script named generate_inno_api.py.

Note that the parameter named String is omitted. While the parameter exist in the INI section of Inno Setup, it is also used in the Registry section as a value of the ValueType parameter. The INI section is rarely used compared to the Registry section which is used often. For this reason, colouring string is undesirable as to how it is used.

Example:

[INI]
Filename: "MyProg.ini"; Section: "InstallSettings"; Key: "InstallPath"; String: "{app}"

[Registry]
Root: HKLM; Subkey: "Software\My Company\My Program\Settings"; ValueType: string; ValueName: "InstallPath"; ValueData: "{app}"

Unfortunately, the inno lexer cannot tell the difference between the parameter String and the value string.

Some hardcoded styles are replaced with $(colour...) variables.

The full file attached has been generated at current default settings.

1 Attachments

Discussion

  • Neil Hodgson

    Neil Hodgson - 2021-09-11
    • Group: Initial --> Committed
     
  • Neil Hodgson

    Neil Hodgson - 2021-09-11

    Committed as [512e5f].

    The inno lexer calls tolower on each character as it is accumulated into the buffer variable. Thus it is unable to distinguish case. If case is significant in some aspects of inno, those tolower calls should be avoided and any case-insensitivity implemented when checking the value.

     

    Related

    Commit: [512e5f]

  • Michael Heath

    Michael Heath - 2021-09-11

    Inno Setup is case-insensitive so tolower should be avoided, might be a true statement.

    The LexInno.cxx lexer file checks whether ch == '#' to determine if to set to SCE_INNO_PREPROC. Similar possibly could be done for setting SCE_INNO_PARAMETER. A parameter isalpha(ch) and ends with :, could be a valid parameter keyword to be set as SCE_INNO_PARAMETER, else it could be a ValueType value to remain as SCE_INNO_DEFAULT.

    I changed line 136:

                        } else if (!isCode && parameterKeywords.InList(buffer)) {
    

    to

                        } else if (!isCode && parameterKeywords.InList(buffer) && (ch == ':')) {
    

    Seems to style good with testing. The example given in initial post looks good. Other inno scripts I have look good.

    So now if String:, it a styled as SCE_INNO_PARAMETER. If String : it is SCE_INNO_DEFAULT. The string in registry section is string; so it is SCE_INNO_DEFAULT. I do not have much C++ experience to know how to handle syntax with optional spaces, especially as ch represents 1 character. For me would be fine, for someone who likes inserting a space before the colon, I do not know how to implement if it is suitable. I have not seen any inno scripts with a space preceding the colon after a parameter keyword so perhaps it is the fix. Just like a preprocessor does not account for space, #define is good, # define is not good. I'm not even sure if the later is valid.

    The submission of this Feature Request with the declaration that I was doing a workaround by omitting string. If you think this is fixable, then an issue report could be submitted to Lexilla repository. If fixed, inno.properties could be updated with parameter keyword string. I could submit an issue and attach a updated inno.properties. Let me know what you think of this.

     
    • Neil Hodgson

      Neil Hodgson - 2021-09-14

      for someone who likes inserting a space before the colon, I do not know how to implement if it is suitable. I have not seen any inno scripts with a space preceding the colon after a parameter keyword so perhaps it is the fix

      If you want this change then it can go in. Its unclear if spaces before the ':' are allowed or have an effect. The change could then be amended if others find it a problem.

      To allow spaces, there could be a function that loops until styler.SafeGetCharAt(pos) is not white space then checks if the character is ':'. For a similar example, see latexNextNotBlankIs in LexLaTeX.cxx .

      Its better for changes to the code to go to the Lexilla project. Its on github which is familiar to more people.
      https://github.com/ScintillaOrg/lexilla

       
      • Michael Heath

        Michael Heath - 2021-09-15

        Thanks for the advice. Use of latexNextNotBlankIs as a base to code allows optional spaces and tabs before the colon. String : will be styled as SCE_INNO_PARAMETER now.

        I may inspect LexInno.cxx more and see if other improvements can be done while I am at it. I will then be able to submit a Pull Request to the lexilla repository.

         
  • Zufu Liu

    Zufu Liu - 2021-09-14

    space is allowed after parameter and before = or :.
    also current lexer has bug for single quoted string, which only appears inside pascal code section or after Check parameter.
    This file can be used for test: https://github.com/XhmikosR/notepad2-mod/blob/master/distrib/notepad2_setup.iss

     
    • Michael Heath

      Michael Heath - 2021-09-15
      • = for Keyword
        • SCE_INNO_KEYWORD
        • keywords2.$(file.patterns.inno)
      • : for Parameter
        • SCE_INNO_PARAMETER
        • keywords3.$(file.patterns.inno)

      Space allowed is True for both.

      Single quote issue. May have seen before with Check Parameter with escaping or other.

      Thanks for the link. Issues I view in that file:

      • WizardSmallImageFile=WizardSmallImageFile.bmp, part of value is recognized as Keyword.
        • Probably fix with = detection.
      • tasks: in CustomMessages section recognized as a Parameter.
        • Probably fix with section detection.
      • Unterminated single quote in CustomMessages recognized as String until EOL.
        • Probably fix with section detection.
      • OnlyBelowVersion is a Keyword and a Parameter. A duplicate that can be recognized incorrect depending where used.
        • Probably fix with = and : detection.

      Thanks for the information. I might be able to fix. No more issues here as not the correct place for lexilla issues. :)

      I have a extension.lua file for inno that changes the api property value based on section. LexInno.cxx sets name IsCode by section detection, so might be able to do something for other sections.

       
  • Michael Heath

    Michael Heath - 2021-09-18

    Due to a Pull Request for LexInno.cxx, I have changed generate_inno_api.py to remove setting of keep_parameter_string which could omit the parameter named string and have generated a new inno.properties.

    The full file attached has been generated at current default settings.

     
    • Neil Hodgson

      Neil Hodgson - 2021-09-18

      Committed as [c56891].

       

      Related

      Commit: [c56891]

  • Neil Hodgson

    Neil Hodgson - 2021-09-22
    • status: open --> closed
     

Log in to post a comment.