#Region "Microsoft.VisualBasic::97c5f94cdee8264d441f6e161b874171, LINQ\TestMain\Parser\Token.vb" ' Author: ' ' asuka (amethyst.asuka@gcmodeller.org) ' xie (genetics@smrucc.org) ' xieguigang (xie.guigang@live.com) ' ' Copyright (c) 2018 GPL3 Licensed ' ' ' GNU GENERAL PUBLIC LICENSE (GPL3) ' ' ' This program is free software: you can redistribute it and/or modify ' it under the terms of the GNU General Public License as published by ' the Free Software Foundation, either version 3 of the License, or ' (at your option) any later version. ' ' This program is distributed in the hope that it will be useful, ' but WITHOUT ANY WARRANTY; without even the implied warranty of ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ' GNU General Public License for more details. ' ' You should have received a copy of the GNU General Public License ' along with this program. If not, see . ' /********************************************************************************/ ' Summaries: ' Class Token ' ' Properties: ParsedObject, Priority, Text, Type ' ' Constructor: (+2 Overloads) Sub New ' ' ' /********************************************************************************/ #End Region 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