@@ -306,6 +306,8 @@ static PxTokenType identifierType(Scanner *scanner) {
306306 switch (scanner -> start [1 ]) {
307307 case 'a' :
308308 return checkKeyword (scanner , 2 , 4 , "tive" , TOKEN_NATIVE );
309+ case 'e' :
310+ return checkKeyword (scanner , 2 , 1 , "w" , TOKEN_NEW );
309311 case 'u' :
310312 return checkKeyword (scanner , 2 , 2 , "ll" , TOKEN_NULL );
311313 }
@@ -323,7 +325,10 @@ static PxTokenType identifierType(Scanner *scanner) {
323325 case 'n' :
324326 return checkKeyword (scanner , 4 , 1 , "t" , TOKEN_PRINT );
325327 case 'v' :
326- return checkKeyword (scanner , 4 , 3 , "ate" , TOKEN_PRIVATE );
328+ if (scanner -> current - scanner -> start > 4 ) {
329+ return checkKeyword (scanner , 4 , 3 , "ate" , TOKEN_PRIVATE );
330+ }
331+ return checkKeyword (scanner , 4 , 0 , "" , TOKEN_PRIVATE );
327332 }
328333 }
329334 break ;
@@ -333,6 +338,17 @@ static PxTokenType identifierType(Scanner *scanner) {
333338 }
334339 break ;
335340 case 'u' :
341+ if (scanner -> current - scanner -> start > 2 ) {
342+ switch (scanner -> start [2 ]) {
343+ case 'b' :
344+ if (scanner -> current - scanner -> start > 3 ) {
345+ // publ...
346+ return checkKeyword (scanner , 4 , 2 , "ic" , TOKEN_PUBLIC );
347+ }
348+ // pub
349+ return checkKeyword (scanner , 2 , 1 , "b" , TOKEN_PUBLIC );
350+ }
351+ }
336352 return checkKeyword (scanner , 2 , 4 , "blic" , TOKEN_PUBLIC );
337353 }
338354 }
0 commit comments