Namespace Parser
'''
''' Represents a token that is parsed out by the .
'''
Public NotInheritable Class Token
Private _Text As String
Private _ParsedObject As Object
Private _Type As TokenType
Private _Priority As TokenPriority
'''
''' The text that makes up the token.
'''
Public ReadOnly Property Text() As String
Get
Return _Text
End Get
End Property
'''
''' If the token can be parsed into a type like an integer, this property holds that value.
'''
Public ReadOnly Property ParsedObject() As Object
Get
Return _ParsedObject
End Get
End Property
'''
''' Token type
'''
Public ReadOnly Property Type() As TokenType
Get
Return _Type
End Get
End Property
'''
''' Token priority
'''
Public ReadOnly Property Priority() As TokenPriority
Get
Return _Priority
End Get
End Property
'''
''' Constructor for tokens that are not parsed.
'''
'''
'''
'''
Public Sub New(text As String, type As TokenType, priority As TokenPriority)
_Text = text
_Type = type
_Priority = priority
_ParsedObject = text
End Sub
'''
''' Constructor for tokens that are parsed.
'''
'''
'''
'''
Public Sub New(parsedObj As Object, type As TokenType, priority As TokenPriority)
_ParsedObject = parsedObj
_Text = ParsedObject.ToString()
_Type = type
_Priority = priority
End Sub
'''
''' The null token represents a state where the encountered an error
''' or has not begun parsing yet.
'''
Public Shared NullToken As New Token("", TokenType.NotAToken, TokenPriority.None)
End Class
End Namespace