Migrated documents from aspclassiccompiler.codeplex.com

This commit is contained in:
dotneteer 2018-09-03 22:12:26 -07:00
parent fe02219dac
commit dbb36a62da
324 changed files with 75166 additions and 74841 deletions

71
License.txt Normal file
View file

@ -0,0 +1,71 @@
http://www.codeplex.com/ASPClassicCompiler/license
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
2. Grant of Copyright License.
Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
3. Grant of Patent License.
Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
4. Redistribution.
You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
1. You must give any other recipients of the Work or Derivative Works a copy of this License; and
2. You must cause any modified files to carry prominent notices stating that You changed the files; and
3. You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
4. If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
5. Submission of Contributions.
Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
6. Trademarks.
This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty.
Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
8. Limitation of Liability.
In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability.
While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.

View file

@ -1,126 +1,126 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
Imports System.Xml
Public Class TokenXmlSerializer
Private ReadOnly Writer As XmlWriter
Public Sub New(ByVal Writer As XmlWriter)
Me.Writer = Writer
End Sub
Private Sub Serialize(ByVal Span As Span)
Writer.WriteAttributeString("startLine", CStr(Span.Start.Line))
Writer.WriteAttributeString("startCol", CStr(Span.Start.Column))
Writer.WriteAttributeString("endLine", CStr(Span.Finish.Line))
Writer.WriteAttributeString("endCol", CStr(Span.Finish.Column))
End Sub
Private Sub Serialize(ByVal TypeCharacter As TypeCharacter)
If TypeCharacter <> TypeCharacter.None Then
Static TypeCharacterTable As Dictionary(Of TypeCharacter, String)
If TypeCharacterTable Is Nothing Then
Dim Table As Dictionary(Of TypeCharacter, String) = New Dictionary(Of TypeCharacter, String)()
' NOTE: These have to be in the same order as the enum!
Dim TypeCharacters() As String = {"$", "%", "&", "S", "I", "L", "!", "#", "@", "F", "R", "D", "US", "UI", "UL"}
Dim TableTypeCharacter As TypeCharacter = TypeCharacter.StringSymbol
For Index As Integer = 0 To TypeCharacters.Length - 1
Table.Add(TableTypeCharacter, TypeCharacters(Index))
TableTypeCharacter = CType(TableTypeCharacter << 1, TypeCharacter)
Next
TypeCharacterTable = Table
End If
Writer.WriteAttributeString("typeChar", TypeCharacterTable(TypeCharacter))
End If
End Sub
Public Sub Serialize(ByVal Token As Token)
Writer.WriteStartElement(Token.Type.ToString())
Serialize(Token.Span)
Select Case Token.Type
Case TokenType.LexicalError
With CType(Token, ErrorToken)
Writer.WriteAttributeString("errorNumber", CStr(.SyntaxError.Type))
Writer.WriteString(.SyntaxError.ToString())
End With
Case TokenType.Comment
With CType(Token, CommentToken)
Writer.WriteAttributeString("isRem", CStr(.IsREM))
Writer.WriteString(.Comment)
End With
Case TokenType.Identifier
With CType(Token, IdentifierToken)
Writer.WriteAttributeString("escaped", CStr(.Escaped))
Serialize(.TypeCharacter)
Writer.WriteString(.Identifier)
End With
Case TokenType.StringLiteral
With CType(Token, StringLiteralToken)
Writer.WriteString(.Literal)
End With
Case TokenType.CharacterLiteral
With CType(Token, CharacterLiteralToken)
Writer.WriteString(.Literal)
End With
Case TokenType.DateLiteral
With CType(Token, DateLiteralToken)
Writer.WriteString(CStr(.Literal))
End With
Case TokenType.IntegerLiteral
With CType(Token, IntegerLiteralToken)
Writer.WriteAttributeString("base", .IntegerBase.ToString())
Serialize(.TypeCharacter)
Writer.WriteString(CStr(.Literal))
End With
Case TokenType.FloatingPointLiteral
With CType(Token, FloatingPointLiteralToken)
Serialize(.TypeCharacter)
Writer.WriteString(CStr(.Literal))
End With
Case TokenType.DecimalLiteral
With CType(Token, DecimalLiteralToken)
Serialize(.TypeCharacter)
Writer.WriteString(CStr(.Literal))
End With
Case TokenType.UnsignedIntegerLiteral
With CType(Token, UnsignedIntegerLiteralToken)
Serialize(.TypeCharacter)
Writer.WriteString(CStr(.Literal))
End With
Case Else
' Fall through
End Select
Writer.WriteEndElement()
End Sub
Public Sub Serialize(ByVal Tokens() As Token)
For Each Token As Token In Tokens
Serialize(Token)
Next
End Sub
End Class
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
Imports System.Xml
Public Class TokenXmlSerializer
Private ReadOnly Writer As XmlWriter
Public Sub New(ByVal Writer As XmlWriter)
Me.Writer = Writer
End Sub
Private Sub Serialize(ByVal Span As Span)
Writer.WriteAttributeString("startLine", CStr(Span.Start.Line))
Writer.WriteAttributeString("startCol", CStr(Span.Start.Column))
Writer.WriteAttributeString("endLine", CStr(Span.Finish.Line))
Writer.WriteAttributeString("endCol", CStr(Span.Finish.Column))
End Sub
Private Sub Serialize(ByVal TypeCharacter As TypeCharacter)
If TypeCharacter <> TypeCharacter.None Then
Static TypeCharacterTable As Dictionary(Of TypeCharacter, String)
If TypeCharacterTable Is Nothing Then
Dim Table As Dictionary(Of TypeCharacter, String) = New Dictionary(Of TypeCharacter, String)()
' NOTE: These have to be in the same order as the enum!
Dim TypeCharacters() As String = {"$", "%", "&", "S", "I", "L", "!", "#", "@", "F", "R", "D", "US", "UI", "UL"}
Dim TableTypeCharacter As TypeCharacter = TypeCharacter.StringSymbol
For Index As Integer = 0 To TypeCharacters.Length - 1
Table.Add(TableTypeCharacter, TypeCharacters(Index))
TableTypeCharacter = CType(TableTypeCharacter << 1, TypeCharacter)
Next
TypeCharacterTable = Table
End If
Writer.WriteAttributeString("typeChar", TypeCharacterTable(TypeCharacter))
End If
End Sub
Public Sub Serialize(ByVal Token As Token)
Writer.WriteStartElement(Token.Type.ToString())
Serialize(Token.Span)
Select Case Token.Type
Case TokenType.LexicalError
With CType(Token, ErrorToken)
Writer.WriteAttributeString("errorNumber", CStr(.SyntaxError.Type))
Writer.WriteString(.SyntaxError.ToString())
End With
Case TokenType.Comment
With CType(Token, CommentToken)
Writer.WriteAttributeString("isRem", CStr(.IsREM))
Writer.WriteString(.Comment)
End With
Case TokenType.Identifier
With CType(Token, IdentifierToken)
Writer.WriteAttributeString("escaped", CStr(.Escaped))
Serialize(.TypeCharacter)
Writer.WriteString(.Identifier)
End With
Case TokenType.StringLiteral
With CType(Token, StringLiteralToken)
Writer.WriteString(.Literal)
End With
Case TokenType.CharacterLiteral
With CType(Token, CharacterLiteralToken)
Writer.WriteString(.Literal)
End With
Case TokenType.DateLiteral
With CType(Token, DateLiteralToken)
Writer.WriteString(CStr(.Literal))
End With
Case TokenType.IntegerLiteral
With CType(Token, IntegerLiteralToken)
Writer.WriteAttributeString("base", .IntegerBase.ToString())
Serialize(.TypeCharacter)
Writer.WriteString(CStr(.Literal))
End With
Case TokenType.FloatingPointLiteral
With CType(Token, FloatingPointLiteralToken)
Serialize(.TypeCharacter)
Writer.WriteString(CStr(.Literal))
End With
Case TokenType.DecimalLiteral
With CType(Token, DecimalLiteralToken)
Serialize(.TypeCharacter)
Writer.WriteString(CStr(.Literal))
End With
Case TokenType.UnsignedIntegerLiteral
With CType(Token, UnsignedIntegerLiteralToken)
Serialize(.TypeCharacter)
Writer.WriteString(CStr(.Literal))
End With
Case Else
' Fall through
End Select
Writer.WriteEndElement()
End Sub
Public Sub Serialize(ByVal Tokens() As Token)
For Each Token As Token In Tokens
Serialize(Token)
Next
End Sub
End Class

File diff suppressed because it is too large Load diff

View file

@ -1,56 +1,56 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A region marked in the source code.
''' </summary>
Public NotInheritable Class SourceRegion
Private ReadOnly _Start, _Finish As Location
Private ReadOnly _Description As String
''' <summary>
''' The start location of the region.
''' </summary>
Public ReadOnly Property Start() As Location
Get
Return _Start
End Get
End Property
''' <summary>
''' The end location of the region.
''' </summary>
Public ReadOnly Property Finish() As Location
Get
Return _Finish
End Get
End Property
''' <summary>
''' The description of the region.
''' </summary>
Public ReadOnly Property Description() As String
Get
Return _Description
End Get
End Property
''' <summary>
''' Constructs a new source region.
''' </summary>
''' <param name="start">The start location of the region.</param>
''' <param name="finish">The end location of the region.</param>
''' <param name="description">The description of the region.</param>
Public Sub New(ByVal start As Location, ByVal finish As Location, ByVal description As String)
_Start = start
_Finish = finish
_Description = description
End Sub
End Class
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A region marked in the source code.
''' </summary>
Public NotInheritable Class SourceRegion
Private ReadOnly _Start, _Finish As Location
Private ReadOnly _Description As String
''' <summary>
''' The start location of the region.
''' </summary>
Public ReadOnly Property Start() As Location
Get
Return _Start
End Get
End Property
''' <summary>
''' The end location of the region.
''' </summary>
Public ReadOnly Property Finish() As Location
Get
Return _Finish
End Get
End Property
''' <summary>
''' The description of the region.
''' </summary>
Public ReadOnly Property Description() As String
Get
Return _Description
End Get
End Property
''' <summary>
''' Constructs a new source region.
''' </summary>
''' <param name="start">The start location of the region.</param>
''' <param name="finish">The end location of the region.</param>
''' <param name="description">The description of the region.</param>
Public Sub New(ByVal start As Location, ByVal finish As Location, ByVal description As String)
_Start = start
_Finish = finish
_Description = description
End Sub
End Class

View file

@ -1,91 +1,91 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' Stores the location of a span of text.
''' </summary>
''' <remarks>The end location is exclusive.</remarks>
Public Structure Span
Private ReadOnly _Start As Location
Private ReadOnly _Finish As Location
''' <summary>
''' The start location of the span.
''' </summary>
Public ReadOnly Property Start() As Location
Get
Return _Start
End Get
End Property
''' <summary>
''' The end location of the span.
''' </summary>
Public ReadOnly Property Finish() As Location
Get
Return _Finish
End Get
End Property
''' <summary>
''' Whether the locations in the span are valid.
''' </summary>
Public ReadOnly Property IsValid() As Boolean
Get
Return Start.IsValid AndAlso Finish.IsValid
End Get
End Property
''' <summary>
''' Constructs a new span with a specific start and end location.
''' </summary>
''' <param name="start">The beginning of the span.</param>
''' <param name="finish">The end of the span.</param>
Public Sub New(ByVal start As Location, ByVal finish As Location)
_Start = Start
_Finish = Finish
End Sub
''' <summary>
''' Compares two specified Span values to see if they are equal.
''' </summary>
''' <param name="left">One span to compare.</param>
''' <param name="right">The other span to compare.</param>
''' <returns>True if the spans are the same, False otherwise.</returns>
Public Shared Operator =(ByVal left As Span, ByVal right As Span) As Boolean
Return left.Start.Index = right.Start.Index AndAlso left.Finish.Index = right.Finish.Index
End Operator
''' <summary>
''' Compares two specified Span values to see if they are not equal.
''' </summary>
''' <param name="left">One span to compare.</param>
''' <param name="right">The other span to compare.</param>
''' <returns>True if the spans are not the same, False otherwise.</returns>
Public Shared Operator <>(ByVal left As Span, ByVal right As Span) As Boolean
Return left.Start.Index <> right.Start.Index OrElse left.Finish.Index <> right.Finish.Index
End Operator
Public Overrides Function ToString() As String
Return Start.ToString() & " - " & Finish.ToString()
End Function
Public Overrides Function Equals(ByVal obj As Object) As Boolean
If TypeOf obj Is Span Then
Return Me = DirectCast(obj, Span)
Else
Return False
End If
End Function
Public Overrides Function GetHashCode() As Integer
Return CInt((Start.Index Xor Finish.Index) And &HFFFFFFFFL)
End Function
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' Stores the location of a span of text.
''' </summary>
''' <remarks>The end location is exclusive.</remarks>
Public Structure Span
Private ReadOnly _Start As Location
Private ReadOnly _Finish As Location
''' <summary>
''' The start location of the span.
''' </summary>
Public ReadOnly Property Start() As Location
Get
Return _Start
End Get
End Property
''' <summary>
''' The end location of the span.
''' </summary>
Public ReadOnly Property Finish() As Location
Get
Return _Finish
End Get
End Property
''' <summary>
''' Whether the locations in the span are valid.
''' </summary>
Public ReadOnly Property IsValid() As Boolean
Get
Return Start.IsValid AndAlso Finish.IsValid
End Get
End Property
''' <summary>
''' Constructs a new span with a specific start and end location.
''' </summary>
''' <param name="start">The beginning of the span.</param>
''' <param name="finish">The end of the span.</param>
Public Sub New(ByVal start As Location, ByVal finish As Location)
_Start = Start
_Finish = Finish
End Sub
''' <summary>
''' Compares two specified Span values to see if they are equal.
''' </summary>
''' <param name="left">One span to compare.</param>
''' <param name="right">The other span to compare.</param>
''' <returns>True if the spans are the same, False otherwise.</returns>
Public Shared Operator =(ByVal left As Span, ByVal right As Span) As Boolean
Return left.Start.Index = right.Start.Index AndAlso left.Finish.Index = right.Finish.Index
End Operator
''' <summary>
''' Compares two specified Span values to see if they are not equal.
''' </summary>
''' <param name="left">One span to compare.</param>
''' <param name="right">The other span to compare.</param>
''' <returns>True if the spans are not the same, False otherwise.</returns>
Public Shared Operator <>(ByVal left As Span, ByVal right As Span) As Boolean
Return left.Start.Index <> right.Start.Index OrElse left.Finish.Index <> right.Finish.Index
End Operator
Public Overrides Function ToString() As String
Return Start.ToString() & " - " & Finish.ToString()
End Function
Public Overrides Function Equals(ByVal obj As Object) As Boolean
If TypeOf obj Is Span Then
Return Me = DirectCast(obj, Span)
Else
Return False
End If
End Function
Public Overrides Function GetHashCode() As Integer
Return CInt((Start.Index Xor Finish.Index) And &HFFFFFFFFL)
End Function
End Structure

View file

@ -1,236 +1,236 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A syntax error.
''' </summary>
Public NotInheritable Class SyntaxError
Private ReadOnly _Type As SyntaxErrorType
Private ReadOnly _Span As Span
''' <summary>
''' The type of the syntax error.
''' </summary>
Public ReadOnly Property Type() As SyntaxErrorType
Get
Return _Type
End Get
End Property
''' <summary>
''' The location of the syntax error.
''' </summary>
Public ReadOnly Property Span() As Span
Get
Return _Span
End Get
End Property
''' <summary>
''' Constructs a new syntax error.
''' </summary>
''' <param name="type">The type of the syntax error.</param>
''' <param name="span">The location of the syntax error.</param>
Public Sub New(ByVal type As SyntaxErrorType, ByVal span As Span)
Debug.Assert(System.Enum.IsDefined(GetType(SyntaxErrorType), type))
_Type = type
_Span = span
End Sub
Public Overrides Function ToString() As String
Static Messages() As String
If Messages Is Nothing Then
Dim Strings() As String
Strings = New String() { _
"", _
"Invalid escaped identifier.", _
"Invalid identifier.", _
"Cannot put a type character on a keyword.", _
"Invalid character.", _
"Invalid character literal.", _
"Invalid string literal.", _
"Invalid date literal.", _
"Invalid floating point literal.", _
"Invalid integer literal.", _
"Invalid decimal literal.", _
"Syntax error.", _
"Expected ','.", _
"Expected '('.", _
"Expected ')'.", _
"Expected '='.", _
"Expected 'As'.", _
"Expected '}'.", _
"Expected '.'.", _
"Expected '-'.", _
"Expected 'Is'.", _
"Expected '>'.", _
"Type expected.", _
"Expected identifier.", _
"Invalid use of keyword.", _
"Bounds can be specified only for the top-level array when initializing an array of arrays.", _
"Array bounds cannot appear in type specifiers.", _
"Expected expression.", _
"Comma, ')', or a valid expression continuation expected.", _
"Expected named argument.", _
"MyBase must be followed by a '.'.", _
"MyClass must be followed by a '.'.", _
"Exit must be followed by Do, For, While, Select, Sub, Function, Property or Try.", _
"Expected 'Next'.", _
"Expected 'Resume' or 'GoTo'.", _
"Expected 'Error'.", _
"Type character does not match declared data type String.", _
"Comma, '}', or a valid expression continuation expected.", _
"Expected one of 'Dim', 'Const', 'Public', 'Private', 'Protected', 'Friend', 'Shadows', 'ReadOnly' or 'Shared'.", _
"End of statement expected.", _
"'Do' must end with a matching 'Loop'.", _
"'While' must end with a matching 'End While'.", _
"'Select' must end with a matching 'End Select'.", _
"'SyncLock' must end with a matching 'End SyncLock'.", _
"'With' must end with a matching 'End With'.", _
"'If' must end with a matching 'End If'.", _
"'Try' must end with a matching 'End Try'.", _
"'Sub' must end with a matching 'End Sub'.", _
"'Function' must end with a matching 'End Function'.", _
"'Property' must end with a matching 'End Property'.", _
"'Get' must end with a matching 'End Get'.", _
"'Set' must end with a matching 'End Set'.", _
"'Class' must end with a matching 'End Class'.", _
"'Structure' must end with a matching 'End Structure'.", _
"'Module' must end with a matching 'End Module'.", _
"'Interface' must end with a matching 'End Interface'.", _
"'Enum' must end with a matching 'End Enum'.", _
"'Namespace' must end with a matching 'End Namespace'.", _
"'Loop' cannot have a condition if matching 'Do' has one.", _
"'Loop' must be preceded by a matching 'Do'.", _
"'Next' must be preceded by a matching 'For' or 'For Each'.", _
"'End While' must be preceded by a matching 'While'.", _
"'End Select' must be preceded by a matching 'Select'.", _
"'End SyncLock' must be preceded by a matching 'SyncLock'.", _
"'End If' must be preceded by a matching 'If'.", _
"'End Try' must be preceded by a matching 'Try'.", _
"'End With' must be preceded by a matching 'With'.", _
"'Catch' cannot appear outside a 'Try' statement.", _
"'Finally' cannot appear outside a 'Try' statement.", _
"'Catch' cannot appear after 'Finally' within a 'Try' statement.", _
"'Finally' can only appear once in a 'Try' statement.", _
"'Case' must be preceded by a matching 'Select'.", _
"'Case' cannot appear after 'Case Else' within a 'Select' statement.", _
"'Case Else' can only appear once in a 'Select' statement.", _
"'Case Else' must be preceded by a matching 'Select'.", _
"'End Sub' must be preceded by a matching 'Sub'.", _
"'End Function' must be preceded by a matching 'Function'.", _
"'End Property' must be preceded by a matching 'Property'.", _
"'End Get' must be preceded by a matching 'Get'.", _
"'End Set' must be preceded by a matching 'Set'.", _
"'End Class' must be preceded by a matching 'Class'.", _
"'End Structure' must be preceded by a matching 'Structure'.", _
"'End Module' must be preceded by a matching 'Module'.", _
"'End Interface' must be preceded by a matching 'Interface'.", _
"'End Enum' must be preceded by a matching 'Enum'.", _
"'End Namespace' must be preceded by a matching 'Namespace'.", _
"Statements and labels are not valid between 'Select Case' and first 'Case'.", _
"'ElseIf' cannot appear after 'Else' within an 'If' statement.", _
"'ElseIf' must be preceded by a matching 'If'.", _
"'Else' can only appear once in an 'If' statement.", _
"'Else' must be preceded by a matching 'If'.", _
"Statement cannot end a block outside of a line 'If' statement.", _
"Attribute of this type is not allowed here.", _
"Modifier cannot be specified twice.", _
"Modifier is not valid on this declaration type.", _
"Can only specify one of 'Dim', 'Static' or 'Const'.", _
"Events cannot have a return type.", _
"Comma or ')' expected.", _
"Method declaration statements must be the first statement on a logical line.", _
"First statement of a method body cannot be on the same line as the method declaration.", _
"'End Sub' must be the first statement on a line.", _
"'End Function' must be the first statement on a line.", _
"'End Get' must be the first statement on a line.", _
"'End Set' must be the first statement on a line.", _
"'Sub' or 'Function' expected.", _
"String constant expected.", _
"'Lib' expected.", _
"Declaration cannot appear within a Property declaration.", _
"Declaration cannot appear within a Class declaration.", _
"Declaration cannot appear within a Structure declaration.", _
"Declaration cannot appear within a Module declaration.", _
"Declaration cannot appear within an Interface declaration.", _
"Declaration cannot appear within an Enum declaration.", _
"Declaration cannot appear within a Namespace declaration.", _
"Specifiers and attributes are not valid on this statement.", _
"Specifiers and attributes are not valid on a Namespace declaration.", _
"Specifiers and attributes are not valid on an Imports declaration.", _
"Specifiers and attributes are not valid on an Option declaration.", _
"Inherits' can only specify one class.", _
"'Inherits' statements must precede all declarations.", _
"'Implements' statements must follow any 'Inherits' statement and precede all declarations in a class.", _
"Enum must contain at least one member.", _
"'Option Explicit' can be followed only by 'On' or 'Off'.", _
"'Option Strict' can be followed only by 'On' or 'Off'.", _
"'Option Compare' must be followed by 'Text' or 'Binary'.", _
"'Option' must be followed by 'Compare', 'Explicit', or 'Strict'.", _
"'Option' statements must precede any declarations or 'Imports' statements.", _
"'Imports' statements must precede any declarations.", _
"Assembly or Module attribute statements must precede any declarations in a file.", _
"'End' statement not valid.", _
"Expected relational operator.", _
"'If', 'ElseIf', 'Else', 'End If', or 'Const' expected.", _
"Expected integer literal.", _
"'#ExternalSource' statements cannot be nested.", _
"'ExternalSource', 'Region' or 'If' expected.", _
"'#End ExternalSource' must be preceded by a matching '#ExternalSource'.", _
"'#ExternalSource' must end with a matching '#End ExternalSource'.", _
"'#End Region' must be preceded by a matching '#Region'.", _
"'#Region' must end with a matching '#End Region'.", _
"'#Region' and '#End Region' statements are not valid within method bodies.", _
"Conversions to and from 'String' cannot occur in a conditional compilation expression.", _
"Conversion is not valid in a conditional compilation expression.", _
"Expression is not valid in a conditional compilation expression.", _
"Operator is not valid for these types in a conditional compilation expression.", _
"'#If' must end with a matching '#End If'.", _
"'#End If' must be preceded by a matching '#If'.", _
"'#ElseIf' cannot appear after '#Else' within an '#If' statement.", _
"'#ElseIf' must be preceded by a matching '#If'.", _
"'#Else' can only appear once in an '#If' statement.", _
"'#Else' must be preceded by a matching '#If'.", _
"'Global' not allowed in this context; identifier expected.", _
"Modules cannot be generic.", _
"Expected 'Of'.", _
"Operator declaration must be one of: +, -, *, \, /, ^, &, Like, Mod, And, Or, Xor, Not, <<, >>, =, <>, <, <=, >, >=, CType, IsTrue, IsFalse.", _
"'Operator' must end with a matching 'End Operator'.", _
"'End Operator' must be preceded by a matching 'Operator'.", _
"'End Operator' must be the first statement on a line.", _
"Properties cannot be generic.", _
"Constructors cannot be generic.", _
"Operators cannot be generic.", _
"Global must be followed by a '.'.", _
"Continue must be followed by Do, For, or While.", _
"'Using' must end with a matching 'End Using'.", _
"Custom 'Event' must end with a matching 'End Event'.", _
"'AddHandler' must end with a matching 'End AddHandler'.", _
"'RemoveHandler' must end with a matching 'End RemoveHandler'.", _
"'RaiseEvent' must end with a matching 'End RaiseEvent'.", _
"'End Using' must be preceded by a matching 'Using'.", _
"'End Event' must be preceded by a matching custom 'Event'.", _
"'End AddHandler' must be preceded by a matching 'AddHandler'.", _
"'End RemoveHandler' must be preceded by a matching 'RemoveHandler'.", _
"'End RaiseEvent' must be preceded by a matching 'RaiseEvent'.", _
"'End AddHandler' must be the first statement on a line.", _
"'End RemoveHandler' must be the first statement on a line.", _
"'End RaiseEvent' must be the first statement on a line." _
}
Messages = Strings
End If
Return "error " & Type & " " & Span.ToString() & ": " & Messages(Type)
End Function
End Class
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A syntax error.
''' </summary>
Public NotInheritable Class SyntaxError
Private ReadOnly _Type As SyntaxErrorType
Private ReadOnly _Span As Span
''' <summary>
''' The type of the syntax error.
''' </summary>
Public ReadOnly Property Type() As SyntaxErrorType
Get
Return _Type
End Get
End Property
''' <summary>
''' The location of the syntax error.
''' </summary>
Public ReadOnly Property Span() As Span
Get
Return _Span
End Get
End Property
''' <summary>
''' Constructs a new syntax error.
''' </summary>
''' <param name="type">The type of the syntax error.</param>
''' <param name="span">The location of the syntax error.</param>
Public Sub New(ByVal type As SyntaxErrorType, ByVal span As Span)
Debug.Assert(System.Enum.IsDefined(GetType(SyntaxErrorType), type))
_Type = type
_Span = span
End Sub
Public Overrides Function ToString() As String
Static Messages() As String
If Messages Is Nothing Then
Dim Strings() As String
Strings = New String() { _
"", _
"Invalid escaped identifier.", _
"Invalid identifier.", _
"Cannot put a type character on a keyword.", _
"Invalid character.", _
"Invalid character literal.", _
"Invalid string literal.", _
"Invalid date literal.", _
"Invalid floating point literal.", _
"Invalid integer literal.", _
"Invalid decimal literal.", _
"Syntax error.", _
"Expected ','.", _
"Expected '('.", _
"Expected ')'.", _
"Expected '='.", _
"Expected 'As'.", _
"Expected '}'.", _
"Expected '.'.", _
"Expected '-'.", _
"Expected 'Is'.", _
"Expected '>'.", _
"Type expected.", _
"Expected identifier.", _
"Invalid use of keyword.", _
"Bounds can be specified only for the top-level array when initializing an array of arrays.", _
"Array bounds cannot appear in type specifiers.", _
"Expected expression.", _
"Comma, ')', or a valid expression continuation expected.", _
"Expected named argument.", _
"MyBase must be followed by a '.'.", _
"MyClass must be followed by a '.'.", _
"Exit must be followed by Do, For, While, Select, Sub, Function, Property or Try.", _
"Expected 'Next'.", _
"Expected 'Resume' or 'GoTo'.", _
"Expected 'Error'.", _
"Type character does not match declared data type String.", _
"Comma, '}', or a valid expression continuation expected.", _
"Expected one of 'Dim', 'Const', 'Public', 'Private', 'Protected', 'Friend', 'Shadows', 'ReadOnly' or 'Shared'.", _
"End of statement expected.", _
"'Do' must end with a matching 'Loop'.", _
"'While' must end with a matching 'End While'.", _
"'Select' must end with a matching 'End Select'.", _
"'SyncLock' must end with a matching 'End SyncLock'.", _
"'With' must end with a matching 'End With'.", _
"'If' must end with a matching 'End If'.", _
"'Try' must end with a matching 'End Try'.", _
"'Sub' must end with a matching 'End Sub'.", _
"'Function' must end with a matching 'End Function'.", _
"'Property' must end with a matching 'End Property'.", _
"'Get' must end with a matching 'End Get'.", _
"'Set' must end with a matching 'End Set'.", _
"'Class' must end with a matching 'End Class'.", _
"'Structure' must end with a matching 'End Structure'.", _
"'Module' must end with a matching 'End Module'.", _
"'Interface' must end with a matching 'End Interface'.", _
"'Enum' must end with a matching 'End Enum'.", _
"'Namespace' must end with a matching 'End Namespace'.", _
"'Loop' cannot have a condition if matching 'Do' has one.", _
"'Loop' must be preceded by a matching 'Do'.", _
"'Next' must be preceded by a matching 'For' or 'For Each'.", _
"'End While' must be preceded by a matching 'While'.", _
"'End Select' must be preceded by a matching 'Select'.", _
"'End SyncLock' must be preceded by a matching 'SyncLock'.", _
"'End If' must be preceded by a matching 'If'.", _
"'End Try' must be preceded by a matching 'Try'.", _
"'End With' must be preceded by a matching 'With'.", _
"'Catch' cannot appear outside a 'Try' statement.", _
"'Finally' cannot appear outside a 'Try' statement.", _
"'Catch' cannot appear after 'Finally' within a 'Try' statement.", _
"'Finally' can only appear once in a 'Try' statement.", _
"'Case' must be preceded by a matching 'Select'.", _
"'Case' cannot appear after 'Case Else' within a 'Select' statement.", _
"'Case Else' can only appear once in a 'Select' statement.", _
"'Case Else' must be preceded by a matching 'Select'.", _
"'End Sub' must be preceded by a matching 'Sub'.", _
"'End Function' must be preceded by a matching 'Function'.", _
"'End Property' must be preceded by a matching 'Property'.", _
"'End Get' must be preceded by a matching 'Get'.", _
"'End Set' must be preceded by a matching 'Set'.", _
"'End Class' must be preceded by a matching 'Class'.", _
"'End Structure' must be preceded by a matching 'Structure'.", _
"'End Module' must be preceded by a matching 'Module'.", _
"'End Interface' must be preceded by a matching 'Interface'.", _
"'End Enum' must be preceded by a matching 'Enum'.", _
"'End Namespace' must be preceded by a matching 'Namespace'.", _
"Statements and labels are not valid between 'Select Case' and first 'Case'.", _
"'ElseIf' cannot appear after 'Else' within an 'If' statement.", _
"'ElseIf' must be preceded by a matching 'If'.", _
"'Else' can only appear once in an 'If' statement.", _
"'Else' must be preceded by a matching 'If'.", _
"Statement cannot end a block outside of a line 'If' statement.", _
"Attribute of this type is not allowed here.", _
"Modifier cannot be specified twice.", _
"Modifier is not valid on this declaration type.", _
"Can only specify one of 'Dim', 'Static' or 'Const'.", _
"Events cannot have a return type.", _
"Comma or ')' expected.", _
"Method declaration statements must be the first statement on a logical line.", _
"First statement of a method body cannot be on the same line as the method declaration.", _
"'End Sub' must be the first statement on a line.", _
"'End Function' must be the first statement on a line.", _
"'End Get' must be the first statement on a line.", _
"'End Set' must be the first statement on a line.", _
"'Sub' or 'Function' expected.", _
"String constant expected.", _
"'Lib' expected.", _
"Declaration cannot appear within a Property declaration.", _
"Declaration cannot appear within a Class declaration.", _
"Declaration cannot appear within a Structure declaration.", _
"Declaration cannot appear within a Module declaration.", _
"Declaration cannot appear within an Interface declaration.", _
"Declaration cannot appear within an Enum declaration.", _
"Declaration cannot appear within a Namespace declaration.", _
"Specifiers and attributes are not valid on this statement.", _
"Specifiers and attributes are not valid on a Namespace declaration.", _
"Specifiers and attributes are not valid on an Imports declaration.", _
"Specifiers and attributes are not valid on an Option declaration.", _
"Inherits' can only specify one class.", _
"'Inherits' statements must precede all declarations.", _
"'Implements' statements must follow any 'Inherits' statement and precede all declarations in a class.", _
"Enum must contain at least one member.", _
"'Option Explicit' can be followed only by 'On' or 'Off'.", _
"'Option Strict' can be followed only by 'On' or 'Off'.", _
"'Option Compare' must be followed by 'Text' or 'Binary'.", _
"'Option' must be followed by 'Compare', 'Explicit', or 'Strict'.", _
"'Option' statements must precede any declarations or 'Imports' statements.", _
"'Imports' statements must precede any declarations.", _
"Assembly or Module attribute statements must precede any declarations in a file.", _
"'End' statement not valid.", _
"Expected relational operator.", _
"'If', 'ElseIf', 'Else', 'End If', or 'Const' expected.", _
"Expected integer literal.", _
"'#ExternalSource' statements cannot be nested.", _
"'ExternalSource', 'Region' or 'If' expected.", _
"'#End ExternalSource' must be preceded by a matching '#ExternalSource'.", _
"'#ExternalSource' must end with a matching '#End ExternalSource'.", _
"'#End Region' must be preceded by a matching '#Region'.", _
"'#Region' must end with a matching '#End Region'.", _
"'#Region' and '#End Region' statements are not valid within method bodies.", _
"Conversions to and from 'String' cannot occur in a conditional compilation expression.", _
"Conversion is not valid in a conditional compilation expression.", _
"Expression is not valid in a conditional compilation expression.", _
"Operator is not valid for these types in a conditional compilation expression.", _
"'#If' must end with a matching '#End If'.", _
"'#End If' must be preceded by a matching '#If'.", _
"'#ElseIf' cannot appear after '#Else' within an '#If' statement.", _
"'#ElseIf' must be preceded by a matching '#If'.", _
"'#Else' can only appear once in an '#If' statement.", _
"'#Else' must be preceded by a matching '#If'.", _
"'Global' not allowed in this context; identifier expected.", _
"Modules cannot be generic.", _
"Expected 'Of'.", _
"Operator declaration must be one of: +, -, *, \, /, ^, &, Like, Mod, And, Or, Xor, Not, <<, >>, =, <>, <, <=, >, >=, CType, IsTrue, IsFalse.", _
"'Operator' must end with a matching 'End Operator'.", _
"'End Operator' must be preceded by a matching 'Operator'.", _
"'End Operator' must be the first statement on a line.", _
"Properties cannot be generic.", _
"Constructors cannot be generic.", _
"Operators cannot be generic.", _
"Global must be followed by a '.'.", _
"Continue must be followed by Do, For, or While.", _
"'Using' must end with a matching 'End Using'.", _
"Custom 'Event' must end with a matching 'End Event'.", _
"'AddHandler' must end with a matching 'End AddHandler'.", _
"'RemoveHandler' must end with a matching 'End RemoveHandler'.", _
"'RaiseEvent' must end with a matching 'End RaiseEvent'.", _
"'End Using' must be preceded by a matching 'Using'.", _
"'End Event' must be preceded by a matching custom 'Event'.", _
"'End AddHandler' must be preceded by a matching 'AddHandler'.", _
"'End RemoveHandler' must be preceded by a matching 'RemoveHandler'.", _
"'End RaiseEvent' must be preceded by a matching 'RaiseEvent'.", _
"'End AddHandler' must be the first statement on a line.", _
"'End RemoveHandler' must be the first statement on a line.", _
"'End RaiseEvent' must be the first statement on a line." _
}
Messages = Strings
End If
Return "error " & Type & " " & Span.ToString() & ": " & Messages(Type)
End Function
End Class

View file

