[refactoring] remove general Node struct
This commit is contained in:
@@ -1,74 +0,0 @@
|
||||
package token
|
||||
|
||||
type Position int
|
||||
|
||||
//go:generate stringer -type=Position -output ./position_string.go
|
||||
const (
|
||||
Start Position = iota
|
||||
End
|
||||
SemiColon
|
||||
AltEnd
|
||||
Ampersand
|
||||
Name
|
||||
Key
|
||||
Var
|
||||
ReturnType
|
||||
CaseSeparator
|
||||
LexicalVars
|
||||
Params
|
||||
Ref
|
||||
Cast
|
||||
Expr
|
||||
InitExpr
|
||||
CondExpr
|
||||
IncExpr
|
||||
True
|
||||
Cond
|
||||
|
||||
Namespace
|
||||
Static
|
||||
Use
|
||||
For
|
||||
Foreach
|
||||
Declare
|
||||
Label
|
||||
Finally
|
||||
List
|
||||
Default
|
||||
Function
|
||||
Alias
|
||||
Equal
|
||||
Array
|
||||
Isset
|
||||
Echo
|
||||
Try
|
||||
Catch
|
||||
Unset
|
||||
|
||||
Stmts
|
||||
VarList
|
||||
ConstList
|
||||
NameList
|
||||
ParamList
|
||||
ModifierList
|
||||
ArrayPairList
|
||||
CaseListStart
|
||||
CaseListEnd
|
||||
PropertyList
|
||||
ParameterList
|
||||
AdaptationList
|
||||
LexicalVarList
|
||||
|
||||
CloseParenthesisToken
|
||||
)
|
||||
|
||||
type Collection map[Position][]*Token
|
||||
|
||||
func (c Collection) IsEmpty() bool {
|
||||
for _, v := range c {
|
||||
if len(v) > 0 {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
// Code generated by "stringer -type=Position -output ./position_string.go"; DO NOT EDIT.
|
||||
|
||||
package token
|
||||
|
||||
import "strconv"
|
||||
|
||||
func _() {
|
||||
// An "invalid array index" compiler error signifies that the constant values have changed.
|
||||
// Re-run the stringer command to generate them again.
|
||||
var x [1]struct{}
|
||||
_ = x[Start-0]
|
||||
_ = x[End-1]
|
||||
_ = x[SemiColon-2]
|
||||
_ = x[AltEnd-3]
|
||||
_ = x[Ampersand-4]
|
||||
_ = x[Name-5]
|
||||
_ = x[Key-6]
|
||||
_ = x[Var-7]
|
||||
_ = x[ReturnType-8]
|
||||
_ = x[CaseSeparator-9]
|
||||
_ = x[LexicalVars-10]
|
||||
_ = x[Params-11]
|
||||
_ = x[Ref-12]
|
||||
_ = x[Cast-13]
|
||||
_ = x[Expr-14]
|
||||
_ = x[InitExpr-15]
|
||||
_ = x[CondExpr-16]
|
||||
_ = x[IncExpr-17]
|
||||
_ = x[True-18]
|
||||
_ = x[Cond-19]
|
||||
_ = x[Namespace-20]
|
||||
_ = x[Static-21]
|
||||
_ = x[Use-22]
|
||||
_ = x[For-23]
|
||||
_ = x[Foreach-24]
|
||||
_ = x[Declare-25]
|
||||
_ = x[Label-26]
|
||||
_ = x[Finally-27]
|
||||
_ = x[List-28]
|
||||
_ = x[Default-29]
|
||||
_ = x[Function-30]
|
||||
_ = x[Alias-31]
|
||||
_ = x[Equal-32]
|
||||
_ = x[Array-33]
|
||||
_ = x[Isset-34]
|
||||
_ = x[Echo-35]
|
||||
_ = x[Try-36]
|
||||
_ = x[Catch-37]
|
||||
_ = x[Unset-38]
|
||||
_ = x[Stmts-39]
|
||||
_ = x[VarList-40]
|
||||
_ = x[ConstList-41]
|
||||
_ = x[NameList-42]
|
||||
_ = x[ParamList-43]
|
||||
_ = x[ModifierList-44]
|
||||
_ = x[ArrayPairList-45]
|
||||
_ = x[CaseListStart-46]
|
||||
_ = x[CaseListEnd-47]
|
||||
_ = x[PropertyList-48]
|
||||
_ = x[ParameterList-49]
|
||||
_ = x[AdaptationList-50]
|
||||
_ = x[LexicalVarList-51]
|
||||
_ = x[CloseParenthesisToken-52]
|
||||
}
|
||||
|
||||
const _Position_name = "StartEndSemiColonAltEndAmpersandNameKeyVarReturnTypeCaseSeparatorLexicalVarsParamsRefCastExprInitExprCondExprIncExprTrueCondNamespaceStaticUseForForeachDeclareLabelFinallyListDefaultFunctionAliasEqualArrayIssetEchoTryCatchUnsetStmtsVarListConstListNameListParamListModifierListArrayPairListCaseListStartCaseListEndPropertyListParameterListAdaptationListLexicalVarListCloseParenthesisToken"
|
||||
|
||||
var _Position_index = [...]uint16{0, 5, 8, 17, 23, 32, 36, 39, 42, 52, 65, 76, 82, 85, 89, 93, 101, 109, 116, 120, 124, 133, 139, 142, 145, 152, 159, 164, 171, 175, 182, 190, 195, 200, 205, 210, 214, 217, 222, 227, 232, 239, 248, 256, 265, 277, 290, 303, 314, 326, 339, 353, 367, 388}
|
||||
|
||||
func (i Position) String() string {
|
||||
if i < 0 || i >= Position(len(_Position_index)-1) {
|
||||
return "Position(" + strconv.FormatInt(int64(i), 10) + ")"
|
||||
}
|
||||
return _Position_name[_Position_index[i]:_Position_index[i+1]]
|
||||
}
|
||||
Reference in New Issue
Block a user