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


Python DoubleList.lGetSecondaryList方法代码示例

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


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

示例1: SubroutineStatement

# 需要导入模块: from AOR.DoubleList import DoubleList [as 别名]
# 或者: from AOR.DoubleList.DoubleList import lGetSecondaryList [as 别名]
class SubroutineStatement(BasicStatement):
    def __init__(self, loc=None, lPrefix=[], sSub="SUBROUTINE", sName="",
                 nIndent=0, oSub = None):
        BasicStatement.__init__(self, None, loc, nIndent)
        self.lPrefix     = lPrefix
        self.sSub        = sSub
        self.sName       = sName
        self.lArgs       = DoubleList()
        self.sParOpen    = None
        self.sParClose   = None
        self.oSub        = oSub
    # --------------------------------------------------------------------------
    def SetParOpen(self, sParOpen): self.sParOpen = sParOpen
    # --------------------------------------------------------------------------
    def SetParClose(self, sParClose): self.sParClose = sParClose
    # --------------------------------------------------------------------------
    def GetName(self): return self.sName
    # --------------------------------------------------------------------------
    def GetPrefix(self): return self.lPrefix
    # --------------------------------------------------------------------------
    def GetArguments(self): return self.lArgs.GetMainList()
    # --------------------------------------------------------------------------
    def AddArgument(self, sName, sComma=None, d=None):
        if self.sParOpen==None: self.sParOpen="("
        self.sParClose = ")"
        if sComma==None and \
               len(self.lArgs.lGetSecondaryList())==len(self.lArgs)-1:
            self.lArgs.append(",", sName)
        else:
            self.lArgs.append(sName, sComma)
            
        if self.oSub:
            self.oSub.AddArgument(sName, sComma=sComma, d=d)
            
    # --------------------------------------------------------------------------
    def ToList(self, stylesheet, l):
        BasicStatement.ToList(self, stylesheet, l)
        for i in self.lPrefix:
            l.append(stylesheet.sKeyword(i), nIndentNext=1)
        l.append(stylesheet.sKeyword(self.sSub), nIndentNext=1)
        l.append(self.sName)
        if not self.sParOpen:
            return 
        l.append(self.sParOpen)
        self.lArgs.ToList(stylesheet, l)
        l.append(self.sParClose)
开发者ID:hiker,项目名称:stan,代码行数:48,代码来源:Subroutine.py

示例2: Read

# 需要导入模块: from AOR.DoubleList import DoubleList [as 别名]
# 或者: from AOR.DoubleList.DoubleList import lGetSecondaryList [as 别名]
class Read(BasicIOList):
    # Stores a read statement
    def __init__(self, sLabel=None, loc=None, nIndent=0,
                 sRead="READ", sParOpen=None,
                 nUnit=None, var=None):
        BasicIOList.__init__(self, sLabel, loc, nIndent, sRead, sParOpen)
        self.lIOExp    = DoubleList()
        self.sFormat   = None
        self.sComma    = None
        if nUnit:
            if not sParOpen: self.SetParOpen()
            self.AddIOOpt("%s"%nUnit)
            self.SetParClose()
        if var:
            self.AddIOExpression(var)
    # --------------------------------------------------------------------------
    def SetFormat(self, sFormat, sComma=None):
        self.sFormat = sFormat
        self.sComma  = sComma
    # --------------------------------------------------------------------------
    def AddIOExpression(self, exp, sComma=None):
        # To simplify manually creating statements, a comma is automatically
        # added, if only expressions are specified here (except for the first
        # call).
        if type(exp)==type(1): exp=`exp`
        if sComma==None and \
               len(self.lIOExp.lGetSecondaryList())==len(self.lIOExp)-1:
            self.lIOExp.append(",", exp)
        else:
            self.lIOExp.append(exp, sComma)
    # --------------------------------------------------------------------------
    def GetVarUsage(self, varUsage, sType="read", obj=None, loc=None):
        for i in self.lIOExp.GetMainList():
            varUsage.AddVariable(i, "write", obj, loc)
        BasicIOList.GetVarUsage(self, varUsage, sType, obj, loc)
    # --------------------------------------------------------------------------
    def ToList(self, stylesheet, l):
        BasicIOList.ToList(self, stylesheet, l)
        l.append(' ')
        if self.sFormat:
            l.append(self.sFormat, nIndent=1)
            if self.sComma:
                l.append(self.sComma)
        self.lIOExp.ToList(stylesheet, l)