@ -1,204 +1,204 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' The type of a syntax error.
''' </summary>
Public Enum SyntaxErrorType
None
' Lexical errors
InvalidEscapedIdentifier
InvalidIdentifier
InvalidTypeCharacterOnKeyword
InvalidCharacter
InvalidCharacterLiteral
InvalidStringLiteral
InvalidDateLiteral
InvalidFloatingPointLiteral
InvalidIntegerLiteral
InvalidDecimalLiteral
' Syntax errors
SyntaxError
ExpectedComma
ExpectedLeftParenthesis
ExpectedRightParenthesis
ExpectedEquals
ExpectedAs
ExpectedRightCurlyBrace
ExpectedPeriod
ExpectedMinus
ExpectedIs
ExpectedGreaterThan
ExpectedType
ExpectedIdentifier
InvalidUseOfKeyword
NoConstituentArraySizes
NoExplicitArraySizes
ExpectedExpression
ArgumentSyntax
ExpectedNamedArgument
ExpectedPeriodAfterMyBase
ExpectedPeriodAfterMyClass
ExpectedExitKind
ExpectedNext
ExpectedResumeOrGoto
ExpectedError
MidTypeCharacter
InitializerSyntax
ExpectedModifier
ExpectedEndOfStatement
ExpectedLoop
ExpectedEndWhile
ExpectedEndSelect
ExpectedEndSyncLock
ExpectedEndWith
ExpectedEndIf
ExpectedEndTry
ExpectedEndSub
ExpectedEndFunction
ExpectedEndProperty
ExpectedEndGet
ExpectedEndSet
ExpectedEndClass
ExpectedEndStructure
ExpectedEndModule
ExpectedEndInterface
ExpectedEndEnum
ExpectedEndNamespace
LoopDoubleCondition
LoopWithoutDo
NextWithoutFor
EndWhileWithoutWhile
EndSelectWithoutSelect
EndSyncLockWithoutSyncLock
EndIfWithoutIf
EndTryWithoutTry
EndWithWithoutWith
CatchWithoutTry
FinallyWithoutTry
CatchAfterFinally
FinallyAfterFinally
CaseWithoutSelect
CaseAfterCaseElse
CaseElseAfterCaseElse
CaseElseWithoutSelect
EndSubWithoutSub
EndFunctionWithoutFunction
EndPropertyWithoutProperty
EndGetWithoutGet
EndSetWithoutSet
EndClassWithoutClass
EndStructureWithoutStructure
EndModuleWithoutModule
EndInterfaceWithoutInterface
EndEnumWithoutEnum
EndNamespaceWithoutNamespace
ExpectedCase
ElseIfAfterElse
ElseIfWithoutIf
ElseAfterElse
ElseWithoutIf
EndInLineIf
IncorrectAttributeType
DuplicateModifier
InvalidModifier
InvalidVariableModifiers
EventsCantBeFunctions
ParameterSyntax
MethodMustBeFirstStatementOnLine
MethodBodyNotAtLineStart
EndSubNotAtLineStart
EndFunctionNotAtLineStart
EndGetNotAtLineStart
EndSetNotAtLineStart
ExpectedSubOrFunction
ExpectedStringLiteral
ExpectedLib
InvalidInsideProperty
InvalidInsideClass
InvalidInsideStructure
InvalidInsideModule
InvalidInsideInterface
InvalidInsideEnum
InvalidInsideNamespace
SpecifiersInvalidOnTypeListDeclaration
SpecifiersInvalidOnNamespaceDeclaration
SpecifiersInvalidOnImportsDeclaration
SpecifiersInvalidOnOptionDeclaration
NoMultipleInheritance
InheritsMustBeFirst
ImplementsInWrongOrder
EmptyEnum
InvalidOptionExplicitType
InvalidOptionStrictType
InvalidOptionCompareType
InvalidOptionType
OptionStatementWrongOrder
ImportsStatementWrongOrder
AttributesStatementWrongOrder
UnrecognizedEnd
ExpectedRelationalOperator
InvalidPreprocessorStatement
ExpectedIntegerLiteral
NestedExternalSourceStatement
ExpectedEndKind
EndExternalSourceWithoutExternalSource
ExpectedEndExternalSource
EndRegionWithoutRegion
ExpectedEndRegion
RegionInsideMethod
' Conditional compilation errors
CantCastStringInCCExpression
InvalidCCCast
CCExpressionRequired
InvalidCCOperator
ExpectedCCEndIf
CCEndIfWithoutCCIf
CCElseIfAfterCCElse
CCElseIfWithoutCCIf
CCElseAfterCCElse
CCElseWithoutCCIf
' New errors in v8.0
InvalidUseOfGlobal
ModulesCantBeGeneric
ExpectedOf
InvalidOperator
ExpectedEndOperator
EndOperatorWithoutOperator
EndOperatorNotAtLineStart
PropertiesCantBeGeneric
ConstructorsCantBeGeneric
OperatorsCantBeGeneric
ExpectedPeriodAfterGlobal
ExpectedContinueKind
ExpectedEndUsing
ExpectedEndEvent
ExpectedEndAddHandler
ExpectedEndRemoveHandler
ExpectedEndRaiseEvent
EndUsingWithoutUsing
EndEventWithoutEvent
EndAddHandlerWithoutAddHandler
EndRemoveHandlerWithoutRemoveHandler
EndRaiseEventWithoutRaiseEvent
EndAddHandlerNotAtLineStart
EndRemoveHandlerNotAtLineStart
EndRaiseEventNotAtLineStart
'Analysis error
NameAlreadyUsed
VariableNotDeclared
NotImplemented
Unexpected
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' The type of a syntax error.
''' </summary>
Public Enum SyntaxErrorType
None
' Lexical errors
InvalidEscapedIdentifier
InvalidIdentifier
InvalidTypeCharacterOnKeyword
InvalidCharacter
InvalidCharacterLiteral
InvalidStringLiteral
InvalidDateLiteral
InvalidFloatingPointLiteral
InvalidIntegerLiteral
InvalidDecimalLiteral
' Syntax errors
SyntaxError
ExpectedComma
ExpectedLeftParenthesis
ExpectedRightParenthesis
ExpectedEquals
ExpectedAs
ExpectedRightCurlyBrace
ExpectedPeriod
ExpectedMinus
ExpectedIs
ExpectedGreaterThan
ExpectedType
ExpectedIdentifier
InvalidUseOfKeyword
NoConstituentArraySizes
NoExplicitArraySizes
ExpectedExpression
ArgumentSyntax
ExpectedNamedArgument
ExpectedPeriodAfterMyBase
ExpectedPeriodAfterMyClass
ExpectedExitKind
ExpectedNext
ExpectedResumeOrGoto
ExpectedError
MidTypeCharacter
InitializerSyntax
ExpectedModifier
ExpectedEndOfStatement
ExpectedLoop
ExpectedEndWhile
ExpectedEndSelect
ExpectedEndSyncLock
ExpectedEndWith
ExpectedEndIf
ExpectedEndTry
ExpectedEndSub
ExpectedEndFunction
ExpectedEndProperty
ExpectedEndGet
ExpectedEndSet
ExpectedEndClass
ExpectedEndStructure
ExpectedEndModule
ExpectedEndInterface
ExpectedEndEnum
ExpectedEndNamespace
LoopDoubleCondition
LoopWithoutDo
NextWithoutFor
EndWhileWithoutWhile
EndSelectWithoutSelect
EndSyncLockWithoutSyncLock
EndIfWithoutIf
EndTryWithoutTry
EndWithWithoutWith
CatchWithoutTry
FinallyWithoutTry
CatchAfterFinally
FinallyAfterFinally
CaseWithoutSelect
CaseAfterCaseElse
CaseElseAfterCaseElse
CaseElseWithoutSelect
EndSubWithoutSub
EndFunctionWithoutFunction
EndPropertyWithoutProperty
EndGetWithoutGet
EndSetWithoutSet
EndClassWithoutClass
EndStructureWithoutStructure
EndModuleWithoutModule
EndInterfaceWithoutInterface
EndEnumWithoutEnum
EndNamespaceWithoutNamespace
ExpectedCase
ElseIfAfterElse
ElseIfWithoutIf
ElseAfterElse
ElseWithoutIf
EndInLineIf
IncorrectAttributeType
DuplicateModifier
InvalidModifier
InvalidVariableModifiers
EventsCantBeFunctions
ParameterSyntax
MethodMustBeFirstStatementOnLine
MethodBodyNotAtLineStart
EndSubNotAtLineStart
EndFunctionNotAtLineStart
EndGetNotAtLineStart
EndSetNotAtLineStart
ExpectedSubOrFunction
ExpectedStringLiteral
ExpectedLib
InvalidInsideProperty
InvalidInsideClass
InvalidInsideStructure
InvalidInsideModule
InvalidInsideInterface
InvalidInsideEnum
InvalidInsideNamespace
SpecifiersInvalidOnTypeListDeclaration
SpecifiersInvalidOnNamespaceDeclaration
SpecifiersInvalidOnImportsDeclaration
SpecifiersInvalidOnOptionDeclaration
NoMultipleInheritance
InheritsMustBeFirst
ImplementsInWrongOrder
EmptyEnum
InvalidOptionExplicitType
InvalidOptionStrictType
InvalidOptionCompareType
InvalidOptionType
OptionStatementWrongOrder
ImportsStatementWrongOrder
AttributesStatementWrongOrder
UnrecognizedEnd
ExpectedRelationalOperator
InvalidPreprocessorStatement
ExpectedIntegerLiteral
NestedExternalSourceStatement
ExpectedEndKind
EndExternalSourceWithoutExternalSource
ExpectedEndExternalSource
EndRegionWithoutRegion
ExpectedEndRegion
RegionInsideMethod
' Conditional compilation errors
CantCastStringInCCExpression
InvalidCCCast
CCExpressionRequired
InvalidCCOperator
ExpectedCCEndIf
CCEndIfWithoutCCIf
CCElseIfAfterCCElse
CCElseIfWithoutCCIf
CCElseAfterCCElse
CCElseWithoutCCIf
' New errors in v8.0
InvalidUseOfGlobal
ModulesCantBeGeneric
ExpectedOf
InvalidOperator
ExpectedEndOperator
EndOperatorWithoutOperator
EndOperatorNotAtLineStart
PropertiesCantBeGeneric
ConstructorsCantBeGeneric
OperatorsCantBeGeneric
ExpectedPeriodAfterGlobal
ExpectedContinueKind
ExpectedEndUsing
ExpectedEndEvent
ExpectedEndAddHandler
ExpectedEndRemoveHandler
ExpectedEndRaiseEvent
EndUsingWithoutUsing
EndEventWithoutEvent
EndAddHandlerWithoutAddHandler
EndRemoveHandlerWithoutRemoveHandler
EndRaiseEventWithoutRaiseEvent
EndAddHandlerNotAtLineStart
EndRemoveHandlerNotAtLineStart
EndRaiseEventNotAtLineStart
'Analysis error
NameAlreadyUsed
VariableNotDeclared
NotImplemented
Unexpected
End Enum

View file

@ -1,37 +1,37 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A character literal.
''' </summary>
Public NotInheritable Class CharacterLiteralToken
Inherits Token
Private ReadOnly _Literal As Char
''' <summary>
''' The literal value.
''' </summary>
Public ReadOnly Property Literal() As Char
Get
Return _Literal
End Get
End Property
''' <summary>
''' Constructs a new character literal token.
''' </summary>
''' <param name="literal">The literal value.</param>
''' <param name="span">The location of the literal.</param>
Public Sub New(ByVal literal As Char, ByVal span As Span)
MyBase.New(TokenType.CharacterLiteral, span)
_Literal = Literal
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A character literal.
''' </summary>
Public NotInheritable Class CharacterLiteralToken
Inherits Token
Private ReadOnly _Literal As Char
''' <summary>
''' The literal value.
''' </summary>
Public ReadOnly Property Literal() As Char
Get
Return _Literal
End Get
End Property
''' <summary>
''' Constructs a new character literal token.
''' </summary>
''' <param name="literal">The literal value.</param>
''' <param name="span">The location of the literal.</param>
Public Sub New(ByVal literal As Char, ByVal span As Span)
MyBase.New(TokenType.CharacterLiteral, span)
_Literal = Literal
End Sub
End Class

View file

@ -1,54 +1,54 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A comment token.
''' </summary>
Public NotInheritable Class CommentToken
Inherits Token
Private ReadOnly _IsREM As Boolean ' Was the comment preceded by a quote or by REM?
Private ReadOnly _Comment As String ' Comment can be Nothing
''' <summary>
''' Whether the comment was preceded by REM.
''' </summary>
Public ReadOnly Property IsREM() As Boolean
Get
Return _IsREM
End Get
End Property
''' <summary>
''' The text of the comment.
''' </summary>
Public ReadOnly Property Comment() As String
Get
Return _Comment
End Get
End Property
''' <summary>
''' Constructs a new comment token.
''' </summary>
''' <param name="comment">The comment value.</param>
''' <param name="isREM">Whether the comment was preceded by REM.</param>
''' <param name="span">The location of the comment.</param>
Public Sub New(ByVal comment As String, ByVal isREM As Boolean, ByVal span As Span)
MyBase.New(TokenType.Comment, span)
If comment Is Nothing Then
Throw New ArgumentNullException("comment")
End If
_IsREM = isREM
_Comment = comment
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A comment token.
''' </summary>
Public NotInheritable Class CommentToken
Inherits Token
Private ReadOnly _IsREM As Boolean ' Was the comment preceded by a quote or by REM?
Private ReadOnly _Comment As String ' Comment can be Nothing
''' <summary>
''' Whether the comment was preceded by REM.
''' </summary>
Public ReadOnly Property IsREM() As Boolean
Get
Return _IsREM
End Get
End Property
''' <summary>
''' The text of the comment.
''' </summary>
Public ReadOnly Property Comment() As String
Get
Return _Comment
End Get
End Property
''' <summary>
''' Constructs a new comment token.
''' </summary>
''' <param name="comment">The comment value.</param>
''' <param name="isREM">Whether the comment was preceded by REM.</param>
''' <param name="span">The location of the comment.</param>
Public Sub New(ByVal comment As String, ByVal isREM As Boolean, ByVal span As Span)
MyBase.New(TokenType.Comment, span)
If comment Is Nothing Then
Throw New ArgumentNullException("comment")
End If
_IsREM = isREM
_Comment = comment
End Sub
End Class

View file

@ -1,37 +1,37 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A date/time literal.
''' </summary>
Public NotInheritable Class DateLiteralToken
Inherits Token
Private ReadOnly _Literal As Date
''' <summary>
''' The literal value.
''' </summary>
Public ReadOnly Property Literal() As Date
Get
Return _Literal
End Get
End Property
''' <summary>
''' Constructs a new date literal instance.
''' </summary>
''' <param name="literal">The literal value.</param>
''' <param name="span">The location of the literal.</param>
Public Sub New(ByVal literal As Date, ByVal span As Span)
MyBase.New(TokenType.DateLiteral, span)
_Literal = literal
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A date/time literal.
''' </summary>
Public NotInheritable Class DateLiteralToken
Inherits Token
Private ReadOnly _Literal As Date
''' <summary>
''' The literal value.
''' </summary>
Public ReadOnly Property Literal() As Date
Get
Return _Literal
End Get
End Property
''' <summary>
''' Constructs a new date literal instance.
''' </summary>
''' <param name="literal">The literal value.</param>
''' <param name="span">The location of the literal.</param>
Public Sub New(ByVal literal As Date, ByVal span As Span)
MyBase.New(TokenType.DateLiteral, span)
_Literal = literal
End Sub
End Class

View file

@ -1,55 +1,55 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A decimal literal token.
''' </summary>
Public NotInheritable Class DecimalLiteralToken
Inherits Token
Private ReadOnly _Literal As Decimal
Private ReadOnly _TypeCharacter As TypeCharacter ' The type character after the literal, if any
''' <summary>
''' The literal value.
''' </summary>
Public ReadOnly Property Literal() As Decimal
Get
Return _Literal
End Get
End Property
''' <summary>
''' The type character of the literal.
''' </summary>
Public ReadOnly Property TypeCharacter() As TypeCharacter
Get
Return _TypeCharacter
End Get
End Property
''' <summary>
''' Constructs a new decimal literal token.
''' </summary>
''' <param name="literal">The literal value.</param>
''' <param name="typeCharacter">The literal's type character.</param>
''' <param name="span">The location of the literal.</param>
Public Sub New(ByVal literal As Decimal, ByVal typeCharacter As TypeCharacter, ByVal span As Span)
MyBase.New(TokenType.DecimalLiteral, span)
If typeCharacter <> typeCharacter.None AndAlso typeCharacter <> typeCharacter.DecimalChar AndAlso _
typeCharacter <> typeCharacter.DecimalSymbol Then
Throw New ArgumentOutOfRangeException("typeCharacter")
End If
_Literal = literal
_TypeCharacter = typeCharacter
End Sub
End Class
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A decimal literal token.
''' </summary>
Public NotInheritable Class DecimalLiteralToken
Inherits Token
Private ReadOnly _Literal As Decimal
Private ReadOnly _TypeCharacter As TypeCharacter ' The type character after the literal, if any
''' <summary>
''' The literal value.
''' </summary>
Public ReadOnly Property Literal() As Decimal
Get
Return _Literal
End Get
End Property
''' <summary>
''' The type character of the literal.
''' </summary>
Public ReadOnly Property TypeCharacter() As TypeCharacter
Get
Return _TypeCharacter
End Get
End Property
''' <summary>
''' Constructs a new decimal literal token.
''' </summary>
''' <param name="literal">The literal value.</param>
''' <param name="typeCharacter">The literal's type character.</param>
''' <param name="span">The location of the literal.</param>
Public Sub New(ByVal literal As Decimal, ByVal typeCharacter As TypeCharacter, ByVal span As Span)
MyBase.New(TokenType.DecimalLiteral, span)
If typeCharacter <> typeCharacter.None AndAlso typeCharacter <> typeCharacter.DecimalChar AndAlso _
typeCharacter <> typeCharacter.DecimalSymbol Then
Throw New ArgumentOutOfRangeException("typeCharacter")
End If
_Literal = literal
_TypeCharacter = typeCharacter
End Sub
End Class

View file

@ -1,25 +1,25 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A token representing the end of the file.
''' </summary>
Public NotInheritable Class EndOfStreamToken
Inherits Token
''' <summary>
''' Creates a new end-of-stream token.
''' </summary>
''' <param name="span">The location of the end of the stream.</param>
Public Sub New(ByVal span As Span)
MyBase.New(TokenType.EndOfStream, Span)
End Sub
End Class
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A token representing the end of the file.
''' </summary>
Public NotInheritable Class EndOfStreamToken
Inherits Token
''' <summary>
''' Creates a new end-of-stream token.
''' </summary>
''' <param name="span">The location of the end of the stream.</param>
Public Sub New(ByVal span As Span)
MyBase.New(TokenType.EndOfStream, Span)
End Sub
End Class

View file

@ -1,42 +1,42 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A lexical error.
''' </summary>
Public NotInheritable Class ErrorToken
Inherits Token
Private ReadOnly _SyntaxError As SyntaxError
''' <summary>
''' The syntax error that represents the lexical error.
''' </summary>
Public ReadOnly Property SyntaxError() As SyntaxError
Get
Return _SyntaxError
End Get
End Property
''' <summary>
''' Creates a new lexical error token.
''' </summary>
''' <param name="errorType">The type of the error.</param>
''' <param name="span">The location of the error.</param>
Public Sub New(ByVal errorType As SyntaxErrorType, ByVal span As Span)
MyBase.New(TokenType.LexicalError, span)
If errorType < SyntaxErrorType.InvalidEscapedIdentifier OrElse errorType > SyntaxErrorType.InvalidDecimalLiteral Then
Throw New ArgumentOutOfRangeException("errorType")
End If
_SyntaxError = New SyntaxError(errorType, span)
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A lexical error.
''' </summary>
Public NotInheritable Class ErrorToken
Inherits Token
Private ReadOnly _SyntaxError As SyntaxError
''' <summary>
''' The syntax error that represents the lexical error.
''' </summary>
Public ReadOnly Property SyntaxError() As SyntaxError
Get
Return _SyntaxError
End Get
End Property
''' <summary>
''' Creates a new lexical error token.
''' </summary>
''' <param name="errorType">The type of the error.</param>
''' <param name="span">The location of the error.</param>
Public Sub New(ByVal errorType As SyntaxErrorType, ByVal span As Span)
MyBase.New(TokenType.LexicalError, span)
If errorType < SyntaxErrorType.InvalidEscapedIdentifier OrElse errorType > SyntaxErrorType.InvalidDecimalLiteral Then
Throw New ArgumentOutOfRangeException("errorType")
End If
_SyntaxError = New SyntaxError(errorType, span)
End Sub
End Class

View file

@ -1,56 +1,56 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A floating point literal.
''' </summary>
Public NotInheritable Class FloatingPointLiteralToken
Inherits Token
Private ReadOnly _Literal As Double
Private ReadOnly _TypeCharacter As TypeCharacter ' The type character after the literal, if any
''' <summary>
''' The value of the literal.
''' </summary>
Public ReadOnly Property Literal() As Double
Get
Return _Literal
End Get
End Property
''' <summary>
''' The type character after the literal.
''' </summary>
Public ReadOnly Property TypeCharacter() As TypeCharacter
Get
Return _TypeCharacter
End Get
End Property
''' <summary>
''' Constructs a new floating point literal token.
''' </summary>
''' <param name="literal">The literal value.</param>
''' <param name="typeCharacter">The type character of the literal.</param>
''' <param name="span">The location of the literal.</param>
Public Sub New(ByVal literal As Double, ByVal typeCharacter As TypeCharacter, ByVal span As Span)
MyBase.New(TokenType.FloatingPointLiteral, span)
If typeCharacter <> typeCharacter.None AndAlso _
typeCharacter <> typeCharacter.SingleSymbol AndAlso typeCharacter <> typeCharacter.SingleChar AndAlso _
typeCharacter <> typeCharacter.DoubleSymbol AndAlso typeCharacter <> typeCharacter.DoubleChar Then
Throw New ArgumentOutOfRangeException("typeCharacter")
End If
_Literal = literal
_TypeCharacter = typeCharacter
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A floating point literal.
''' </summary>
Public NotInheritable Class FloatingPointLiteralToken
Inherits Token
Private ReadOnly _Literal As Double
Private ReadOnly _TypeCharacter As TypeCharacter ' The type character after the literal, if any
''' <summary>
''' The value of the literal.
''' </summary>
Public ReadOnly Property Literal() As Double
Get
Return _Literal
End Get
End Property
''' <summary>
''' The type character after the literal.
''' </summary>
Public ReadOnly Property TypeCharacter() As TypeCharacter
Get
Return _TypeCharacter
End Get
End Property
''' <summary>
''' Constructs a new floating point literal token.
''' </summary>
''' <param name="literal">The literal value.</param>
''' <param name="typeCharacter">The type character of the literal.</param>
''' <param name="span">The location of the literal.</param>
Public Sub New(ByVal literal As Double, ByVal typeCharacter As TypeCharacter, ByVal span As Span)
MyBase.New(TokenType.FloatingPointLiteral, span)
If typeCharacter <> typeCharacter.None AndAlso _
typeCharacter <> typeCharacter.SingleSymbol AndAlso typeCharacter <> typeCharacter.SingleChar AndAlso _
typeCharacter <> typeCharacter.DoubleSymbol AndAlso typeCharacter <> typeCharacter.DoubleChar Then
Throw New ArgumentOutOfRangeException("typeCharacter")
End If
_Literal = literal
_TypeCharacter = typeCharacter
End Sub
End Class

View file

