1 #Region "Microsoft.VisualBasic::8c414a5089a8f58612ff485c35371f78, Microsoft.VisualBasic.Core\Scripting\TokenIcer\LangModels\StackTokens(Of Tokens).vb"
2
3     ' Author:
4     
5     '       asuka (amethyst.asuka@gcmodeller.org)
6     '       xie (genetics@smrucc.org)
7     '       xieguigang (xie.guigang@live.com)
8     
9     ' Copyright (c) 2018 GPL3 Licensed
10     
11     
12     ' GNU GENERAL PUBLIC LICENSE (GPL3)
13     
14     
15     ' This program is free software: you can redistribute it and/or modify
16     ' it under the terms of the GNU General Public License as published by
17     ' the Free Software Foundation, either version 3 of the License, or
18     ' (at your option) any later version.
19     
20     ' This program is distributed in the hope that it will be useful,
21     ' but WITHOUT ANY WARRANTY; without even the implied warranty of
22     ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23     ' GNU General Public License for more details.
24     
25     ' You should have received a copy of the GNU General Public License
26     ' along with this program. If not, see <http://www.gnu.org/licenses/>.
27
28
29
30     ' /********************************************************************************/
31
32     ' Summaries:
33
34     '     Class StackTokens
35     
36     '         Properties: LPair, ParamDeli, Pretend, RPair, WhiteSpace
37     
38     '         Constructor: (+1 OverloadsSub New
39     '         Function: Equals
40     
41     
42     ' /********************************************************************************/
43
44 #End Region
45
46 Imports Microsoft.VisualBasic.Linq
47
48 Namespace Scripting.TokenIcer
49
50     ''' <summary>
51     ''' 进行栈树解析所必须要的一些基本元素
52     ''' </summary>
53     ''' <typeparam name="Tokens"></typeparam>
54     Public Class StackTokens(Of Tokens)
55
56         ''' <summary>
57         ''' Pretend the root tokens as a true node
58         ''' </summary>
59         ''' <returns></returns>
60         Public Property Pretend As Tokens
61         ''' <summary>
62         ''' 参数的分隔符,一般是逗号
63         ''' </summary>
64         ''' <returns></returns>
65         Public Property ParamDeli As Tokens
66         ''' <summary>
67         ''' 向下一层堆栈符号,一般是左括号
68         ''' </summary>
69         ''' <returns></returns>
70         Public Property LPair As Tokens
71         ''' <summary>
72         ''' 向上一层出栈符号,一般是右括号
73         ''' </summary>
74         ''' <returns></returns>
75         Public Property RPair As Tokens
76         Public Property WhiteSpace As Tokens
77
78         ''' <summary>
79         ''' Tokens equals?
80         ''' </summary>
81         ''' <param name="a"></param>
82         ''' <param name="b"></param>
83         ''' <returns></returns>
84         Public Overloads Function Equals(a As Tokens, b As Tokens) As Boolean
85             Dim flag As Boolean = __equals(a, b)
86             Return flag
87         End Function
88
89         ReadOnly __equals As Func(Of Tokens, Tokens, Boolean)
90
91         ''' <summary>
92         ''' Tokens equals? 
93         ''' </summary>
94         ''' <param name="equals"></param>
95         Sub New(equals As Func(Of Tokens, Tokens, Boolean))
96             __equals = equals
97         End Sub
98     End Class
99 End Namespace