开发者ID:hiker,项目名称:stan,代码行数:46,代码来源:IO.py

示例3: FunctionCall

# 需要导入模块: from AOR.DoubleList import DoubleList [as 别名]
# 或者: from AOR.DoubleList.DoubleList import lGetSecondaryList [as 别名]
class FunctionCall(BasicRepr):

    # Stores a function call.
    def __init__(self, sName=None, sArg=None):
        self.sName     = sName
        self.lArgs     = DoubleList()
        self.sParOpen  = None
        self.sParClose = None
        if sArg:
            self.sParOpen="("
            self.AddArgument(sArg)
            self.sParClose=")"
    # --------------------------------------------------------------------------
    # Returns the name of the called subroutine
    def sGetName(self): return self.sName
    # --------------------------------------------------------------------------
    def lGetArgs(self): return self.lArgs
    # --------------------------------------------------------------------------
    def SetParOpen(self, sParOpen): self.sParOpen = sParOpen
    # --------------------------------------------------------------------------
    def SetParClose(self, sParClose): self.sParClose = sParClose
    # --------------------------------------------------------------------------
    # Adds an actual argument.
    def AddArgument(self, arg, sComma=None):
        if self.sParOpen==None: self.sParOpen="("
        self.sParClose = ")"
        if sComma==None and \
               len(self.lArgs.lGetSecondaryList())==len(self.lArgs)-1:
            self.lArgs.append(",", arg)
        else:
            self.lArgs.append(arg, sComma)
    # --------------------------------------------------------------------------
    # Adds a keyword argument: keyword=val
    def AddKeywordArgument(self, sKeyword, sEqual, obj, sComma=None):
        self.lArgs.append(OptionString(sKeyword, sEqual, obj), sComma)
    # --------------------------------------------------------------------------
    # Adds an alternate return specification: *123
    def AddAltReturn(self, sStar, sLabel, sComma=None):
        self.lArgs.append(StarLabel(sStar, sLabel), sComma)
    # --------------------------------------------------------------------------
    # Adds an alternate return specification with keyword: keyw=*123
    def AddKeywordAltReturn(self, sKeyword, sEqual, sStar, sLabel, sComma=None):
        self.lArgs.append(OptionString(sKeyword, sEqual,
                                       StarLabel(sStar, sLabel)), sComma)
    # --------------------------------------------------------------------------
    def GetVarUsage(self, varUsage, sType="read", obj=None, loc=None):
        for i in self.lArgs.GetMainList():
            varUsage.AddVariable(i, "unknown", obj, loc)
    # --------------------------------------------------------------------------
    def ToList(self, stylesheet, l):
        if stylesheet["mathsmode"]:
            s = string.lower(self.sName)
            if s=="sqrt" and stylesheet["dosqrt"]:
                return stylesheet.HandleSqrt(self, l)
            if s=="exp" and stylesheet["doexp"]:
                return stylesheet.HandleExp(self, l)
            if s=="abs" and stylesheet["doabs"]:
                return stylesheet.HandleAbs(self, l)
        l.append(self.sName)
        if not self.sParOpen: return
        l.append(self.sParOpen)
        self.lArgs.ToList(stylesheet, l, bAddSpace=1)
        l.append(self.sParClose)
开发者ID:hiker,项目名称:stan,代码行数:65,代码来源:Statements.py


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