@ -1,313 +1,313 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' An identifier.
''' </summary>
Public NotInheritable Class IdentifierToken
Inherits Token
Private Structure Keyword
Public ReadOnly Versions As LanguageVersion
Public ReadOnly ReservedVersions As LanguageVersion
Public ReadOnly TokenType As TokenType
Public Sub New(ByVal Versions As LanguageVersion, ByVal ReservedVersions As LanguageVersion, ByVal TokenType As TokenType)
Me.Versions = Versions
Me.ReservedVersions = ReservedVersions
Me.TokenType = TokenType
End Sub
End Structure
Private Shared KeywordTable As Dictionary(Of String, Keyword)
Private Shared Sub AddKeyword(ByVal table As Dictionary(Of String, Keyword), ByVal name As String, ByVal keyword As Keyword)
table.Add(name, keyword)
table.Add(Scanner.MakeFullWidth(name), keyword)
End Sub
' Returns the token type of the string.
Friend Shared Function TokenTypeFromString(ByVal s As String, ByVal Version As LanguageVersion, ByVal IncludeUnreserved As Boolean) As TokenType
If KeywordTable Is Nothing Then
Dim Table As New Dictionary(Of String, Keyword)(StringComparer.InvariantCultureIgnoreCase)
' NOTE: These have to be in the same order as the enum!
AddKeyword(Table, "AddHandler", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.AddHandler))
AddKeyword(Table, "AddressOf", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.AddressOf))
AddKeyword(Table, "Alias", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Alias))
AddKeyword(Table, "And", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.And))
AddKeyword(Table, "AndAlso", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.AndAlso))
AddKeyword(Table, "Ansi", New Keyword(LanguageVersion.All, LanguageVersion.VisualBasic71, TokenType.Ansi))
AddKeyword(Table, "As", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.As))
AddKeyword(Table, "Assembly", New Keyword(LanguageVersion.All, LanguageVersion.VisualBasic71, TokenType.Assembly))
AddKeyword(Table, "Auto", New Keyword(LanguageVersion.All, LanguageVersion.VisualBasic71, TokenType.Auto))
AddKeyword(Table, "Binary", New Keyword(LanguageVersion.All, LanguageVersion.None, TokenType.Binary))
AddKeyword(Table, "Boolean", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Boolean))
AddKeyword(Table, "ByRef", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.ByRef))
AddKeyword(Table, "Byte", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Byte))
AddKeyword(Table, "ByVal", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.ByVal))
AddKeyword(Table, "Call", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Call))
AddKeyword(Table, "Case", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Case))
AddKeyword(Table, "Catch", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Catch))
'AddKeyword(Table, "CBool", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.CBool))
'AddKeyword(Table, "CByte", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.CByte))
'AddKeyword(Table, "CChar", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.CChar))
'AddKeyword(Table, "CDate", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.CDate))
'AddKeyword(Table, "CDbl", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.CDbl))
'AddKeyword(Table, "CDec", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.CDec))
AddKeyword(Table, "Char", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Char))
'AddKeyword(Table, "CInt", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.CInt))
AddKeyword(Table, "Class", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Class))
'AddKeyword(Table, "CLng", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.CLng))
'AddKeyword(Table, "CObj", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.CObj))
AddKeyword(Table, "Compare", New Keyword(LanguageVersion.All, LanguageVersion.None, TokenType.Compare))
AddKeyword(Table, "Const", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Const))
AddKeyword(Table, "Continue", New Keyword(LanguageVersion.VisualBasic80, LanguageVersion.VisualBasic80, TokenType.Continue))
'AddKeyword(Table, "CSByte", New Keyword(LanguageVersion.VisualBasic80, LanguageVersion.VisualBasic80, TokenType.CSByte))
'AddKeyword(Table, "CShort", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.CShort))
'AddKeyword(Table, "CSng", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.CSng))
'AddKeyword(Table, "CStr", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.CStr))
'AddKeyword(Table, "CType", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.CType))
'AddKeyword(Table, "CUInt", New Keyword(LanguageVersion.VisualBasic80, LanguageVersion.VisualBasic80, TokenType.CUInt))
'AddKeyword(Table, "CULng", New Keyword(LanguageVersion.VisualBasic80, LanguageVersion.VisualBasic80, TokenType.CULng))
'AddKeyword(Table, "CUShort", New Keyword(LanguageVersion.VisualBasic80, LanguageVersion.VisualBasic80, TokenType.CUShort))
AddKeyword(Table, "Custom", New Keyword(LanguageVersion.VisualBasic80, LanguageVersion.None, TokenType.Custom))
AddKeyword(Table, "Date", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Date))
AddKeyword(Table, "Decimal", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Decimal))
AddKeyword(Table, "Declare", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Declare))
AddKeyword(Table, "Default", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Default))
AddKeyword(Table, "Delegate", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Delegate))
AddKeyword(Table, "Dim", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Dim))
AddKeyword(Table, "DirectCast", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.DirectCast))
AddKeyword(Table, "Do", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Do))
AddKeyword(Table, "Double", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Double))
AddKeyword(Table, "Each", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Each))
AddKeyword(Table, "Else", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Else))
AddKeyword(Table, "ElseIf", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.ElseIf))
AddKeyword(Table, "End", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.End))
AddKeyword(Table, "EndIf", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.EndIf))
AddKeyword(Table, "Enum", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Enum))
AddKeyword(Table, "Erase", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Erase))
AddKeyword(Table, "Error", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Error))
AddKeyword(Table, "Event", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Event))
AddKeyword(Table, "Exit", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Exit))
AddKeyword(Table, "Explicit", New Keyword(LanguageVersion.All, LanguageVersion.None, TokenType.Explicit))
AddKeyword(Table, "ExternalChecksum", New Keyword(LanguageVersion.VisualBasic80, LanguageVersion.None, TokenType.ExternalChecksum))
AddKeyword(Table, "ExternalSource", New Keyword(LanguageVersion.All, LanguageVersion.None, TokenType.ExternalSource))
AddKeyword(Table, "False", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.False))
AddKeyword(Table, "Finally", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Finally))
AddKeyword(Table, "For", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.For))
AddKeyword(Table, "Friend", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Friend))
AddKeyword(Table, "Function", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Function))
AddKeyword(Table, "Get", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Get))
AddKeyword(Table, "GetType", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.GetType))
AddKeyword(Table, "Global", New Keyword(LanguageVersion.VisualBasic80, LanguageVersion.VisualBasic80, TokenType.Global))
AddKeyword(Table, "GoSub", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.GoSub))
AddKeyword(Table, "GoTo", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.GoTo))
AddKeyword(Table, "Handles", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Handles))
AddKeyword(Table, "If", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.If))
AddKeyword(Table, "Implements", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Implements))
AddKeyword(Table, "Imports", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Imports))
AddKeyword(Table, "In", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.In))
AddKeyword(Table, "Inherits", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Inherits))
AddKeyword(Table, "Integer", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Integer))
AddKeyword(Table, "Interface", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Interface))
AddKeyword(Table, "Is", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Is))
AddKeyword(Table, "IsFalse", New Keyword(LanguageVersion.VisualBasic80, LanguageVersion.None, TokenType.IsFalse))
AddKeyword(Table, "IsNot", New Keyword(LanguageVersion.VisualBasic80, LanguageVersion.VisualBasic80, TokenType.IsNot))
AddKeyword(Table, "IsTrue", New Keyword(LanguageVersion.VisualBasic80, LanguageVersion.None, TokenType.IsTrue))
AddKeyword(Table, "Let", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Let))
AddKeyword(Table, "Lib", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Lib))
AddKeyword(Table, "Like", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Like))
AddKeyword(Table, "Long", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Long))
AddKeyword(Table, "Loop", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Loop))
AddKeyword(Table, "Me", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Me))
AddKeyword(Table, "Mid", New Keyword(LanguageVersion.All, LanguageVersion.None, TokenType.Mid))
AddKeyword(Table, "Mod", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Mod))
AddKeyword(Table, "Module", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Module))
AddKeyword(Table, "MustInherit", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.MustInherit))
AddKeyword(Table, "MustOverride", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.MustOverride))
AddKeyword(Table, "MyBase", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.MyBase))
AddKeyword(Table, "MyClass", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.MyClass))
AddKeyword(Table, "Namespace", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Namespace))
AddKeyword(Table, "Narrowing", New Keyword(LanguageVersion.VisualBasic80, LanguageVersion.VisualBasic80, TokenType.Narrowing))
AddKeyword(Table, "New", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.New))
AddKeyword(Table, "Next", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Next))
AddKeyword(Table, "Not", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Not))
AddKeyword(Table, "Nothing", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Nothing))
AddKeyword(Table, "NotInheritable", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.NotInheritable))
AddKeyword(Table, "NotOverridable", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.NotOverridable))
AddKeyword(Table, "Object", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Object))
AddKeyword(Table, "Of", New Keyword(LanguageVersion.VisualBasic80, LanguageVersion.VisualBasic80, TokenType.Of))
AddKeyword(Table, "Off", New Keyword(LanguageVersion.All, LanguageVersion.None, TokenType.Off))
AddKeyword(Table, "On", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.On))
AddKeyword(Table, "Operator", New Keyword(LanguageVersion.VisualBasic80, LanguageVersion.VisualBasic80, TokenType.Operator))
AddKeyword(Table, "Option", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Option))
AddKeyword(Table, "Optional", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Optional))
AddKeyword(Table, "Or", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Or))
AddKeyword(Table, "OrElse", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.OrElse))
AddKeyword(Table, "Overloads", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Overloads))
AddKeyword(Table, "Overridable", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Overridable))
AddKeyword(Table, "Overrides", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Overrides))
AddKeyword(Table, "ParamArray", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.ParamArray))
AddKeyword(Table, "Partial", New Keyword(LanguageVersion.VisualBasic80, LanguageVersion.VisualBasic80, TokenType.Partial))
AddKeyword(Table, "Preserve", New Keyword(LanguageVersion.All, LanguageVersion.VisualBasic71, TokenType.Preserve))
AddKeyword(Table, "Private", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Private))
AddKeyword(Table, "Property", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Property))
AddKeyword(Table, "Protected", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Protected))
AddKeyword(Table, "Public", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Public))
AddKeyword(Table, "RaiseEvent", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.RaiseEvent))
AddKeyword(Table, "ReadOnly", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.ReadOnly))
AddKeyword(Table, "ReDim", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.ReDim))
AddKeyword(Table, "Region", New Keyword(LanguageVersion.All, LanguageVersion.None, TokenType.Region))
AddKeyword(Table, "REM", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.[REM]))
AddKeyword(Table, "RemoveHandler", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.RemoveHandler))
AddKeyword(Table, "Resume", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Resume))
AddKeyword(Table, "Return", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Return))
AddKeyword(Table, "SByte", New Keyword(LanguageVersion.VisualBasic80, LanguageVersion.VisualBasic80, TokenType.SByte))
AddKeyword(Table, "Select", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Select))
AddKeyword(Table, "Set", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Set))
AddKeyword(Table, "Shadows", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Shadows))
AddKeyword(Table, "Shared", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Shared))
AddKeyword(Table, "Short", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Short))
AddKeyword(Table, "Single", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Single))
AddKeyword(Table, "Static", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Static))
AddKeyword(Table, "Step", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Step))
AddKeyword(Table, "Stop", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Stop))
AddKeyword(Table, "Strict", New Keyword(LanguageVersion.All, LanguageVersion.None, TokenType.Strict))
AddKeyword(Table, "String", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.String))
AddKeyword(Table, "Structure", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Structure))
AddKeyword(Table, "Sub", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Sub))
AddKeyword(Table, "SyncLock", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.SyncLock))
AddKeyword(Table, "Text", New Keyword(LanguageVersion.All, LanguageVersion.None, TokenType.Text))
AddKeyword(Table, "Then", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Then))
AddKeyword(Table, "Throw", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Throw))
AddKeyword(Table, "To", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.To))
AddKeyword(Table, "True", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.True))
AddKeyword(Table, "Try", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Try))
AddKeyword(Table, "TryCast", New Keyword(LanguageVersion.VisualBasic80, LanguageVersion.VisualBasic80, TokenType.TryCast))
AddKeyword(Table, "TypeOf", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.TypeOf))
AddKeyword(Table, "UInteger", New Keyword(LanguageVersion.VisualBasic80, LanguageVersion.VisualBasic80, TokenType.UInteger))
AddKeyword(Table, "ULong", New Keyword(LanguageVersion.VisualBasic80, LanguageVersion.VisualBasic80, TokenType.ULong))
AddKeyword(Table, "UShort", New Keyword(LanguageVersion.VisualBasic80, LanguageVersion.VisualBasic80, TokenType.UShort))
AddKeyword(Table, "Using", New Keyword(LanguageVersion.VisualBasic80, LanguageVersion.VisualBasic80, TokenType.Using))
AddKeyword(Table, "Unicode", New Keyword(LanguageVersion.All, LanguageVersion.VisualBasic71, TokenType.Unicode))
AddKeyword(Table, "Until", New Keyword(LanguageVersion.All, LanguageVersion.VisualBasic71, TokenType.Until))
AddKeyword(Table, "Variant", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Variant))
AddKeyword(Table, "Wend", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Wend))
AddKeyword(Table, "When", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.When))
AddKeyword(Table, "While", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.While))
AddKeyword(Table, "Widening", New Keyword(LanguageVersion.VisualBasic80, LanguageVersion.VisualBasic80, TokenType.Widening))
AddKeyword(Table, "With", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.With))
AddKeyword(Table, "WithEvents", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.WithEvents))
AddKeyword(Table, "WriteOnly", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.WriteOnly))
AddKeyword(Table, "Xor", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Xor))
KeywordTable = Table
End If
If KeywordTable.ContainsKey(s) Then
Dim Keyword As Keyword = KeywordTable(s)
If ((Keyword.Versions And Version) = Version) AndAlso _
(IncludeUnreserved OrElse ((Keyword.ReservedVersions And Version) = Version)) Then
Return Keyword.TokenType
End If
End If
Return TokenType.Identifier
End Function
''' <summary>
''' Determines if a token type is a keyword.
''' </summary>
''' <param name="type">The token type to check.</param>
''' <returns>True if the token type is a keyword, False otherwise.</returns>
Public Shared Function IsKeyword(ByVal type As TokenType) As Boolean
Return type >= TokenType.AddHandler AndAlso type <= TokenType.Xor
End Function
Public Overrides Function AsUnreservedKeyword() As TokenType
Return _UnreservedType
End Function
Private ReadOnly _Identifier As String
Private ReadOnly _UnreservedType As TokenType
Private ReadOnly _Escaped As Boolean ' Whether the identifier was escaped (i.e. [a])
Private ReadOnly _TypeCharacter As TypeCharacter ' The type character that followed, if any
''' <summary>
''' The identifier name.
''' </summary>
Public ReadOnly Property Identifier() As String
Get
Return _Identifier
End Get
End Property
''' <summary>
''' Whether the identifier is escaped.
''' </summary>
Public ReadOnly Property Escaped() As Boolean
Get
Return _Escaped
End Get
End Property
''' <summary>
''' The type character of the identifier.
''' </summary>
Public ReadOnly Property TypeCharacter() As TypeCharacter
Get
Return _TypeCharacter
End Get
End Property
''' <summary>
''' Constructs a new identifier token.
''' </summary>
''' <param name="type">The token type of the identifier.</param>
''' <param name="unreservedType">The unreserved token type of the identifier.</param>
''' <param name="identifier">The text of the identifier</param>
''' <param name="escaped">Whether the identifier is escaped.</param>
''' <param name="typeCharacter">The type character of the identifier.</param>
''' <param name="span">The location of the identifier.</param>
Public Sub New(ByVal type As TokenType, ByVal unreservedType As TokenType, ByVal identifier As String, ByVal escaped As Boolean, ByVal typeCharacter As TypeCharacter, ByVal span As Span)
MyBase.New(type, span)
If type <> TokenType.Identifier AndAlso Not IsKeyword(type) Then
Throw New ArgumentOutOfRangeException("type")
End If
If unreservedType <> TokenType.Identifier AndAlso Not IsKeyword(unreservedType) Then
Throw New ArgumentOutOfRangeException("unreservedType")
End If
If identifier Is Nothing OrElse identifier = "" Then
Throw New ArgumentException("Identifier cannot be empty.", "identifier")
End If
If typeCharacter <> typeCharacter.None AndAlso typeCharacter <> typeCharacter.DecimalSymbol AndAlso _
typeCharacter <> typeCharacter.DoubleSymbol AndAlso typeCharacter <> typeCharacter.IntegerSymbol AndAlso _
typeCharacter <> typeCharacter.LongSymbol AndAlso typeCharacter <> typeCharacter.SingleSymbol AndAlso _
typeCharacter <> typeCharacter.StringSymbol Then
Throw New ArgumentOutOfRangeException("typeCharacter")
End If
If typeCharacter <> typeCharacter.None AndAlso escaped Then
Throw New ArgumentException("Escaped identifiers cannot have type characters.")
End If
_UnreservedType = unreservedType
_Identifier = identifier
_Escaped = escaped
_TypeCharacter = typeCharacter
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' An identifier.
''' </summary>
Public NotInheritable Class IdentifierToken
Inherits Token
Private Structure Keyword
Public ReadOnly Versions As LanguageVersion
Public ReadOnly ReservedVersions As LanguageVersion
Public ReadOnly TokenType As TokenType
Public Sub New(ByVal Versions As LanguageVersion, ByVal ReservedVersions As LanguageVersion, ByVal TokenType As TokenType)
Me.Versions = Versions
Me.ReservedVersions = ReservedVersions
Me.TokenType = TokenType
End Sub
End Structure
Private Shared KeywordTable As Dictionary(Of String, Keyword)
Private Shared Sub AddKeyword(ByVal table As Dictionary(Of String, Keyword), ByVal name As String, ByVal keyword As Keyword)
table.Add(name, keyword)
table.Add(Scanner.MakeFullWidth(name), keyword)
End Sub
' Returns the token type of the string.
Friend Shared Function TokenTypeFromString(ByVal s As String, ByVal Version As LanguageVersion, ByVal IncludeUnreserved As Boolean) As TokenType
If KeywordTable Is Nothing Then
Dim Table As New Dictionary(Of String, Keyword)(StringComparer.InvariantCultureIgnoreCase)
' NOTE: These have to be in the same order as the enum!
AddKeyword(Table, "AddHandler", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.AddHandler))
AddKeyword(Table, "AddressOf", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.AddressOf))
AddKeyword(Table, "Alias", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Alias))
AddKeyword(Table, "And", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.And))
AddKeyword(Table, "AndAlso", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.AndAlso))
AddKeyword(Table, "Ansi", New Keyword(LanguageVersion.All, LanguageVersion.VisualBasic71, TokenType.Ansi))
AddKeyword(Table, "As", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.As))
AddKeyword(Table, "Assembly", New Keyword(LanguageVersion.All, LanguageVersion.VisualBasic71, TokenType.Assembly))
AddKeyword(Table, "Auto", New Keyword(LanguageVersion.All, LanguageVersion.VisualBasic71, TokenType.Auto))
AddKeyword(Table, "Binary", New Keyword(LanguageVersion.All, LanguageVersion.None, TokenType.Binary))
AddKeyword(Table, "Boolean", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Boolean))
AddKeyword(Table, "ByRef", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.ByRef))
AddKeyword(Table, "Byte", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Byte))
AddKeyword(Table, "ByVal", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.ByVal))
AddKeyword(Table, "Call", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Call))
AddKeyword(Table, "Case", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Case))
AddKeyword(Table, "Catch", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Catch))
'AddKeyword(Table, "CBool", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.CBool))
'AddKeyword(Table, "CByte", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.CByte))
'AddKeyword(Table, "CChar", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.CChar))
'AddKeyword(Table, "CDate", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.CDate))
'AddKeyword(Table, "CDbl", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.CDbl))
'AddKeyword(Table, "CDec", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.CDec))
AddKeyword(Table, "Char", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Char))
'AddKeyword(Table, "CInt", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.CInt))
AddKeyword(Table, "Class", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Class))
'AddKeyword(Table, "CLng", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.CLng))
'AddKeyword(Table, "CObj", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.CObj))
AddKeyword(Table, "Compare", New Keyword(LanguageVersion.All, LanguageVersion.None, TokenType.Compare))
AddKeyword(Table, "Const", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Const))
AddKeyword(Table, "Continue", New Keyword(LanguageVersion.VisualBasic80, LanguageVersion.VisualBasic80, TokenType.Continue))
'AddKeyword(Table, "CSByte", New Keyword(LanguageVersion.VisualBasic80, LanguageVersion.VisualBasic80, TokenType.CSByte))
'AddKeyword(Table, "CShort", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.CShort))
'AddKeyword(Table, "CSng", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.CSng))
'AddKeyword(Table, "CStr", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.CStr))
'AddKeyword(Table, "CType", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.CType))
'AddKeyword(Table, "CUInt", New Keyword(LanguageVersion.VisualBasic80, LanguageVersion.VisualBasic80, TokenType.CUInt))
'AddKeyword(Table, "CULng", New Keyword(LanguageVersion.VisualBasic80, LanguageVersion.VisualBasic80, TokenType.CULng))
'AddKeyword(Table, "CUShort", New Keyword(LanguageVersion.VisualBasic80, LanguageVersion.VisualBasic80, TokenType.CUShort))
AddKeyword(Table, "Custom", New Keyword(LanguageVersion.VisualBasic80, LanguageVersion.None, TokenType.Custom))
AddKeyword(Table, "Date", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Date))
AddKeyword(Table, "Decimal", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Decimal))
AddKeyword(Table, "Declare", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Declare))
AddKeyword(Table, "Default", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Default))
AddKeyword(Table, "Delegate", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Delegate))
AddKeyword(Table, "Dim", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Dim))
AddKeyword(Table, "DirectCast", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.DirectCast))
AddKeyword(Table, "Do", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Do))
AddKeyword(Table, "Double", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Double))
AddKeyword(Table, "Each", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Each))
AddKeyword(Table, "Else", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Else))
AddKeyword(Table, "ElseIf", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.ElseIf))
AddKeyword(Table, "End", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.End))
AddKeyword(Table, "EndIf", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.EndIf))
AddKeyword(Table, "Enum", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Enum))
AddKeyword(Table, "Erase", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Erase))
AddKeyword(Table, "Error", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Error))
AddKeyword(Table, "Event", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Event))
AddKeyword(Table, "Exit", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Exit))
AddKeyword(Table, "Explicit", New Keyword(LanguageVersion.All, LanguageVersion.None, TokenType.Explicit))
AddKeyword(Table, "ExternalChecksum", New Keyword(LanguageVersion.VisualBasic80, LanguageVersion.None, TokenType.ExternalChecksum))
AddKeyword(Table, "ExternalSource", New Keyword(LanguageVersion.All, LanguageVersion.None, TokenType.ExternalSource))
AddKeyword(Table, "False", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.False))
AddKeyword(Table, "Finally", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Finally))
AddKeyword(Table, "For", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.For))
AddKeyword(Table, "Friend", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Friend))
AddKeyword(Table, "Function", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Function))
AddKeyword(Table, "Get", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Get))
AddKeyword(Table, "GetType", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.GetType))
AddKeyword(Table, "Global", New Keyword(LanguageVersion.VisualBasic80, LanguageVersion.VisualBasic80, TokenType.Global))
AddKeyword(Table, "GoSub", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.GoSub))
AddKeyword(Table, "GoTo", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.GoTo))
AddKeyword(Table, "Handles", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Handles))
AddKeyword(Table, "If", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.If))
AddKeyword(Table, "Implements", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Implements))
AddKeyword(Table, "Imports", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Imports))
AddKeyword(Table, "In", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.In))
AddKeyword(Table, "Inherits", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Inherits))
AddKeyword(Table, "Integer", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Integer))
AddKeyword(Table, "Interface", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Interface))
AddKeyword(Table, "Is", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Is))
AddKeyword(Table, "IsFalse", New Keyword(LanguageVersion.VisualBasic80, LanguageVersion.None, TokenType.IsFalse))
AddKeyword(Table, "IsNot", New Keyword(LanguageVersion.VisualBasic80, LanguageVersion.VisualBasic80, TokenType.IsNot))
AddKeyword(Table, "IsTrue", New Keyword(LanguageVersion.VisualBasic80, LanguageVersion.None, TokenType.IsTrue))
AddKeyword(Table, "Let", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Let))
AddKeyword(Table, "Lib", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Lib))
AddKeyword(Table, "Like", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Like))
AddKeyword(Table, "Long", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Long))
AddKeyword(Table, "Loop", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Loop))
AddKeyword(Table, "Me", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Me))
AddKeyword(Table, "Mid", New Keyword(LanguageVersion.All, LanguageVersion.None, TokenType.Mid))
AddKeyword(Table, "Mod", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Mod))
AddKeyword(Table, "Module", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Module))
AddKeyword(Table, "MustInherit", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.MustInherit))
AddKeyword(Table, "MustOverride", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.MustOverride))
AddKeyword(Table, "MyBase", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.MyBase))
AddKeyword(Table, "MyClass", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.MyClass))
AddKeyword(Table, "Namespace", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Namespace))
AddKeyword(Table, "Narrowing", New Keyword(LanguageVersion.VisualBasic80, LanguageVersion.VisualBasic80, TokenType.Narrowing))
AddKeyword(Table, "New", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.New))
AddKeyword(Table, "Next", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Next))
AddKeyword(Table, "Not", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Not))
AddKeyword(Table, "Nothing", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Nothing))
AddKeyword(Table, "NotInheritable", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.NotInheritable))
AddKeyword(Table, "NotOverridable", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.NotOverridable))
AddKeyword(Table, "Object", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Object))
AddKeyword(Table, "Of", New Keyword(LanguageVersion.VisualBasic80, LanguageVersion.VisualBasic80, TokenType.Of))
AddKeyword(Table, "Off", New Keyword(LanguageVersion.All, LanguageVersion.None, TokenType.Off))
AddKeyword(Table, "On", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.On))
AddKeyword(Table, "Operator", New Keyword(LanguageVersion.VisualBasic80, LanguageVersion.VisualBasic80, TokenType.Operator))
AddKeyword(Table, "Option", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Option))
AddKeyword(Table, "Optional", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Optional))
AddKeyword(Table, "Or", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Or))
AddKeyword(Table, "OrElse", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.OrElse))
AddKeyword(Table, "Overloads", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Overloads))
AddKeyword(Table, "Overridable", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Overridable))
AddKeyword(Table, "Overrides", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Overrides))
AddKeyword(Table, "ParamArray", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.ParamArray))
AddKeyword(Table, "Partial", New Keyword(LanguageVersion.VisualBasic80, LanguageVersion.VisualBasic80, TokenType.Partial))
AddKeyword(Table, "Preserve", New Keyword(LanguageVersion.All, LanguageVersion.VisualBasic71, TokenType.Preserve))
AddKeyword(Table, "Private", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Private))
AddKeyword(Table, "Property", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Property))
AddKeyword(Table, "Protected", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Protected))
AddKeyword(Table, "Public", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Public))
AddKeyword(Table, "RaiseEvent", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.RaiseEvent))
AddKeyword(Table, "ReadOnly", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.ReadOnly))
AddKeyword(Table, "ReDim", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.ReDim))
AddKeyword(Table, "Region", New Keyword(LanguageVersion.All, LanguageVersion.None, TokenType.Region))
AddKeyword(Table, "REM", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.[REM]))
AddKeyword(Table, "RemoveHandler", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.RemoveHandler))
AddKeyword(Table, "Resume", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Resume))
AddKeyword(Table, "Return", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Return))
AddKeyword(Table, "SByte", New Keyword(LanguageVersion.VisualBasic80, LanguageVersion.VisualBasic80, TokenType.SByte))
AddKeyword(Table, "Select", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Select))
AddKeyword(Table, "Set", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Set))
AddKeyword(Table, "Shadows", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Shadows))
AddKeyword(Table, "Shared", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Shared))
AddKeyword(Table, "Short", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Short))
AddKeyword(Table, "Single", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Single))
AddKeyword(Table, "Static", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Static))
AddKeyword(Table, "Step", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Step))
AddKeyword(Table, "Stop", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Stop))
AddKeyword(Table, "Strict", New Keyword(LanguageVersion.All, LanguageVersion.None, TokenType.Strict))
AddKeyword(Table, "String", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.String))
AddKeyword(Table, "Structure", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Structure))
AddKeyword(Table, "Sub", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Sub))
AddKeyword(Table, "SyncLock", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.SyncLock))
AddKeyword(Table, "Text", New Keyword(LanguageVersion.All, LanguageVersion.None, TokenType.Text))
AddKeyword(Table, "Then", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Then))
AddKeyword(Table, "Throw", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Throw))
AddKeyword(Table, "To", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.To))
AddKeyword(Table, "True", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.True))
AddKeyword(Table, "Try", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Try))
AddKeyword(Table, "TryCast", New Keyword(LanguageVersion.VisualBasic80, LanguageVersion.VisualBasic80, TokenType.TryCast))
AddKeyword(Table, "TypeOf", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.TypeOf))
AddKeyword(Table, "UInteger", New Keyword(LanguageVersion.VisualBasic80, LanguageVersion.VisualBasic80, TokenType.UInteger))
AddKeyword(Table, "ULong", New Keyword(LanguageVersion.VisualBasic80, LanguageVersion.VisualBasic80, TokenType.ULong))
AddKeyword(Table, "UShort", New Keyword(LanguageVersion.VisualBasic80, LanguageVersion.VisualBasic80, TokenType.UShort))
AddKeyword(Table, "Using", New Keyword(LanguageVersion.VisualBasic80, LanguageVersion.VisualBasic80, TokenType.Using))
AddKeyword(Table, "Unicode", New Keyword(LanguageVersion.All, LanguageVersion.VisualBasic71, TokenType.Unicode))
AddKeyword(Table, "Until", New Keyword(LanguageVersion.All, LanguageVersion.VisualBasic71, TokenType.Until))
AddKeyword(Table, "Variant", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Variant))
AddKeyword(Table, "Wend", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Wend))
AddKeyword(Table, "When", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.When))
AddKeyword(Table, "While", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.While))
AddKeyword(Table, "Widening", New Keyword(LanguageVersion.VisualBasic80, LanguageVersion.VisualBasic80, TokenType.Widening))
AddKeyword(Table, "With", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.With))
AddKeyword(Table, "WithEvents", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.WithEvents))
AddKeyword(Table, "WriteOnly", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.WriteOnly))
AddKeyword(Table, "Xor", New Keyword(LanguageVersion.All, LanguageVersion.All, TokenType.Xor))
KeywordTable = Table
End If
If KeywordTable.ContainsKey(s) Then
Dim Keyword As Keyword = KeywordTable(s)
If ((Keyword.Versions And Version) = Version) AndAlso _
(IncludeUnreserved OrElse ((Keyword.ReservedVersions And Version) = Version)) Then
Return Keyword.TokenType
End If
End If
Return TokenType.Identifier
End Function
''' <summary>
''' Determines if a token type is a keyword.
''' </summary>
''' <param name="type">The token type to check.</param>
''' <returns>True if the token type is a keyword, False otherwise.</returns>
Public Shared Function IsKeyword(ByVal type As TokenType) As Boolean
Return type >= TokenType.AddHandler AndAlso type <= TokenType.Xor
End Function
Public Overrides Function AsUnreservedKeyword() As TokenType
Return _UnreservedType
End Function
Private ReadOnly _Identifier As String
Private ReadOnly _UnreservedType As TokenType
Private ReadOnly _Escaped As Boolean ' Whether the identifier was escaped (i.e. [a])
Private ReadOnly _TypeCharacter As TypeCharacter ' The type character that followed, if any
''' <summary>
''' The identifier name.
''' </summary>
Public ReadOnly Property Identifier() As String
Get
Return _Identifier
End Get
End Property
''' <summary>
''' Whether the identifier is escaped.
''' </summary>
Public ReadOnly Property Escaped() As Boolean
Get
Return _Escaped
End Get
End Property
''' <summary>
''' The type character of the identifier.
''' </summary>
Public ReadOnly Property TypeCharacter() As TypeCharacter
Get
Return _TypeCharacter
End Get
End Property
''' <summary>
''' Constructs a new identifier token.
''' </summary>
''' <param name="type">The token type of the identifier.</param>
''' <param name="unreservedType">The unreserved token type of the identifier.</param>
''' <param name="identifier">The text of the identifier</param>
''' <param name="escaped">Whether the identifier is escaped.</param>
''' <param name="typeCharacter">The type character of the identifier.</param>
''' <param name="span">The location of the identifier.</param>
Public Sub New(ByVal type As TokenType, ByVal unreservedType As TokenType, ByVal identifier As String, ByVal escaped As Boolean, ByVal typeCharacter As TypeCharacter, ByVal span As Span)
MyBase.New(type, span)
If type <> TokenType.Identifier AndAlso Not IsKeyword(type) Then
Throw New ArgumentOutOfRangeException("type")
End If
If unreservedType <> TokenType.Identifier AndAlso Not IsKeyword(unreservedType) Then
Throw New ArgumentOutOfRangeException("unreservedType")
End If
If identifier Is Nothing OrElse identifier = "" Then
Throw New ArgumentException("Identifier cannot be empty.", "identifier")
End If
If typeCharacter <> typeCharacter.None AndAlso typeCharacter <> typeCharacter.DecimalSymbol AndAlso _
typeCharacter <> typeCharacter.DoubleSymbol AndAlso typeCharacter <> typeCharacter.IntegerSymbol AndAlso _
typeCharacter <> typeCharacter.LongSymbol AndAlso typeCharacter <> typeCharacter.SingleSymbol AndAlso _
typeCharacter <> typeCharacter.StringSymbol Then
Throw New ArgumentOutOfRangeException("typeCharacter")
End If
If typeCharacter <> typeCharacter.None AndAlso escaped Then
Throw New ArgumentException("Escaped identifiers cannot have type characters.")
End If
_UnreservedType = unreservedType
_Identifier = identifier
_Escaped = escaped
_TypeCharacter = typeCharacter
End Sub
End Class

View file

@ -1,74 +1,74 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' An integer literal.
''' </summary>
Public NotInheritable Class IntegerLiteralToken
Inherits Token
Private ReadOnly _Literal As Integer
Private ReadOnly _TypeCharacter As TypeCharacter ' The type character after the literal, if any
Private ReadOnly _IntegerBase As IntegerBase ' The base of the literal
''' <summary>
''' The value of the literal.
''' </summary>
Public ReadOnly Property Literal() As Integer
Get
Return _Literal
End Get
End Property
''' <summary>
''' The type character of the literal.
''' </summary>
Public ReadOnly Property TypeCharacter() As TypeCharacter
Get
Return _TypeCharacter
End Get
End Property
''' <summary>
''' The integer base of the literal.
''' </summary>
Public ReadOnly Property IntegerBase() As IntegerBase
Get
Return _IntegerBase
End Get
End Property
''' <summary>
''' Constructs a new integer literal.
''' </summary>
''' <param name="literal">The literal value.</param>
''' <param name="integerBase">The integer base of the literal.</param>
''' <param name="typeCharacter">The type character of the literal.</param>
''' <param name="span">The location of the literal.</param>
Public Sub New(ByVal literal As Integer, ByVal integerBase As IntegerBase, ByVal typeCharacter As TypeCharacter, ByVal span As Span)
MyBase.New(TokenType.IntegerLiteral, span)
If integerBase < integerBase.Decimal OrElse integerBase > integerBase.Hexadecimal Then
Throw New ArgumentOutOfRangeException("integerBase")
End If
If typeCharacter <> typeCharacter.None AndAlso _
typeCharacter <> typeCharacter.IntegerSymbol AndAlso typeCharacter <> typeCharacter.IntegerChar AndAlso _
typeCharacter <> typeCharacter.ShortChar AndAlso _
typeCharacter <> typeCharacter.LongSymbol AndAlso typeCharacter <> typeCharacter.LongChar Then
Throw New ArgumentOutOfRangeException("typeCharacter")
End If
_Literal = literal
_IntegerBase = integerBase
_TypeCharacter = typeCharacter
End Sub
End Class
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' An integer literal.
''' </summary>
Public NotInheritable Class IntegerLiteralToken
Inherits Token
Private ReadOnly _Literal As Integer
Private ReadOnly _TypeCharacter As TypeCharacter ' The type character after the literal, if any
Private ReadOnly _IntegerBase As IntegerBase ' The base of the literal
''' <summary>
''' The value of the literal.
''' </summary>
Public ReadOnly Property Literal() As Integer
Get
Return _Literal
End Get
End Property
''' <summary>
''' The type character of the literal.
''' </summary>
Public ReadOnly Property TypeCharacter() As TypeCharacter
Get
Return _TypeCharacter
End Get
End Property
''' <summary>
''' The integer base of the literal.
''' </summary>
Public ReadOnly Property IntegerBase() As IntegerBase
Get
Return _IntegerBase
End Get
End Property
''' <summary>
''' Constructs a new integer literal.
''' </summary>
''' <param name="literal">The literal value.</param>
''' <param name="integerBase">The integer base of the literal.</param>
''' <param name="typeCharacter">The type character of the literal.</param>
''' <param name="span">The location of the literal.</param>
Public Sub New(ByVal literal As Integer, ByVal integerBase As IntegerBase, ByVal typeCharacter As TypeCharacter, ByVal span As Span)
MyBase.New(TokenType.IntegerLiteral, span)
If integerBase < integerBase.Decimal OrElse integerBase > integerBase.Hexadecimal Then
Throw New ArgumentOutOfRangeException("integerBase")
End If
If typeCharacter <> typeCharacter.None AndAlso _
typeCharacter <> typeCharacter.IntegerSymbol AndAlso typeCharacter <> typeCharacter.IntegerChar AndAlso _
typeCharacter <> typeCharacter.ShortChar AndAlso _
typeCharacter <> typeCharacter.LongSymbol AndAlso typeCharacter <> typeCharacter.LongChar Then
Throw New ArgumentOutOfRangeException("typeCharacter")
End If
_Literal = literal
_IntegerBase = integerBase
_TypeCharacter = typeCharacter
End Sub
End Class

View file

@ -1,24 +1,24 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A line terminator.
''' </summary>
Public NotInheritable Class LineTerminatorToken
Inherits Token
''' <summary>
''' Create a new line terminator token.
''' </summary>
''' <param name="span">The location of the line terminator.</param>
Public Sub New(ByVal span As Span)
MyBase.New(TokenType.LineTerminator, span)
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A line terminator.
''' </summary>
Public NotInheritable Class LineTerminatorToken
Inherits Token
''' <summary>
''' Create a new line terminator token.
''' </summary>
''' <param name="span">The location of the line terminator.</param>
Public Sub New(ByVal span As Span)
MyBase.New(TokenType.LineTerminator, span)
End Sub
End Class

View file

@ -1,89 +1,89 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A punctuation token.
''' </summary>
Public NotInheritable Class PunctuatorToken
Inherits Token
Private Shared PunctuatorTable As Dictionary(Of String, TokenType)
Private Shared Sub AddPunctuator(ByVal table As Dictionary(Of String, TokenType), ByVal punctuator As String, ByVal type As TokenType)
table.Add(punctuator, type)
table.Add(Scanner.MakeFullWidth(punctuator), type)
End Sub
' Returns the token type of the string.
Friend Shared Function TokenTypeFromString(ByVal s As String) As TokenType
If PunctuatorTable Is Nothing Then
Dim Table As New Dictionary(Of String, TokenType)(StringComparer.InvariantCulture)
' NOTE: These have to be in the same order as the enum!
AddPunctuator(Table, "(", TokenType.LeftParenthesis)
AddPunctuator(Table, ")", TokenType.RightParenthesis)
AddPunctuator(Table, "{", TokenType.LeftCurlyBrace)
AddPunctuator(Table, "}", TokenType.RightCurlyBrace)
AddPunctuator(Table, "!", TokenType.Exclamation)
AddPunctuator(Table, "#", TokenType.Pound)
AddPunctuator(Table, ",", TokenType.Comma)
AddPunctuator(Table, ".", TokenType.Period)
AddPunctuator(Table, ":", TokenType.Colon)
AddPunctuator(Table, ":=", TokenType.ColonEquals)
AddPunctuator(Table, "&", TokenType.Ampersand)
AddPunctuator(Table, "&=", TokenType.AmpersandEquals)
AddPunctuator(Table, "*", TokenType.Star)
AddPunctuator(Table, "*=", TokenType.StarEquals)
AddPunctuator(Table, "+", TokenType.Plus)
AddPunctuator(Table, "+=", TokenType.PlusEquals)
AddPunctuator(Table, "-", TokenType.Minus)
AddPunctuator(Table, "-=", TokenType.MinusEquals)
AddPunctuator(Table, "/", TokenType.ForwardSlash)
AddPunctuator(Table, "/=", TokenType.ForwardSlashEquals)
AddPunctuator(Table, "\", TokenType.BackwardSlash)
AddPunctuator(Table, "\=", TokenType.BackwardSlashEquals)
AddPunctuator(Table, "^", TokenType.Caret)
AddPunctuator(Table, "^=", TokenType.CaretEquals)
AddPunctuator(Table, "<", TokenType.LessThan)
AddPunctuator(Table, "<=", TokenType.LessThanEquals)
AddPunctuator(Table, "=<", TokenType.LessThanEquals) 'lc VBScript allows the other way
AddPunctuator(Table, "=", TokenType.Equals)
AddPunctuator(Table, "<>", TokenType.NotEquals)
AddPunctuator(Table, ">", TokenType.GreaterThan)
AddPunctuator(Table, ">=", TokenType.GreaterThanEquals)
AddPunctuator(Table, "=>", TokenType.GreaterThanEquals) 'lc
AddPunctuator(Table, "<<", TokenType.LessThanLessThan)
AddPunctuator(Table, "<<=", TokenType.LessThanLessThanEquals)
AddPunctuator(Table, ">>", TokenType.GreaterThanGreaterThan)
AddPunctuator(Table, ">>=", TokenType.GreaterThanGreaterThanEquals)
PunctuatorTable = Table
End If
If Not PunctuatorTable.ContainsKey(s) Then
Return TokenType.None
Else
Return PunctuatorTable(s)
End If
End Function
''' <summary>
''' Constructs a new punctuator token.
''' </summary>
''' <param name="type">The punctuator token type.</param>
''' <param name="span">The location of the punctuator.</param>
Public Sub New(ByVal type As TokenType, ByVal span As Span)
MyBase.New(type, span)
If (type < TokenType.LeftParenthesis OrElse type > TokenType.GreaterThanGreaterThanEquals) Then
Throw New ArgumentOutOfRangeException("type")
End If
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A punctuation token.
''' </summary>
Public NotInheritable Class PunctuatorToken
Inherits Token
Private Shared PunctuatorTable As Dictionary(Of String, TokenType)
Private Shared Sub AddPunctuator(ByVal table As Dictionary(Of String, TokenType), ByVal punctuator As String, ByVal type As TokenType)
table.Add(punctuator, type)
table.Add(Scanner.MakeFullWidth(punctuator), type)
End Sub
' Returns the token type of the string.
Friend Shared Function TokenTypeFromString(ByVal s As String) As TokenType
If PunctuatorTable Is Nothing Then
Dim Table As New Dictionary(Of String, TokenType)(StringComparer.InvariantCulture)
' NOTE: These have to be in the same order as the enum!
AddPunctuator(Table, "(", TokenType.LeftParenthesis)
AddPunctuator(Table, ")", TokenType.RightParenthesis)
AddPunctuator(Table, "{", TokenType.LeftCurlyBrace)
AddPunctuator(Table, "}", TokenType.RightCurlyBrace)
AddPunctuator(Table, "!", TokenType.Exclamation)
AddPunctuator(Table, "#", TokenType.Pound)
AddPunctuator(Table, ",", TokenType.Comma)
AddPunctuator(Table, ".", TokenType.Period)
AddPunctuator(Table, ":", TokenType.Colon)
AddPunctuator(Table, ":=", TokenType.ColonEquals)
AddPunctuator(Table, "&", TokenType.Ampersand)
AddPunctuator(Table, "&=", TokenType.AmpersandEquals)
AddPunctuator(Table, "*", TokenType.Star)
AddPunctuator(Table, "*=", TokenType.StarEquals)
AddPunctuator(Table, "+", TokenType.Plus)
AddPunctuator(Table, "+=", TokenType.PlusEquals)
AddPunctuator(Table, "-", TokenType.Minus)
AddPunctuator(Table, "-=", TokenType.MinusEquals)
AddPunctuator(Table, "/", TokenType.ForwardSlash)
AddPunctuator(Table, "/=", TokenType.ForwardSlashEquals)
AddPunctuator(Table, "\", TokenType.BackwardSlash)
AddPunctuator(Table, "\=", TokenType.BackwardSlashEquals)
AddPunctuator(Table, "^", TokenType.Caret)
AddPunctuator(Table, "^=", TokenType.CaretEquals)
AddPunctuator(Table, "<", TokenType.LessThan)
AddPunctuator(Table, "<=", TokenType.LessThanEquals)
AddPunctuator(Table, "=<", TokenType.LessThanEquals) 'lc VBScript allows the other way
AddPunctuator(Table, "=", TokenType.Equals)
AddPunctuator(Table, "<>", TokenType.NotEquals)
AddPunctuator(Table, ">", TokenType.GreaterThan)
AddPunctuator(Table, ">=", TokenType.GreaterThanEquals)
AddPunctuator(Table, "=>", TokenType.GreaterThanEquals) 'lc
AddPunctuator(Table, "<<", TokenType.LessThanLessThan)
AddPunctuator(Table, "<<=", TokenType.LessThanLessThanEquals)
AddPunctuator(Table, ">>", TokenType.GreaterThanGreaterThan)
AddPunctuator(Table, ">>=", TokenType.GreaterThanGreaterThanEquals)
PunctuatorTable = Table
End If
If Not PunctuatorTable.ContainsKey(s) Then
Return TokenType.None
Else
Return PunctuatorTable(s)
End If
End Function
''' <summary>
''' Constructs a new punctuator token.
''' </summary>
''' <param name="type">The punctuator token type.</param>
''' <param name="span">The location of the punctuator.</param>
Public Sub New(ByVal type As TokenType, ByVal span As Span)
MyBase.New(type, span)
If (type < TokenType.LeftParenthesis OrElse type > TokenType.GreaterThanGreaterThanEquals) Then
Throw New ArgumentOutOfRangeException("type")
End If
End Sub
End Class

View file

@ -1,42 +1,42 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A string literal.
''' </summary>
Public NotInheritable Class StringLiteralToken
Inherits Token
Private ReadOnly _Literal As String
''' <summary>
''' The value of the literal.
''' </summary>
Public ReadOnly Property Literal() As String
Get
Return _Literal
End Get
End Property
''' <summary>
''' Constructs a new string literal token.
''' </summary>
''' <param name="literal">The value of the literal.</param>
''' <param name="span">The location of the literal.</param>
Public Sub New(ByVal literal As String, ByVal span As Span)
MyBase.New(TokenType.StringLiteral, span)
If literal Is Nothing Then
Throw New ArgumentNullException("literal")
End If
_Literal = literal
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A string literal.
''' </summary>
Public NotInheritable Class StringLiteralToken
Inherits Token
Private ReadOnly _Literal As String
''' <summary>
''' The value of the literal.
''' </summary>
Public ReadOnly Property Literal() As String
Get
Return _Literal
End Get
End Property
''' <summary>
''' Constructs a new string literal token.
''' </summary>
''' <param name="literal">The value of the literal.</param>
''' <param name="span">The location of the literal.</param>
Public Sub New(ByVal literal As String, ByVal span As Span)
MyBase.New(TokenType.StringLiteral, span)
If literal Is Nothing Then
Throw New ArgumentNullException("literal")
End If
_Literal = literal
End Sub
End Class

View file

@ -1,49 +1,49 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' The base class for all tokens. Contains line and column information as well as token type.
''' </summary>
Public MustInherit Class Token
Private ReadOnly _Type As TokenType
Private ReadOnly _Span As Span ' A span ends at the first character beyond the token
''' <summary>
''' The type of the token.
''' </summary>
Public ReadOnly Property Type() As TokenType
Get
Return _Type
End Get
End Property
''' <summary>
''' The span of the token in the source text.
''' </summary>
Public ReadOnly Property Span() As Span
Get
Return _Span
End Get
End Property
Protected Sub New(ByVal type As TokenType, ByVal span As Span)
Debug.Assert([Enum].IsDefined(GetType(TokenType), type))
_Type = type
_Span = span
End Sub
''' <summary>
''' Returns the unreserved keyword type of an identifier.
''' </summary>
''' <returns>The unreserved keyword type of an identifier, the token's type otherwise.</returns>
Public Overridable Function AsUnreservedKeyword() As TokenType
Return Type
End Function
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' The base class for all tokens. Contains line and column information as well as token type.
''' </summary>
Public MustInherit Class Token
Private ReadOnly _Type As TokenType
Private ReadOnly _Span As Span ' A span ends at the first character beyond the token
''' <summary>
''' The type of the token.
''' </summary>
Public ReadOnly Property Type() As TokenType
Get
Return _Type
End Get
End Property
''' <summary>
''' The span of the token in the source text.
''' </summary>
Public ReadOnly Property Span() As Span
Get
Return _Span
End Get
End Property
Protected Sub New(ByVal type As TokenType, ByVal span As Span)
Debug.Assert([Enum].IsDefined(GetType(TokenType), type))
_Type = type
_Span = span
End Sub
''' <summary>
''' Returns the unreserved keyword type of an identifier.
''' </summary>
''' <returns>The unreserved keyword type of an identifier, the token's type otherwise.</returns>
Public Overridable Function AsUnreservedKeyword() As TokenType
Return Type
End Function
End Class

