当前位置: 首页>>代码示例>>Python>>正文


Python token.RPAR属性代码示例

本文整理汇总了Python中token.RPAR属性的典型用法代码示例。如果您正苦于以下问题:Python token.RPAR属性的具体用法?Python token.RPAR怎么用?Python token.RPAR使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在token的用法示例。


在下文中一共展示了token.RPAR属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: classdef

# 需要导入模块: import token [as 别名]
# 或者: from token import RPAR [as 别名]
def classdef(self, nodelist):
        # classdef: 'class' NAME ['(' [testlist] ')'] ':' suite

        name = nodelist[1][1]
        doc = self.get_docstring(nodelist[-1])
        if nodelist[2][0] == token.COLON:
            bases = []
        elif nodelist[3][0] == token.RPAR:
            bases = []
        else:
            bases = self.com_bases(nodelist[3])

        # code for class
        code = self.com_node(nodelist[-1])

        if doc is not None:
            assert isinstance(code, Stmt)
            assert isinstance(code.nodes[0], Discard)
            del code.nodes[0]

        return Class(name, bases, doc, code, lineno=nodelist[1][2]) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:23,代码来源:transformer.py

示例2: atom

# 需要导入模块: import token [as 别名]
# 或者: from token import RPAR [as 别名]
def atom(cls, nodelist):
        t = nodelist[1][0]
        if t == token.LPAR:
            if nodelist[2][0] == token.RPAR:
                raise SyntaxError("Empty parentheses")
            return cls.interpret(nodelist[2])
        msg = "Language feature not supported in environment markers"
        raise SyntaxError(msg) 
开发者ID:jpush,项目名称:jbox,代码行数:10,代码来源:__init__.py

示例3: atom_lpar

# 需要导入模块: import token [as 别名]
# 或者: from token import RPAR [as 别名]
def atom_lpar(self, nodelist):
        if nodelist[1][0] == token.RPAR:
            return Tuple((), lineno=nodelist[0][2])
        return self.com_node(nodelist[1]) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:6,代码来源:transformer.py

示例4: com_call_function

# 需要导入模块: import token [as 别名]
# 或者: from token import RPAR [as 别名]
def com_call_function(self, primaryNode, nodelist):
        if nodelist[0] == token.RPAR:
            return CallFunc(primaryNode, [], lineno=extractLineNo(nodelist))
        args = []
        kw = 0
        star_node = dstar_node = None
        len_nodelist = len(nodelist)
        i = 1
        while i < len_nodelist:
            node = nodelist[i]

            if node[0]==token.STAR:
                if star_node is not None:
                    raise SyntaxError, 'already have the varargs indentifier'
                star_node = self.com_node(nodelist[i+1])
                i = i + 3
                continue
            elif node[0]==token.DOUBLESTAR:
                if dstar_node is not None:
                    raise SyntaxError, 'already have the kwargs indentifier'
                dstar_node = self.com_node(nodelist[i+1])
                i = i + 3
                continue

            # positional or named parameters
            kw, result = self.com_argument(node, kw, star_node)

            if len_nodelist != 2 and isinstance(result, GenExpr) \
               and len(node) == 3 and node[2][0] == symbol.comp_for:
                # allow f(x for x in y), but reject f(x for x in y, 1)
                # should use f((x for x in y), 1) instead of f(x for x in y, 1)
                raise SyntaxError, 'generator expression needs parenthesis'

            args.append(result)
            i = i + 2

        return CallFunc(primaryNode, args, star_node, dstar_node,
                        lineno=extractLineNo(nodelist)) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:40,代码来源:transformer.py

示例5: atom

# 需要导入模块: import token [as 别名]
# 或者: from token import RPAR [as 别名]
def atom(cls, nodelist):
        t = nodelist[1][0]
        if t == token.LPAR:
            if nodelist[2][0] == token.RPAR:
                raise SyntaxError("Empty parentheses")
            return cls.interpret(nodelist[2])
        raise SyntaxError("Language feature not supported in environment markers") 
开发者ID:aliyun,项目名称:oss-ftp,代码行数:9,代码来源:pkg_resources.py


注:本文中的token.RPAR属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。