pyv8-win64


pyv8-win64是为sublime text 中的emmet插件准备的
资源截图
代码片段和文件信息
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import with_statement

import sys os re
import thread
import logging

try:
    from cStringIO import StringIO
except ImportError:
    from StringIO import StringIO

try:
    import json
except ImportError:
    import simplejson as json

import _PyV8

__author__ = ‘Flier Lu 
__version__ = ‘1.0‘

__all__ = [“ReadOnly“ “DontEnum“ “DontDelete“ “Internal“
           “JSError“ “JSobject“ “JSArray“ “JSFunction“
           “JSClass“ “JSEngine“ “JSContext“
           “JSobjectSpace“ “JSAllocationAction“
           “JSStackTrace“ “JSStackframe“ “profiler“ 
           “JSExtension“ “JSLocker“ “JSUnlocker“ “AST“]

class JSAttribute(object):
    def __init__(self name):
        self.name = name

    def __call__(self func):
        setattr(func “__%s__“ % self.name True)
        
        return func

ReadOnly = JSAttribute(name=‘readonly‘)
DontEnum = JSAttribute(name=‘dontenum‘)
DontDelete = JSAttribute(name=‘dontdel‘)
Internal = JSAttribute(name=‘internal‘)

class JSError(Exception):
    def __init__(self impl):
        Exception.__init__(self)

        self._impl = impl

    def __str__(self):
        return str(self._impl)

    def __unicode__(self *args **kwargs):
        return unicode(self._impl)

    def __getattribute__(self attr):
        impl = super(JSError self).__getattribute__(“_impl“)

        try:
            return getattr(impl attr)
        except AttributeError:
            return super(JSError self).__getattribute__(attr)

    RE_frame = re.compile(r“s+ats(?:news)?(?P.+)s((?P[^:]+):?(?Pd+)?:?(?Pd+)?)“)
    RE_FUNC = re.compile(r“s+ats(?:news)?(?P.+)s((?P[^)]+))“)
    RE_FILE = re.compile(r“s+ats(?P[^:]+):?(?Pd+)?:?(?Pd+)?“)

    @staticmethod
    def parse_stack(value):
        stack = []

        def int_or_nul(value):
            return int(value) if value else None

        for line in value.split(‘
‘)[1:]:
            m = JSError.RE_frame.match(line)

            if m:
                stack.append((m.group(‘func‘) m.group(‘file‘) int_or_nul(m.group(‘row‘)) int_or_nul(m.group(‘col‘))))
                continue

            m = JSError.RE_FUNC.match(line)

            if m:
                stack.append((m.group(‘func‘) m.group(‘file‘) None None))
                continue

            m = JSError.RE_FILE.match(line)

            if m:
                stack.append((None m.group(‘file‘) int_or_nul(m.group(‘row‘)) int_or_nul(m.group(‘col‘))))
                continue

            assert line

        return stack

    @property
    def frames(self):
        return self.parse_stack(self.stackTrace)

_PyV8._JSError._jsclass = JSError

JSobject = _PyV8.JSobject
JSArray = _PyV8.JSArray
JSFunction = _PyV8.JSFunction
JSExtension = _PyV8.JSExtension

def func_apply(self thisArg argArray=[]):
    if isinstance(thisArg JSobject):
        return self.invoke(

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件       79541  2012-08-28 18:27  PyV8.py
     文件     5011456  2012-08-28 18:27  _PyV8.pyd

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)