View file

@ -1,236 +1,236 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' The type of a token.
''' </summary>
Public Enum TokenType
None
LexicalError
EndOfStream
LineTerminator
Comment
Identifier
StringLiteral
CharacterLiteral
DateLiteral
IntegerLiteral
UnsignedIntegerLiteral
FloatingPointLiteral
DecimalLiteral
[AddHandler]
[AddressOf]
[Alias]
[And]
[AndAlso]
[Ansi]
[As]
[Assembly]
[Auto]
Binary
[Boolean]
[ByRef]
[Byte]
[ByVal]
[Call]
[Case]
[Catch]
[CBool]
[CByte]
[CChar]
[CDate]
[CDec]
[CDbl]
[Char]
[CInt]
[Class]
[CLng]
[CObj]
Compare
[Const]
[Continue]
[CSByte]
[CShort]
[CSng]
[CStr]
[CType]
[CUInt]
[CULng]
[CUShort]
[Custom]
[Date]
[Decimal]
[Declare]
[Default]
[Delegate]
[Dim]
[DirectCast]
[Do]
[Double]
[Each]
[Else]
[ElseIf]
[End]
[EndIf]
[Enum]
[Erase]
[Error]
[Event]
[Exit]
Explicit
ExternalChecksum
ExternalSource
[False]
[Finally]
[For]
[Friend]
[Function]
[Get]
[GetType]
[Global]
[GoSub]
[GoTo]
[Handles]
[If]
[Implements]
[Imports]
[In]
[Inherits]
[Integer]
[Interface]
[Is]
IsTrue
[IsNot]
IsFalse
[Let]
[Lib]
[Like]
[Long]
[Loop]
[Me]
Mid
[Mod]
[Module]
[MustInherit]
[MustOverride]
[MyBase]
[MyClass]
[Namespace]
[Narrowing]
[New]
[Next]
[Not]
[Nothing]
[NotInheritable]
[NotOverridable]
[Object]
[Of]
Off
[On]
[Operator]
[Option]
[Optional]
[Or]
[OrElse]
[Overloads]
[Overridable]
[Overrides]
[ParamArray]
[Partial]
[Preserve]
[Private]
[Property]
[Protected]
[Public]
[RaiseEvent]
[ReadOnly]
[ReDim]
Region
[REM]
[RemoveHandler]
[Resume]
[Return]
[SByte]
[Select]
[Set]
[Shadows]
[Shared]
[Short]
[Single]
[Static]
[Step]
[Stop]
Strict
[String]
[Structure]
[Sub]
[SyncLock]
Text
[Then]
[Throw]
[To]
[True]
[Try]
[TryCast]
[TypeOf]
[UInteger]
[ULong]
[UShort]
[Using]
[Unicode]
[Until]
[Variant]
[Wend]
[When]
[While]
[Widening]
[With]
[WithEvents]
[WriteOnly]
[Xor]
LeftParenthesis ' (
RightParenthesis ' )
LeftCurlyBrace ' {
RightCurlyBrace ' }
Exclamation ' !
Pound ' #
Comma ' ,
Period ' .
Colon ' :
ColonEquals ' :=
Ampersand ' &
AmpersandEquals ' &=
Star ' *
StarEquals ' *=
Plus ' +
PlusEquals ' +=
Minus ' -
MinusEquals ' -=
ForwardSlash ' /
ForwardSlashEquals ' /=
BackwardSlash ' \
BackwardSlashEquals ' \=
Caret ' ^
CaretEquals ' ^=
LessThan ' <
LessThanEquals ' <=
Equals ' =
NotEquals ' <>
GreaterThan ' >
GreaterThanEquals ' >=
LessThanLessThan ' <<
LessThanLessThanEquals ' <<=
GreaterThanGreaterThan ' >>
GreaterThanGreaterThanEquals ' >>=
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' The type of a token.
''' </summary>
Public Enum TokenType
None
LexicalError
EndOfStream
LineTerminator
Comment
Identifier
StringLiteral
CharacterLiteral
DateLiteral
IntegerLiteral
UnsignedIntegerLiteral
FloatingPointLiteral
DecimalLiteral
[AddHandler]
[AddressOf]
[Alias]
[And]
[AndAlso]
[Ansi]
[As]
[Assembly]
[Auto]
Binary
[Boolean]
[ByRef]
[Byte]
[ByVal]
[Call]
[Case]
[Catch]
[CBool]
[CByte]
[CChar]
[CDate]
[CDec]
[CDbl]
[Char]
[CInt]
[Class]
[CLng]
[CObj]
Compare
[Const]
[Continue]
[CSByte]
[CShort]
[CSng]
[CStr]
[CType]
[CUInt]
[CULng]
[CUShort]
[Custom]
[Date]
[Decimal]
[Declare]
[Default]
[Delegate]
[Dim]
[DirectCast]
[Do]
[Double]
[Each]
[Else]
[ElseIf]
[End]
[EndIf]
[Enum]
[Erase]
[Error]
[Event]
[Exit]
Explicit
ExternalChecksum
ExternalSource
[False]
[Finally]
[For]
[Friend]
[Function]
[Get]
[GetType]
[Global]
[GoSub]
[GoTo]
[Handles]
[If]
[Implements]
[Imports]
[In]
[Inherits]
[Integer]
[Interface]
[Is]
IsTrue
[IsNot]
IsFalse
[Let]
[Lib]
[Like]
[Long]
[Loop]
[Me]
Mid
[Mod]
[Module]
[MustInherit]
[MustOverride]
[MyBase]
[MyClass]
[Namespace]
[Narrowing]
[New]
[Next]
[Not]
[Nothing]
[NotInheritable]
[NotOverridable]
[Object]
[Of]
Off
[On]
[Operator]
[Option]
[Optional]
[Or]
[OrElse]
[Overloads]
[Overridable]
[Overrides]
[ParamArray]
[Partial]
[Preserve]
[Private]
[Property]
[Protected]
[Public]
[RaiseEvent]
[ReadOnly]
[ReDim]
Region
[REM]
[RemoveHandler]
[Resume]
[Return]
[SByte]
[Select]
[Set]
[Shadows]
[Shared]
[Short]
[Single]
[Static]
[Step]
[Stop]
Strict
[String]
[Structure]
[Sub]
[SyncLock]
Text
[Then]
[Throw]
[To]
[True]
[Try]
[TryCast]
[TypeOf]
[UInteger]
[ULong]
[UShort]
[Using]
[Unicode]
[Until]
[Variant]
[Wend]
[When]
[While]
[Widening]
[With]
[WithEvents]
[WriteOnly]
[Xor]
LeftParenthesis ' (
RightParenthesis ' )
LeftCurlyBrace ' {
RightCurlyBrace ' }
Exclamation ' !
Pound ' #
Comma ' ,
Period ' .
Colon ' :
ColonEquals ' :=
Ampersand ' &
AmpersandEquals ' &=
Star ' *
StarEquals ' *=
Plus ' +
PlusEquals ' +=
Minus ' -
MinusEquals ' -=
ForwardSlash ' /
ForwardSlashEquals ' /=
BackwardSlash ' \
BackwardSlashEquals ' \=
Caret ' ^
CaretEquals ' ^=
LessThan ' <
LessThanEquals ' <=
Equals ' =
NotEquals ' <>
GreaterThan ' >
GreaterThanEquals ' >=
LessThanLessThan ' <<
LessThanLessThanEquals ' <<=
GreaterThanGreaterThan ' >>
GreaterThanGreaterThanEquals ' >>=
End Enum

View file

@ -1,76 +1,76 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' An integer literal.
''' </summary>
Public NotInheritable Class UnsignedIntegerLiteralToken
Inherits Token
Private ReadOnly _Literal As ULong
Private ReadOnly _TypeCharacter As TypeCharacter ' The type character after the literal, if any
Private ReadOnly _IntegerBase As IntegerBase ' The base of the literal
''' <summary>
''' The value of the literal.
''' </summary>
<CLSCompliant(False)> _
Public ReadOnly Property Literal() As ULong
Get
Return _Literal
End Get
End Property
''' <summary>
''' The type character of the literal.
''' </summary>
Public ReadOnly Property TypeCharacter() As TypeCharacter
Get
Return _TypeCharacter
End Get
End Property
''' <summary>
''' The integer base of the literal.
''' </summary>
Public ReadOnly Property IntegerBase() As IntegerBase
Get
Return _IntegerBase
End Get
End Property
''' <summary>
''' Constructs a new unsigned integer literal.
''' </summary>
''' <param name="literal">The literal value.</param>
''' <param name="integerBase">The integer base of the literal.</param>
''' <param name="typeCharacter">The type character of the literal.</param>
''' <param name="span">The location of the literal.</param>
<CLSCompliant(False)> _
Public Sub New(ByVal literal As ULong, ByVal integerBase As IntegerBase, ByVal typeCharacter As TypeCharacter, ByVal span As Span)
MyBase.New(TokenType.UnsignedIntegerLiteral, span)
If integerBase < integerBase.Decimal OrElse integerBase > integerBase.Hexadecimal Then
Throw New ArgumentOutOfRangeException("integerBase")
End If
If typeCharacter <> typeCharacter.None AndAlso _
typeCharacter <> typeCharacter.UnsignedIntegerChar AndAlso _
typeCharacter <> typeCharacter.UnsignedLongChar AndAlso _
typeCharacter <> typeCharacter.UnsignedShortChar Then
Throw New ArgumentOutOfRangeException("typeCharacter")
End If
_Literal = literal
_IntegerBase = integerBase
_TypeCharacter = typeCharacter
End Sub
End Class
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' An integer literal.
''' </summary>
Public NotInheritable Class UnsignedIntegerLiteralToken
Inherits Token
Private ReadOnly _Literal As ULong
Private ReadOnly _TypeCharacter As TypeCharacter ' The type character after the literal, if any
Private ReadOnly _IntegerBase As IntegerBase ' The base of the literal
''' <summary>
''' The value of the literal.
''' </summary>
<CLSCompliant(False)> _
Public ReadOnly Property Literal() As ULong
Get
Return _Literal
End Get
End Property
''' <summary>
''' The type character of the literal.
''' </summary>
Public ReadOnly Property TypeCharacter() As TypeCharacter
Get
Return _TypeCharacter
End Get
End Property
''' <summary>
''' The integer base of the literal.
''' </summary>
Public ReadOnly Property IntegerBase() As IntegerBase
Get
Return _IntegerBase
End Get
End Property
''' <summary>
''' Constructs a new unsigned integer literal.
''' </summary>
''' <param name="literal">The literal value.</param>
''' <param name="integerBase">The integer base of the literal.</param>
''' <param name="typeCharacter">The type character of the literal.</param>
''' <param name="span">The location of the literal.</param>
<CLSCompliant(False)> _
Public Sub New(ByVal literal As ULong, ByVal integerBase As IntegerBase, ByVal typeCharacter As TypeCharacter, ByVal span As Span)
MyBase.New(TokenType.UnsignedIntegerLiteral, span)
If integerBase < integerBase.Decimal OrElse integerBase > integerBase.Hexadecimal Then
Throw New ArgumentOutOfRangeException("integerBase")
End If
If typeCharacter <> typeCharacter.None AndAlso _
typeCharacter <> typeCharacter.UnsignedIntegerChar AndAlso _
typeCharacter <> typeCharacter.UnsignedLongChar AndAlso _
typeCharacter <> typeCharacter.UnsignedShortChar Then
Throw New ArgumentOutOfRangeException("typeCharacter")
End If
_Literal = literal
_IntegerBase = integerBase
_TypeCharacter = typeCharacter
End Sub
End Class

View file

@ -1,78 +1,78 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for an argument to a call or index.
''' </summary>
Public NotInheritable Class Argument
Inherits Tree
Private ReadOnly _Name As SimpleName
Private ReadOnly _ColonEqualsLocation As Location
Private ReadOnly _Expression As Expression
''' <summary>
''' The name of the argument, if any.
''' </summary>
Public ReadOnly Property Name() As SimpleName
Get
Return _Name
End Get
End Property
''' <summary>
''' The location of the ':=', if any.
''' </summary>
Public ReadOnly Property ColonEqualsLocation() As Location
Get
Return _ColonEqualsLocation
End Get
End Property
''' <summary>
''' The argument, if any.
''' </summary>
Public ReadOnly Property Expression() As Expression
Get
Return _Expression
End Get
End Property
''' <summary>
''' Constructs a new parse tree for an argument.
''' </summary>
''' <param name="name">The name of the argument, if any.</param>
''' <param name="colonEqualsLocation">The location of the ':=', if any.</param>
''' <param name="expression">The expression, if any.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal name As SimpleName, ByVal colonEqualsLocation As Location, ByVal expression As Expression, ByVal span As Span)
MyBase.New(TreeType.Argument, span)
If expression Is Nothing Then
Throw New ArgumentNullException("expression")
End If
SetParent(name)
SetParent(expression)
_Name = name
_ColonEqualsLocation = colonEqualsLocation
_Expression = expression
End Sub
Private Sub New()
MyBase.New(TreeType.Argument, Nothing)
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
AddChild(childList, Name)
AddChild(childList, Expression)
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for an argument to a call or index.
''' </summary>
Public NotInheritable Class Argument
Inherits Tree
Private ReadOnly _Name As SimpleName
Private ReadOnly _ColonEqualsLocation As Location
Private ReadOnly _Expression As Expression
''' <summary>
''' The name of the argument, if any.
''' </summary>
Public ReadOnly Property Name() As SimpleName
Get
Return _Name
End Get
End Property
''' <summary>
''' The location of the ':=', if any.
''' </summary>
Public ReadOnly Property ColonEqualsLocation() As Location
Get
Return _ColonEqualsLocation
End Get
End Property
''' <summary>
''' The argument, if any.
''' </summary>
Public ReadOnly Property Expression() As Expression
Get
Return _Expression
End Get
End Property
''' <summary>
''' Constructs a new parse tree for an argument.
''' </summary>
''' <param name="name">The name of the argument, if any.</param>
''' <param name="colonEqualsLocation">The location of the ':=', if any.</param>
''' <param name="expression">The expression, if any.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal name As SimpleName, ByVal colonEqualsLocation As Location, ByVal expression As Expression, ByVal span As Span)
MyBase.New(TreeType.Argument, span)
If expression Is Nothing Then
Throw New ArgumentNullException("expression")
End If
SetParent(name)
SetParent(expression)
_Name = name
_ColonEqualsLocation = colonEqualsLocation
_Expression = expression
End Sub
Private Sub New()
MyBase.New(TreeType.Argument, Nothing)
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
AddChild(childList, Name)
AddChild(childList, Expression)
End Sub
End Class

View file

@ -1,40 +1,40 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A read-only collection of arguments.
''' </summary>
Public NotInheritable Class ArgumentCollection
Inherits CommaDelimitedTreeCollection(Of Argument)
Private ReadOnly _RightParenthesisLocation As Location
''' <summary>
''' The location of the ')'.
''' </summary>
Public ReadOnly Property RightParenthesisLocation() As Location
Get
Return _RightParenthesisLocation
End Get
End Property
''' <summary>
''' Constructs a new argument collection.
''' </summary>
''' <param name="arguments">The arguments in the collection.</param>
''' <param name="commaLocations">The location of the commas in the collection.</param>
''' <param name="rightParenthesisLocation">The location of the ')'.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal arguments As IList(Of Argument), ByVal commaLocations As IList(Of Location), ByVal rightParenthesisLocation As Location, ByVal span As Span)
MyBase.New(TreeType.ArgumentCollection, arguments, commaLocations, span)
_RightParenthesisLocation = rightParenthesisLocation
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A read-only collection of arguments.
''' </summary>
Public NotInheritable Class ArgumentCollection
Inherits CommaDelimitedTreeCollection(Of Argument)
Private ReadOnly _RightParenthesisLocation As Location
''' <summary>
''' The location of the ')'.
''' </summary>
Public ReadOnly Property RightParenthesisLocation() As Location
Get
Return _RightParenthesisLocation
End Get
End Property
''' <summary>
''' Constructs a new argument collection.
''' </summary>
''' <param name="arguments">The arguments in the collection.</param>
''' <param name="commaLocations">The location of the commas in the collection.</param>
''' <param name="rightParenthesisLocation">The location of the ')'.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal arguments As IList(Of Argument), ByVal commaLocations As IList(Of Location), ByVal rightParenthesisLocation As Location, ByVal span As Span)
MyBase.New(TreeType.ArgumentCollection, arguments, commaLocations, span)
_RightParenthesisLocation = rightParenthesisLocation
End Sub
End Class

View file

@ -1,98 +1,98 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for an attribute usage.
''' </summary>
Public NotInheritable Class Attribute
Inherits Tree
Private ReadOnly _AttributeType As AttributeTypes
Private ReadOnly _AttributeTypeLocation As Location
Private ReadOnly _ColonLocation As Location
Private ReadOnly _Name As Name
Private ReadOnly _Arguments As ArgumentCollection
''' <summary>
''' The target type of the attribute.
''' </summary>
Public ReadOnly Property AttributeType() As AttributeTypes
Get
Return _AttributeType
End Get
End Property
''' <summary>
''' The location of the attribute type, if any.
''' </summary>
Public ReadOnly Property AttributeTypeLocation() As Location
Get
Return _AttributeTypeLocation
End Get
End Property
''' <summary>
''' The location of the ':', if any.
''' </summary>
Public ReadOnly Property ColonLocation() As Location
Get
Return _ColonLocation
End Get
End Property
''' <summary>
''' The name of the attribute being applied.
''' </summary>
Public ReadOnly Property Name() As Name
Get
Return _Name
End Get
End Property
''' <summary>
''' The arguments to the attribute.
''' </summary>
Public ReadOnly Property Arguments() As ArgumentCollection
Get
Return _Arguments
End Get
End Property
''' <summary>
''' Constructs a new attribute parse tree.
''' </summary>
''' <param name="attributeType">The target type of the attribute.</param>
''' <param name="attributeTypeLocation">The location of the attribute type.</param>
''' <param name="colonLocation">The location of the ':'.</param>
''' <param name="name">The name of the attribute being applied.</param>
''' <param name="arguments">The arguments to the attribute.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal attributeType As AttributeTypes, ByVal attributeTypeLocation As Location, ByVal colonLocation As Location, ByVal name As Name, ByVal arguments As ArgumentCollection, ByVal span As Span)
MyBase.New(TreeType.Attribute, span)
If name Is Nothing Then
Throw New ArgumentNullException("name")
End If
SetParent(name)
SetParent(arguments)
_AttributeType = attributeType
_AttributeTypeLocation = attributeTypeLocation
_ColonLocation = colonLocation
_Name = name
_Arguments = arguments
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
AddChild(childList, Name)
AddChild(childList, Arguments)
End Sub
End Class
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for an attribute usage.
''' </summary>
Public NotInheritable Class Attribute
Inherits Tree
Private ReadOnly _AttributeType As AttributeTypes
Private ReadOnly _AttributeTypeLocation As Location
Private ReadOnly _ColonLocation As Location
Private ReadOnly _Name As Name
Private ReadOnly _Arguments As ArgumentCollection
''' <summary>
''' The target type of the attribute.
''' </summary>
Public ReadOnly Property AttributeType() As AttributeTypes
Get
Return _AttributeType
End Get
End Property
''' <summary>
''' The location of the attribute type, if any.
''' </summary>
Public ReadOnly Property AttributeTypeLocation() As Location
Get
Return _AttributeTypeLocation
End Get
End Property
''' <summary>
''' The location of the ':', if any.
''' </summary>
Public ReadOnly Property ColonLocation() As Location
Get
Return _ColonLocation
End Get
End Property
''' <summary>
''' The name of the attribute being applied.
''' </summary>
Public ReadOnly Property Name() As Name
Get
Return _Name
End Get
End Property
''' <summary>
''' The arguments to the attribute.
''' </summary>
Public ReadOnly Property Arguments() As ArgumentCollection
Get
Return _Arguments
End Get
End Property
''' <summary>
''' Constructs a new attribute parse tree.
''' </summary>
''' <param name="attributeType">The target type of the attribute.</param>
''' <param name="attributeTypeLocation">The location of the attribute type.</param>
''' <param name="colonLocation">The location of the ':'.</param>
''' <param name="name">The name of the attribute being applied.</param>
''' <param name="arguments">The arguments to the attribute.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal attributeType As AttributeTypes, ByVal attributeTypeLocation As Location, ByVal colonLocation As Location, ByVal name As Name, ByVal arguments As ArgumentCollection, ByVal span As Span)
MyBase.New(TreeType.Attribute, span)
If name Is Nothing Then
Throw New ArgumentNullException("name")
End If
SetParent(name)
SetParent(arguments)
_AttributeType = attributeType
_AttributeTypeLocation = attributeTypeLocation
_ColonLocation = colonLocation
_Name = name
_Arguments = arguments
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
AddChild(childList, Name)
AddChild(childList, Arguments)
End Sub
End Class

View file

@ -1,29 +1,29 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A read-only collection of attributes.
''' </summary>
Public NotInheritable Class AttributeBlockCollection
Inherits TreeCollection(Of AttributeCollection)
''' <summary>
''' Constructs a new collection of attribute blocks.
''' </summary>
''' <param name="attributeBlocks">The attribute blockss in the collection.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal attributeBlocks As IList(Of AttributeCollection), ByVal span As Span)
MyBase.New(TreeType.AttributeBlockCollection, attributeBlocks, span)
If attributeBlocks Is Nothing OrElse attributeBlocks.Count = 0 Then
Throw New ArgumentException("AttributeBlocksCollection cannot be empty.")
End If
End Sub
End Class
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A read-only collection of attributes.
''' </summary>
Public NotInheritable Class AttributeBlockCollection
Inherits TreeCollection(Of AttributeCollection)
''' <summary>
''' Constructs a new collection of attribute blocks.
''' </summary>
''' <param name="attributeBlocks">The attribute blockss in the collection.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal attributeBlocks As IList(Of AttributeCollection), ByVal span As Span)
MyBase.New(TreeType.AttributeBlockCollection, attributeBlocks, span)
If attributeBlocks Is Nothing OrElse attributeBlocks.Count = 0 Then
Throw New ArgumentException("AttributeBlocksCollection cannot be empty.")
End If
End Sub
End Class

View file

@ -1,44 +1,44 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A read-only collection of attributes.
''' </summary>
Public NotInheritable Class AttributeCollection
Inherits CommaDelimitedTreeCollection(Of Attribute)
Private ReadOnly _RightBracketLocation As Location
''' <summary>
''' The location of the '}'.
''' </summary>
Public ReadOnly Property RightBracketLocation() As Location
Get
Return _RightBracketLocation
End Get
End Property
''' <summary>
''' Constructs a new collection of attributes.
''' </summary>
''' <param name="attributes">The attributes in the collection.</param>
''' <param name="commaLocations">The location of the commas in the list.</param>
''' <param name="rightBracketLocation">The location of the right bracket.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal attributes As IList(Of Attribute), ByVal commaLocations As IList(Of Location), ByVal rightBracketLocation As Location, ByVal span As Span)
MyBase.New(TreeType.AttributeCollection, attributes, commaLocations, span)
If attributes Is Nothing OrElse attributes.Count = 0 Then
Throw New ArgumentException("AttributeCollection cannot be empty.")
End If
_RightBracketLocation = rightBracketLocation
End Sub
End Class
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A read-only collection of attributes.
''' </summary>
Public NotInheritable Class AttributeCollection
Inherits CommaDelimitedTreeCollection(Of Attribute)
Private ReadOnly _RightBracketLocation As Location
''' <summary>
''' The location of the '}'.
''' </summary>
Public ReadOnly Property RightBracketLocation() As Location
Get
Return _RightBracketLocation
End Get
End Property
''' <summary>
''' Constructs a new collection of attributes.
''' </summary>
''' <param name="attributes">The attributes in the collection.</param>
''' <param name="commaLocations">The location of the commas in the list.</param>
''' <param name="rightBracketLocation">The location of the right bracket.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal attributes As IList(Of Attribute), ByVal commaLocations As IList(Of Location), ByVal rightBracketLocation As Location, ByVal span As Span)
MyBase.New(TreeType.AttributeCollection, attributes, commaLocations, span)
If attributes Is Nothing OrElse attributes.Count = 0 Then
Throw New ArgumentException("AttributeCollection cannot be empty.")
End If
_RightBracketLocation = rightBracketLocation
End Sub
End Class

View file

@ -1,24 +1,24 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' The type of an attribute usage.
''' </summary>
<Flags()> _
Public Enum AttributeTypes
''' <summary>Regular application.</summary>
Regular = &H1
''' <summary>Applied to the netmodule.</summary>
[Module] = &H2
''' <summary>Applied to the assembly.</summary>
Assembly = &H4
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' The type of an attribute usage.
''' </summary>
<Flags()> _
Public Enum AttributeTypes
''' <summary>Regular application.</summary>
Regular = &H1
''' <summary>Applied to the netmodule.</summary>
[Module] = &H2
''' <summary>Applied to the assembly.</summary>
Assembly = &H4
End Enum

View file

@ -1,47 +1,47 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' The type a block declaration.
''' </summary>
Public Enum BlockType
None
[Do]
[For]
[While]
[Select]
[If]
[Try]
[SyncLock]
[Using]
[With]
[Sub]
[Function]
[Operator]
[Event]
[AddHandler]
[RemoveHandler]
[RaiseEvent]
[Get]
[Set]
[Property]
[Class]
[Structure]
[Module]
[Interface]
[Enum]
[Namespace]
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' The type a block declaration.
''' </summary>
Public Enum BlockType
None
[Do]
[For]
[While]
[Select]
[If]
[Try]
[SyncLock]
[Using]
[With]
[Sub]
[Function]
[Operator]
[Event]
[AddHandler]
[RemoveHandler]
[RaiseEvent]
[Get]
[Set]
[Property]
[Class]
[Structure]
[Module]
[Interface]
[Enum]
[Namespace]
End Enum

View file

@ -1,22 +1,22 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a case clause in a Select statement.
''' </summary>
Public MustInherit Class CaseClause
Inherits Tree
Protected Sub New(ByVal type As TreeType, ByVal span As Span)
MyBase.New(type, span)
Debug.Assert(type = TreeType.ComparisonCaseClause OrElse type = TreeType.RangeCaseClause)
End Sub
End Class
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a case clause in a Select statement.
''' </summary>
Public MustInherit Class CaseClause
Inherits Tree
Protected Sub New(ByVal type As TreeType, ByVal span As Span)
MyBase.New(type, span)
Debug.Assert(type = TreeType.ComparisonCaseClause OrElse type = TreeType.RangeCaseClause)
End Sub
End Class

View file

@ -1,30 +1,30 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A collection of case clauses.
''' </summary>
Public NotInheritable Class CaseClauseCollection
Inherits CommaDelimitedTreeCollection(Of CaseClause)
''' <summary>
''' Constructs a new collection of case clauses.
''' </summary>
''' <param name="caseClauses">The case clauses in the collection.</param>
''' <param name="commaLocations">The locations of the commas in the list.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal caseClauses As IList(Of CaseClause), ByVal commaLocations As IList(Of Location), ByVal span As Span)
MyBase.New(TreeType.CaseClauseCollection, caseClauses, commaLocations, span)
If caseClauses Is Nothing OrElse caseClauses.Count = 0 Then
Throw New ArgumentException("CaseClauseCollection cannot be empty.")
End If
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A collection of case clauses.
''' </summary>
Public NotInheritable Class CaseClauseCollection
Inherits CommaDelimitedTreeCollection(Of CaseClause)
''' <summary>
''' Constructs a new collection of case clauses.
''' </summary>
''' <param name="caseClauses">The case clauses in the collection.</param>
''' <param name="commaLocations">The locations of the commas in the list.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal caseClauses As IList(Of CaseClause), ByVal commaLocations As IList(Of Location), ByVal span As Span)
MyBase.New(TreeType.CaseClauseCollection, caseClauses, commaLocations, span)
If caseClauses Is Nothing OrElse caseClauses.Count = 0 Then
Throw New ArgumentException("CaseClauseCollection cannot be empty.")
End If
End Sub
End Class

View file

@ -1,88 +1,88 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a case clause that compares values.
''' </summary>
Public NotInheritable Class ComparisonCaseClause
Inherits CaseClause
Private ReadOnly _IsLocation As Location
Private ReadOnly _ComparisonOperator As OperatorType
Private ReadOnly _OperatorLocation As Location
Private ReadOnly _Operand As Expression
''' <summary>
''' The location of the 'Is', if any.
''' </summary>
Public ReadOnly Property IsLocation() As Location
Get
Return _IsLocation
End Get
End Property
''' <summary>
''' The comparison operator used in the case clause.
''' </summary>
Public ReadOnly Property ComparisonOperator() As OperatorType
Get
Return _ComparisonOperator
End Get
End Property
''' <summary>
''' The location of the comparison operator.
''' </summary>
Public ReadOnly Property OperatorLocation() As Location
Get
Return _OperatorLocation
End Get
End Property
''' <summary>
''' The operand of the case clause.
''' </summary>
Public ReadOnly Property Operand() As Expression
Get
Return _Operand
End Get
End Property
''' <summary>
''' Constructs a new parse tree for a comparison case clause.
''' </summary>
''' <param name="isLocation">The location of the 'Is', if any.</param>
''' <param name="comparisonOperator">The comparison operator used.</param>
''' <param name="operatorLocation">The location of the comparison operator.</param>
''' <param name="operand">The operand of the comparison.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal isLocation As Location, ByVal comparisonOperator As OperatorType, ByVal operatorLocation As Location, ByVal operand As Expression, ByVal span As Span)
MyBase.New(TreeType.ComparisonCaseClause, span)
If operand Is Nothing Then
Throw New ArgumentNullException("operand")
End If
If comparisonOperator < OperatorType.Equals OrElse comparisonOperator > OperatorType.GreaterThanEquals Then
Throw New ArgumentOutOfRangeException("comparisonOperator")
End If
SetParent(operand)
_IsLocation = isLocation
_ComparisonOperator = comparisonOperator
_OperatorLocation = operatorLocation
_Operand = operand
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
AddChild(childList, Operand)
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a case clause that compares values.
''' </summary>
Public NotInheritable Class ComparisonCaseClause
Inherits CaseClause
Private ReadOnly _IsLocation As Location
Private ReadOnly _ComparisonOperator As OperatorType
Private ReadOnly _OperatorLocation As Location
Private ReadOnly _Operand As Expression
''' <summary>
''' The location of the 'Is', if any.
''' </summary>
Public ReadOnly Property IsLocation() As Location
Get
Return _IsLocation
End Get
End Property
''' <summary>
''' The comparison operator used in the case clause.
''' </summary>
Public ReadOnly Property ComparisonOperator() As OperatorType
Get
Return _ComparisonOperator
End Get
End Property
''' <summary>
''' The location of the comparison operator.
''' </summary>
Public ReadOnly Property OperatorLocation() As Location
Get
Return _OperatorLocation
End Get
End Property
''' <summary>
''' The operand of the case clause.
''' </summary>
Public ReadOnly Property Operand() As Expression
Get
Return _Operand
End Get
End Property
''' <summary>
''' Constructs a new parse tree for a comparison case clause.
''' </summary>
''' <param name="isLocation">The location of the 'Is', if any.</param>
''' <param name="comparisonOperator">The comparison operator used.</param>
''' <param name="operatorLocation">The location of the comparison operator.</param>
''' <param name="operand">The operand of the comparison.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal isLocation As Location, ByVal comparisonOperator As OperatorType, ByVal operatorLocation As Location, ByVal operand As Expression, ByVal span As Span)
MyBase.New(TreeType.ComparisonCaseClause, span)
If operand Is Nothing Then
Throw New ArgumentNullException("operand")
End If
If comparisonOperator < OperatorType.Equals OrElse comparisonOperator > OperatorType.GreaterThanEquals Then
Throw New ArgumentOutOfRangeException("comparisonOperator")
End If
SetParent(operand)
_IsLocation = isLocation
_ComparisonOperator = comparisonOperator
_OperatorLocation = operatorLocation
_Operand = operand
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
AddChild(childList, Operand)
End Sub
End Class

View file

@ -1,48 +1,48 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a case clause that compares against a range of values.
''' </summary>
Public NotInheritable Class RangeCaseClause
Inherits CaseClause
Private ReadOnly _RangeExpression As Expression
''' <summary>
''' The range expression.
''' </summary>
Public ReadOnly Property RangeExpression() As Expression
Get
Return _RangeExpression
End Get
End Property
''' <summary>
''' Constructs a new range case clause parse tree.
''' </summary>
''' <param name="rangeExpression">The range expression.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal rangeExpression As Expression, ByVal span As Span)
MyBase.New(TreeType.RangeCaseClause, span)
If rangeExpression Is Nothing Then
Throw New ArgumentNullException("rangeExpression")
End If
SetParent(rangeExpression)
_RangeExpression = rangeExpression
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
AddChild(childList, RangeExpression)
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a case clause that compares against a range of values.
''' </summary>
Public NotInheritable Class RangeCaseClause
Inherits CaseClause
Private ReadOnly _RangeExpression As Expression
''' <summary>
''' The range expression.
''' </summary>
Public ReadOnly Property RangeExpression() As Expression
Get
Return _RangeExpression
End Get
End Property
''' <summary>
''' Constructs a new range case clause parse tree.
''' </summary>
''' <param name="rangeExpression">The range expression.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal rangeExpression As Expression, ByVal span As Span)
MyBase.New(TreeType.RangeCaseClause, span)
If rangeExpression Is Nothing Then
Throw New ArgumentNullException("rangeExpression")
End If
SetParent(rangeExpression)
_RangeExpression = rangeExpression
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
AddChild(childList, RangeExpression)
End Sub
End Class

View file

@ -1,37 +1,37 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A collection of trees that are colon delimited.
''' </summary>
Public MustInherit Class ColonDelimitedTreeCollection(Of T As Tree)
Inherits TreeCollection(Of T)
Private ReadOnly _ColonLocations As ReadOnlyCollection(Of Location)
''' <summary>
''' The locations of the colons in the collection.
''' </summary>
Public ReadOnly Property ColonLocations() As ReadOnlyCollection(Of Location)
Get
Return _ColonLocations
End Get
End Property
Protected Sub New(ByVal type As TreeType, ByVal trees As IList(Of T), ByVal colonLocations As IList(Of Location), ByVal span As Span)
MyBase.New(type, trees, span)
Debug.Assert(type = TreeType.StatementCollection OrElse type = TreeType.DeclarationCollection)
If colonLocations IsNot Nothing AndAlso colonLocations.Count > 0 Then
_ColonLocations = New ReadOnlyCollection(Of Location)(colonLocations)
End If
End Sub
End Class
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A collection of trees that are colon delimited.
''' </summary>
Public MustInherit Class ColonDelimitedTreeCollection(Of T As Tree)
Inherits TreeCollection(Of T)
Private ReadOnly _ColonLocations As ReadOnlyCollection(Of Location)
''' <summary>
''' The locations of the colons in the collection.
''' </summary>
Public ReadOnly Property ColonLocations() As ReadOnlyCollection(Of Location)
Get
Return _ColonLocations
End Get
End Property
Protected Sub New(ByVal type As TreeType, ByVal trees As IList(Of T), ByVal colonLocations As IList(Of Location), ByVal span As Span)
MyBase.New(type, trees, span)
Debug.Assert(type = TreeType.StatementCollection OrElse type = TreeType.DeclarationCollection)
If colonLocations IsNot Nothing AndAlso colonLocations.Count > 0 Then
_ColonLocations = New ReadOnlyCollection(Of Location)(colonLocations)
End If
End Sub
End Class

View file

