Add comment between continue line (underbar) on ASP Classic VBScript
I am currently trying to figure out how to add comment within a line continuation statement on ASP classic. Our code management requirement requires us to write a Start block and End block to mark the place where we did a change. For example.
Old code
arrayName = Array("FIRST_NAME", _
开发者_运维技巧,"LAST_NAME" _
,"ADDRESS"
)
New code
arrayName = Array("FIRST_NAME" _
,"LAST_NAME" _
,"ADDRESS" _
' 2011/09/27 bob Added new column for XYZ support Start
,"NEW_COLUMN" _
' 2011/09/27 bob Added new column for XYZ support End
)
The new code is causing an error since the underbar cannot be placed within the comment. Are there anyway to place code management comment between such lines? Just want to see if I may have missed other options. I think there is none but what do you guys/gals think?
If the comment line position is very important for you, you may need to write your own array push procedure.
So, you have not missed anything. This is the cause of VBScript syntax.
With underscore
, actually runs following:
Array("FIRST_NAME", "LAST_NAME", "ADDRESS", 'comment, "NEW_COLUMN", 'comment)
And this will cause an error too.
I wrote this to giving idea about push into arrays.
Sub [+](arrT, ByVal val)
Dim iIdx : iIdx = 0
If IsArray(arrT) Then
iIdx = UBound(arrT) + 1
ReDim Preserve arrT(iIdx)
Else
ReDim arrT(iIdx)
End If
arrT(iIdx) = val
End Sub
'Start push
[+]arrayName, "FIRST_NAME"
[+]arrayName, "LAST_NAME"
[+]arrayName, "ADDRESS"
'2011/09/27 bob Added new column for XYZ support Start
[+]arrayName, "NEW_COLUMN"
'2011/09/27 bob Added new column for XYZ support End
'Test
Response.Write Join(arrayName, "<br />")
Use this comment instead:
' 2011/09/27 bob Added "NEW_COLUMN" for XYZ support
arrayName = Array("FIRST_NAME" _
,"LAST_NAME" _
,"ADDRESS" _
,"NEW_COLUMN" _
)
Your version control system will take care of showing the differences so there's little use for the start and end comments.
精彩评论