Closed walkinrain2008 closed 5 years ago
i search vars in *.py , found that only IDENTIFIER_START,IDENTIFIER_PART is useful only save / load IDENTIFIER_START & IDENTIFIER_PART second run result:
begin
import time = [0.170071518]
i found that IDENTIFIER_START & IDENTIFIER_PART is only used to function like:
def isIdentifierStart(ch):
return (ch if isinstance(ch, unicode) else unichr(ch)) in IDENTIFIER_START
is it possible to use other methods? like :
c_LETTER = ['Lu','Ll','Lt','Lm','Lo','Nl']
c_PART = ['Lu','Ll','Lt','Lm','Lo','Nl','Mn','Mc','Nd','Pc']
def isIdentifierStart(ch):
c= ch if isinstance(ch, unicode) else unichr(ch)
return (unicodedata.category(c) in c_Letter) or (c in ('$','_', '\\'))
i hope this code is useful for you.
U_CATEGORIES
also uses a lot of memory (~100MB)
This is a big problem for me
I agree the current implementation is not ideal, will try to fix it when I have some time.
Fixed in 3467b65
my computer import pyjsparser is very slowly. test code :
result is:
i found slowly code is :
it is found that 1 var U_CATEGORIES is very large 2 var U_CATEGORIES is only used to assign values to other variables. i change the code for pyjsparserdata.py in line224
test result: first run:
second run:
i hope this code is useful for your module . my English is poor , forgive me !