@ -1,37 +1,37 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A collection of trees that are delimited by commas.
''' </summary>
Public MustInherit Class CommaDelimitedTreeCollection(Of T As Tree)
Inherits TreeCollection(Of T)
Private ReadOnly _CommaLocations As ReadOnlyCollection(Of Location)
''' <summary>
''' The location of the commas in the list.
''' </summary>
Public ReadOnly Property CommaLocations() As ReadOnlyCollection(Of Location)
Get
Return _CommaLocations
End Get
End Property
Protected Sub New(ByVal type As TreeType, ByVal trees As IList(Of T), ByVal commaLocations As IList(Of Location), ByVal span As Span)
MyBase.New(type, trees, span)
Debug.Assert(type >= TreeType.ArgumentCollection AndAlso type <= TreeType.ImportCollection)
If commaLocations IsNot Nothing AndAlso commaLocations.Count > 0 Then
_CommaLocations = New ReadOnlyCollection(Of Location)(commaLocations)
End If
End Sub
End Class
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A collection of trees that are delimited by commas.
''' </summary>
Public MustInherit Class CommaDelimitedTreeCollection(Of T As Tree)
Inherits TreeCollection(Of T)
Private ReadOnly _CommaLocations As ReadOnlyCollection(Of Location)
''' <summary>
''' The location of the commas in the list.
''' </summary>
Public ReadOnly Property CommaLocations() As ReadOnlyCollection(Of Location)
Get
Return _CommaLocations
End Get
End Property
Protected Sub New(ByVal type As TreeType, ByVal trees As IList(Of T), ByVal commaLocations As IList(Of Location), ByVal span As Span)
MyBase.New(type, trees, span)
Debug.Assert(type >= TreeType.ArgumentCollection AndAlso type <= TreeType.ImportCollection)
If commaLocations IsNot Nothing AndAlso commaLocations.Count > 0 Then
_CommaLocations = New ReadOnlyCollection(Of Location)(commaLocations)
End If
End Sub
End Class

View file

@ -1,103 +1,103 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A collection of a particular type of trees
''' </summary>
''' <typeparam name="T">The type of tree the collection contains.</typeparam>
Public MustInherit Class TreeCollection(Of T As Tree)
Inherits Tree
Implements IList(Of T)
Private _Trees As ReadOnlyCollection(Of T)
Protected Sub New(ByVal type As TreeType, ByVal trees As IList(Of T), ByVal span As Span)
MyBase.New(type, span)
Debug.Assert(type >= TreeType.ArgumentCollection AndAlso type <= TreeType.DeclarationCollection)
If trees Is Nothing Then
_Trees = New ReadOnlyCollection(Of T)(New List(Of T)())
Else
_Trees = New ReadOnlyCollection(Of T)(trees)
SetParents(trees)
End If
End Sub
Private Sub Add(ByVal item As T) Implements ICollection(Of T).Add
Throw New NotSupportedException()
End Sub
Private Sub Clear() Implements ICollection(Of T).Clear
Throw New NotSupportedException()
End Sub
Public Function Contains(ByVal item As T) As Boolean Implements ICollection(Of T).Contains
Return _Trees.Contains(item)
End Function
Public Sub CopyTo(ByVal array() As T, ByVal arrayIndex As Integer) Implements ICollection(Of T).CopyTo
_Trees.CopyTo(array, arrayIndex)
End Sub
Public ReadOnly Property Count() As Integer Implements ICollection(Of T).Count
Get
Return _Trees.Count
End Get
End Property
Private ReadOnly Property IsReadOnly() As Boolean Implements ICollection(Of T).IsReadOnly
Get
Return True
End Get
End Property
Private Function Remove(ByVal item As T) As Boolean Implements ICollection(Of T).Remove
Throw New NotSupportedException()
End Function
Public Function GetEnumerator() As IEnumerator(Of T) Implements IEnumerable(Of T).GetEnumerator
Return _Trees.GetEnumerator
End Function
Public Function IndexOf(ByVal item As T) As Integer Implements IList(Of T).IndexOf
Return _Trees.IndexOf(item)
End Function
Private Sub Insert(ByVal index As Integer, ByVal item As T) Implements IList(Of T).Insert
Throw New NotSupportedException()
End Sub
Public ReadOnly Property Item(ByVal index As Integer) As T
Get
Return _Trees.Item(index)
End Get
End Property
Private Property IListItem(ByVal index As Integer) As T Implements IList(Of T).Item
Get
Return _Trees.Item(index)
End Get
Set(ByVal value As T)
Throw New NotSupportedException()
End Set
End Property
Private Sub RemoveAt(ByVal index As Integer) Implements IList(Of T).RemoveAt
Throw New NotSupportedException()
End Sub
Private Function IEnumerableGetEnumerator() As IEnumerator Implements IEnumerable.GetEnumerator
Return _Trees.GetEnumerator()
End Function
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
AddChildren(childList, _Trees)
End Sub
End Class
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A collection of a particular type of trees
''' </summary>
''' <typeparam name="T">The type of tree the collection contains.</typeparam>
Public MustInherit Class TreeCollection(Of T As Tree)
Inherits Tree
Implements IList(Of T)
Private _Trees As ReadOnlyCollection(Of T)
Protected Sub New(ByVal type As TreeType, ByVal trees As IList(Of T), ByVal span As Span)
MyBase.New(type, span)
Debug.Assert(type >= TreeType.ArgumentCollection AndAlso type <= TreeType.DeclarationCollection)
If trees Is Nothing Then
_Trees = New ReadOnlyCollection(Of T)(New List(Of T)())
Else
_Trees = New ReadOnlyCollection(Of T)(trees)
SetParents(trees)
End If
End Sub
Private Sub Add(ByVal item As T) Implements ICollection(Of T).Add
Throw New NotSupportedException()
End Sub
Private Sub Clear() Implements ICollection(Of T).Clear
Throw New NotSupportedException()
End Sub
Public Function Contains(ByVal item As T) As Boolean Implements ICollection(Of T).Contains
Return _Trees.Contains(item)
End Function
Public Sub CopyTo(ByVal array() As T, ByVal arrayIndex As Integer) Implements ICollection(Of T).CopyTo
_Trees.CopyTo(array, arrayIndex)
End Sub
Public ReadOnly Property Count() As Integer Implements ICollection(Of T).Count
Get
Return _Trees.Count
End Get
End Property
Private ReadOnly Property IsReadOnly() As Boolean Implements ICollection(Of T).IsReadOnly
Get
Return True
End Get
End Property
Private Function Remove(ByVal item As T) As Boolean Implements ICollection(Of T).Remove
Throw New NotSupportedException()
End Function
Public Function GetEnumerator() As IEnumerator(Of T) Implements IEnumerable(Of T).GetEnumerator
Return _Trees.GetEnumerator
End Function
Public Function IndexOf(ByVal item As T) As Integer Implements IList(Of T).IndexOf
Return _Trees.IndexOf(item)
End Function
Private Sub Insert(ByVal index As Integer, ByVal item As T) Implements IList(Of T).Insert
Throw New NotSupportedException()
End Sub
Public ReadOnly Property Item(ByVal index As Integer) As T
Get
Return _Trees.Item(index)
End Get
End Property
Private Property IListItem(ByVal index As Integer) As T Implements IList(Of T).Item
Get
Return _Trees.Item(index)
End Get
Set(ByVal value As T)
Throw New NotSupportedException()
End Set
End Property
Private Sub RemoveAt(ByVal index As Integer) Implements IList(Of T).RemoveAt
Throw New NotSupportedException()
End Sub
Private Function IEnumerableGetEnumerator() As IEnumerator Implements IEnumerable.GetEnumerator
Return _Trees.GetEnumerator()
End Function
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
AddChildren(childList, _Trees)
End Sub
End Class

View file

@ -1,54 +1,54 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a comment.
''' </summary>
Public NotInheritable Class Comment
Inherits Tree
Private ReadOnly _Comment As String
Private ReadOnly _IsREM As Boolean
''' <summary>
''' The text of the comment.
''' </summary>
Public ReadOnly Property Comment() As String
Get
Return _Comment
End Get
End Property
''' <summary>
''' Whether the comment is a REM comment.
''' </summary>
Public ReadOnly Property IsREM() As Boolean
Get
Return _IsREM
End Get
End Property
''' <summary>
''' Constructs a new comment parse tree.
''' </summary>
''' <param name="comment">The text of the comment.</param>
''' <param name="isREM">Whether the comment is a REM comment.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal comment As String, ByVal isREM As Boolean, ByVal span As Span)
MyBase.New(TreeType.Comment, span)
If comment Is Nothing Then
Throw New ArgumentNullException("comment")
End If
_Comment = comment
_IsREM = isREM
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a comment.
''' </summary>
Public NotInheritable Class Comment
Inherits Tree
Private ReadOnly _Comment As String
Private ReadOnly _IsREM As Boolean
''' <summary>
''' The text of the comment.
''' </summary>
Public ReadOnly Property Comment() As String
Get
Return _Comment
End Get
End Property
''' <summary>
''' Whether the comment is a REM comment.
''' </summary>
Public ReadOnly Property IsREM() As Boolean
Get
Return _IsREM
End Get
End Property
''' <summary>
''' Constructs a new comment parse tree.
''' </summary>
''' <param name="comment">The text of the comment.</param>
''' <param name="isREM">Whether the comment is a REM comment.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal comment As String, ByVal isREM As Boolean, ByVal span As Span)
MyBase.New(TreeType.Comment, span)
If comment Is Nothing Then
Throw New ArgumentNullException("comment")
End If
_Comment = comment
_IsREM = isREM
End Sub
End Class

View file

@ -1,49 +1,49 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for an assembly-level or module-level attribute declaration.
''' </summary>
Public NotInheritable Class AttributeDeclaration
Inherits Declaration
Private ReadOnly _Attributes As AttributeBlockCollection
''' <summary>
''' The attributes.
''' </summary>
Public ReadOnly Property Attributes() As AttributeBlockCollection
Get
Return _Attributes
End Get
End Property
''' <summary>
''' Constructs a new parse tree for assembly-level or module-level attribute declarations.
''' </summary>
''' <param name="attributes">The attributes.</param>
''' <param name="span">The location of the parse tree.</param>
''' <param name="comments">The comments for the parse tree.</param>
Public Sub New(ByVal attributes As AttributeBlockCollection, ByVal span As Span, ByVal comments As IList(Of Comment))
MyBase.New(TreeType.AttributeDeclaration, span, comments)
If attributes Is Nothing Then
Throw New ArgumentNullException("attributes")
End If
SetParent(attributes)
_Attributes = attributes
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
AddChild(childList, Attributes)
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for an assembly-level or module-level attribute declaration.
''' </summary>
Public NotInheritable Class AttributeDeclaration
Inherits Declaration
Private ReadOnly _Attributes As AttributeBlockCollection
''' <summary>
''' The attributes.
''' </summary>
Public ReadOnly Property Attributes() As AttributeBlockCollection
Get
Return _Attributes
End Get
End Property
''' <summary>
''' Constructs a new parse tree for assembly-level or module-level attribute declarations.
''' </summary>
''' <param name="attributes">The attributes.</param>
''' <param name="span">The location of the parse tree.</param>
''' <param name="comments">The comments for the parse tree.</param>
Public Sub New(ByVal attributes As AttributeBlockCollection, ByVal span As Span, ByVal comments As IList(Of Comment))
MyBase.New(TreeType.AttributeDeclaration, span, comments)
If attributes Is Nothing Then
Throw New ArgumentNullException("attributes")
End If
SetParent(attributes)
_Attributes = attributes
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
AddChild(childList, Attributes)
End Sub
End Class

View file

@ -1,86 +1,86 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a block declaration.
''' </summary>
Public MustInherit Class BlockDeclaration
Inherits ModifiedDeclaration
Private ReadOnly _KeywordLocation As Location
Private ReadOnly _Name As SimpleName
Private ReadOnly _Declarations As DeclarationCollection
Private ReadOnly _EndDeclaration As EndBlockDeclaration
''' <summary>
''' The location of the keyword.
''' </summary>
Public ReadOnly Property KeywordLocation() As Location
Get
Return _KeywordLocation
End Get
End Property
''' <summary>
''' The name of the declaration.
''' </summary>
Public ReadOnly Property Name() As SimpleName
Get
Return _Name
End Get
End Property
''' <summary>
''' The declarations in the block.
''' </summary>
Public ReadOnly Property Declarations() As DeclarationCollection
Get
Return _Declarations
End Get
End Property
''' <summary>
''' The End statement for the block.
''' </summary>
Public ReadOnly Property EndDeclaration() As EndBlockDeclaration
Get
Return _EndDeclaration
End Get
End Property
Protected Sub New(ByVal type As TreeType, ByVal attributes As AttributeBlockCollection, ByVal modifiers As ModifierCollection, ByVal keywordLocation As Location, ByVal name As SimpleName, ByVal declarations As DeclarationCollection, ByVal endDeclaration As EndBlockDeclaration, ByVal span As Span, ByVal comments As IList(Of Comment))
MyBase.New(type, attributes, modifiers, span, comments)
Debug.Assert(type = TreeType.ClassDeclaration OrElse type = TreeType.ModuleDeclaration OrElse _
type = TreeType.InterfaceDeclaration OrElse type = TreeType.StructureDeclaration OrElse _
type = TreeType.EnumDeclaration)
If name Is Nothing Then
Throw New ArgumentNullException("name")
End If
SetParent(name)
SetParent(declarations)
SetParent(endDeclaration)
_KeywordLocation = keywordLocation
_Name = name
_Declarations = declarations
_EndDeclaration = endDeclaration
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
MyBase.GetChildTrees(childList)
AddChild(childList, Name)
AddChild(childList, Declarations)
AddChild(childList, EndDeclaration)
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a block declaration.
''' </summary>
Public MustInherit Class BlockDeclaration
Inherits ModifiedDeclaration
Private ReadOnly _KeywordLocation As Location
Private ReadOnly _Name As SimpleName
Private ReadOnly _Declarations As DeclarationCollection
Private ReadOnly _EndDeclaration As EndBlockDeclaration
''' <summary>
''' The location of the keyword.
''' </summary>
Public ReadOnly Property KeywordLocation() As Location
Get
Return _KeywordLocation
End Get
End Property
''' <summary>
''' The name of the declaration.
''' </summary>
Public ReadOnly Property Name() As SimpleName
Get
Return _Name
End Get
End Property
''' <summary>
''' The declarations in the block.
''' </summary>
Public ReadOnly Property Declarations() As DeclarationCollection
Get
Return _Declarations
End Get
End Property
''' <summary>
''' The End statement for the block.
''' </summary>
Public ReadOnly Property EndDeclaration() As EndBlockDeclaration
Get
Return _EndDeclaration
End Get
End Property
Protected Sub New(ByVal type As TreeType, ByVal attributes As AttributeBlockCollection, ByVal modifiers As ModifierCollection, ByVal keywordLocation As Location, ByVal name As SimpleName, ByVal declarations As DeclarationCollection, ByVal endDeclaration As EndBlockDeclaration, ByVal span As Span, ByVal comments As IList(Of Comment))
MyBase.New(type, attributes, modifiers, span, comments)
Debug.Assert(type = TreeType.ClassDeclaration OrElse type = TreeType.ModuleDeclaration OrElse _
type = TreeType.InterfaceDeclaration OrElse type = TreeType.StructureDeclaration OrElse _
type = TreeType.EnumDeclaration)
If name Is Nothing Then
Throw New ArgumentNullException("name")
End If
SetParent(name)
SetParent(declarations)
SetParent(endDeclaration)
_KeywordLocation = keywordLocation
_Name = name
_Declarations = declarations
_EndDeclaration = endDeclaration
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
MyBase.GetChildTrees(childList)
AddChild(childList, Name)
AddChild(childList, Declarations)
AddChild(childList, EndDeclaration)
End Sub
End Class

View file

@ -1,44 +1,44 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
'LC Changed Declaration to Inherits from Statement instead of tree so that we can add declaration to statement collection
''' <summary>
''' A parse tree for a declaration.
''' </summary>
Public Class Declaration
Inherits Statement
''' <summary>
''' Creates a bad declaration.
''' </summary>
''' <param name="span">The location of the parse tree.</param>
''' <param name="comments">The comments for the parse tree.</param>
''' <returns>A bad declaration.</returns>
Public Shared Function GetBadDeclaration(ByVal span As Span, ByVal comments As IList(Of Comment)) As Declaration
Return New Declaration(span, comments)
End Function
Protected Sub New(ByVal type As TreeType, ByVal span As Span, ByVal comments As IList(Of Comment))
MyBase.New(type, span, comments)
Debug.Assert(type >= TreeType.EmptyDeclaration AndAlso type <= TreeType.DelegateFunctionDeclaration)
End Sub
Private Sub New(ByVal span As Span, ByVal comments As IList(Of Comment))
MyBase.New(TreeType.SyntaxError, span, comments)
End Sub
Public Overrides ReadOnly Property IsBad() As Boolean
Get
Return Type = TreeType.SyntaxError
End Get
End Property
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
'LC Changed Declaration to Inherits from Statement instead of tree so that we can add declaration to statement collection
''' <summary>
''' A parse tree for a declaration.
''' </summary>
Public Class Declaration
Inherits Statement
''' <summary>
''' Creates a bad declaration.
''' </summary>
''' <param name="span">The location of the parse tree.</param>
''' <param name="comments">The comments for the parse tree.</param>
''' <returns>A bad declaration.</returns>
Public Shared Function GetBadDeclaration(ByVal span As Span, ByVal comments As IList(Of Comment)) As Declaration
Return New Declaration(span, comments)
End Function
Protected Sub New(ByVal type As TreeType, ByVal span As Span, ByVal comments As IList(Of Comment))
MyBase.New(type, span, comments)
Debug.Assert(type >= TreeType.EmptyDeclaration AndAlso type <= TreeType.DelegateFunctionDeclaration)
End Sub
Private Sub New(ByVal span As Span, ByVal comments As IList(Of Comment))
MyBase.New(TreeType.SyntaxError, span, comments)
End Sub
Public Overrides ReadOnly Property IsBad() As Boolean
Get
Return Type = TreeType.SyntaxError
End Get
End Property
End Class

View file

@ -1,32 +1,32 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A read-only collection of declarations.
''' </summary>
Public NotInheritable Class DeclarationCollection
Inherits ColonDelimitedTreeCollection(Of Declaration)
''' <summary>
''' Constructs a new collection of declarations.
''' </summary>
''' <param name="declarations">The declarations in the collection.</param>
''' <param name="colonLocations">The locations of the colons in the collection.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal declarations As IList(Of Declaration), ByVal colonLocations As IList(Of Location), ByVal span As Span)
MyBase.New(TreeType.DeclarationCollection, declarations, colonLocations, span)
' A declaration collection may need to hold just a colon.
If (declarations Is Nothing OrElse declarations.Count = 0) AndAlso _
(colonLocations Is Nothing OrElse colonLocations.Count = 0) Then
Throw New ArgumentException("DeclarationCollection cannot be empty.")
End If
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A read-only collection of declarations.
''' </summary>
Public NotInheritable Class DeclarationCollection
Inherits ColonDelimitedTreeCollection(Of Declaration)
''' <summary>
''' Constructs a new collection of declarations.
''' </summary>
''' <param name="declarations">The declarations in the collection.</param>
''' <param name="colonLocations">The locations of the colons in the collection.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal declarations As IList(Of Declaration), ByVal colonLocations As IList(Of Location), ByVal span As Span)
MyBase.New(TreeType.DeclarationCollection, declarations, colonLocations, span)
' A declaration collection may need to hold just a colon.
If (declarations Is Nothing OrElse declarations.Count = 0) AndAlso _
(colonLocations Is Nothing OrElse colonLocations.Count = 0) Then
Throw New ArgumentException("DeclarationCollection cannot be empty.")
End If
End Sub
End Class

View file

@ -1,25 +1,25 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for an empty declaration.
''' </summary>
Public NotInheritable Class EmptyDeclaration
Inherits Declaration
''' <summary>
''' Constructs a new parse tree for an empty declaration.
''' </summary>
''' <param name="span">The location of the parse tree.</param>
''' <param name="comments">The comments for the parse tree.</param>
Public Sub New(ByVal span As Span, ByVal comments As IList(Of Comment))
MyBase.New(TreeType.EmptyDeclaration, span, comments)
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for an empty declaration.
''' </summary>
Public NotInheritable Class EmptyDeclaration
Inherits Declaration
''' <summary>
''' Constructs a new parse tree for an empty declaration.
''' </summary>
''' <param name="span">The location of the parse tree.</param>
''' <param name="comments">The comments for the parse tree.</param>
Public Sub New(ByVal span As Span, ByVal comments As IList(Of Comment))
MyBase.New(TreeType.EmptyDeclaration, span, comments)
End Sub
End Class

View file

@ -1,71 +1,71 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for an End declaration.
''' </summary>
Public NotInheritable Class EndBlockDeclaration
Inherits Declaration
Private ReadOnly _EndType As BlockType
Private ReadOnly _EndArgumentLocation As Location
''' <summary>
''' The type of block the declaration ends.
''' </summary>
Public ReadOnly Property EndType() As BlockType
Get
Return _EndType
End Get
End Property
''' <summary>
''' The location of the end block argument.
''' </summary>
Public ReadOnly Property EndArgumentLocation() As Location
Get
Return _EndArgumentLocation
End Get
End Property
''' <summary>
''' Creates a new parse tree for an End block declaration.
''' </summary>
''' <param name="endType">The type of the block the statement ends.</param>
''' <param name="endArgumentLocation">The location of the end block argument.</param>
''' <param name="span">The location of the parse tree.</param>
''' <param name="comments">The comments for the parse tree.</param>
Public Sub New(ByVal endType As BlockType, ByVal endArgumentLocation As Location, ByVal span As Span, ByVal comments As IList(Of Comment))
MyBase.New(TreeType.EndBlockDeclaration, span, comments)
If endType < BlockType.Sub AndAlso endType > BlockType.Namespace Then
Throw New ArgumentOutOfRangeException("endType")
End If
_EndType = endType
_EndArgumentLocation = endArgumentLocation
End Sub
Friend Sub New(ByVal endBlockStatement As EndBlockStatement)
MyBase.New(TreeType.EndBlockDeclaration, endBlockStatement.Span, endBlockStatement.Comments)
' We only need to convert these types.
Select Case endBlockStatement.EndType
Case BlockType.Function, BlockType.Get, BlockType.Set, BlockType.Sub, BlockType.Operator, _
BlockType.AddHandler, BlockType.RemoveHandler, BlockType.RaiseEvent
_EndType = endBlockStatement.EndType
Case Else
Throw New ArgumentException("Invalid EndBlockStatement type.")
End Select
_EndArgumentLocation = endBlockStatement.EndArgumentLocation
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for an End declaration.
''' </summary>
Public NotInheritable Class EndBlockDeclaration
Inherits Declaration
Private ReadOnly _EndType As BlockType
Private ReadOnly _EndArgumentLocation As Location
''' <summary>
''' The type of block the declaration ends.
''' </summary>
Public ReadOnly Property EndType() As BlockType
Get
Return _EndType
End Get
End Property
''' <summary>
''' The location of the end block argument.
''' </summary>
Public ReadOnly Property EndArgumentLocation() As Location
Get
Return _EndArgumentLocation
End Get
End Property
''' <summary>
''' Creates a new parse tree for an End block declaration.
''' </summary>
''' <param name="endType">The type of the block the statement ends.</param>
''' <param name="endArgumentLocation">The location of the end block argument.</param>
''' <param name="span">The location of the parse tree.</param>
''' <param name="comments">The comments for the parse tree.</param>
Public Sub New(ByVal endType As BlockType, ByVal endArgumentLocation As Location, ByVal span As Span, ByVal comments As IList(Of Comment))
MyBase.New(TreeType.EndBlockDeclaration, span, comments)
If endType < BlockType.Sub AndAlso endType > BlockType.Namespace Then
Throw New ArgumentOutOfRangeException("endType")
End If
_EndType = endType
_EndArgumentLocation = endArgumentLocation
End Sub
Friend Sub New(ByVal endBlockStatement As EndBlockStatement)
MyBase.New(TreeType.EndBlockDeclaration, endBlockStatement.Span, endBlockStatement.Comments)
' We only need to convert these types.
Select Case endBlockStatement.EndType
Case BlockType.Function, BlockType.Get, BlockType.Set, BlockType.Sub, BlockType.Operator, _
BlockType.AddHandler, BlockType.RemoveHandler, BlockType.RaiseEvent
_EndType = endBlockStatement.EndType
Case Else
Throw New ArgumentException("Invalid EndBlockStatement type.")
End Select
_EndArgumentLocation = endBlockStatement.EndArgumentLocation
End Sub
End Class

View file

@ -1,52 +1,52 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a declaration with modifiers.
''' </summary>
Public MustInherit Class ModifiedDeclaration
Inherits Declaration
Private ReadOnly _Attributes As AttributeBlockCollection
Private ReadOnly _Modifiers As ModifierCollection
''' <summary>
''' The attributes on the declaration.
''' </summary>
Public ReadOnly Property Attributes() As AttributeBlockCollection
Get
Return _Attributes
End Get
End Property
''' <summary>
''' The modifiers on the declaration.
''' </summary>
Public ReadOnly Property Modifiers() As ModifierCollection
Get
Return _Modifiers
End Get
End Property
Protected Sub New(ByVal type As TreeType, ByVal attributes As AttributeBlockCollection, ByVal modifiers As ModifierCollection, ByVal span As Span, ByVal comments As IList(Of Comment))
MyBase.New(type, span, comments)
SetParent(attributes)
SetParent(modifiers)
_Attributes = attributes
_Modifiers = modifiers
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
AddChild(childList, Attributes)
AddChild(childList, Modifiers)
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a declaration with modifiers.
''' </summary>
Public MustInherit Class ModifiedDeclaration
Inherits Declaration
Private ReadOnly _Attributes As AttributeBlockCollection
Private ReadOnly _Modifiers As ModifierCollection
''' <summary>
''' The attributes on the declaration.
''' </summary>
Public ReadOnly Property Attributes() As AttributeBlockCollection
Get
Return _Attributes
End Get
End Property
''' <summary>
''' The modifiers on the declaration.
''' </summary>
Public ReadOnly Property Modifiers() As ModifierCollection
Get
Return _Modifiers
End Get
End Property
Protected Sub New(ByVal type As TreeType, ByVal attributes As AttributeBlockCollection, ByVal modifiers As ModifierCollection, ByVal span As Span, ByVal comments As IList(Of Comment))
MyBase.New(type, span, comments)
SetParent(attributes)
SetParent(modifiers)
_Attributes = attributes
_Modifiers = modifiers
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
AddChild(childList, Attributes)
AddChild(childList, Modifiers)
End Sub
End Class

View file

@ -1,25 +1,25 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for an AddressOf expression.
''' </summary>
Public NotInheritable Class AddressOfExpression
Inherits UnaryExpression
''' <summary>
''' Constructs a new AddressOf expression parse tree.
''' </summary>
''' <param name="operand">The operand of AddressOf.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal operand As Expression, ByVal span As Span)
MyBase.New(TreeType.AddressOfExpression, operand, span)
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for an AddressOf expression.
''' </summary>
Public NotInheritable Class AddressOfExpression
Inherits UnaryExpression
''' <summary>
''' Constructs a new AddressOf expression parse tree.
''' </summary>
''' <param name="operand">The operand of AddressOf.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal operand As Expression, ByVal span As Span)
MyBase.New(TreeType.AddressOfExpression, operand, span)
End Sub
End Class

View file

@ -1,100 +1,100 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a binary operator expression.
''' </summary>
Public NotInheritable Class BinaryOperatorExpression
Inherits Expression
Private ReadOnly _LeftOperand As Expression
Private ReadOnly _Operator As OperatorType
Private ReadOnly _OperatorLocation As Location
Private ReadOnly _RightOperand As Expression
''' <summary>
''' The left operand expression.
''' </summary>
Public ReadOnly Property LeftOperand() As Expression
Get
Return _LeftOperand
End Get
End Property
''' <summary>
''' The operator.
''' </summary>
Public ReadOnly Property [Operator]() As OperatorType
Get
Return _Operator
End Get
End Property
''' <summary>
''' The location of the operator.
''' </summary>
Public ReadOnly Property OperatorLocation() As Location
Get
Return _OperatorLocation
End Get
End Property
''' <summary>
''' The right operand expression.
''' </summary>
Public ReadOnly Property RightOperand() As Expression
Get
Return _RightOperand
End Get
End Property
''' <summary>
''' Constructs a new parse tree for a binary operation.
''' </summary>
''' <param name="leftOperand">The left operand expression.</param>
''' <param name="operator">The operator.</param>
''' <param name="operatorLocation">The location of the operator.</param>
''' <param name="rightOperand">The right operand expression.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal leftOperand As Expression, ByVal [operator] As OperatorType, ByVal operatorLocation As Location, ByVal rightOperand As Expression, ByVal span As Span)
MyBase.New(TreeType.BinaryOperatorExpression, span)
If [operator] < OperatorType.Plus OrElse [operator] > OperatorType.GreaterThanEquals Then
Throw New ArgumentOutOfRangeException("operator")
End If
If leftOperand Is Nothing Then
Throw New ArgumentNullException("leftOperand")
End If
If rightOperand Is Nothing Then
Throw New ArgumentNullException("rightOperand")
End If
SetParent(leftOperand)
SetParent(rightOperand)
_LeftOperand = leftOperand
_Operator = [operator]
_OperatorLocation = operatorLocation
_RightOperand = rightOperand
End Sub
Public Overrides ReadOnly Property IsConstant() As Boolean
Get
Return LeftOperand.IsConstant AndAlso RightOperand.IsConstant
End Get
End Property
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
AddChild(childList, LeftOperand)
AddChild(childList, RightOperand)
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a binary operator expression.
''' </summary>
Public NotInheritable Class BinaryOperatorExpression
Inherits Expression
Private ReadOnly _LeftOperand As Expression
Private ReadOnly _Operator As OperatorType
Private ReadOnly _OperatorLocation As Location
Private ReadOnly _RightOperand As Expression
''' <summary>
''' The left operand expression.
''' </summary>
Public ReadOnly Property LeftOperand() As Expression
Get
Return _LeftOperand
End Get
End Property
''' <summary>
''' The operator.
''' </summary>
Public ReadOnly Property [Operator]() As OperatorType
Get
Return _Operator
End Get
End Property
''' <summary>
''' The location of the operator.
''' </summary>
Public ReadOnly Property OperatorLocation() As Location
Get
Return _OperatorLocation
End Get
End Property
''' <summary>
''' The right operand expression.
''' </summary>
Public ReadOnly Property RightOperand() As Expression
Get
Return _RightOperand
End Get
End Property
''' <summary>
''' Constructs a new parse tree for a binary operation.
''' </summary>
''' <param name="leftOperand">The left operand expression.</param>
''' <param name="operator">The operator.</param>
''' <param name="operatorLocation">The location of the operator.</param>
''' <param name="rightOperand">The right operand expression.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal leftOperand As Expression, ByVal [operator] As OperatorType, ByVal operatorLocation As Location, ByVal rightOperand As Expression, ByVal span As Span)
MyBase.New(TreeType.BinaryOperatorExpression, span)
If [operator] < OperatorType.Plus OrElse [operator] > OperatorType.GreaterThanEquals Then
Throw New ArgumentOutOfRangeException("operator")
End If
If leftOperand Is Nothing Then
Throw New ArgumentNullException("leftOperand")
End If
If rightOperand Is Nothing Then
Throw New ArgumentNullException("rightOperand")
End If
SetParent(leftOperand)
SetParent(rightOperand)
_LeftOperand = leftOperand
_Operator = [operator]
_OperatorLocation = operatorLocation
_RightOperand = rightOperand
End Sub
Public Overrides ReadOnly Property IsConstant() As Boolean
Get
Return LeftOperand.IsConstant AndAlso RightOperand.IsConstant
End Get
End Property
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
AddChild(childList, LeftOperand)
AddChild(childList, RightOperand)
End Sub
End Class

View file

@ -1,43 +1,43 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a Boolean literal expression.
''' </summary>
Public NotInheritable Class BooleanLiteralExpression
Inherits LiteralExpression
Private ReadOnly _Literal As Boolean
''' <summary>
''' The literal value.
''' </summary>
Public ReadOnly Property Literal() As Boolean
Get
Return _Literal
End Get
End Property
'LC
Public Overrides ReadOnly Property Value() As Object
Get
Return _Literal
End Get
End Property
''' <summary>
''' Constructs a new parse tree for a Boolean literal expression.
''' </summary>
''' <param name="literal">The literal value.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal literal As Boolean, ByVal span As Span)
MyBase.New(TreeType.BooleanLiteralExpression, span)
_Literal = literal
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a Boolean literal expression.
''' </summary>
Public NotInheritable Class BooleanLiteralExpression
Inherits LiteralExpression
Private ReadOnly _Literal As Boolean
''' <summary>
''' The literal value.
''' </summary>
Public ReadOnly Property Literal() As Boolean
Get
Return _Literal
End Get
End Property
'LC
Public Overrides ReadOnly Property Value() As Object
Get
Return _Literal
End Get
End Property
''' <summary>
''' Constructs a new parse tree for a Boolean literal expression.
''' </summary>
''' <param name="literal">The literal value.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal literal As Boolean, ByVal span As Span)
MyBase.New(TreeType.BooleanLiteralExpression, span)
_Literal = literal
End Sub
End Class

View file

@ -1,29 +1,29 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a CType expression.
''' </summary>
Public NotInheritable Class CTypeExpression
Inherits CastTypeExpression
''' <summary>
''' Constructs a new parse tree for a CType expression.
''' </summary>
''' <param name="leftParenthesisLocation">The location of the '('.</param>
''' <param name="operand">The expression to be converted.</param>
''' <param name="commaLocation">The location of the ','.</param>
''' <param name="target">The target type of the conversion.</param>
''' <param name="rightParenthesisLocation">The location of the ')'.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal leftParenthesisLocation As Location, ByVal operand As Expression, ByVal commaLocation As Location, ByVal target As TypeName, ByVal rightParenthesisLocation As Location, ByVal span As Span)
MyBase.New(TreeType.CTypeExpression, leftParenthesisLocation, operand, commaLocation, target, rightParenthesisLocation, span)
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a CType expression.
''' </summary>
Public NotInheritable Class CTypeExpression
Inherits CastTypeExpression
''' <summary>
''' Constructs a new parse tree for a CType expression.
''' </summary>
''' <param name="leftParenthesisLocation">The location of the '('.</param>
''' <param name="operand">The expression to be converted.</param>
''' <param name="commaLocation">The location of the ','.</param>
''' <param name="target">The target type of the conversion.</param>
''' <param name="rightParenthesisLocation">The location of the ')'.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal leftParenthesisLocation As Location, ByVal operand As Expression, ByVal commaLocation As Location, ByVal target As TypeName, ByVal rightParenthesisLocation As Location, ByVal span As Span)
MyBase.New(TreeType.CTypeExpression, leftParenthesisLocation, operand, commaLocation, target, rightParenthesisLocation, span)
End Sub
End Class

View file

@ -1,62 +1,62 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a call or index expression.
''' </summary>
Public NotInheritable Class CallOrIndexExpression
Inherits Expression
Private ReadOnly _TargetExpression As Expression
Private ReadOnly _Arguments As ArgumentCollection
''' <summary>
''' The target of the call or index.
''' </summary>
Public ReadOnly Property TargetExpression() As Expression
Get
Return _TargetExpression
End Get
End Property
''' <summary>
''' The arguments to the call or index.
''' </summary>
Public ReadOnly Property Arguments() As ArgumentCollection
Get
Return _Arguments
End Get
End Property
''' <summary>
''' Constructs a new parse tree for a call or index expression.
''' </summary>
''' <param name="targetExpression">The target of the call or index.</param>
''' <param name="arguments">The arguments to the call or index.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal targetExpression As Expression, ByVal arguments As ArgumentCollection, ByVal span As Span)
MyBase.New(TreeType.CallOrIndexExpression, span)
If targetExpression Is Nothing Then
Throw New ArgumentNullException("targetExpression")
End If
SetParent(targetExpression)
SetParent(arguments)
_TargetExpression = targetExpression
_Arguments = arguments
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
AddChild(childList, TargetExpression)
AddChild(childList, Arguments)
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a call or index expression.
''' </summary>
Public NotInheritable Class CallOrIndexExpression
Inherits Expression
Private ReadOnly _TargetExpression As Expression
Private ReadOnly _Arguments As ArgumentCollection
''' <summary>
''' The target of the call or index.
''' </summary>
Public ReadOnly Property TargetExpression() As Expression
Get
Return _TargetExpression
End Get
End Property
''' <summary>
''' The arguments to the call or index.
''' </summary>
Public ReadOnly Property Arguments() As ArgumentCollection
Get
Return _Arguments
End Get
End Property
''' <summary>
''' Constructs a new parse tree for a call or index expression.
''' </summary>
''' <param name="targetExpression">The target of the call or index.</param>
''' <param name="arguments">The arguments to the call or index.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal targetExpression As Expression, ByVal arguments As ArgumentCollection, ByVal span As Span)
MyBase.New(TreeType.CallOrIndexExpression, span)
If targetExpression Is Nothing Then
Throw New ArgumentNullException("targetExpression")
End If
SetParent(targetExpression)
SetParent(arguments)
_TargetExpression = targetExpression
_Arguments = arguments
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
AddChild(childList, TargetExpression)
AddChild(childList, Arguments)
End Sub
End Class

