资源简介
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+at\s(?:new\s)?(?P.+)\s\((?P[^:]+):?(?P\d+)?:?(?P \d+)?\)“)
RE_FUNC = re.compile(r“\s+at\s(?:new\s)?(?P.+)\s\((?P[^\)]+)\)“)
RE_FILE = re.compile(r“\s+at\s(?P[^:]+):?(?P\d+)?:?(?P \d+)?“)
@staticmethod
def parse_stack(value):
stack = []
def int_or_nul(value):
return int(value) if value else None
for line in value.split(‘\n‘)[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
- 上一篇:基于Multisim设计的数控直流稳压电源
- 下一篇:如何进入游戏数值策划的大门
评论
共有 条评论