]> git.saurik.com Git - apple/javascriptcore.git/blobdiff - KeywordLookupGenerator.py
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / KeywordLookupGenerator.py
index 748acf9dc14baeb3b84203e46592012bc0d6f9b0..d13daba61d24758b0a062a9695a1e1825094c46e 100644 (file)
@@ -68,11 +68,16 @@ def allWhitespace(str):
 
 
 def parseKeywords(keywordsText):
 
 
 def parseKeywords(keywordsText):
+
+    if sys.platform == "cygwin":
+        keywordsText = keywordsText.replace("\r\n", "\n")
+
     lines = keywordsText.split("\n")
     lines = [line.split("#")[0] for line in lines]
     lines = [line for line in lines if (not allWhitespace(line))]
     name = lines[0].split()
     terminator = lines[-1]
     lines = keywordsText.split("\n")
     lines = [line.split("#")[0] for line in lines]
     lines = [line for line in lines if (not allWhitespace(line))]
     name = lines[0].split()
     terminator = lines[-1]
+
     if not name[0] == "@begin":
         raise Exception("expected description beginning with @begin")
     if not terminator == "@end":
     if not name[0] == "@begin":
         raise Exception("expected description beginning with @begin")
     if not terminator == "@end":
@@ -136,10 +141,10 @@ class Trie:
         str = makePadding(indent)
 
         if self.value != None:
         str = makePadding(indent)
 
         if self.value != None:
-            print(str + "if (!isIdentPart(code[%d])) {" % (len(self.fullPrefix)))
+            print(str + "if (!isIdentPartIncludingEscape(code+%d, m_codeEnd)) {" % (len(self.fullPrefix)))
             print(str + "    internalShift<%d>();" % len(self.fullPrefix))
             print(str + "    if (shouldCreateIdentifier)")
             print(str + "    internalShift<%d>();" % len(self.fullPrefix))
             print(str + "    if (shouldCreateIdentifier)")
-            print(str + ("        data->ident = &m_globalData->propertyNames->%sKeyword;" % self.fullPrefix))
+            print(str + ("        data->ident = &m_vm->propertyNames->%sKeyword;" % self.fullPrefix))
             print(str + "    return " + self.value + ";")
             print(str + "}")
         rootIndex = len(self.fullPrefix)
             print(str + "    return " + self.value + ";")
             print(str + "}")
         rootIndex = len(self.fullPrefix)
@@ -179,8 +184,8 @@ class Trie:
     def printAsC(self):
         print("namespace JSC {")
         print("")
     def printAsC(self):
         print("namespace JSC {")
         print("")
-        print("static ALWAYS_INLINE bool isIdentPart(LChar c);")
-        print("static ALWAYS_INLINE bool isIdentPart(UChar c);")
+        print("static ALWAYS_INLINE bool isIdentPartIncludingEscape(const LChar* code, const LChar* codeEnd);")
+        print("static ALWAYS_INLINE bool isIdentPartIncludingEscape(const UChar* code, const UChar* codeEnd);")
         # max length + 1 so we don't need to do any bounds checking at all
         print("static const int maxTokenLength = %d;" % (self.maxLength() + 1))
         print("")
         # max length + 1 so we don't need to do any bounds checking at all
         print("static const int maxTokenLength = %d;" % (self.maxLength() + 1))
         print("")
@@ -253,16 +258,16 @@ print("""
 
 
 #define COMPARE_2CHARS(address, char1, char2) \\
 
 
 #define COMPARE_2CHARS(address, char1, char2) \\
-    (((uint16_t*)(address))[0] == CHARPAIR_TOUINT16(char1, char2))
+    ((reinterpret_cast<const uint16_t*>(address))[0] == CHARPAIR_TOUINT16(char1, char2))
 #define COMPARE_2UCHARS(address, char1, char2) \\
 #define COMPARE_2UCHARS(address, char1, char2) \\
-    (((uint32_t*)(address))[0] == UCHARPAIR_TOUINT32(char1, char2))
+    ((reinterpret_cast<const uint32_t*>(address))[0] == UCHARPAIR_TOUINT32(char1, char2))
 
 #if CPU(X86_64)
 
 #define COMPARE_4CHARS(address, char1, char2, char3, char4) \\
 
 #if CPU(X86_64)
 
 #define COMPARE_4CHARS(address, char1, char2, char3, char4) \\
-    (((uint32_t*)(address))[0] == CHARQUAD_TOUINT32(char1, char2, char3, char4))
+    ((reinterpret_cast<const uint32_t*>(address))[0] == CHARQUAD_TOUINT32(char1, char2, char3, char4))
 #define COMPARE_4UCHARS(address, char1, char2, char3, char4) \\
 #define COMPARE_4UCHARS(address, char1, char2, char3, char4) \\
-    (((uint64_t*)(address))[0] == UCHARQUAD_TOUINT64(char1, char2, char3, char4))
+    ((reinterpret_cast<const uint64_t*>(address))[0] == UCHARQUAD_TOUINT64(char1, char2, char3, char4))
 
 #else // CPU(X86_64)
 
 
 #else // CPU(X86_64)