View file

@ -1,79 +1,79 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a CType or DirectCast expression.
''' </summary>
Public MustInherit Class CastTypeExpression
Inherits UnaryExpression
Private ReadOnly _LeftParenthesisLocation As Location
Private ReadOnly _CommaLocation As Location
Private ReadOnly _Target As TypeName
Private ReadOnly _RightParenthesisLocation As Location
''' <summary>
''' The location of the '('.
''' </summary>
Public ReadOnly Property LeftParenthesisLocation() As Location
Get
Return _LeftParenthesisLocation
End Get
End Property
''' <summary>
''' The location of the ','.
''' </summary>
Public ReadOnly Property CommaLocation() As Location
Get
Return _CommaLocation
End Get
End Property
''' <summary>
''' The target type for the operand.
''' </summary>
Public ReadOnly Property Target() As TypeName
Get
Return _Target
End Get
End Property
''' <summary>
''' The location of the ')'.
''' </summary>
Public ReadOnly Property RightParenthesisLocation() As Location
Get
Return _RightParenthesisLocation
End Get
End Property
Protected Sub New(ByVal type As TreeType, ByVal leftParenthesisLocation As Location, ByVal operand As Expression, ByVal commaLocation As Location, ByVal target As TypeName, ByVal rightParenthesisLocation As Location, ByVal span As Span)
MyBase.New(type, operand, span)
Debug.Assert(type = TreeType.CTypeExpression OrElse type = TreeType.DirectCastExpression OrElse type = TreeType.TryCastExpression)
If target Is Nothing Then
Throw New ArgumentNullException("target")
End If
SetParent(target)
_Target = target
_LeftParenthesisLocation = leftParenthesisLocation
_CommaLocation = commaLocation
_RightParenthesisLocation = rightParenthesisLocation
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
MyBase.GetChildTrees(childList)
AddChild(childList, Target)
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a CType or DirectCast expression.
''' </summary>
Public MustInherit Class CastTypeExpression
Inherits UnaryExpression
Private ReadOnly _LeftParenthesisLocation As Location
Private ReadOnly _CommaLocation As Location
Private ReadOnly _Target As TypeName
Private ReadOnly _RightParenthesisLocation As Location
''' <summary>
''' The location of the '('.
''' </summary>
Public ReadOnly Property LeftParenthesisLocation() As Location
Get
Return _LeftParenthesisLocation
End Get
End Property
''' <summary>
''' The location of the ','.
''' </summary>
Public ReadOnly Property CommaLocation() As Location
Get
Return _CommaLocation
End Get
End Property
''' <summary>
''' The target type for the operand.
''' </summary>
Public ReadOnly Property Target() As TypeName
Get
Return _Target
End Get
End Property
''' <summary>
''' The location of the ')'.
''' </summary>
Public ReadOnly Property RightParenthesisLocation() As Location
Get
Return _RightParenthesisLocation
End Get
End Property
Protected Sub New(ByVal type As TreeType, ByVal leftParenthesisLocation As Location, ByVal operand As Expression, ByVal commaLocation As Location, ByVal target As TypeName, ByVal rightParenthesisLocation As Location, ByVal span As Span)
MyBase.New(type, operand, span)
Debug.Assert(type = TreeType.CTypeExpression OrElse type = TreeType.DirectCastExpression OrElse type = TreeType.TryCastExpression)
If target Is Nothing Then
Throw New ArgumentNullException("target")
End If
SetParent(target)
_Target = target
_LeftParenthesisLocation = leftParenthesisLocation
_CommaLocation = commaLocation
_RightParenthesisLocation = rightParenthesisLocation
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
MyBase.GetChildTrees(childList)
AddChild(childList, Target)
End Sub
End Class

View file

@ -1,44 +1,44 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a character literal expression.
''' </summary>
Public NotInheritable Class CharacterLiteralExpression
Inherits LiteralExpression
Private ReadOnly _Literal As Char
''' <summary>
''' The literal value.
''' </summary>
Public ReadOnly Property Literal() As Char
Get
Return _Literal
End Get
End Property
'LC
Public Overrides ReadOnly Property Value() As Object
Get
Return _Literal
End Get
End Property
''' <summary>
''' Constructs a new parse tree for a character literal expression.
''' </summary>
''' <param name="literal">The literal value.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal literal As Char, ByVal span As Span)
MyBase.New(TreeType.CharacterLiteralExpression, span)
_Literal = literal
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a character literal expression.
''' </summary>
Public NotInheritable Class CharacterLiteralExpression
Inherits LiteralExpression
Private ReadOnly _Literal As Char
''' <summary>
''' The literal value.
''' </summary>
Public ReadOnly Property Literal() As Char
Get
Return _Literal
End Get
End Property
'LC
Public Overrides ReadOnly Property Value() As Object
Get
Return _Literal
End Get
End Property
''' <summary>
''' Constructs a new parse tree for a character literal expression.
''' </summary>
''' <param name="literal">The literal value.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal literal As Char, ByVal span As Span)
MyBase.New(TreeType.CharacterLiteralExpression, span)
_Literal = literal
End Sub
End Class

View file

@ -1,44 +1,44 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a date literal expression.
''' </summary>
Public NotInheritable Class DateLiteralExpression
Inherits LiteralExpression
Private ReadOnly _Literal As Date
''' <summary>
''' The literal value.
''' </summary>
Public ReadOnly Property Literal() As Date
Get
Return _Literal
End Get
End Property
'LC
Public Overrides ReadOnly Property Value() As Object
Get
Return _Literal
End Get
End Property
''' <summary>
''' Constructs a new parse tree for a date literal.
''' </summary>
''' <param name="literal">The literal value.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal literal As Date, ByVal span As Span)
MyBase.New(TreeType.DateLiteralExpression, span)
_Literal = literal
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a date literal expression.
''' </summary>
Public NotInheritable Class DateLiteralExpression
Inherits LiteralExpression
Private ReadOnly _Literal As Date
''' <summary>
''' The literal value.
''' </summary>
Public ReadOnly Property Literal() As Date
Get
Return _Literal
End Get
End Property
'LC
Public Overrides ReadOnly Property Value() As Object
Get
Return _Literal
End Get
End Property
''' <summary>
''' Constructs a new parse tree for a date literal.
''' </summary>
''' <param name="literal">The literal value.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal literal As Date, ByVal span As Span)
MyBase.New(TreeType.DateLiteralExpression, span)
_Literal = literal
End Sub
End Class

View file

@ -1,62 +1,62 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a decimal literal expression.
''' </summary>
Public NotInheritable Class DecimalLiteralExpression
Inherits LiteralExpression
Private ReadOnly _Literal As Decimal
Private ReadOnly _TypeCharacter As TypeCharacter
''' <summary>
''' The literal value.
''' </summary>
Public ReadOnly Property Literal() As Decimal
Get
Return _Literal
End Get
End Property
'LC
Public Overrides ReadOnly Property Value() As Object
Get
Return _Literal
End Get
End Property
''' <summary>
''' The type character on the literal value.
''' </summary>
Public ReadOnly Property TypeCharacter() As TypeCharacter
Get
Return _TypeCharacter
End Get
End Property
''' <summary>
''' Constructs a new parse tree for a floating point literal.
''' </summary>
''' <param name="literal">The literal value.</param>
''' <param name="typeCharacter">The type character on the literal value.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal literal As Decimal, ByVal typeCharacter As TypeCharacter, ByVal span As Span)
MyBase.New(TreeType.DecimalLiteralExpression, span)
If typeCharacter <> typeCharacter.None AndAlso typeCharacter <> typeCharacter.DecimalChar AndAlso _
typeCharacter <> typeCharacter.DecimalSymbol Then
Throw New ArgumentOutOfRangeException("typeCharacter")
End If
_Literal = literal
_TypeCharacter = typeCharacter
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a decimal literal expression.
''' </summary>
Public NotInheritable Class DecimalLiteralExpression
Inherits LiteralExpression
Private ReadOnly _Literal As Decimal
Private ReadOnly _TypeCharacter As TypeCharacter
''' <summary>
''' The literal value.
''' </summary>
Public ReadOnly Property Literal() As Decimal
Get
Return _Literal
End Get
End Property
'LC
Public Overrides ReadOnly Property Value() As Object
Get
Return _Literal
End Get
End Property
''' <summary>
''' The type character on the literal value.
''' </summary>
Public ReadOnly Property TypeCharacter() As TypeCharacter
Get
Return _TypeCharacter
End Get
End Property
''' <summary>
''' Constructs a new parse tree for a floating point literal.
''' </summary>
''' <param name="literal">The literal value.</param>
''' <param name="typeCharacter">The type character on the literal value.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal literal As Decimal, ByVal typeCharacter As TypeCharacter, ByVal span As Span)
MyBase.New(TreeType.DecimalLiteralExpression, span)
If typeCharacter <> typeCharacter.None AndAlso typeCharacter <> typeCharacter.DecimalChar AndAlso _
typeCharacter <> typeCharacter.DecimalSymbol Then
Throw New ArgumentOutOfRangeException("typeCharacter")
End If
_Literal = literal
_TypeCharacter = typeCharacter
End Sub
End Class

View file

@ -1,74 +1,74 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a dictionary lookup expression.
''' </summary>
Public NotInheritable Class DictionaryLookupExpression
Inherits Expression
Private ReadOnly _Qualifier As Expression
Private ReadOnly _BangLocation As Location
Private ReadOnly _Name As SimpleName
''' <summary>
''' The dictionary expression.
''' </summary>
Public ReadOnly Property Qualifier() As Expression
Get
Return _Qualifier
End Get
End Property
''' <summary>
''' The location of the '!'.
''' </summary>
Public ReadOnly Property BangLocation() As Location
Get
Return _BangLocation
End Get
End Property
''' <summary>
''' The name to look up.
''' </summary>
Public ReadOnly Property Name() As SimpleName
Get
Return _Name
End Get
End Property
''' <summary>
''' Constructs a new parse tree for a dictionary lookup expression.
''' </summary>
''' <param name="qualifier">The dictionary expression.</param>
''' <param name="bangLocation">The location of the '!'.</param>
''' <param name="name">The name to look up..</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal qualifier As Expression, ByVal bangLocation As Location, ByVal name As SimpleName, ByVal span As Span)
MyBase.New(TreeType.DictionaryLookupExpression, span)
If name Is Nothing Then
Throw New ArgumentNullException("name")
End If
SetParent(qualifier)
SetParent(name)
_Qualifier = qualifier
_BangLocation = bangLocation
_Name = name
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
AddChild(childList, Qualifier)
AddChild(childList, Name)
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a dictionary lookup expression.
''' </summary>
Public NotInheritable Class DictionaryLookupExpression
Inherits Expression
Private ReadOnly _Qualifier As Expression
Private ReadOnly _BangLocation As Location
Private ReadOnly _Name As SimpleName
''' <summary>
''' The dictionary expression.
''' </summary>
Public ReadOnly Property Qualifier() As Expression
Get
Return _Qualifier
End Get
End Property
''' <summary>
''' The location of the '!'.
''' </summary>
Public ReadOnly Property BangLocation() As Location
Get
Return _BangLocation
End Get
End Property
''' <summary>
''' The name to look up.
''' </summary>
Public ReadOnly Property Name() As SimpleName
Get
Return _Name
End Get
End Property
''' <summary>
''' Constructs a new parse tree for a dictionary lookup expression.
''' </summary>
''' <param name="qualifier">The dictionary expression.</param>
''' <param name="bangLocation">The location of the '!'.</param>
''' <param name="name">The name to look up..</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal qualifier As Expression, ByVal bangLocation As Location, ByVal name As SimpleName, ByVal span As Span)
MyBase.New(TreeType.DictionaryLookupExpression, span)
If name Is Nothing Then
Throw New ArgumentNullException("name")
End If
SetParent(qualifier)
SetParent(name)
_Qualifier = qualifier
_BangLocation = bangLocation
_Name = name
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
AddChild(childList, Qualifier)
AddChild(childList, Name)
End Sub
End Class

View file

@ -1,29 +1,29 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a DirectCast expression.
''' </summary>
Public NotInheritable Class DirectCastExpression
Inherits CastTypeExpression
''' <summary>
''' Constructs a new parse tree for a DirectCast expression.
''' </summary>
''' <param name="leftParenthesisLocation">The location of the '('.</param>
''' <param name="operand">The expression to be converted.</param>
''' <param name="commaLocation">The location of the ','.</param>
''' <param name="target">The target type of the conversion.</param>
''' <param name="rightParenthesisLocation">The location of the ')'.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal leftParenthesisLocation As Location, ByVal operand As Expression, ByVal commaLocation As Location, ByVal target As TypeName, ByVal rightParenthesisLocation As Location, ByVal span As Span)
MyBase.New(TreeType.DirectCastExpression, leftParenthesisLocation, operand, commaLocation, target, rightParenthesisLocation, span)
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a DirectCast expression.
''' </summary>
Public NotInheritable Class DirectCastExpression
Inherits CastTypeExpression
''' <summary>
''' Constructs a new parse tree for a DirectCast expression.
''' </summary>
''' <param name="leftParenthesisLocation">The location of the '('.</param>
''' <param name="operand">The expression to be converted.</param>
''' <param name="commaLocation">The location of the ','.</param>
''' <param name="target">The target type of the conversion.</param>
''' <param name="rightParenthesisLocation">The location of the ')'.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal leftParenthesisLocation As Location, ByVal operand As Expression, ByVal commaLocation As Location, ByVal target As TypeName, ByVal rightParenthesisLocation As Location, ByVal span As Span)
MyBase.New(TreeType.DirectCastExpression, leftParenthesisLocation, operand, commaLocation, target, rightParenthesisLocation, span)
End Sub
End Class

View file

@ -1,50 +1,50 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for an expression.
''' </summary>
Public Class Expression
Inherits Tree
''' <summary>
''' Creates a bad expression.
''' </summary>
''' <param name="span">The location of the parse tree.</param>
''' <returns>A bad expression.</returns>
Public Shared Function GetBadExpression(ByVal span As Span) As Expression
Return New Expression(span)
End Function
''' <summary>
''' Whether the expression is constant or not.
''' </summary>
Public Overridable ReadOnly Property IsConstant() As Boolean
Get
Return False
End Get
End Property
Protected Sub New(ByVal type As TreeType, ByVal span As Span)
MyBase.New(type, span)
Debug.Assert(type >= TreeType.SimpleNameExpression AndAlso type <= TreeType.GetTypeExpression)
End Sub
Private Sub New(ByVal span As Span)
MyBase.New(TreeType.SyntaxError, span)
End Sub
Public Overrides ReadOnly Property IsBad() As Boolean
Get
Return Type = TreeType.SyntaxError
End Get
End Property
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for an expression.
''' </summary>
Public Class Expression
Inherits Tree
''' <summary>
''' Creates a bad expression.
''' </summary>
''' <param name="span">The location of the parse tree.</param>
''' <returns>A bad expression.</returns>
Public Shared Function GetBadExpression(ByVal span As Span) As Expression
Return New Expression(span)
End Function
''' <summary>
''' Whether the expression is constant or not.
''' </summary>
Public Overridable ReadOnly Property IsConstant() As Boolean
Get
Return False
End Get
End Property
Protected Sub New(ByVal type As TreeType, ByVal span As Span)
MyBase.New(type, span)
Debug.Assert(type >= TreeType.SimpleNameExpression AndAlso type <= TreeType.GetTypeExpression)
End Sub
Private Sub New(ByVal span As Span)
MyBase.New(TreeType.SyntaxError, span)
End Sub
Public Overrides ReadOnly Property IsBad() As Boolean
Get
Return Type = TreeType.SyntaxError
End Get
End Property
End Class

View file

@ -1,31 +1,31 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A read-only collection of expressions.
''' </summary>
Public NotInheritable Class ExpressionCollection
Inherits CommaDelimitedTreeCollection(Of Expression)
''' <summary>
''' Constructs a new collection of expressions.
''' </summary>
''' <param name="expressions">The expressions in the collection.</param>
''' <param name="commaLocations">The locations of the commas in the collection.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal expressions As IList(Of Expression), ByVal commaLocations As IList(Of Location), ByVal span As Span)
MyBase.New(TreeType.ExpressionCollection, expressions, commaLocations, span)
If (expressions Is Nothing OrElse expressions.Count = 0) AndAlso _
(commaLocations Is Nothing OrElse commaLocations.Count = 0) Then
Throw New ArgumentException("ExpressionCollection cannot be empty.")
End If
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A read-only collection of expressions.
''' </summary>
Public NotInheritable Class ExpressionCollection
Inherits CommaDelimitedTreeCollection(Of Expression)
''' <summary>
''' Constructs a new collection of expressions.
''' </summary>
''' <param name="expressions">The expressions in the collection.</param>
''' <param name="commaLocations">The locations of the commas in the collection.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal expressions As IList(Of Expression), ByVal commaLocations As IList(Of Location), ByVal span As Span)
MyBase.New(TreeType.ExpressionCollection, expressions, commaLocations, span)
If (expressions Is Nothing OrElse expressions.Count = 0) AndAlso _
(commaLocations Is Nothing OrElse commaLocations.Count = 0) Then
Throw New ArgumentException("ExpressionCollection cannot be empty.")
End If
End Sub
End Class

View file

@ -1,63 +1,63 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a floating point literal.
''' </summary>
Public NotInheritable Class FloatingPointLiteralExpression
Inherits LiteralExpression
Private ReadOnly _Literal As Double
Private ReadOnly _TypeCharacter As TypeCharacter
''' <summary>
''' The literal value.
''' </summary>
Public ReadOnly Property Literal() As Double
Get
Return _Literal
End Get
End Property
'LC
Public Overrides ReadOnly Property Value() As Object
Get
Return _Literal
End Get
End Property
''' <summary>
''' The type character on the literal value.
''' </summary>
Public ReadOnly Property TypeCharacter() As TypeCharacter
Get
Return _TypeCharacter
End Get
End Property
''' <summary>
''' Constructs a new parse tree for a floating point literal.
''' </summary>
''' <param name="literal">The literal value.</param>
''' <param name="typeCharacter">The type character on the literal.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal literal As Double, ByVal typeCharacter As TypeCharacter, ByVal span As Span)
MyBase.New(TreeType.FloatingPointLiteralExpression, span)
If typeCharacter <> typeCharacter.None AndAlso _
typeCharacter <> typeCharacter.SingleSymbol AndAlso typeCharacter <> typeCharacter.SingleChar AndAlso _
typeCharacter <> typeCharacter.DoubleSymbol AndAlso typeCharacter <> typeCharacter.DoubleChar Then
Throw New ArgumentOutOfRangeException("typeCharacter")
End If
_Literal = literal
_TypeCharacter = typeCharacter
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a floating point literal.
''' </summary>
Public NotInheritable Class FloatingPointLiteralExpression
Inherits LiteralExpression
Private ReadOnly _Literal As Double
Private ReadOnly _TypeCharacter As TypeCharacter
''' <summary>
''' The literal value.
''' </summary>
Public ReadOnly Property Literal() As Double
Get
Return _Literal
End Get
End Property
'LC
Public Overrides ReadOnly Property Value() As Object
Get
Return _Literal
End Get
End Property
''' <summary>
''' The type character on the literal value.
''' </summary>
Public ReadOnly Property TypeCharacter() As TypeCharacter
Get
Return _TypeCharacter
End Get
End Property
''' <summary>
''' Constructs a new parse tree for a floating point literal.
''' </summary>
''' <param name="literal">The literal value.</param>
''' <param name="typeCharacter">The type character on the literal.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal literal As Double, ByVal typeCharacter As TypeCharacter, ByVal span As Span)
MyBase.New(TreeType.FloatingPointLiteralExpression, span)
If typeCharacter <> typeCharacter.None AndAlso _
typeCharacter <> typeCharacter.SingleSymbol AndAlso typeCharacter <> typeCharacter.SingleChar AndAlso _
typeCharacter <> typeCharacter.DoubleSymbol AndAlso typeCharacter <> typeCharacter.DoubleChar Then
Throw New ArgumentOutOfRangeException("typeCharacter")
End If
_Literal = literal
_TypeCharacter = typeCharacter
End Sub
End Class

View file

@ -1,66 +1,66 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a qualified name expression.
''' </summary>
Public NotInheritable Class GenericQualifiedExpression
Inherits Expression
Private ReadOnly _Base As Expression
Private ReadOnly _TypeArguments As TypeArgumentCollection
''' <summary>
''' The base expression.
''' </summary>
Public ReadOnly Property Base() As Expression
Get
Return _Base
End Get
End Property
''' <summary>
''' The qualifying type arguments.
''' </summary>
Public ReadOnly Property TypeArguments() As TypeArgumentCollection
Get
Return _TypeArguments
End Get
End Property
''' <summary>
''' Constructs a new parse tree for a generic qualified expression.
''' </summary>
''' <param name="base">The base expression.</param>
''' <param name="typeArguments">The qualifying type arguments.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal base As Expression, ByVal typeArguments As TypeArgumentCollection, ByVal span As Span)
MyBase.New(TreeType.GenericQualifiedExpression, span)
If base Is Nothing Then
Throw New ArgumentNullException("base")
End If
If typeArguments Is Nothing Then
Throw New ArgumentNullException("typeArguments")
End If
SetParent(base)
SetParent(typeArguments)
_Base = base
_TypeArguments = typeArguments
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
AddChild(childList, Base)
AddChild(childList, TypeArguments)
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a qualified name expression.
''' </summary>
Public NotInheritable Class GenericQualifiedExpression
Inherits Expression
Private ReadOnly _Base As Expression
Private ReadOnly _TypeArguments As TypeArgumentCollection
''' <summary>
''' The base expression.
''' </summary>
Public ReadOnly Property Base() As Expression
Get
Return _Base
End Get
End Property
''' <summary>
''' The qualifying type arguments.
''' </summary>
Public ReadOnly Property TypeArguments() As TypeArgumentCollection
Get
Return _TypeArguments
End Get
End Property
''' <summary>
''' Constructs a new parse tree for a generic qualified expression.
''' </summary>
''' <param name="base">The base expression.</param>
''' <param name="typeArguments">The qualifying type arguments.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal base As Expression, ByVal typeArguments As TypeArgumentCollection, ByVal span As Span)
MyBase.New(TreeType.GenericQualifiedExpression, span)
If base Is Nothing Then
Throw New ArgumentNullException("base")
End If
If typeArguments Is Nothing Then
Throw New ArgumentNullException("typeArguments")
End If
SetParent(base)
SetParent(typeArguments)
_Base = base
_TypeArguments = typeArguments
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
AddChild(childList, Base)
AddChild(childList, TypeArguments)
End Sub
End Class

View file

@ -1,72 +1,72 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a GetType expression.
''' </summary>
Public NotInheritable Class GetTypeExpression
Inherits Expression
Private ReadOnly _LeftParenthesisLocation As Location
Private ReadOnly _Target As TypeName
Private ReadOnly _RightParenthesisLocation As Location
''' <summary>
''' The location of the '('.
''' </summary>
Public ReadOnly Property LeftParenthesisLocation() As Location
Get
Return _LeftParenthesisLocation
End Get
End Property
''' <summary>
''' The target type of the GetType expression.
''' </summary>
Public ReadOnly Property Target() As TypeName
Get
Return _Target
End Get
End Property
''' <summary>
''' The location of the ')'.
''' </summary>
Public ReadOnly Property RightParenthesisLocation() As Location
Get
Return _RightParenthesisLocation
End Get
End Property
''' <summary>
''' Constructs a new parse tree for a GetType expression.
''' </summary>
''' <param name="leftParenthesisLocation">The location of the '('.</param>
''' <param name="target">The target type of the GetType expression.</param>
''' <param name="rightParenthesisLocation">The location of the ')'.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal leftParenthesisLocation As Location, ByVal target As TypeName, ByVal rightParenthesisLocation As Location, ByVal span As Span)
MyBase.New(TreeType.GetTypeExpression, span)
If target Is Nothing Then
Throw New ArgumentNullException("target")
End If
SetParent(target)
_LeftParenthesisLocation = leftParenthesisLocation
_Target = target
_RightParenthesisLocation = rightParenthesisLocation
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
AddChild(childList, Target)
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a GetType expression.
''' </summary>
Public NotInheritable Class GetTypeExpression
Inherits Expression
Private ReadOnly _LeftParenthesisLocation As Location
Private ReadOnly _Target As TypeName
Private ReadOnly _RightParenthesisLocation As Location
''' <summary>
''' The location of the '('.
''' </summary>
Public ReadOnly Property LeftParenthesisLocation() As Location
Get
Return _LeftParenthesisLocation
End Get
End Property
''' <summary>
''' The target type of the GetType expression.
''' </summary>
Public ReadOnly Property Target() As TypeName
Get
Return _Target
End Get
End Property
''' <summary>
''' The location of the ')'.
''' </summary>
Public ReadOnly Property RightParenthesisLocation() As Location
Get
Return _RightParenthesisLocation
End Get
End Property
''' <summary>
''' Constructs a new parse tree for a GetType expression.
''' </summary>
''' <param name="leftParenthesisLocation">The location of the '('.</param>
''' <param name="target">The target type of the GetType expression.</param>
''' <param name="rightParenthesisLocation">The location of the ')'.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal leftParenthesisLocation As Location, ByVal target As TypeName, ByVal rightParenthesisLocation As Location, ByVal span As Span)
MyBase.New(TreeType.GetTypeExpression, span)
If target Is Nothing Then
Throw New ArgumentNullException("target")
End If
SetParent(target)
_LeftParenthesisLocation = leftParenthesisLocation
_Target = target
_RightParenthesisLocation = rightParenthesisLocation
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
AddChild(childList, Target)
End Sub
End Class

View file

@ -1,24 +1,24 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for Nothing.
''' </summary>
Public NotInheritable Class GlobalExpression
Inherits Expression
''' <summary>
''' Constructs a new parse tree for Global.
''' </summary>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal span As Span)
MyBase.New(TreeType.GlobalExpression, span)
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for Nothing.
''' </summary>
Public NotInheritable Class GlobalExpression
Inherits Expression
''' <summary>
''' Constructs a new parse tree for Global.
''' </summary>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal span As Span)
MyBase.New(TreeType.GlobalExpression, span)
End Sub
End Class

View file

@ -1,42 +1,42 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for Me, MyBase or MyClass.
''' </summary>
Public NotInheritable Class InstanceExpression
Inherits Expression
Private _InstanceType As InstanceType
''' <summary>
''' The type of the instance expression.
''' </summary>
Public ReadOnly Property InstanceType() As InstanceType
Get
Return _InstanceType
End Get
End Property
''' <summary>
''' Constructs a new parse tree for My, MyBase or MyClass.
''' </summary>
''' <param name="instanceType">The type of the instance expression.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal instanceType As InstanceType, ByVal span As Span)
MyBase.New(TreeType.InstanceExpression, span)
If instanceType < instanceType.Me OrElse instanceType > instanceType.MyBase Then
Throw New ArgumentOutOfRangeException("instanceType")
End If
_InstanceType = instanceType
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for Me, MyBase or MyClass.
''' </summary>
Public NotInheritable Class InstanceExpression
Inherits Expression
Private _InstanceType As InstanceType
''' <summary>
''' The type of the instance expression.
''' </summary>
Public ReadOnly Property InstanceType() As InstanceType
Get
Return _InstanceType
End Get
End Property
''' <summary>
''' Constructs a new parse tree for My, MyBase or MyClass.
''' </summary>
''' <param name="instanceType">The type of the instance expression.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal instanceType As InstanceType, ByVal span As Span)
MyBase.New(TreeType.InstanceExpression, span)
If instanceType < instanceType.Me OrElse instanceType > instanceType.MyBase Then
Throw New ArgumentOutOfRangeException("instanceType")
End If
_InstanceType = instanceType
End Sub
End Class

View file

@ -1,18 +1,18 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' The type of an instance expression.
''' </summary>
Public Enum InstanceType
[Me]
[MyClass]
[MyBase]
End Enum
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' The type of an instance expression.
''' </summary>
Public Enum InstanceType
[Me]
[MyClass]
[MyBase]
End Enum

View file

@ -1,80 +1,80 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for an integer literal.
''' </summary>
Public NotInheritable Class IntegerLiteralExpression
Inherits LiteralExpression
Private ReadOnly _Literal As Integer
Private ReadOnly _TypeCharacter As TypeCharacter
Private ReadOnly _IntegerBase As IntegerBase
''' <summary>
''' The literal value.
''' </summary>
Public ReadOnly Property Literal() As Integer
Get
Return _Literal
End Get
End Property
'LC
Public Overrides ReadOnly Property Value() As Object
Get
Return _Literal
End Get
End Property
''' <summary>
''' The type character on the literal.
''' </summary>
Public ReadOnly Property TypeCharacter() As TypeCharacter
Get
Return _TypeCharacter
End Get
End Property
''' <summary>
''' The integer base of the literal.
''' </summary>
Public ReadOnly Property IntegerBase() As IntegerBase
Get
Return _IntegerBase
End Get
End Property
''' <summary>
''' Constructs a new parse tree for an integer literal.
''' </summary>
''' <param name="literal">The literal value.</param>
''' <param name="integerBase">The integer base of the literal.</param>
''' <param name="typeCharacter">The type character on the literal.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal literal As Integer, ByVal integerBase As IntegerBase, ByVal typeCharacter As TypeCharacter, ByVal span As Span)
MyBase.New(TreeType.IntegerLiteralExpression, span)
If integerBase < integerBase.Decimal OrElse integerBase > integerBase.Hexadecimal Then
Throw New ArgumentOutOfRangeException("integerBase")
End If
If typeCharacter <> typeCharacter.None AndAlso _
typeCharacter <> typeCharacter.IntegerSymbol AndAlso typeCharacter <> typeCharacter.IntegerChar AndAlso _
typeCharacter <> typeCharacter.ShortChar AndAlso _
typeCharacter <> typeCharacter.LongSymbol AndAlso typeCharacter <> typeCharacter.LongChar Then
Throw New ArgumentOutOfRangeException("typeCharacter")
End If
_Literal = literal
_IntegerBase = integerBase
_TypeCharacter = typeCharacter
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for an integer literal.
''' </summary>
Public NotInheritable Class IntegerLiteralExpression
Inherits LiteralExpression
Private ReadOnly _Literal As Integer
Private ReadOnly _TypeCharacter As TypeCharacter
Private ReadOnly _IntegerBase As IntegerBase
''' <summary>
''' The literal value.
''' </summary>
Public ReadOnly Property Literal() As Integer
Get
Return _Literal
End Get
End Property
'LC
Public Overrides ReadOnly Property Value() As Object
Get
Return _Literal
End Get
End Property
''' <summary>
''' The type character on the literal.
''' </summary>
Public ReadOnly Property TypeCharacter() As TypeCharacter
Get
Return _TypeCharacter
End Get
End Property
''' <summary>
''' The integer base of the literal.
''' </summary>
Public ReadOnly Property IntegerBase() As IntegerBase
Get
Return _IntegerBase
End Get
End Property
''' <summary>
''' Constructs a new parse tree for an integer literal.
''' </summary>
''' <param name="literal">The literal value.</param>
''' <param name="integerBase">The integer base of the literal.</param>
''' <param name="typeCharacter">The type character on the literal.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal literal As Integer, ByVal integerBase As IntegerBase, ByVal typeCharacter As TypeCharacter, ByVal span As Span)
MyBase.New(TreeType.IntegerLiteralExpression, span)
If integerBase < integerBase.Decimal OrElse integerBase > integerBase.Hexadecimal Then
Throw New ArgumentOutOfRangeException("integerBase")
End If
If typeCharacter <> typeCharacter.None AndAlso _
typeCharacter <> typeCharacter.IntegerSymbol AndAlso typeCharacter <> typeCharacter.IntegerChar AndAlso _
typeCharacter <> typeCharacter.ShortChar AndAlso _
typeCharacter <> typeCharacter.LongSymbol AndAlso typeCharacter <> typeCharacter.LongChar Then
Throw New ArgumentOutOfRangeException("typeCharacter")
End If
_Literal = literal
_IntegerBase = integerBase
_TypeCharacter = typeCharacter
End Sub
End Class

View file

@ -1,71 +1,71 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for an intrinsic conversion expression.
''' </summary>
Public NotInheritable Class IntrinsicCastExpression
Inherits UnaryExpression
Private ReadOnly _IntrinsicType As IntrinsicType
Private ReadOnly _LeftParenthesisLocation As Location
Private ReadOnly _RightParenthesisLocation As Location
''' <summary>
''' The intrinsic type conversion.
''' </summary>
Public ReadOnly Property IntrinsicType() As IntrinsicType
Get
Return _IntrinsicType
End Get
End Property
''' <summary>
''' The location of the '('.
''' </summary>
Public ReadOnly Property LeftParenthesisLocation() As Location
Get
Return _LeftParenthesisLocation
End Get
End Property
''' <summary>
''' The location of the ')'.
''' </summary>
Public ReadOnly Property RightParenthesisLocation() As Location
Get
Return _RightParenthesisLocation
End Get
End Property
''' <summary>
''' Constructs a new parse tree for an intrinsic conversion expression.
''' </summary>
''' <param name="intrinsicType">The intrinsic type conversion.</param>
''' <param name="leftParenthesisLocation">The location of the '('.</param>
''' <param name="operand">The expression to convert.</param>
''' <param name="rightParenthesisLocation">The location of the ')'.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal intrinsicType As IntrinsicType, ByVal leftParenthesisLocation As Location, ByVal operand As Expression, ByVal rightParenthesisLocation As Location, ByVal span As Span)
MyBase.New(TreeType.IntrinsicCastExpression, operand, span)
If intrinsicType < intrinsicType.Boolean OrElse intrinsicType > intrinsicType.Object Then
Throw New ArgumentOutOfRangeException("intrinsicType")
End If
If operand Is Nothing Then
Throw New ArgumentNullException("operand")
End If
_IntrinsicType = intrinsicType
_LeftParenthesisLocation = leftParenthesisLocation
_RightParenthesisLocation = rightParenthesisLocation
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for an intrinsic conversion expression.
''' </summary>
Public NotInheritable Class IntrinsicCastExpression
Inherits UnaryExpression
Private ReadOnly _IntrinsicType As IntrinsicType
Private ReadOnly _LeftParenthesisLocation As Location
Private ReadOnly _RightParenthesisLocation As Location
''' <summary>
''' The intrinsic type conversion.
''' </summary>
Public ReadOnly Property IntrinsicType() As IntrinsicType
Get
Return _IntrinsicType
End Get
End Property
''' <summary>
''' The location of the '('.
''' </summary>
Public ReadOnly Property LeftParenthesisLocation() As Location
Get
Return _LeftParenthesisLocation
End Get
End Property
''' <summary>
''' The location of the ')'.
''' </summary>
Public ReadOnly Property RightParenthesisLocation() As Location
Get
Return _RightParenthesisLocation
End Get
End Property
''' <summary>
''' Constructs a new parse tree for an intrinsic conversion expression.
''' </summary>
''' <param name="intrinsicType">The intrinsic type conversion.</param>
''' <param name="leftParenthesisLocation">The location of the '('.</param>
''' <param name="operand">The expression to convert.</param>
''' <param name="rightParenthesisLocation">The location of the ')'.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal intrinsicType As IntrinsicType, ByVal leftParenthesisLocation As Location, ByVal operand As Expression, ByVal rightParenthesisLocation As Location, ByVal span As Span)
MyBase.New(TreeType.IntrinsicCastExpression, operand, span)
If intrinsicType < intrinsicType.Boolean OrElse intrinsicType > intrinsicType.Object Then
Throw New ArgumentOutOfRangeException("intrinsicType")
End If
If operand Is Nothing Then
Throw New ArgumentNullException("operand")
End If
_IntrinsicType = intrinsicType
_LeftParenthesisLocation = leftParenthesisLocation
_RightParenthesisLocation = rightParenthesisLocation
End Sub
End Class

