@@ -157,8 +157,46 @@ uint HashTbl::CountAndVerifyItems(IdentPtr *buckets, uint bucketCount, uint mask
157
157
}
158
158
#endif
159
159
160
+
160
161
#pragma warning(push)
161
- #pragma warning(disable:4740) // flow in or out of inline asm code suppresses global optimization
162
+ #pragma warning(disable:4740) // flow in or out of inline asm code suppresses global optimization
163
+
164
+ // Decide if token is keyword by string matching -
165
+ // This method is used during colorizing when scanner isn't interested in storing the actual id and does not care about conversion of escape sequences
166
+ tokens Ident::TkFromNameLen (uint32 luHash, _In_reads_(cch) LPCOLESTR prgch, uint32 cch, bool isStrictMode, ushort * pgrfid, ushort * ptk)
167
+ {
168
+ // look for a keyword
169
+ #include " kwds_sw.h"
170
+
171
+ #define KEYWORD (tk,f,prec2,nop2,prec1,nop1,name ) \
172
+ LEqual_##name: \
173
+ if (cch == g_ssym_##name.cch && \
174
+ 0 == memcmp (g_ssym_##name.sz , prgch, cch * sizeof (OLECHAR))) \
175
+ { \
176
+ if (f) \
177
+ *pgrfid |= f; \
178
+ *ptk = tk; \
179
+ return ((f & fidKwdRsvd) || (isStrictMode && (f & fidKwdFutRsvd))) ? tk : tkID; \
180
+ } \
181
+ goto LDefault;
182
+ #include " keywords.h"
183
+
184
+ LDefault:
185
+ return tkID;
186
+ }
187
+
188
+ #pragma warning(pop)
189
+
190
+ #if DBG
191
+ tokens Ident::TkFromNameLen (_In_reads_(cch) LPCOLESTR prgch, uint32 cch, bool isStrictMode)
192
+ {
193
+ uint32 luHash = CaseSensitiveComputeHash (prgch, prgch + cch);
194
+ ushort grfid;
195
+ ushort tk;
196
+ return TkFromNameLen (luHash, prgch, cch, isStrictMode, &grfid, &tk);
197
+ }
198
+ #endif
199
+
162
200
tokens Ident::Tk (bool isStrictMode)
163
201
{
164
202
const tokens token = (tokens)m_tk;
@@ -168,22 +206,8 @@ tokens Ident::Tk(bool isStrictMode)
168
206
const uint32 luHash = this ->m_luHash ;
169
207
const LPCOLESTR prgch = Psz ();
170
208
const uint32 cch = Cch ();
171
- #include " kwds_sw.h"
172
-
173
- #define KEYWORD (tk,f,prec2,nop2,prec1,nop1,name ) \
174
- LEqual_##name: \
175
- if (cch == g_ssym_##name.cch && \
176
- 0 == memcmp (g_ssym_##name.sz , prgch, cch * sizeof (OLECHAR))) \
177
- { \
178
- if (f) \
179
- this ->m_grfid |= f; \
180
- this ->m_tk = tk; \
181
- return ((f & fidKwdRsvd) || (isStrictMode && (f & fidKwdFutRsvd))) ? tk : tkID; \
182
- } \
183
- goto LDefault;
184
- #include " keywords.h"
185
- LDefault:
186
- return tkID;
209
+
210
+ return TkFromNameLen (luHash, prgch, cch, isStrictMode, &this ->m_grfid , &this ->m_tk );
187
211
}
188
212
else if (token == tkNone || !(m_grfid & fidKwdRsvd))
189
213
{
@@ -194,7 +218,6 @@ tokens Ident::Tk(bool isStrictMode)
194
218
}
195
219
return token;
196
220
}
197
- #pragma warning(pop)
198
221
199
222
void Ident::SetTk (tokens token, ushort grfid)
200
223
{
@@ -423,33 +446,6 @@ bool HashTbl::Contains(_In_reads_(cch) LPCOLESTR prgch, int32 cch)
423
446
424
447
#include " HashFunc.cpp"
425
448
426
- #pragma warning(push)
427
- #pragma warning(disable:4740) // flow in or out of inline asm code suppresses global optimization
428
-
429
- // Decide if token is keyword by string matching -
430
- // This method is used during colorizing when scanner isn't interested in storing the actual id and does not care about conversion of escape sequences
431
- tokens HashTbl::TkFromNameLen (_In_reads_(cch) LPCOLESTR prgch, uint32 cch, bool isStrictMode)
432
- {
433
- uint32 luHash = CaseSensitiveComputeHash (prgch, prgch + cch);
434
-
435
- // look for a keyword
436
- #include " kwds_sw.h"
437
-
438
- #define KEYWORD (tk,f,prec2,nop2,prec1,nop1,name ) \
439
- LEqual_##name: \
440
- if (cch == g_ssym_##name.cch && \
441
- 0 == memcmp (g_ssym_##name.sz , prgch, cch * sizeof (OLECHAR))) \
442
- { \
443
- return ((f & fidKwdRsvd) || (isStrictMode && (f & fidKwdFutRsvd))) ? tk : tkID; \
444
- } \
445
- goto LDefault;
446
- #include " keywords.h"
447
-
448
- LDefault:
449
- return tkID;
450
- }
451
-
452
- #pragma warning(pop)
453
449
454
450
__declspec (noreturn) void HashTbl::OutOfMemory()
455
451
{
0 commit comments