SharpDevelop Community

Get your problems solved!
Welcome to SharpDevelop Community Sign in | Join | Help
in Search

SyntaxHighlighting for NSIS

Last post 10-08-2014 4:57 AM by fuct. 7 replies.
Page 1 of 1 (8 items)
Sort Posts: Previous Next
  • 11-17-2008 5:10 PM

    SyntaxHighlighting for NSIS

     I don't know if this is the correct forum to put this question, but here's my question

    I am writing a program that uses the SyntaxHighlighting mode of #Dev for NSIS.

     I have almost everything highlighted I want, now comes the question..

     How do I enable highlighting of KeyWords (from the xshd file) in strings?

    Ex

    Normal string

    "$SMPROGRAMS\My application" will highlight all with a color of blue.

     How wold I get this highlighlighting?

    "$SMPROGRAMS\My application"  where the variable $SMPROGRAMS is highlighted in say red, but th quotes and the rest of the string is highlighted in blue?

     

    I have tried different Delimeters and such, but still no avail, unless I am not using the correct ones.

    If there are any suggestions please feel free to leave any.

    (Yes I do like NSIS, and still learning/unfamiliar with WiX)

     

    Also I wold like to add this SyntaxHighlighing to #Dev after I finish this project.

    If you need to see the NSIS-Mode.xshd file let me know.

  • 11-17-2008 7:14 PM In reply to

    • siegi44
    • Top 10 Contributor
    • Joined on 03-31-2006
    • Steyr, Austria
    • Posts 806
    • Team Members

    Re: SyntaxHighlighting for NSIS

    Hi,

    you can set a reference to another RuleSet inside a span:

    Example:

    <SyntaxDefinition name = "C#" extensions = ".cs">
        
        <RuleSets>
            <RuleSet ignorecase = "false">
              <Delimiters>~!%^*()-+=|\#/{}[:;"'&lt;&amp;&gt; , .?</Delimiters>
             
              <Span name = "docComment" rule = "DocumentSet" bold = "false" italic = "false" color = "LightGray" stopateol = "true">
                   <Begin>///</Begin>
              </Span>

            </RuleSet>
                   
            <RuleSet name = "TestSet" ignorecase = "true">
                 <Delimiters>~!@%^*()-+=|\#/{}[:;"'&lt;&gt; , .?</Delimiters>
                <KeyWords name = "ErrorWords" bold="true" italic="true" color="Red">
                        <Key word = "TODO" />
                        <Key word = "FIXME" />
                </KeyWords>
                <KeyWords name = "WarningWords" bold="true" italic="true" color="Yellow">
                        <Key word = "HACK" />
                        <Key word = "UNDONE" />
                </KeyWords>
                 
            </RuleSet>

        </RuleSets>

    </SyntaxDefinition>

     Notice the "rule"-attribute in the  "docComment" span element, which is set to the name of the new ruleset "TestSet" (see "name"-attribute).

    Hope, this helps.

  • 11-18-2008 12:04 AM In reply to

    Re: SyntaxHighlighting for NSIS

    I added the RuleSet with delimeters, and added the span with the char($) as the <Begin> char to start at, and the ruleset to the span as well, but it will still not highlight the "keyword" in the string, as per example in my first post.

     Could there be something else I could try that you could suggest?

    BTW I appreciate the help you suggested, THANX!

  • 11-18-2008 12:09 AM In reply to

    Re: SyntaxHighlighting for NSIS

     Inside the RuleSet, use:

    <MarkFollowing markmarker ="true" bold = "true" italic = "false" color = "Red">$</MarkFollowing>

    $ must be a delimiter for this.

  • 11-18-2008 2:57 PM In reply to

    Re: SyntaxHighlighting for NSIS

     I tried that as well but still no success.  I put the keywords in the RuleSet, outside the RuleSet with the<Marker>in place.  I tried referencing the ruleset with rule="BaseVar"(the name of the ruleset) as well.

     

    Here is a highlighed section of what I have done (oops I forgot to highlight the un.onUninstSuccess, this is also highlighted as well), I have highlighted the variables in this example, (the onese with the "$" to illustrate what I need so you can see the placement of them as located in the strings.  

     

    (I noticed that when I post this reply this does not hightlight correctly)

    So here is a short highlighting list

    Function=blue

    un.onUinstSuccess = lightblue

    MB_?? = orange

    All strings encapsulated by " " are lightblue

    I need all variables inside strings with $ to be red.

     


    p.MsoNormal {margin-top:0in; margin-right:0in; margin-bottom:10.0pt; margin-left:0in; line-height:115%; font-size:11.0pt; font-family:"Calibri","sans-serif"; }

    Function un.onUninstSuccess

      HideWindow

      MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."

    FunctionEnd

     

    Function un.onInit

      MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2

      Abort

    FunctionEnd

     

    Section Uninstall

      Delete "$INSTDIR\${PRODUCT_NAME}.url"

      Delete "$INSTDIR\uninst.exe"

      Delete "$INSTDIR\Example.file"

      Delete "$INSTDIR\AppMainExe.exe"

     

    Here is a copy of the ruleset as per both of your suggestions... I omitted some of the keywords to make the list short. 

     

    <RuleSet name="BaseVar" ignorecase="false">
          <Delimiters>~!@%^*()-+=|\#/{}[:;"'&lt;&gt; , .?</Delimiters>
          <MarkFollowing markmarker ="true" bold = "true" italic = "false" color = "Red">$</MarkFollowing>
          <KeyWords name="Variable" bold="false" italic="false" color="#800000">      
            <Key word="$INSTDIR"/>
          </KeyWords>
        </RuleSet>

     

    If there are anyother suggestions please let me know.  I appreciate any help on this matter, no matter how small or large it may be.  

    Oh, I also removed the bold,italic,color from my <KeyWords> location to see if that wold help and still no such luck.

    Thanx Daniel for the help!

  • 11-24-2008 3:59 PM In reply to

    Re: SyntaxHighlighting for NSIS

     How can I post the xshd file so that it may be shared/used in #D?

  • 11-24-2008 7:26 PM In reply to

    Re: SyntaxHighlighting for NSIS

    Wiki?
  • 10-08-2014 4:57 AM In reply to

    • fuct
    • Not Ranked
    • Joined on 05-21-2010
    • Posts 6

    Re: SyntaxHighlighting for NSIS

    PumaSpeed:

     How can I post the xshd file so that it may be shared/used in #D?

    6 years later, i wish we had a copy of your NSIS .xshd logic. Really could use it right about now

     

Page 1 of 1 (8 items)
Powered by Community Server (Commercial Edition), by Telligent Systems
Don't contact us via this (fleischfalle@alphasierrapapa.com) email address.