View file

@ -1,31 +1,31 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a literal expression.
''' </summary>
Public MustInherit Class LiteralExpression
Inherits Expression
Public NotOverridable Overrides ReadOnly Property IsConstant() As Boolean
Get
Return True
End Get
End Property
'LC add property to get value
Public MustOverride ReadOnly Property Value() As Object
Protected Sub New(ByVal type As TreeType, ByVal span As Span)
MyBase.New(type, span)
Debug.Assert(type >= TreeType.StringLiteralExpression AndAlso type <= TreeType.BooleanLiteralExpression)
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a literal expression.
''' </summary>
Public MustInherit Class LiteralExpression
Inherits Expression
Public NotOverridable Overrides ReadOnly Property IsConstant() As Boolean
Get
Return True
End Get
End Property
'LC add property to get value
Public MustOverride ReadOnly Property Value() As Object
Protected Sub New(ByVal type As TreeType, ByVal span As Span)
MyBase.New(type, span)
Debug.Assert(type >= TreeType.StringLiteralExpression AndAlso type <= TreeType.BooleanLiteralExpression)
End Sub
End Class

View file

@ -1,66 +1,66 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a New array expression.
''' </summary>
Public NotInheritable Class NewAggregateExpression
Inherits Expression
Private ReadOnly _Target As ArrayTypeName
Private ReadOnly _Initializer As AggregateInitializer
''' <summary>
''' The target array type to create.
''' </summary>
Public ReadOnly Property Target() As ArrayTypeName
Get
Return _Target
End Get
End Property
''' <summary>
''' The initializer for the array.
''' </summary>
Public ReadOnly Property Initializer() As AggregateInitializer
Get
Return _Initializer
End Get
End Property
''' <summary>
''' The constructor for a New array expression parse tree.
''' </summary>
''' <param name="target">The target array type to create.</param>
''' <param name="initializer">The initializer for the array.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal target As ArrayTypeName, ByVal initializer As AggregateInitializer, ByVal span As Span)
MyBase.New(TreeType.NewAggregateExpression, span)
If target Is Nothing Then
Throw New ArgumentNullException("target")
End If
If initializer Is Nothing Then
Throw New ArgumentNullException("initializer")
End If
SetParent(target)
SetParent(initializer)
_Target = target
_Initializer = initializer
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
AddChild(childList, Target)
AddChild(childList, Initializer)
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a New array expression.
''' </summary>
Public NotInheritable Class NewAggregateExpression
Inherits Expression
Private ReadOnly _Target As ArrayTypeName
Private ReadOnly _Initializer As AggregateInitializer
''' <summary>
''' The target array type to create.
''' </summary>
Public ReadOnly Property Target() As ArrayTypeName
Get
Return _Target
End Get
End Property
''' <summary>
''' The initializer for the array.
''' </summary>
Public ReadOnly Property Initializer() As AggregateInitializer
Get
Return _Initializer
End Get
End Property
''' <summary>
''' The constructor for a New array expression parse tree.
''' </summary>
''' <param name="target">The target array type to create.</param>
''' <param name="initializer">The initializer for the array.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal target As ArrayTypeName, ByVal initializer As AggregateInitializer, ByVal span As Span)
MyBase.New(TreeType.NewAggregateExpression, span)
If target Is Nothing Then
Throw New ArgumentNullException("target")
End If
If initializer Is Nothing Then
Throw New ArgumentNullException("initializer")
End If
SetParent(target)
SetParent(initializer)
_Target = target
_Initializer = initializer
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
AddChild(childList, Target)
AddChild(childList, Initializer)
End Sub
End Class

View file

@ -1,62 +1,62 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a New expression.
''' </summary>
Public NotInheritable Class NewExpression
Inherits Expression
Private ReadOnly _Target As TypeName
Private ReadOnly _Arguments As ArgumentCollection
''' <summary>
''' The target type to create.
''' </summary>
Public ReadOnly Property Target() As TypeName
Get
Return _Target
End Get
End Property
''' <summary>
''' The arguments to the constructor.
''' </summary>
Public ReadOnly Property Arguments() As ArgumentCollection
Get
Return _Arguments
End Get
End Property
''' <summary>
''' Constructs a new parse tree for a New expression.
''' </summary>
''' <param name="target">The target type to create.</param>
''' <param name="arguments">The arguments to the constructor.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal target As TypeName, ByVal arguments As ArgumentCollection, ByVal span As Span)
MyBase.New(TreeType.NewExpression, span)
If target Is Nothing Then
Throw New ArgumentNullException("target")
End If
SetParent(target)
SetParent(arguments)
_Target = target
_Arguments = arguments
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
AddChild(childList, Target)
AddChild(childList, Arguments)
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a New expression.
''' </summary>
Public NotInheritable Class NewExpression
Inherits Expression
Private ReadOnly _Target As TypeName
Private ReadOnly _Arguments As ArgumentCollection
''' <summary>
''' The target type to create.
''' </summary>
Public ReadOnly Property Target() As TypeName
Get
Return _Target
End Get
End Property
''' <summary>
''' The arguments to the constructor.
''' </summary>
Public ReadOnly Property Arguments() As ArgumentCollection
Get
Return _Arguments
End Get
End Property
''' <summary>
''' Constructs a new parse tree for a New expression.
''' </summary>
''' <param name="target">The target type to create.</param>
''' <param name="arguments">The arguments to the constructor.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal target As TypeName, ByVal arguments As ArgumentCollection, ByVal span As Span)
MyBase.New(TreeType.NewExpression, span)
If target Is Nothing Then
Throw New ArgumentNullException("target")
End If
SetParent(target)
SetParent(arguments)
_Target = target
_Arguments = arguments
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
AddChild(childList, Target)
AddChild(childList, Arguments)
End Sub
End Class

View file

@ -1,30 +1,30 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for Nothing.
''' </summary>
Public NotInheritable Class NothingExpression
Inherits Expression
Public Overrides ReadOnly Property IsConstant() As Boolean
Get
Return True
End Get
End Property
''' <summary>
''' Constructs a new parse tree for Nothing.
''' </summary>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal span As Span)
MyBase.New(TreeType.NothingExpression, span)
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for Nothing.
''' </summary>
Public NotInheritable Class NothingExpression
Inherits Expression
Public Overrides ReadOnly Property IsConstant() As Boolean
Get
Return True
End Get
End Property
''' <summary>
''' Constructs a new parse tree for Nothing.
''' </summary>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal span As Span)
MyBase.New(TreeType.NothingExpression, span)
End Sub
End Class

View file

@ -1,48 +1,48 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' The type of a unary operator expression.
''' </summary>
Public Enum OperatorType
None
' Unary operators
UnaryPlus
Negate
[Not]
' Binary operators
Plus
Minus
Multiply
Divide
IntegralDivide
Concatenate
ShiftLeft
ShiftRight
Power
Modulus
[Or]
[OrElse]
[And]
[AndAlso]
[Xor]
[Like]
[Is]
[IsNot]
[To]
Equals
NotEquals
LessThan
LessThanEquals
GreaterThan
GreaterThanEquals
End Enum
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' The type of a unary operator expression.
''' </summary>
Public Enum OperatorType
None
' Unary operators
UnaryPlus
Negate
[Not]
' Binary operators
Plus
Minus
Multiply
Divide
IntegralDivide
Concatenate
ShiftLeft
ShiftRight
Power
Modulus
[Or]
[OrElse]
[And]
[AndAlso]
[Xor]
[Like]
[Is]
[IsNot]
[To]
Equals
NotEquals
LessThan
LessThanEquals
GreaterThan
GreaterThanEquals
End Enum

View file

@ -1,39 +1,39 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a parenthesized expression.
''' </summary>
Public NotInheritable Class ParentheticalExpression
Inherits UnaryExpression
Private ReadOnly _RightParenthesisLocation As Location
''' <summary>
''' The location of the ')'.
''' </summary>
Public ReadOnly Property RightParenthesisLocation() As Location
Get
Return _RightParenthesisLocation
End Get
End Property
''' <summary>
''' Constructs a new parenthesized expression parse tree.
''' </summary>
''' <param name="operand">The operand of the expression.</param>
''' <param name="rightParenthesisLocation">The location of the ')'.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal operand As Expression, ByVal rightParenthesisLocation As Location, ByVal span As Span)
MyBase.New(TreeType.ParentheticalExpression, operand, span)
_RightParenthesisLocation = rightParenthesisLocation
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a parenthesized expression.
''' </summary>
Public NotInheritable Class ParentheticalExpression
Inherits UnaryExpression
Private ReadOnly _RightParenthesisLocation As Location
''' <summary>
''' The location of the ')'.
''' </summary>
Public ReadOnly Property RightParenthesisLocation() As Location
Get
Return _RightParenthesisLocation
End Get
End Property
''' <summary>
''' Constructs a new parenthesized expression parse tree.
''' </summary>
''' <param name="operand">The operand of the expression.</param>
''' <param name="rightParenthesisLocation">The location of the ')'.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal operand As Expression, ByVal rightParenthesisLocation As Location, ByVal span As Span)
MyBase.New(TreeType.ParentheticalExpression, operand, span)
_RightParenthesisLocation = rightParenthesisLocation
End Sub
End Class

View file

@ -1,74 +1,74 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a qualified name expression.
''' </summary>
Public NotInheritable Class QualifiedExpression
Inherits Expression
Private ReadOnly _Qualifier As Expression
Private ReadOnly _DotLocation As Location
Private ReadOnly _Name As SimpleName
''' <summary>
''' The expression qualifying the name.
''' </summary>
Public ReadOnly Property Qualifier() As Expression
Get
Return _Qualifier
End Get
End Property
''' <summary>
''' The location of the '.'.
''' </summary>
Public ReadOnly Property DotLocation() As Location
Get
Return _DotLocation
End Get
End Property
''' <summary>
''' The qualified name.
''' </summary>
Public ReadOnly Property Name() As SimpleName
Get
Return _Name
End Get
End Property
''' <summary>
''' Constructs a new parse tree for a qualified name expression.
''' </summary>
''' <param name="qualifier">The expression qualifying the name.</param>
''' <param name="dotLocation">The location of the '.'.</param>
''' <param name="name">The qualified name.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal qualifier As Expression, ByVal dotLocation As Location, ByVal name As SimpleName, ByVal span As Span)
MyBase.New(TreeType.QualifiedExpression, span)
If name Is Nothing Then
Throw New ArgumentNullException("name")
End If
SetParent(qualifier)
SetParent(name)
_Qualifier = qualifier
_DotLocation = dotLocation
_Name = name
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
AddChild(childList, Qualifier)
AddChild(childList, Name)
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a qualified name expression.
''' </summary>
Public NotInheritable Class QualifiedExpression
Inherits Expression
Private ReadOnly _Qualifier As Expression
Private ReadOnly _DotLocation As Location
Private ReadOnly _Name As SimpleName
''' <summary>
''' The expression qualifying the name.
''' </summary>
Public ReadOnly Property Qualifier() As Expression
Get
Return _Qualifier
End Get
End Property
''' <summary>
''' The location of the '.'.
''' </summary>
Public ReadOnly Property DotLocation() As Location
Get
Return _DotLocation
End Get
End Property
''' <summary>
''' The qualified name.
''' </summary>
Public ReadOnly Property Name() As SimpleName
Get
Return _Name
End Get
End Property
''' <summary>
''' Constructs a new parse tree for a qualified name expression.
''' </summary>
''' <param name="qualifier">The expression qualifying the name.</param>
''' <param name="dotLocation">The location of the '.'.</param>
''' <param name="name">The qualified name.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal qualifier As Expression, ByVal dotLocation As Location, ByVal name As SimpleName, ByVal span As Span)
MyBase.New(TreeType.QualifiedExpression, span)
If name Is Nothing Then
Throw New ArgumentNullException("name")
End If
SetParent(qualifier)
SetParent(name)
_Qualifier = qualifier
_DotLocation = dotLocation
_Name = name
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
AddChild(childList, Qualifier)
AddChild(childList, Name)
End Sub
End Class

View file

@ -1,48 +1,48 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a simple name expression.
''' </summary>
Public NotInheritable Class SimpleNameExpression
Inherits Expression
Private ReadOnly _Name As SimpleName
''' <summary>
''' The name.
''' </summary>
Public ReadOnly Property Name() As SimpleName
Get
Return _Name
End Get
End Property
''' <summary>
''' Constructs a new parse tree for a simple name expression.
''' </summary>
''' <param name="name">The name.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal name As SimpleName, ByVal span As Span)
MyBase.New(TreeType.SimpleNameExpression, span)
If name Is Nothing Then
Throw New ArgumentNullException("name")
End If
SetParent(name)
_Name = name
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
AddChild(childList, Name)
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a simple name expression.
''' </summary>
Public NotInheritable Class SimpleNameExpression
Inherits Expression
Private ReadOnly _Name As SimpleName
''' <summary>
''' The name.
''' </summary>
Public ReadOnly Property Name() As SimpleName
Get
Return _Name
End Get
End Property
''' <summary>
''' Constructs a new parse tree for a simple name expression.
''' </summary>
''' <param name="name">The name.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal name As SimpleName, ByVal span As Span)
MyBase.New(TreeType.SimpleNameExpression, span)
If name Is Nothing Then
Throw New ArgumentNullException("name")
End If
SetParent(name)
_Name = name
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
AddChild(childList, Name)
End Sub
End Class

View file

@ -1,49 +1,49 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a string literal expression.
''' </summary>
Public NotInheritable Class StringLiteralExpression
Inherits LiteralExpression
Private ReadOnly _Literal As String
''' <summary>
''' The literal value.
''' </summary>
Public ReadOnly Property Literal() As String
Get
Return _Literal
End Get
End Property
'LC
Public Overrides ReadOnly Property Value() As Object
Get
Return _Literal
End Get
End Property
''' <summary>
''' Constructs a new string literal expression parse tree.
''' </summary>
''' <param name="literal">The literal value.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal literal As String, ByVal span As Span)
MyBase.New(TreeType.StringLiteralExpression, span)
If literal Is Nothing Then
Throw New ArgumentNullException("literal")
End If
_Literal = literal
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a string literal expression.
''' </summary>
Public NotInheritable Class StringLiteralExpression
Inherits LiteralExpression
Private ReadOnly _Literal As String
''' <summary>
''' The literal value.
''' </summary>
Public ReadOnly Property Literal() As String
Get
Return _Literal
End Get
End Property
'LC
Public Overrides ReadOnly Property Value() As Object
Get
Return _Literal
End Get
End Property
''' <summary>
''' Constructs a new string literal expression parse tree.
''' </summary>
''' <param name="literal">The literal value.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal literal As String, ByVal span As Span)
MyBase.New(TreeType.StringLiteralExpression, span)
If literal Is Nothing Then
Throw New ArgumentNullException("literal")
End If
_Literal = literal
End Sub
End Class

View file

@ -1,29 +1,29 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a CType expression.
''' </summary>
Public NotInheritable Class TryCastExpression
Inherits CastTypeExpression
''' <summary>
''' Constructs a new parse tree for a TryCast expression.
''' </summary>
''' <param name="leftParenthesisLocation">The location of the '('.</param>
''' <param name="operand">The expression to be converted.</param>
''' <param name="commaLocation">The location of the ','.</param>
''' <param name="target">The target type of the conversion.</param>
''' <param name="rightParenthesisLocation">The location of the ')'.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal leftParenthesisLocation As Location, ByVal operand As Expression, ByVal commaLocation As Location, ByVal target As TypeName, ByVal rightParenthesisLocation As Location, ByVal span As Span)
MyBase.New(TreeType.TryCastExpression, leftParenthesisLocation, operand, commaLocation, target, rightParenthesisLocation, span)
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a CType expression.
''' </summary>
Public NotInheritable Class TryCastExpression
Inherits CastTypeExpression
''' <summary>
''' Constructs a new parse tree for a TryCast expression.
''' </summary>
''' <param name="leftParenthesisLocation">The location of the '('.</param>
''' <param name="operand">The expression to be converted.</param>
''' <param name="commaLocation">The location of the ','.</param>
''' <param name="target">The target type of the conversion.</param>
''' <param name="rightParenthesisLocation">The location of the ')'.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal leftParenthesisLocation As Location, ByVal operand As Expression, ByVal commaLocation As Location, ByVal target As TypeName, ByVal rightParenthesisLocation As Location, ByVal span As Span)
MyBase.New(TreeType.TryCastExpression, leftParenthesisLocation, operand, commaLocation, target, rightParenthesisLocation, span)
End Sub
End Class

View file

@ -1,62 +1,62 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a TypeOf ... Is expression.
''' </summary>
Public NotInheritable Class TypeOfExpression
Inherits UnaryExpression
Private ReadOnly _IsLocation As Location
Private ReadOnly _Target As TypeName
''' <summary>
''' The location of the 'Is'.
''' </summary>
Public ReadOnly Property IsLocation() As Location
Get
Return _IsLocation
End Get
End Property
''' <summary>
''' The target type for the operand.
''' </summary>
Public ReadOnly Property Target() As TypeName
Get
Return _Target
End Get
End Property
''' <summary>
''' Constructs a new parse tree for a TypeOf ... Is expression.
''' </summary>
''' <param name="operand">The target value.</param>
''' <param name="isLocation">The location of the 'Is'.</param>
''' <param name="target">The target type to check against.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal operand As Expression, ByVal isLocation As Location, ByVal target As TypeName, ByVal span As Span)
MyBase.New(TreeType.TypeOfExpression, operand, span)
If target Is Nothing Then
Throw New ArgumentNullException("target")
End If
SetParent(target)
_Target = target
_IsLocation = isLocation
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
MyBase.GetChildTrees(childList)
AddChild(childList, Target)
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a TypeOf ... Is expression.
''' </summary>
Public NotInheritable Class TypeOfExpression
Inherits UnaryExpression
Private ReadOnly _IsLocation As Location
Private ReadOnly _Target As TypeName
''' <summary>
''' The location of the 'Is'.
''' </summary>
Public ReadOnly Property IsLocation() As Location
Get
Return _IsLocation
End Get
End Property
''' <summary>
''' The target type for the operand.
''' </summary>
Public ReadOnly Property Target() As TypeName
Get
Return _Target
End Get
End Property
''' <summary>
''' Constructs a new parse tree for a TypeOf ... Is expression.
''' </summary>
''' <param name="operand">The target value.</param>
''' <param name="isLocation">The location of the 'Is'.</param>
''' <param name="target">The target type to check against.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal operand As Expression, ByVal isLocation As Location, ByVal target As TypeName, ByVal span As Span)
MyBase.New(TreeType.TypeOfExpression, operand, span)
If target Is Nothing Then
Throw New ArgumentNullException("target")
End If
SetParent(target)
_Target = target
_IsLocation = isLocation
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
MyBase.GetChildTrees(childList)
AddChild(childList, Target)
End Sub
End Class

View file

@ -1,47 +1,47 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for an expression that refers to a type.
''' </summary>
Public NotInheritable Class TypeReferenceExpression
Inherits Expression
Private ReadOnly _TypeName As TypeName
''' <summary>
''' The name of the type being referred to.
''' </summary>
Public ReadOnly Property TypeName() As TypeName
Get
Return _TypeName
End Get
End Property
''' <summary>
''' Constructs a new parse tree for a type reference.
''' </summary>
''' <param name="typeName">The name of the type being referred to.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal typeName As TypeName, ByVal span As Span)
MyBase.New(TreeType.TypeReferenceExpression, span)
If typeName Is Nothing Then
Throw New ArgumentNullException("typeName")
End If
SetParent(typeName)
_TypeName = typeName
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
AddChild(childList, TypeName)
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for an expression that refers to a type.
''' </summary>
Public NotInheritable Class TypeReferenceExpression
Inherits Expression
Private ReadOnly _TypeName As TypeName
''' <summary>
''' The name of the type being referred to.
''' </summary>
Public ReadOnly Property TypeName() As TypeName
Get
Return _TypeName
End Get
End Property
''' <summary>
''' Constructs a new parse tree for a type reference.
''' </summary>
''' <param name="typeName">The name of the type being referred to.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal typeName As TypeName, ByVal span As Span)
MyBase.New(TreeType.TypeReferenceExpression, span)
If typeName Is Nothing Then
Throw New ArgumentNullException("typeName")
End If
SetParent(typeName)
_TypeName = typeName
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
AddChild(childList, TypeName)
End Sub
End Class

View file

@ -1,54 +1,54 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for an expression that has an operand.
''' </summary>
Public MustInherit Class UnaryExpression
Inherits Expression
Private ReadOnly _Operand As Expression
''' <summary>
''' The operand of the expression.
''' </summary>
Public ReadOnly Property Operand() As Expression
Get
Return _Operand
End Get
End Property
Protected Sub New(ByVal type As TreeType, ByVal operand As Expression, ByVal span As Span)
MyBase.New(type, span)
Debug.Assert(type = TreeType.ParentheticalExpression OrElse _
type = TreeType.TypeOfExpression OrElse _
(type = TreeType.CTypeExpression OrElse type = TreeType.DirectCastExpression OrElse type = TreeType.TryCastExpression) OrElse _
type = TreeType.IntrinsicCastExpression OrElse _
(type >= TreeType.UnaryOperatorExpression AndAlso type <= TreeType.AddressOfExpression))
If operand Is Nothing Then
Throw New ArgumentNullException("operand")
End If
SetParent(operand)
_Operand = operand
End Sub
Public Overrides ReadOnly Property IsConstant() As Boolean
Get
Return Operand.IsConstant
End Get
End Property
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
AddChild(childList, Operand)
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for an expression that has an operand.
''' </summary>
Public MustInherit Class UnaryExpression
Inherits Expression
Private ReadOnly _Operand As Expression
''' <summary>
''' The operand of the expression.
''' </summary>
Public ReadOnly Property Operand() As Expression
Get
Return _Operand
End Get
End Property
Protected Sub New(ByVal type As TreeType, ByVal operand As Expression, ByVal span As Span)
MyBase.New(type, span)
Debug.Assert(type = TreeType.ParentheticalExpression OrElse _
type = TreeType.TypeOfExpression OrElse _
(type = TreeType.CTypeExpression OrElse type = TreeType.DirectCastExpression OrElse type = TreeType.TryCastExpression) OrElse _
type = TreeType.IntrinsicCastExpression OrElse _
(type >= TreeType.UnaryOperatorExpression AndAlso type <= TreeType.AddressOfExpression))
If operand Is Nothing Then
Throw New ArgumentNullException("operand")
End If
SetParent(operand)
_Operand = operand
End Sub
Public Overrides ReadOnly Property IsConstant() As Boolean
Get
Return Operand.IsConstant
End Get
End Property
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
AddChild(childList, Operand)
End Sub
End Class

View file

@ -1,43 +1,43 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for an unary operator expression.
''' </summary>
Public NotInheritable Class UnaryOperatorExpression
Inherits UnaryExpression
Private _Operator As OperatorType
''' <summary>
''' The operator.
''' </summary>
Public ReadOnly Property [Operator]() As OperatorType
Get
Return _Operator
End Get
End Property
''' <summary>
''' Constructs a new unary operator expression parse tree.
''' </summary>
''' <param name="operator">The type of the unary operator.</param>
''' <param name="operand">The operand of the operator.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal [operator] As OperatorType, ByVal operand As Expression, ByVal span As Span)
MyBase.New(TreeType.UnaryOperatorExpression, operand, span)
If [operator] < OperatorType.UnaryPlus OrElse [operator] > OperatorType.Not Then
Throw New ArgumentOutOfRangeException("operator")
End If
_Operator = [operator]
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for an unary operator expression.
''' </summary>
Public NotInheritable Class UnaryOperatorExpression
Inherits UnaryExpression
Private _Operator As OperatorType
''' <summary>
''' The operator.
''' </summary>
Public ReadOnly Property [Operator]() As OperatorType
Get
Return _Operator
End Get
End Property
''' <summary>
''' Constructs a new unary operator expression parse tree.
''' </summary>
''' <param name="operator">The type of the unary operator.</param>
''' <param name="operand">The operand of the operator.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal [operator] As OperatorType, ByVal operand As Expression, ByVal span As Span)
MyBase.New(TreeType.UnaryOperatorExpression, operand, span)
If [operator] < OperatorType.UnaryPlus OrElse [operator] > OperatorType.Not Then
Throw New ArgumentOutOfRangeException("operator")
End If
_Operator = [operator]
End Sub
End Class

View file

@ -1,44 +1,44 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for an entire file.
''' </summary>
Public NotInheritable Class File
Inherits Tree
Private ReadOnly _Declarations As DeclarationCollection
''' <summary>
''' The declarations in the file.
''' </summary>
Public ReadOnly Property Declarations() As DeclarationCollection
Get
Return _Declarations
End Get
End Property
''' <summary>
''' Constructs a new file parse tree.
''' </summary>
''' <param name="declarations">The declarations in the file.</param>
''' <param name="span">The location of the tree.</param>
Public Sub New(ByVal declarations As DeclarationCollection, ByVal span As Span)
MyBase.New(TreeType.File, span)
SetParent(declarations)
_Declarations = declarations
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
AddChild(childList, Declarations)
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for an entire file.
''' </summary>
Public NotInheritable Class File
Inherits Tree
Private ReadOnly _Declarations As DeclarationCollection
''' <summary>
''' The declarations in the file.
''' </summary>
Public ReadOnly Property Declarations() As DeclarationCollection
Get
Return _Declarations
End Get
End Property
''' <summary>
''' Constructs a new file parse tree.
''' </summary>
''' <param name="declarations">The declarations in the file.</param>
''' <param name="span">The location of the tree.</param>
Public Sub New(ByVal declarations As DeclarationCollection, ByVal span As Span)
MyBase.New(TreeType.File, span)
SetParent(declarations)
_Declarations = declarations
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
AddChild(childList, Declarations)
End Sub
End Class

View file

@ -1,51 +1,51 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for an Imports declaration.
''' </summary>
Public NotInheritable Class ImportsDeclaration
Inherits Declaration
Private ReadOnly _ImportMembers As ImportCollection
''' <summary>
''' The members imported.
''' </summary>
Public ReadOnly Property ImportMembers() As ImportCollection
Get
Return _ImportMembers
End Get
End Property
''' <summary>
''' Constructs a parse tree for an Imports declaration.
''' </summary>
''' <param name="importMembers">The members imported.</param>
''' <param name="span">The location of the parse tree.</param>
''' <param name="comments">The comments for the parse tree.</param>
Public Sub New(ByVal importMembers As ImportCollection, ByVal span As Span, ByVal comments As IList(Of Comment))
MyBase.New(TreeType.ImportsDeclaration, span, comments)
If importMembers Is Nothing Then
Throw New ArgumentNullException("importMembers")
End If
SetParent(importMembers)
_ImportMembers = importMembers
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
MyBase.GetChildTrees(childList)
AddChild(childList, ImportMembers)
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for an Imports declaration.
''' </summary>
Public NotInheritable Class ImportsDeclaration
Inherits Declaration
Private ReadOnly _ImportMembers As ImportCollection
''' <summary>
''' The members imported.
''' </summary>
Public ReadOnly Property ImportMembers() As ImportCollection
Get
Return _ImportMembers
End Get
End Property
''' <summary>
''' Constructs a parse tree for an Imports declaration.
''' </summary>
''' <param name="importMembers">The members imported.</param>
''' <param name="span">The location of the parse tree.</param>
''' <param name="comments">The comments for the parse tree.</param>
Public Sub New(ByVal importMembers As ImportCollection, ByVal span As Span, ByVal comments As IList(Of Comment))
MyBase.New(TreeType.ImportsDeclaration, span, comments)
If importMembers Is Nothing Then
Throw New ArgumentNullException("importMembers")
End If
SetParent(importMembers)
_ImportMembers = importMembers
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
MyBase.GetChildTrees(childList)
AddChild(childList, ImportMembers)
End Sub
End Class

View file

@ -1,93 +1,93 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a namespace declaration.
''' </summary>
Public NotInheritable Class NamespaceDeclaration
Inherits ModifiedDeclaration
Private ReadOnly _NamespaceLocation As Location
Private ReadOnly _Name As Name
Private ReadOnly _Declarations As DeclarationCollection
Private ReadOnly _EndDeclaration As EndBlockDeclaration
''' <summary>
''' The location of 'Namespace'.
''' </summary>
Public ReadOnly Property NamespaceLocation() As Location
Get
Return _NamespaceLocation
End Get
End Property
''' <summary>
''' The name of the namespace.
''' </summary>
Public ReadOnly Property Name() As Name
Get
Return _Name
End Get
End Property
''' <summary>
''' The declarations in the namespace.
''' </summary>
Public ReadOnly Property Declarations() As DeclarationCollection
Get
Return _Declarations
End Get
End Property
''' <summary>
''' The End Namespace declaration, if any.
''' </summary>
Public ReadOnly Property EndDeclaration() As EndBlockDeclaration
Get
Return _EndDeclaration
End Get
End Property
''' <summary>
''' Constructs a parse tree for a namespace declaration.
''' </summary>
''' <param name="attributes">The attributes on the declaration.</param>
''' <param name="modifiers">The modifiers on the declaration.</param>
''' <param name="namespaceLocation">The location of 'Namespace'.</param>
''' <param name="name">The name of the namespace.</param>
''' <param name="declarations">The declarations in the namespace.</param>
''' <param name="endDeclaration">The End Namespace statement, if any.</param>
''' <param name="span">The location of the parse tree.</param>
''' <param name="comments">The comments for the parse tree.</param>
Public Sub New(ByVal attributes As AttributeBlockCollection, ByVal modifiers As ModifierCollection, ByVal namespaceLocation As Location, ByVal name As Name, ByVal declarations As DeclarationCollection, ByVal endDeclaration As EndBlockDeclaration, ByVal span As Span, ByVal comments As IList(Of Comment))
MyBase.New(TreeType.NamespaceDeclaration, attributes, modifiers, span, comments)
If name Is Nothing Then
Throw New ArgumentNullException("name")
End If
SetParent(name)
SetParent(declarations)
SetParent(endDeclaration)
_NamespaceLocation = namespaceLocation
_Name = name
_Declarations = declarations
_EndDeclaration = endDeclaration
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
MyBase.GetChildTrees(childList)
AddChild(childList, Name)
AddChild(childList, Declarations)
AddChild(childList, EndDeclaration)
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a namespace declaration.
''' </summary>
Public NotInheritable Class NamespaceDeclaration
Inherits ModifiedDeclaration
Private ReadOnly _NamespaceLocation As Location
Private ReadOnly _Name As Name
Private ReadOnly _Declarations As DeclarationCollection
Private ReadOnly _EndDeclaration As EndBlockDeclaration
''' <summary>
''' The location of 'Namespace'.
''' </summary>
Public ReadOnly Property NamespaceLocation() As Location
Get
Return _NamespaceLocation
End Get
End Property
''' <summary>
''' The name of the namespace.
''' </summary>
Public ReadOnly Property Name() As Name
Get
Return _Name
End Get
End Property
''' <summary>
''' The declarations in the namespace.
''' </summary>
Public ReadOnly Property Declarations() As DeclarationCollection
Get
Return _Declarations
End Get
End Property
''' <summary>
''' The End Namespace declaration, if any.
''' </summary>
Public ReadOnly Property EndDeclaration() As EndBlockDeclaration
Get
Return _EndDeclaration
End Get
End Property
''' <summary>
''' Constructs a parse tree for a namespace declaration.
''' </summary>
''' <param name="attributes">The attributes on the declaration.</param>
''' <param name="modifiers">The modifiers on the declaration.</param>
''' <param name="namespaceLocation">The location of 'Namespace'.</param>
''' <param name="name">The name of the namespace.</param>
''' <param name="declarations">The declarations in the namespace.</param>
''' <param name="endDeclaration">The End Namespace statement, if any.</param>
''' <param name="span">The location of the parse tree.</param>
''' <param name="comments">The comments for the parse tree.</param>
Public Sub New(ByVal attributes As AttributeBlockCollection, ByVal modifiers As ModifierCollection, ByVal namespaceLocation As Location, ByVal name As Name, ByVal declarations As DeclarationCollection, ByVal endDeclaration As EndBlockDeclaration, ByVal span As Span, ByVal comments As IList(Of Comment))
MyBase.New(TreeType.NamespaceDeclaration, attributes, modifiers, span, comments)
If name Is Nothing Then
Throw New ArgumentNullException("name")
End If
SetParent(name)
SetParent(declarations)
SetParent(endDeclaration)
_NamespaceLocation = namespaceLocation
_Name = name
_Declarations = declarations
_EndDeclaration = endDeclaration
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
MyBase.GetChildTrees(childList)
AddChild(childList, Name)
AddChild(childList, Declarations)
AddChild(childList, EndDeclaration)
End Sub
End Class

View file

@ -1,67 +1,67 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for an Option declaration.
''' </summary>
Public NotInheritable Class OptionDeclaration
Inherits Declaration
Private ReadOnly _OptionType As OptionType
Private ReadOnly _OptionTypeLocation As Location
Private ReadOnly _OptionArgumentLocation As Location
''' <summary>
''' The type of Option statement.
''' </summary>
Public ReadOnly Property OptionType() As OptionType
Get
Return _OptionType
End Get
End Property
''' <summary>
''' The location of the Option type (e.g. "Strict"), if any.
''' </summary>
Public ReadOnly Property OptionTypeLocation() As Location
Get
Return _OptionTypeLocation
End Get
End Property
''' <summary>
''' The location of the Option argument (e.g. "On"), if any.
''' </summary>
Public ReadOnly Property OptionArgumentLocation() As Location
Get
Return _OptionArgumentLocation
End Get
End Property
''' <summary>
''' Constructs a new parse tree for an Option declaration.
''' </summary>
''' <param name="optionType">The type of the Option declaration.</param>
''' <param name="optionTypeLocation">The location of the Option type, if any.</param>
''' <param name="optionArgumentLocation">The location of the Option argument, if any.</param>
''' <param name="span">The location of the parse tree.</param>
''' <param name="comments">The comments for the parse tree.</param>
Public Sub New(ByVal optionType As OptionType, ByVal optionTypeLocation As Location, ByVal optionArgumentLocation As Location, ByVal span As Span, ByVal comments As IList(Of Comment))
MyBase.New(TreeType.OptionDeclaration, span, comments)
If optionType < optionType.SyntaxError OrElse optionType > optionType.CompareText Then
Throw New ArgumentOutOfRangeException("optionType")
End If
_OptionType = optionType
_OptionTypeLocation = optionTypeLocation
_OptionArgumentLocation = optionArgumentLocation
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for an Option declaration.
''' </summary>
Public NotInheritable Class OptionDeclaration
Inherits Declaration
Private ReadOnly _OptionType As OptionType
Private ReadOnly _OptionTypeLocation As Location
Private ReadOnly _OptionArgumentLocation As Location
''' <summary>
''' The type of Option statement.
''' </summary>
Public ReadOnly Property OptionType() As OptionType
Get
Return _OptionType
End Get
End Property
''' <summary>
''' The location of the Option type (e.g. "Strict"), if any.
''' </summary>
Public ReadOnly Property OptionTypeLocation() As Location
Get
Return _OptionTypeLocation
End Get
End Property
''' <summary>
''' The location of the Option argument (e.g. "On"), if any.
''' </summary>
Public ReadOnly Property OptionArgumentLocation() As Location
Get
Return _OptionArgumentLocation
End Get
End Property
''' <summary>
''' Constructs a new parse tree for an Option declaration.
''' </summary>
''' <param name="optionType">The type of the Option declaration.</param>
''' <param name="optionTypeLocation">The location of the Option type, if any.</param>
''' <param name="optionArgumentLocation">The location of the Option argument, if any.</param>
''' <param name="span">The location of the parse tree.</param>
''' <param name="comments">The comments for the parse tree.</param>
Public Sub New(ByVal optionType As OptionType, ByVal optionTypeLocation As Location, ByVal optionArgumentLocation As Location, ByVal span As Span, ByVal comments As IList(Of Comment))
MyBase.New(TreeType.OptionDeclaration, span, comments)
If optionType < optionType.SyntaxError OrElse optionType > optionType.CompareText Then
Throw New ArgumentOutOfRangeException("optionType")
End If
_OptionType = optionType
_OptionTypeLocation = optionTypeLocation
_OptionArgumentLocation = optionArgumentLocation
End Sub
End Class

