Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ GetRegularToken()

void System.__DTString.GetRegularToken ( out TokenType tokenType,
out int tokenValue,
DateTimeFormatInfo dtfi )
inlinepackage

Definition at line 70 of file __DTString.cs.

71 {
72 tokenValue = 0;
73 if (Index >= Length)
74 {
75 tokenType = TokenType.EndOfString;
76 return;
77 }
78 while (true)
79 {
80 if (DateTimeParse.IsDigit(m_current))
81 {
82 tokenValue = m_current - 48;
83 int index = Index;
84 while (++Index < Length)
85 {
87 int num = m_current - 48;
88 if (num < 0 || num > 9)
89 {
90 break;
91 }
92 tokenValue = tokenValue * 10 + num;
93 }
94 if (Index - index > 8)
95 {
96 tokenType = TokenType.NumberToken;
97 tokenValue = -1;
98 }
99 else if (Index - index < 3)
100 {
101 tokenType = TokenType.NumberToken;
102 }
103 else
104 {
105 tokenType = TokenType.YearNumberToken;
106 }
108 {
109 int index2 = Index;
110 char current = m_current;
111 Index = index;
113 if (dtfi.Tokenize(TokenType.RegularTokenMask, out var tokenType2, out var tokenValue2, ref this))
114 {
115 tokenType = tokenType2;
116 tokenValue = tokenValue2;
117 }
118 else
119 {
120 Index = index2;
121 m_current = current;
122 }
123 }
124 break;
125 }
126 if (char.IsWhiteSpace(m_current))
127 {
128 do
129 {
130 if (++Index < Length)
131 {
133 continue;
134 }
135 tokenType = TokenType.EndOfString;
136 return;
137 }
138 while (char.IsWhiteSpace(m_current));
139 continue;
140 }
141 dtfi.Tokenize(TokenType.RegularTokenMask, out tokenType, out tokenValue, ref this);
142 break;
143 }
144 }
readonly bool m_checkDigitToken
Definition __DTString.cs:16
ReadOnlySpan< char > Value
Definition __DTString.cs:8

References System.__DTString.Index, System.index, System.index2, System.DateTimeParse.IsDigit(), System.__DTString.Length, System.__DTString.m_checkDigitToken, System.__DTString.m_current, and System.__DTString.Value.