本文整理汇总了Python中pygments.lexers.JavaLexer方法的典型用法代码示例。如果您正苦于以下问题:Python lexers.JavaLexer方法的具体用法?Python lexers.JavaLexer怎么用?Python lexers.JavaLexer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pygments.lexers
的用法示例。
在下文中一共展示了lexers.JavaLexer方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: reload_java_sources
# 需要导入模块: from pygments import lexers [as 别名]
# 或者: from pygments.lexers import JavaLexer [as 别名]
def reload_java_sources(self):
"""Reload completely the sources by asking Androguard
to decompile it again. Useful when:
- an element has been renamed to propagate the info
- the current tab is changed because we do not know what user
did since then, so we need to propagate previous changes as well
"""
log.debug("Getting sources for %s" % self.current_class)
lines = [("COMMENTS", [(
"COMMENT", "// filename:%s\n// digest:%s\n\n" % (
self.current_filename, self.current_digest))])]
method_info_buff = ""
for method in self.current_class.get_methods():
method_info_buff += "// " + str(method) + "\n"
lines.append(("COMMENTS", [(
"COMMENT", method_info_buff + "\n\n")]))
lines.extend(self.current_class.get_source_ext())
# TODO: delete doc when tab is closed? not deleted by "self" :(
if hasattr(self, "doc"):
del self.doc
self.doc = SourceDocument(parent=self, lines=lines)
self.setDocument(self.doc)
# No need to save hightlighter. highlighBlock will automatically be called
# because we passed the QTextDocument to QSyntaxHighlighter constructor
MyHighlighter(self.doc, lexer=JavaLexer())
示例2: reload_java_sources
# 需要导入模块: from pygments import lexers [as 别名]
# 或者: from pygments.lexers import JavaLexer [as 别名]
def reload_java_sources(self):
'''Reload completely the sources by asking Androguard
to decompile it again. Useful when:
- an element has been renamed to propagate the info
- the current tab is changed because we do not know what user
did since then, so we need to propagate previous changes as well
'''
androconf.debug("Getting sources for %s" % self.current_class)
lines = []
lines.append(("COMMENTS", [("COMMENT", "/*\n * filename:%s\n * digest:%s\n */\n" % (self.current_filename, self.current_digest))]))
lines.extend(self.current_class.get_source_ext())
#TODO: delete doc when tab is closed? not deleted by "self" :(
if hasattr(self, "doc"):
del self.doc
self.doc = SourceDocument(parent=self, lines=lines)
self.setDocument(self.doc)
#No need to save hightlighter. highlighBlock will automatically be called
#because we passed the QTextDocument to QSyntaxHighlighter constructor
if PYGMENTS:
PygmentsHighlighter(self.doc, lexer=JavaLexer())
else:
androconf.debug("Pygments is not present !")
示例3: reload_java_sources
# 需要导入模块: from pygments import lexers [as 别名]
# 或者: from pygments.lexers import JavaLexer [as 别名]
def reload_java_sources(self):
'''Reload completely the sources by asking Androguard
to decompile it again. Useful when:
- an element has been renamed to propagate the info
- the current tab is changed because we do not know what user
did since then, so we need to propagate previous changes as well
'''
androconf.debug("Getting sources for %s" % self.current_class)
lines = []
lines.append(("COMMENTS", [(
"COMMENT", "// filename:%s\n// digest:%s\n\n" % (
self.current_filename, self.current_digest))]))
method_info_buff = ""
for method in self.current_class.get_methods():
method_info_buff += "// " + str(method) + "\n"
lines.append(("COMMENTS", [(
"COMMENT", method_info_buff + "\n\n")]))
lines.extend(self.current_class.get_source_ext())
#TODO: delete doc when tab is closed? not deleted by "self" :(
if hasattr(self, "doc"):
del self.doc
self.doc = SourceDocument(parent=self, lines=lines)
self.setDocument(self.doc)
#No need to save hightlighter. highlighBlock will automatically be called
#because we passed the QTextDocument to QSyntaxHighlighter constructor
if PYGMENTS:
MyHighlighter(self.doc, lexer=JavaLexer())
else:
androconf.debug("Pygments is not present !")
示例4: lexer
# 需要导入模块: from pygments import lexers [as 别名]
# 或者: from pygments.lexers import JavaLexer [as 别名]
def lexer():
yield JavaLexer()