View file

@ -1,24 +1,24 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' The type of an Option declaration.
''' </summary>
Public Enum OptionType
SyntaxError
Explicit
ExplicitOn
ExplicitOff
Strict
StrictOn
StrictOff
CompareBinary
CompareText
End Enum
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' The type of an Option declaration.
''' </summary>
Public Enum OptionType
SyntaxError
Explicit
ExplicitOn
ExplicitOff
Strict
StrictOn
StrictOff
CompareBinary
CompareText
End Enum

View file

@ -1,32 +1,32 @@
'LC Represent a script file
Public Class ScriptBlock
Inherits Tree
Private ReadOnly _statements As StatementCollection
''' <summary>
''' The declarations in the file.
''' </summary>
Public ReadOnly Property Statements() As StatementCollection
Get
Return _statements
End Get
End Property
''' <summary>
''' Constructs a new file parse tree.
''' </summary>
''' <param name="statements">The statements in the file.</param>
''' <param name="span">The location of the tree.</param>
Public Sub New(ByVal statements As StatementCollection, ByVal span As Span)
MyBase.New(TreeType.ScriptBlock, span)
SetParent(statements)
_statements = statements
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
AddChild(childList, _statements)
End Sub
End Class
'LC Represent a script file
Public Class ScriptBlock
Inherits Tree
Private ReadOnly _statements As StatementCollection
''' <summary>
''' The declarations in the file.
''' </summary>
Public ReadOnly Property Statements() As StatementCollection
Get
Return _statements
End Get
End Property
''' <summary>
''' Constructs a new file parse tree.
''' </summary>
''' <param name="statements">The statements in the file.</param>
''' <param name="span">The location of the tree.</param>
Public Sub New(ByVal statements As StatementCollection, ByVal span As Span)
MyBase.New(TreeType.ScriptBlock, span)
SetParent(statements)
_statements = statements
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
AddChild(childList, _statements)
End Sub
End Class

View file

@ -1,79 +1,79 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for an Imports statement that aliases a type or namespace.
''' </summary>
Public NotInheritable Class AliasImport
Inherits Import
Private ReadOnly _Name As SimpleName
Private ReadOnly _EqualsLocation As Location
Private ReadOnly _AliasedTypeName As TypeName
''' <summary>
''' The alias name.
''' </summary>
Public ReadOnly Property Name() As SimpleName
Get
Return _Name
End Get
End Property
''' <summary>
''' The location of the '='.
''' </summary>
Public ReadOnly Property EqualsLocation() As Location
Get
Return _EqualsLocation
End Get
End Property
''' <summary>
''' The name being aliased.
''' </summary>
Public ReadOnly Property AliasedTypeName() As TypeName
Get
Return _AliasedTypeName
End Get
End Property
''' <summary>
''' Constructs a new aliased import parse tree.
''' </summary>
''' <param name="name">The name of the alias.</param>
''' <param name="equalsLocation">The location of the '='.</param>
''' <param name="aliasedTypeName">The name being aliased.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal name As SimpleName, ByVal equalsLocation As Location, ByVal aliasedTypeName As TypeName, ByVal span As Span)
MyBase.New(TreeType.AliasImport, span)
If aliasedTypeName Is Nothing Then
Throw New ArgumentNullException("aliasedTypeName")
End If
If name Is Nothing Then
Throw New ArgumentNullException("name")
End If
SetParent(name)
SetParent(aliasedTypeName)
_Name = name
_EqualsLocation = equalsLocation
_AliasedTypeName = aliasedTypeName
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
MyBase.GetChildTrees(childList)
AddChild(childList, AliasedTypeName)
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for an Imports statement that aliases a type or namespace.
''' </summary>
Public NotInheritable Class AliasImport
Inherits Import
Private ReadOnly _Name As SimpleName
Private ReadOnly _EqualsLocation As Location
Private ReadOnly _AliasedTypeName As TypeName
''' <summary>
''' The alias name.
''' </summary>
Public ReadOnly Property Name() As SimpleName
Get
Return _Name
End Get
End Property
''' <summary>
''' The location of the '='.
''' </summary>
Public ReadOnly Property EqualsLocation() As Location
Get
Return _EqualsLocation
End Get
End Property
''' <summary>
''' The name being aliased.
''' </summary>
Public ReadOnly Property AliasedTypeName() As TypeName
Get
Return _AliasedTypeName
End Get
End Property
''' <summary>
''' Constructs a new aliased import parse tree.
''' </summary>
''' <param name="name">The name of the alias.</param>
''' <param name="equalsLocation">The location of the '='.</param>
''' <param name="aliasedTypeName">The name being aliased.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal name As SimpleName, ByVal equalsLocation As Location, ByVal aliasedTypeName As TypeName, ByVal span As Span)
MyBase.New(TreeType.AliasImport, span)
If aliasedTypeName Is Nothing Then
Throw New ArgumentNullException("aliasedTypeName")
End If
If name Is Nothing Then
Throw New ArgumentNullException("name")
End If
SetParent(name)
SetParent(aliasedTypeName)
_Name = name
_EqualsLocation = equalsLocation
_AliasedTypeName = aliasedTypeName
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
MyBase.GetChildTrees(childList)
AddChild(childList, AliasedTypeName)
End Sub
End Class

View file

@ -1,22 +1,22 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for an Imports statement.
''' </summary>
Public MustInherit Class Import
Inherits Tree
Protected Sub New(ByVal type As TreeType, ByVal span As Span)
MyBase.New(type, span)
Debug.Assert(type = TreeType.AliasImport OrElse type = TreeType.NameImport)
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for an Imports statement.
''' </summary>
Public MustInherit Class Import
Inherits Tree
Protected Sub New(ByVal type As TreeType, ByVal span As Span)
MyBase.New(type, span)
Debug.Assert(type = TreeType.AliasImport OrElse type = TreeType.NameImport)
End Sub
End Class

View file

@ -1,31 +1,31 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A read-only collection of imports.
''' </summary>
Public NotInheritable Class ImportCollection
Inherits CommaDelimitedTreeCollection(Of Import)
''' <summary>
''' Constructs a collection of imports.
''' </summary>
''' <param name="importMembers">The imports in the collection.</param>
''' <param name="commaLocations">The location of the commas.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal importMembers As IList(Of Import), ByVal commaLocations As IList(Of Location), ByVal span As Span)
MyBase.New(TreeType.ImportCollection, importMembers, commaLocations, span)
If importMembers Is Nothing OrElse importMembers.Count = 0 Then
Throw New ArgumentException("ImportCollection cannot be empty.")
End If
End Sub
End Class
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A read-only collection of imports.
''' </summary>
Public NotInheritable Class ImportCollection
Inherits CommaDelimitedTreeCollection(Of Import)
''' <summary>
''' Constructs a collection of imports.
''' </summary>
''' <param name="importMembers">The imports in the collection.</param>
''' <param name="commaLocations">The location of the commas.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal importMembers As IList(Of Import), ByVal commaLocations As IList(Of Location), ByVal span As Span)
MyBase.New(TreeType.ImportCollection, importMembers, commaLocations, span)
If importMembers Is Nothing OrElse importMembers.Count = 0 Then
Throw New ArgumentException("ImportCollection cannot be empty.")
End If
End Sub
End Class

View file

@ -1,48 +1,48 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for an Imports statement for a name.
''' </summary>
Public NotInheritable Class NameImport
Inherits Import
Private ReadOnly _TypeName As TypeName
''' <summary>
''' The imported name.
''' </summary>
Public ReadOnly Property TypeName() As TypeName
Get
Return _TypeName
End Get
End Property
''' <summary>
''' Constructs a new name import parse tree.
''' </summary>
''' <param name="typeName">The name to import.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal typeName As TypeName, ByVal span As Span)
MyBase.New(TreeType.NameImport, span)
If typeName Is Nothing Then
Throw New ArgumentNullException("typeName")
End If
SetParent(typeName)
_TypeName = typeName
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
AddChild(childList, TypeName)
End Sub
End Class
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for an Imports statement for a name.
''' </summary>
Public NotInheritable Class NameImport
Inherits Import
Private ReadOnly _TypeName As TypeName
''' <summary>
''' The imported name.
''' </summary>
Public ReadOnly Property TypeName() As TypeName
Get
Return _TypeName
End Get
End Property
''' <summary>
''' Constructs a new name import parse tree.
''' </summary>
''' <param name="typeName">The name to import.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal typeName As TypeName, ByVal span As Span)
MyBase.New(TreeType.NameImport, span)
If typeName Is Nothing Then
Throw New ArgumentNullException("typeName")
End If
SetParent(typeName)
_TypeName = typeName
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
AddChild(childList, TypeName)
End Sub
End Class

View file

@ -1,47 +1,47 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for an aggregate initializer.
''' </summary>
Public NotInheritable Class AggregateInitializer
Inherits Initializer
Private ReadOnly _Elements As InitializerCollection
''' <summary>
''' The elements of the aggregate initializer.
''' </summary>
Public ReadOnly Property Elements() As InitializerCollection
Get
Return _Elements
End Get
End Property
''' <summary>
''' Constructs a new aggregate initializer parse tree.
''' </summary>
''' <param name="elements">The elements of the aggregate initializer.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal elements As InitializerCollection, ByVal span As Span)
MyBase.New(TreeType.AggregateInitializer, span)
If elements Is Nothing Then
Throw New ArgumentNullException("elements")
End If
SetParent(elements)
_Elements = elements
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
AddChild(childList, Elements)
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for an aggregate initializer.
''' </summary>
Public NotInheritable Class AggregateInitializer
Inherits Initializer
Private ReadOnly _Elements As InitializerCollection
''' <summary>
''' The elements of the aggregate initializer.
''' </summary>
Public ReadOnly Property Elements() As InitializerCollection
Get
Return _Elements
End Get
End Property
''' <summary>
''' Constructs a new aggregate initializer parse tree.
''' </summary>
''' <param name="elements">The elements of the aggregate initializer.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal elements As InitializerCollection, ByVal span As Span)
MyBase.New(TreeType.AggregateInitializer, span)
If elements Is Nothing Then
Throw New ArgumentNullException("elements")
End If
SetParent(elements)
_Elements = elements
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
AddChild(childList, Elements)
End Sub
End Class

View file

@ -1,48 +1,48 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for an expression initializer.
''' </summary>
Public NotInheritable Class ExpressionInitializer
Inherits Initializer
Private ReadOnly _Expression As Expression
''' <summary>
''' The expression.
''' </summary>
Public ReadOnly Property Expression() As Expression
Get
Return _Expression
End Get
End Property
''' <summary>
''' Constructs a new expression initializer parse tree.
''' </summary>
''' <param name="expression">The expression.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal expression As Expression, ByVal span As Span)
MyBase.New(TreeType.ExpressionInitializer, span)
If expression Is Nothing Then
Throw New ArgumentNullException("expression")
End If
SetParent(expression)
_Expression = expression
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
AddChild(childList, Expression)
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for an expression initializer.
''' </summary>
Public NotInheritable Class ExpressionInitializer
Inherits Initializer
Private ReadOnly _Expression As Expression
''' <summary>
''' The expression.
''' </summary>
Public ReadOnly Property Expression() As Expression
Get
Return _Expression
End Get
End Property
''' <summary>
''' Constructs a new expression initializer parse tree.
''' </summary>
''' <param name="expression">The expression.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal expression As Expression, ByVal span As Span)
MyBase.New(TreeType.ExpressionInitializer, span)
If expression Is Nothing Then
Throw New ArgumentNullException("expression")
End If
SetParent(expression)
_Expression = expression
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
AddChild(childList, Expression)
End Sub
End Class

View file

@ -1,22 +1,22 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for an initializer.
''' </summary>
Public MustInherit Class Initializer
Inherits Tree
Protected Sub New(ByVal type As TreeType, ByVal span As Span)
MyBase.New(type, span)
Debug.Assert(type = TreeType.ExpressionInitializer OrElse type = TreeType.AggregateInitializer)
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for an initializer.
''' </summary>
Public MustInherit Class Initializer
Inherits Tree
Protected Sub New(ByVal type As TreeType, ByVal span As Span)
MyBase.New(type, span)
Debug.Assert(type = TreeType.ExpressionInitializer OrElse type = TreeType.AggregateInitializer)
End Sub
End Class

View file

@ -1,38 +1,38 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A read-only collection of initializers.
''' </summary>
Public NotInheritable Class InitializerCollection
Inherits CommaDelimitedTreeCollection(Of Initializer)
Private ReadOnly _RightCurlyBraceLocation As Location
''' <summary>
''' The location of the '}'.
''' </summary>
Public ReadOnly Property RightCurlyBraceLocation() As Location
Get
Return _RightCurlyBraceLocation
End Get
End Property
''' <summary>
''' Constructs a new initializer collection.
''' </summary>
''' <param name="initializers">The initializers in the collection.</param>
''' <param name="commaLocations">The locations of the commas in the collection.</param>
''' <param name="rightCurlyBraceLocation">The location of the '}'.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal initializers As IList(Of Initializer), ByVal commaLocations As IList(Of Location), ByVal rightCurlyBraceLocation As Location, ByVal span As Span)
MyBase.New(TreeType.InitializerCollection, initializers, commaLocations, span)
_RightCurlyBraceLocation = rightCurlyBraceLocation
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A read-only collection of initializers.
''' </summary>
Public NotInheritable Class InitializerCollection
Inherits CommaDelimitedTreeCollection(Of Initializer)
Private ReadOnly _RightCurlyBraceLocation As Location
''' <summary>
''' The location of the '}'.
''' </summary>
Public ReadOnly Property RightCurlyBraceLocation() As Location
Get
Return _RightCurlyBraceLocation
End Get
End Property
''' <summary>
''' Constructs a new initializer collection.
''' </summary>
''' <param name="initializers">The initializers in the collection.</param>
''' <param name="commaLocations">The locations of the commas in the collection.</param>
''' <param name="rightCurlyBraceLocation">The location of the '}'.</param>
''' <param name="span">The location of the parse tree.</param>
Public Sub New(ByVal initializers As IList(Of Initializer), ByVal commaLocations As IList(Of Location), ByVal rightCurlyBraceLocation As Location, ByVal span As Span)
MyBase.New(TreeType.InitializerCollection, initializers, commaLocations, span)
_RightCurlyBraceLocation = rightCurlyBraceLocation
End Sub
End Class

View file

@ -1,31 +1,31 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' The type of an intrinsic type name.
''' </summary>
Public Enum IntrinsicType
[Boolean]
[SByte]
[Byte]
[Short]
[UShort]
[Integer]
[UInteger]
[Long]
[ULong]
[Decimal]
[Single]
[Double]
[Date]
[Char]
[String]
[Object]
End Enum
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' The type of an intrinsic type name.
''' </summary>
Public Enum IntrinsicType
[Boolean]
[SByte]
[Byte]
[Short]
[UShort]
[Integer]
[UInteger]
[Long]
[ULong]
[Decimal]
[Single]
[Double]
[Date]
[Char]
[String]
[Object]
End Enum

View file

@ -1,88 +1,88 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a AddHandler property accessor.
''' </summary>
Public NotInheritable Class AddHandlerAccessorDeclaration
Inherits ModifiedDeclaration
Private ReadOnly _AddHandlerLocation As Location
Private ReadOnly _Parameters As ParameterCollection
Private ReadOnly _Statements As StatementCollection
Private ReadOnly _EndStatement As EndBlockDeclaration
''' <summary>
''' The location of the 'AddHandler'.
''' </summary>
Public ReadOnly Property AddHandlerLocation() As Location
Get
Return _AddHandlerLocation
End Get
End Property
''' <summary>
''' The accessor's parameters.
''' </summary>
Public ReadOnly Property Parameters() As ParameterCollection
Get
Return _Parameters
End Get
End Property
''' <summary>
''' The statements in the accessor.
''' </summary>
Public ReadOnly Property Statements() As StatementCollection
Get
Return _Statements
End Get
End Property
''' <summary>
''' The End declaration for the accessor.
''' </summary>
Public ReadOnly Property EndStatement() As EndBlockDeclaration
Get
Return _EndStatement
End Get
End Property
''' <summary>
''' Constructs a new parse tree for a property accessor.
''' </summary>
''' <param name="attributes">The attributes for the parse tree.</param>
''' <param name="addHandlerLocation">The location of the 'AddHandler'.</param>
''' <param name="parameters">The parameters of the declaration.</param>
''' <param name="statements">The statements in the declaration.</param>
''' <param name="endStatement">The end block declaration, if any.</param>
''' <param name="span">The location of the parse tree.</param>
''' <param name="comments">The comments for the parse tree.</param>
Public Sub New(ByVal attributes As AttributeBlockCollection, ByVal addHandlerLocation As Location, ByVal parameters As ParameterCollection, ByVal statements As StatementCollection, ByVal endStatement As EndBlockDeclaration, ByVal span As Span, ByVal comments As IList(Of Comment))
MyBase.New(TreeType.AddHandlerAccessorDeclaration, attributes, Nothing, span, comments)
SetParent(parameters)
SetParent(statements)
SetParent(endStatement)
_Parameters = parameters
_AddHandlerLocation = addHandlerLocation
_Statements = statements
_EndStatement = endStatement
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
MyBase.GetChildTrees(childList)
AddChild(childList, Parameters)
AddChild(childList, Statements)
AddChild(childList, EndStatement)
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a AddHandler property accessor.
''' </summary>
Public NotInheritable Class AddHandlerAccessorDeclaration
Inherits ModifiedDeclaration
Private ReadOnly _AddHandlerLocation As Location
Private ReadOnly _Parameters As ParameterCollection
Private ReadOnly _Statements As StatementCollection
Private ReadOnly _EndStatement As EndBlockDeclaration
''' <summary>
''' The location of the 'AddHandler'.
''' </summary>
Public ReadOnly Property AddHandlerLocation() As Location
Get
Return _AddHandlerLocation
End Get
End Property
''' <summary>
''' The accessor's parameters.
''' </summary>
Public ReadOnly Property Parameters() As ParameterCollection
Get
Return _Parameters
End Get
End Property
''' <summary>
''' The statements in the accessor.
''' </summary>
Public ReadOnly Property Statements() As StatementCollection
Get
Return _Statements
End Get
End Property
''' <summary>
''' The End declaration for the accessor.
''' </summary>
Public ReadOnly Property EndStatement() As EndBlockDeclaration
Get
Return _EndStatement
End Get
End Property
''' <summary>
''' Constructs a new parse tree for a property accessor.
''' </summary>
''' <param name="attributes">The attributes for the parse tree.</param>
''' <param name="addHandlerLocation">The location of the 'AddHandler'.</param>
''' <param name="parameters">The parameters of the declaration.</param>
''' <param name="statements">The statements in the declaration.</param>
''' <param name="endStatement">The end block declaration, if any.</param>
''' <param name="span">The location of the parse tree.</param>
''' <param name="comments">The comments for the parse tree.</param>
Public Sub New(ByVal attributes As AttributeBlockCollection, ByVal addHandlerLocation As Location, ByVal parameters As ParameterCollection, ByVal statements As StatementCollection, ByVal endStatement As EndBlockDeclaration, ByVal span As Span, ByVal comments As IList(Of Comment))
MyBase.New(TreeType.AddHandlerAccessorDeclaration, attributes, Nothing, span, comments)
SetParent(parameters)
SetParent(statements)
SetParent(endStatement)
_Parameters = parameters
_AddHandlerLocation = addHandlerLocation
_Statements = statements
_EndStatement = endStatement
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
MyBase.GetChildTrees(childList)
AddChild(childList, Parameters)
AddChild(childList, Statements)
AddChild(childList, EndStatement)
End Sub
End Class

View file

@ -1,18 +1,18 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' The character set of a Declare statement.
''' </summary>
Public Enum Charset
Ansi
Unicode
Auto
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' The character set of a Declare statement.
''' </summary>
Public Enum Charset
Ansi
Unicode
Auto
End Enum

View file

@ -1,32 +1,32 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a constructor declaration.
''' </summary>
Public NotInheritable Class ConstructorDeclaration
Inherits MethodDeclaration
''' <summary>
''' Creates a new parse tree for a constructor declaration.
''' </summary>
''' <param name="attributes">The attributes for the parse tree.</param>
''' <param name="modifiers">The modifiers for the parse tree.</param>
''' <param name="keywordLocation">The location of the keyword.</param>
''' <param name="name">The name of the declaration.</param>
''' <param name="parameters">The parameters of the declaration.</param>
''' <param name="statements">The statements in the declaration.</param>
''' <param name="endDeclaration">The end block declaration, if any.</param>
''' <param name="span">The location of the parse tree.</param>
''' <param name="comments">The comments for the parse tree.</param>
Public Sub New(ByVal attributes As AttributeBlockCollection, ByVal modifiers As ModifierCollection, ByVal keywordLocation As Location, ByVal name As SimpleName, ByVal parameters As ParameterCollection, ByVal statements As StatementCollection, ByVal endDeclaration As EndBlockDeclaration, ByVal span As Span, ByVal comments As IList(Of Comment))
MyBase.New(TreeType.ConstructorDeclaration, attributes, modifiers, keywordLocation, name, Nothing, parameters, Nothing, Nothing, Nothing, Nothing, Nothing, statements, endDeclaration, span, comments)
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a constructor declaration.
''' </summary>
Public NotInheritable Class ConstructorDeclaration
Inherits MethodDeclaration
''' <summary>
''' Creates a new parse tree for a constructor declaration.
''' </summary>
''' <param name="attributes">The attributes for the parse tree.</param>
''' <param name="modifiers">The modifiers for the parse tree.</param>
''' <param name="keywordLocation">The location of the keyword.</param>
''' <param name="name">The name of the declaration.</param>
''' <param name="parameters">The parameters of the declaration.</param>
''' <param name="statements">The statements in the declaration.</param>
''' <param name="endDeclaration">The end block declaration, if any.</param>
''' <param name="span">The location of the parse tree.</param>
''' <param name="comments">The comments for the parse tree.</param>
Public Sub New(ByVal attributes As AttributeBlockCollection, ByVal modifiers As ModifierCollection, ByVal keywordLocation As Location, ByVal name As SimpleName, ByVal parameters As ParameterCollection, ByVal statements As StatementCollection, ByVal endDeclaration As EndBlockDeclaration, ByVal span As Span, ByVal comments As IList(Of Comment))
MyBase.New(TreeType.ConstructorDeclaration, attributes, modifiers, keywordLocation, name, Nothing, parameters, Nothing, Nothing, Nothing, Nothing, Nothing, statements, endDeclaration, span, comments)
End Sub
End Class

View file

@ -1,92 +1,92 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a custom event declaration.
''' </summary>
Public NotInheritable Class CustomEventDeclaration
Inherits SignatureDeclaration
Private ReadOnly _CustomLocation As Location
Private ReadOnly _ImplementsList As NameCollection
Private ReadOnly _Accessors As DeclarationCollection
Private ReadOnly _EndDeclaration As EndBlockDeclaration
''' <summary>
''' The location of the 'Custom' keyword.
''' </summary>
Public ReadOnly Property CustomLocation() As Location
Get
Return _CustomLocation
End Get
End Property
''' <summary>
''' The list of implemented members.
''' </summary>
Public ReadOnly Property ImplementsList() As NameCollection
Get
Return _ImplementsList
End Get
End Property
''' <summary>
''' The event accessors.
''' </summary>
Public ReadOnly Property Accessors() As DeclarationCollection
Get
Return _Accessors
End Get
End Property
''' <summary>
''' The End Event declaration, if any.
''' </summary>
Public ReadOnly Property EndDeclaration() As EndBlockDeclaration
Get
Return _EndDeclaration
End Get
End Property
''' <summary>
''' Constructs a new parse tree for a custom property declaration.
''' </summary>
''' <param name="attributes">The attributes on the declaration.</param>
''' <param name="modifiers">The modifiers on the declaration.</param>
''' <param name="customLocation">The location of the 'Custom' keyword.</param>
''' <param name="keywordLocation">The location of the keyword.</param>
''' <param name="name">The name of the custom event.</param>
''' <param name="asLocation">The location of the 'As', if any.</param>
''' <param name="resultType">The result type, if any.</param>
''' <param name="implementsList">The implements list.</param>
''' <param name="accessors">The custom event accessors.</param>
''' <param name="endDeclaration">The End Event declaration, if any.</param>
''' <param name="span">The location of the parse tree.</param>
''' <param name="comments">The comments for the parse tree.</param>
Public Sub New(ByVal attributes As AttributeBlockCollection, ByVal modifiers As ModifierCollection, ByVal customLocation As Location, ByVal keywordLocation As Location, ByVal name As SimpleName, ByVal asLocation As Location, ByVal resultType As TypeName, ByVal implementsList As NameCollection, ByVal accessors As DeclarationCollection, ByVal endDeclaration As EndBlockDeclaration, ByVal span As Span, ByVal comments As IList(Of Comment))
MyBase.New(TreeType.CustomEventDeclaration, attributes, modifiers, keywordLocation, name, Nothing, Nothing, asLocation, Nothing, resultType, span, comments)
SetParent(accessors)
SetParent(endDeclaration)
SetParent(implementsList)
_CustomLocation = customLocation
_ImplementsList = implementsList
_Accessors = accessors
_EndDeclaration = endDeclaration
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
MyBase.GetChildTrees(childList)
AddChild(childList, ImplementsList)
AddChild(childList, Accessors)
AddChild(childList, EndDeclaration)
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for a custom event declaration.
''' </summary>
Public NotInheritable Class CustomEventDeclaration
Inherits SignatureDeclaration
Private ReadOnly _CustomLocation As Location
Private ReadOnly _ImplementsList As NameCollection
Private ReadOnly _Accessors As DeclarationCollection
Private ReadOnly _EndDeclaration As EndBlockDeclaration
''' <summary>
''' The location of the 'Custom' keyword.
''' </summary>
Public ReadOnly Property CustomLocation() As Location
Get
Return _CustomLocation
End Get
End Property
''' <summary>
''' The list of implemented members.
''' </summary>
Public ReadOnly Property ImplementsList() As NameCollection
Get
Return _ImplementsList
End Get
End Property
''' <summary>
''' The event accessors.
''' </summary>
Public ReadOnly Property Accessors() As DeclarationCollection
Get
Return _Accessors
End Get
End Property
''' <summary>
''' The End Event declaration, if any.
''' </summary>
Public ReadOnly Property EndDeclaration() As EndBlockDeclaration
Get
Return _EndDeclaration
End Get
End Property
''' <summary>
''' Constructs a new parse tree for a custom property declaration.
''' </summary>
''' <param name="attributes">The attributes on the declaration.</param>
''' <param name="modifiers">The modifiers on the declaration.</param>
''' <param name="customLocation">The location of the 'Custom' keyword.</param>
''' <param name="keywordLocation">The location of the keyword.</param>
''' <param name="name">The name of the custom event.</param>
''' <param name="asLocation">The location of the 'As', if any.</param>
''' <param name="resultType">The result type, if any.</param>
''' <param name="implementsList">The implements list.</param>
''' <param name="accessors">The custom event accessors.</param>
''' <param name="endDeclaration">The End Event declaration, if any.</param>
''' <param name="span">The location of the parse tree.</param>
''' <param name="comments">The comments for the parse tree.</param>
Public Sub New(ByVal attributes As AttributeBlockCollection, ByVal modifiers As ModifierCollection, ByVal customLocation As Location, ByVal keywordLocation As Location, ByVal name As SimpleName, ByVal asLocation As Location, ByVal resultType As TypeName, ByVal implementsList As NameCollection, ByVal accessors As DeclarationCollection, ByVal endDeclaration As EndBlockDeclaration, ByVal span As Span, ByVal comments As IList(Of Comment))
MyBase.New(TreeType.CustomEventDeclaration, attributes, modifiers, keywordLocation, name, Nothing, Nothing, asLocation, Nothing, resultType, span, comments)
SetParent(accessors)
SetParent(endDeclaration)
SetParent(implementsList)
_CustomLocation = customLocation
_ImplementsList = implementsList
_Accessors = accessors
_EndDeclaration = endDeclaration
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
MyBase.GetChildTrees(childList)
AddChild(childList, ImplementsList)
AddChild(childList, Accessors)
AddChild(childList, EndDeclaration)
End Sub
End Class

View file

@ -1,78 +1,78 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for an enumerated value declaration.
''' </summary>
Public NotInheritable Class EnumValueDeclaration
Inherits ModifiedDeclaration
Private ReadOnly _Name As Name
Private ReadOnly _EqualsLocation As Location
Private ReadOnly _Expression As Expression
''' <summary>
''' The name of the enumerated value.
''' </summary>
Public ReadOnly Property Name() As Name
Get
Return _Name
End Get
End Property
''' <summary>
''' The location of the '=', if any.
''' </summary>
Public ReadOnly Property EqualsLocation() As Location
Get
Return _EqualsLocation
End Get
End Property
''' <summary>
''' The enumerated value, if any.
''' </summary>
Public ReadOnly Property Expression() As Expression
Get
Return _Expression
End Get
End Property
''' <summary>
''' Constructs a new parse tree for an enumerated value.
''' </summary>
''' <param name="attributes">The attributes on the declaration.</param>
''' <param name="name">The name of the declaration.</param>
''' <param name="equalsLocation">The location of the '=', if any.</param>
''' <param name="expression">The enumerated value, if any.</param>
''' <param name="span">The location of the parse tree.</param>
''' <param name="comments">The comments for the parse tree.</param>
Public Sub New(ByVal attributes As AttributeBlockCollection, ByVal name As Name, ByVal equalsLocation As Location, ByVal expression As Expression, ByVal span As Span, ByVal comments As IList(Of Comment))
MyBase.New(TreeType.EnumValueDeclaration, attributes, Nothing, span, comments)
If name Is Nothing Then
Throw New ArgumentNullException("name")
End If
SetParent(name)
SetParent(expression)
_Name = name
_EqualsLocation = equalsLocation
_Expression = expression
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
MyBase.GetChildTrees(childList)
AddChild(childList, Name)
AddChild(childList, Expression)
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for an enumerated value declaration.
''' </summary>
Public NotInheritable Class EnumValueDeclaration
Inherits ModifiedDeclaration
Private ReadOnly _Name As Name
Private ReadOnly _EqualsLocation As Location
Private ReadOnly _Expression As Expression
''' <summary>
''' The name of the enumerated value.
''' </summary>
Public ReadOnly Property Name() As Name
Get
Return _Name
End Get
End Property
''' <summary>
''' The location of the '=', if any.
''' </summary>
Public ReadOnly Property EqualsLocation() As Location
Get
Return _EqualsLocation
End Get
End Property
''' <summary>
''' The enumerated value, if any.
''' </summary>
Public ReadOnly Property Expression() As Expression
Get
Return _Expression
End Get
End Property
''' <summary>
''' Constructs a new parse tree for an enumerated value.
''' </summary>
''' <param name="attributes">The attributes on the declaration.</param>
''' <param name="name">The name of the declaration.</param>
''' <param name="equalsLocation">The location of the '=', if any.</param>
''' <param name="expression">The enumerated value, if any.</param>
''' <param name="span">The location of the parse tree.</param>
''' <param name="comments">The comments for the parse tree.</param>
Public Sub New(ByVal attributes As AttributeBlockCollection, ByVal name As Name, ByVal equalsLocation As Location, ByVal expression As Expression, ByVal span As Span, ByVal comments As IList(Of Comment))
MyBase.New(TreeType.EnumValueDeclaration, attributes, Nothing, span, comments)
If name Is Nothing Then
Throw New ArgumentNullException("name")
End If
SetParent(name)
SetParent(expression)
_Name = name
_EqualsLocation = equalsLocation
_Expression = expression
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
MyBase.GetChildTrees(childList)
AddChild(childList, Name)
AddChild(childList, Expression)
End Sub
End Class

View file

@ -1,53 +1,53 @@
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for an event declaration.
''' </summary>
Public NotInheritable Class EventDeclaration
Inherits SignatureDeclaration
Private ReadOnly _ImplementsList As NameCollection
''' <summary>
''' The list of implemented members.
''' </summary>
Public ReadOnly Property ImplementsList() As NameCollection
Get
Return _ImplementsList
End Get
End Property
''' <summary>
''' Constructs a parse tree for an event declaration.
''' </summary>
''' <param name="attributes">The attributes for the parse tree.</param>
''' <param name="modifiers">The modifiers for the parse tree.</param>
''' <param name="keywordLocation">The location of the keyword.</param>
''' <param name="name">The name of the declaration.</param>
''' <param name="parameters">The parameters of the declaration.</param>
''' <param name="asLocation">The location of the 'As', if any.</param>
''' <param name="resultTypeAttributes">The attributes on the result type, if any.</param>
''' <param name="resultType">The result type, if any.</param>
''' <param name="implementsList">The list of implemented members.</param>
''' <param name="span">The location of the parse tree.</param>
''' <param name="comments">The comments for the parse tree.</param>
Public Sub New(ByVal attributes As AttributeBlockCollection, ByVal modifiers As ModifierCollection, ByVal keywordLocation As Location, ByVal name As SimpleName, ByVal parameters As ParameterCollection, ByVal asLocation As Location, ByVal resultTypeAttributes As AttributeBlockCollection, ByVal resultType As TypeName, ByVal implementsList As NameCollection, ByVal span As Span, ByVal comments As IList(Of Comment))
MyBase.New(TreeType.EventDeclaration, attributes, modifiers, keywordLocation, name, Nothing, parameters, asLocation, resultTypeAttributes, resultType, span, comments)
SetParent(implementsList)
_ImplementsList = implementsList
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
MyBase.GetChildTrees(childList)
AddChild(childList, ImplementsList)
End Sub
'
' Visual Basic .NET Parser
'
' Copyright (C) 2005, Microsoft Corporation. All rights reserved.
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
''' <summary>
''' A parse tree for an event declaration.
''' </summary>
Public NotInheritable Class EventDeclaration
Inherits SignatureDeclaration
Private ReadOnly _ImplementsList As NameCollection
''' <summary>
''' The list of implemented members.
''' </summary>
Public ReadOnly Property ImplementsList() As NameCollection
Get
Return _ImplementsList
End Get
End Property
''' <summary>
''' Constructs a parse tree for an event declaration.
''' </summary>
''' <param name="attributes">The attributes for the parse tree.</param>
''' <param name="modifiers">The modifiers for the parse tree.</param>
''' <param name="keywordLocation">The location of the keyword.</param>
''' <param name="name">The name of the declaration.</param>
''' <param name="parameters">The parameters of the declaration.</param>
''' <param name="asLocation">The location of the 'As', if any.</param>
''' <param name="resultTypeAttributes">The attributes on the result type, if any.</param>
''' <param name="resultType">The result type, if any.</param>
''' <param name="implementsList">The list of implemented members.</param>
''' <param name="span">The location of the parse tree.</param>
''' <param name="comments">The comments for the parse tree.</param>
Public Sub New(ByVal attributes As AttributeBlockCollection, ByVal modifiers As ModifierCollection, ByVal keywordLocation As Location, ByVal name As SimpleName, ByVal parameters As ParameterCollection, ByVal asLocation As Location, ByVal resultTypeAttributes As AttributeBlockCollection, ByVal resultType As TypeName, ByVal implementsList As NameCollection, ByVal span As Span, ByVal comments As IList(Of Comment))
MyBase.New(TreeType.EventDeclaration, attributes, modifiers, keywordLocation, name, Nothing, parameters, asLocation, resultTypeAttributes, resultType, span, comments)
SetParent(implementsList)
_ImplementsList = implementsList
End Sub
Protected Overrides Sub GetChildTrees(ByVal childList As IList(Of Tree))
MyBase.GetChildTrees(childList)
AddChild(childList, ImplementsList)
End Sub
End Class

Some files were not shown because too many files have changed in this diff Show more