• Login
Community
  • Login

Possible syntax color logic bug for ASP in all versions?

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
color syntaxasp
3 Posts 2 Posters 1.1k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M
    mushu999
    last edited by Apr 16, 2018, 7:09 PM

    This appears to be a bug that has always been in the program and I finally had time to narrow it down. Would someone else please copy the code below into a new tab in their copy of NPP and set the language to ASP and tell me if it acts the same for them?

    The problem: ASP language syntax color stops working properly. I believe it is a bug in the ASP language logic regarding the use of an apostrophe as a remark character, since ASP acts like VB in that respect. It appears to lose the bracket matching logic when an apostrophe is used within a string constant inside double-quote marks. See following code as an example (it doesn’t run since I pulled so much code out):

    [code]
    <%@ Page Language=“VB” CompilerOptions=“/R:System.Management.dll” Debug=“True” Buffer=“True” %>
    <%@ Assembly Name=“System.DirectoryServices” %>
    <%@ Assembly Name=“Microsoft.GroupPolicy.Management” %>
    <%@ Import Namespace=“ActiveDS” %>
    <%
    ’ ActiveDS namespace import above requires Interop.ActiveDS.dll placed in bin directory (also tested on Server 2012R2)
    ’ Microsoft.GroupPolicy.Management assembly above requires Microsoft.GroupPolicy.Management.dll placed in bin directory
    %>

    <script type=“text/vb” runat=“server”>

    Public Dim LDver As String = “v1.6”
    Public Dim loggedInUser As String
    Public Dim rootDSE As Object = GetObject(“LDAP://rootDSE”)
    Public Dim domainDN As Object = rootDSE.Get(“defaultNamingContext”)

    If myKey=“msexchmailboxsecuritydescriptor” Then ’ http://www.selfadsi.org/deep-inside/ad-security-descriptors.htm
    Response.Write(“<span style=‘font-family:courier;font-size:9pt;’>”)
    Dim de As New DirectoryEntry(“LDAP://” + DistinguishedName)
    Dim sd As SecurityDescriptor = de.InvokeGet(“msExchMailboxSecurityDescriptor”)
    Dim dacl As AccessControlList = sd.DiscretionaryAcl
    For Each ace As AccessControlEntry In dacl
    If LCase(strLogon)=“user1” Or LCase(strLogon)=“user2” Then
    If LCase(Left(ace.Trustee.ToString(),4))=“xyz” Then Response.Write(“<span style=‘background-color:#cf9’>”)
    Response.Write(ace.Trustee.ToString()&“<br/>”)
    If LCase(Left(ace.Trustee.ToString(),4))=“xyz” Then Response.Write(“</span>”)
    Else
    If Left(ace.Trustee,4)=“xyz” Then
    Response.Write(Right(ace.Trustee.ToString(),Len(ace.Trustee.ToString())-4)&“<br/>”)
    End If
    End If 'me or not me
    Next
    Response.Write(“</span>”)
    End If

    '_______________________________________________________________________________________ [ GetUserParamsValue ]
    ’ pass in the full value of the user’s UserParameters attribute (i.e. CStr(UserDirectoryEntry.Properties(“userParameters”).Value))
    ’ and pass in the name of the value inside userParameters that you want to retrieve. The possible value names are listed here: http://msdn.microsoft.com/en-us/library/ff635169.aspx
    ’
    [/code]

    Note that the color stops working after line 26 but notice line 24 at the very end where the bracket is not colored correctly inside the quotes and then line 25 has a non-colored ampersand which is normally red for me. Is this a function of the color settings or perhaps a theme I’m using? That’s why I need someone else to try it also to see if it is really a bug in the NPP code or not.

    My Style Configurator is set to “Solarized” and I use font “Dina” 8pt.

    ALSO there seem to be syntax errors in the “Style” list for several Languages in the Style Configurator window. I don’t know if this is actually a problem or not since I don’t know how those are used internally or by plugins. For example, select “asp” as Language and notice it has “ASPSYBOL” missing an “M”. And under the “Caml” Language notice “BUILIN FUNC & TYPE” is missing a “T”. Probably it doesn’t matter, but pointing that out anyway.

    Thanks!

    S 1 Reply Last reply Apr 16, 2018, 8:15 PM Reply Quote 0
    • S
      Savio Tamara Lobo @mushu999
      last edited by Apr 16, 2018, 8:15 PM

      @mushu999 said:

      This appears to be a bug that has always been in the program and I finally had time to narrow it down. Would someone else please copy the code below into a new tab in their copy of NPP and set the language to ASP and tell me if it acts the same for them?

      The problem: ASP language syntax color stops working properly. I believe it is a bug in the ASP language logic regarding the use of an apostrophe as a remark character, since ASP acts like VB in that respect. It appears to lose the bracket matching logic when an apostrophe is used within a string constant inside double-quote marks. See following code as an example (it doesn’t run since I pulled so much code out):

      [code]
      <%@ Page Language=“VB” CompilerOptions=“/R:System.Management.dll” Debug=“True” Buffer=“True” %>
      <%@ Assembly Name=“System.DirectoryServices” %>
      <%@ Assembly Name=“Microsoft.GroupPolicy.Management” %>
      <%@ Import Namespace=“ActiveDS” %>
      <%
      ’ ActiveDS namespace import above requires Interop.ActiveDS.dll placed in bin directory (also tested on Server 2012R2)
      ’ Microsoft.GroupPolicy.Management assembly above requires Microsoft.GroupPolicy.Management.dll placed in bin directory
      %>

      <script type=“text/vb” runat=“server”>

      Public Dim LDver As String = “v1.6”
      Public Dim loggedInUser As String
      Public Dim rootDSE As Object = GetObject(“LDAP://rootDSE”)
      Public Dim domainDN As Object = rootDSE.Get(“defaultNamingContext”)

      If myKey=“msexchmailboxsecuritydescriptor” Then ’ http://www.selfadsi.org/deep-inside/ad-security-descriptors.htm
      Response.Write(“<span style=‘font-family:courier;font-size:9pt;’>”)
      Dim de As New DirectoryEntry(“LDAP://” + DistinguishedName)
      Dim sd As SecurityDescriptor = de.InvokeGet(“msExchMailboxSecurityDescriptor”)
      Dim dacl As AccessControlList = sd.DiscretionaryAcl
      For Each ace As AccessControlEntry In dacl
      If LCase(strLogon)=“user1” Or LCase(strLogon)=“user2” Then
      If LCase(Left(ace.Trustee.ToString(),4))=“xyz” Then Response.Write(“<span style=‘background-color:#cf9’>”)
      Response.Write(ace.Trustee.ToString()&“<br/>”)
      If LCase(Left(ace.Trustee.ToString(),4))=“xyz” Then Response.Write(“</span>”)
      Else
      If Left(ace.Trustee,4)=“xyz” Then
      Response.Write(Right(ace.Trustee.ToString(),Len(ace.Trustee.ToString())-4)&“<br/>”)
      End If
      End If 'me or not me
      Next
      Response.Write(“</span>”)
      End If

      '_______________________________________________________________________________________ [ GetUserParamsValue ]
      ’ pass in the full value of the user’s UserParameters attribute (i.e. CStr(UserDirectoryEntry.Properties(“userParameters”).Value))
      ’ and pass in the name of the value inside userParameters that you want to retrieve. The possible value names are listed here: http://msdn.microsoft.com/en-us/library/ff635169.aspx
      ’
      [/code]

      Note that the color stops working after line 26 but notice line 24 at the very end where the bracket is not colored correctly inside the quotes and then line 25 has a non-colored ampersand which is normally red for me. Is this a function of the color settings or perhaps a theme I’m using? That’s why I need someone else to try it also to see if it is really a bug in the NPP code or not.

      My Style Configurator is set to “Solarized” and I use font “Dina” 8pt.

      ALSO there seem to be syntax errors in the “Style” list for several Languages in the Style Configurator window. I don’t know if this is actually a problem or not since I don’t know how those are used internally or by plugins. For example, select “asp” as Language and notice it has “ASPSYBOL” missing an “M”. And under the “Caml” Language notice “BUILIN FUNC & TYPE” is missing a “T”. Probably it doesn’t matter, but pointing that out anyway.

      Thanks!

      M 1 Reply Last reply Apr 16, 2018, 11:12 PM Reply Quote 0
      • M
        mushu999 @Savio Tamara Lobo
        last edited by Apr 16, 2018, 11:12 PM

        @Savio-Tamara-Lobo you didn’t post anything?

        1 Reply Last reply Reply Quote 0
        1 out of 3
        • First post
          1/3
          Last post
        The Community of users of the Notepad++ text editor.
        Powered by NodeBB | Contributors