Possible syntax color logic bug for ASP in all versions?
-
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!
-
@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!
-
@Savio-Tamara-Lobo you didn’t post anything?