Esempio n. 1
0
def process_one_file(path):
  if not os.path.exists(path):
    sys.stderr.write("File does not exist: %s" % path)
    sys.exit(-1)
  
  file = open(path, "r")
  data = file.read()
  file.close()
  
  buf, n = parse(data, expand_loops=glob.g_expand_loops, expand_generators=glob.g_expand_generators, file=path.replace("\\", "/"))
  infer_files([n])
  
  #resolve_types(n, typespace)
  resolve_structs([n], typespace)
Esempio n. 2
0
def process_all_files():
    global typespace
    files = []
    for f in os.listdir("../"):
        if f.endswith(".js"):
            files.append(f)

    nfiles = []
    for f in files:
        if "[Conflict]" in f: continue

        path = ".." + os.path.sep + f

        if f in t_stamps and not do_clean:
            if os.stat(path).st_mtime == t_stamps[f]:
                sys.stdout.write("Loading stored AST tree for %s...\r" % f)
                n = db[f]
                nfiles.append(n)

                #XXX only do one file for initial testing
                continue

        sys.stdout.write("Parsing %s...\n" % f)
        glob.reset()

        file = open(path, "r")
        data = file.read()
        file.close()

        buf, n = parse(data,
                       expand_loops=glob.g_expand_loops,
                       expand_generators=glob.g_expand_generators,
                       file=path.replace("\\", "/"))
        if n == None:
            print("error!")
            break

        t_stamps[f] = os.stat(path).st_mtime
        db[f] = n
        nfiles.append(n)

    t_stamps.close()
    db.close()
    infer_files(nfiles)
    resolve_structs(nfiles, typespace)
    gen_opcode_files(nfiles, typespace)
Esempio n. 3
0
def process_one_file(path):
    if not os.path.exists(path):
        sys.stderr.write("File does not exist: %s" % path)
        sys.exit(-1)

    file = open(path, "r")
    data = file.read()
    file.close()

    buf, n = parse(data,
                   expand_loops=glob.g_expand_loops,
                   expand_generators=glob.g_expand_generators,
                   file=path.replace("\\", "/"))
    infer_files([n])

    #resolve_types(n, typespace)
    resolve_structs([n], typespace)
Esempio n. 4
0
def process_all_files():
  global typespace
  files = []
  for f in os.listdir("../"):
    if f.endswith(".js"):
      files.append(f)
    
  nfiles = []
  for f in files:
    if "[Conflict]" in f: continue
    
    path = ".."+os.path.sep+f
    
    if f in t_stamps and not do_clean:
      if os.stat(path).st_mtime == t_stamps[f]:
        sys.stdout.write("Loading stored AST tree for %s...\r"%f)
        n = db[f]
        nfiles.append(n)
        
        #XXX only do one file for initial testing
        continue

    sys.stdout.write("Parsing %s...\n"%f)
    glob.reset();
    
    file = open(path, "r")
    data = file.read()
    file.close()
    
    buf, n = parse(data, expand_loops=glob.g_expand_loops, expand_generators=glob.g_expand_generators, file=path.replace("\\", "/"))
    if n == None:
      print("error!")
      break
    
    t_stamps[f] = os.stat(path).st_mtime
    db[f] = n
    nfiles.append(n)
    
  t_stamps.close()
  db.close()
  infer_files(nfiles)
  resolve_structs(nfiles, typespace)
  gen_opcode_files(nfiles, typespace)