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


Python DoubleList.append方法代码示例

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


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

示例1: BasicIOList

# 需要导入模块: from AOR.DoubleList import DoubleList [as 别名]
# 或者: from AOR.DoubleList.DoubleList import append [as 别名]
class BasicIOList(BasicStatement):
    def __init__(self, sLabel=None, loc=None, nIndent=0, sKeyword="",
                 sParOpen=None, opt=None):
        BasicStatement.__init__(self, sLabel, loc, nIndent, isDeclaration=0)
        self.sKeyword  = sKeyword
        self.sParOpen  = sParOpen
        self.sParClose = ')'
        self.lParams   = DoubleList()
        if opt: self.AddIOOpt(opt)
    # --------------------------------------------------------------------------
    def SetParOpen(self, sParOpen='('): self.sParOpen = sParOpen
    # --------------------------------------------------------------------------
    def SetParClose(self, sParClose=')'): self.sParClose = sParClose
    # --------------------------------------------------------------------------
    def AddIOOpt(self, exp, sComma=None):
        if type(exp)==type(1): exp=`exp`
        self.lParams.append(exp, sComma)
    # --------------------------------------------------------------------------
    def sGetParClose(self): return self.sParClose
    # --------------------------------------------------------------------------
    def GetVarUsage(self, varUsage, sType="read", obj=None, loc=None):
        for i in self.lParams.GetMainList():
            varUsage.AddVariable(i, "unknown", obj, loc)
    # --------------------------------------------------------------------------
    def ToList(self, stylesheet, l):
        BasicStatement.ToList(self, stylesheet, l)
        l.append(stylesheet.sKeyword(self.sKeyword))
        if self.sParOpen:
            l.append(self.sParOpen)
            self.lParams.ToList(stylesheet, l),
            l.append(self.sParClose)
开发者ID:hiker,项目名称:stan,代码行数:33,代码来源:IO.py

示例2: Implicit

# 需要导入模块: from AOR.DoubleList import DoubleList [as 别名]
# 或者: from AOR.DoubleList.DoubleList import append [as 别名]
class Implicit(BasicStatement):

    # Stores a parameter declaration
    def __init__(self, sImplicit="IMPLICIT", loc=None, nIndent=0):
        BasicStatement.__init__(self, None, loc, nIndent)
        self.sImplicit = sImplicit
        self.sNone     = None
        self.type      = None
        self.l         = DoubleList()
        self.sParOpen  = None
        self.sParClose = None
    # --------------------------------------------------------------------------
    def SetParOpen(self, sParOpen): self.sParOpen = sParOpen
    # --------------------------------------------------------------------------
    def SetParClose(self, sParClose): self.sParClose = sParClose
    # --------------------------------------------------------------------------
    def SetImplicitNone(self, sNone="NONE"): self.sNone=sNone
    # --------------------------------------------------------------------------
    def isNone(self): return self.sNone!=None
    # --------------------------------------------------------------------------
    def SetType(self, type): self.type=type
    # --------------------------------------------------------------------------
    def AddLetter(self, sFrom, sDash=None, sTo=None, sComma=None):
        self.l.append(FromTo(sFrom, sDash, sTo), sComma)
    # --------------------------------------------------------------------------
    def ToList(self, stylesheet, l):
        BasicStatement.ToList(self, stylesheet, l)
        l.append(stylesheet.sKeyword(self.sImplicit),nIndentNext=1)
        if self.sNone:
            l.append(stylesheet.sKeyword(self.sNone))
            return
        stylesheet.ToList(self.type, l)
        l.append(self.sParOpen)
        self.l.ToList(stylesheet, l)
        l.append(self.sParClose)
开发者ID:hiker,项目名称:stan,代码行数:37,代码来源:Declaration.py

示例3: CrayPointer

# 需要导入模块: from AOR.DoubleList import DoubleList [as 别名]
# 或者: from AOR.DoubleList.DoubleList import append [as 别名]
class CrayPointer(BasicStatement):
    def __init__(self, loc, sPointer='POINTER', nIndent=0):
        BasicStatement.__init__(self, None, loc, nIndent)
        self.sPointer = sPointer
        self.lPointer = DoubleList()
    # --------------------------------------------------------------------------
    def AddPointer(self, pointer, sComma=None):
        self.lPointer.append(pointer, sComma)
    # --------------------------------------------------------------------------
    def ToList(self, stylesheet, l):
        BasicStatement.ToList(self, stylesheet, l)
        l.append(self.sPointer, nIndentNext=1)
        self.lPointer.ToList(stylesheet, l)
开发者ID:hiker,项目名称:stan,代码行数:15,代码来源:Declaration.py

示例4: DataValueList

# 需要导入模块: from AOR.DoubleList import DoubleList [as 别名]
# 或者: from AOR.DoubleList.DoubleList import append [as 别名]
class DataValueList(BasicRepr):
    def __init__(self, sSlash1='/'):
        self.sSlash1   = sSlash1
        self.sSlash2   = None
        self.ValueList = DoubleList()
    # --------------------------------------------------------------------------
    def AddValue(self, obj, sComma=None): self.ValueList.append(obj, sComma)
    # --------------------------------------------------------------------------
    def AddSlash(self, sSlash): self.sSlash2 = sSlash
    # --------------------------------------------------------------------------
    def ToList(self, stylesheet, l):
        l.append(self.sSlash1)
        self.ValueList.ToList(stylesheet, l)
        l.append(self.sSlash2)
开发者ID:hiker,项目名称:stan,代码行数:16,代码来源:Declaration.py

示例5: FunctionStatement

# 需要导入模块: from AOR.DoubleList import DoubleList [as 别名]
# 或者: from AOR.DoubleList.DoubleList import append [as 别名]
class FunctionStatement(BasicStatement):
    def __init__(self, loc=None, nIndent=0, lType=None, sFunc="FUNCTION", sName="",
                 oFunc = None):
        BasicStatement.__init__(self, None, loc, nIndent, isDeclaration=0)
        self.sFunc       = sFunc
        self.sName       = sName
        self.lArgs       = DoubleList()
        self.sParOpen    = None
        self.sParClose   = None
        self.lType       = lType
        self.oFunc       = oFunc
        self.lResult     = []
    # --------------------------------------------------------------------------
    def SetParOpen(self, sParOpen  ): self.sParOpen  = sParOpen
    # --------------------------------------------------------------------------
    def SetParClose(self, sParClose): self.sParClose = sParClose
    # --------------------------------------------------------------------------
    def GetName(self): return self.sName
    # --------------------------------------------------------------------------
    def GetType(self): return self.lType
    # --------------------------------------------------------------------------
    def GetArguments(self): return self.lArgs.GetMainList()
    # --------------------------------------------------------------------------
    def AddArgument(self, sName, sComma=None, d=None):
        self.lArgs.append(sName, sComma)
        if self.oFunc:
            self.oFunc.AddArgument(sName, sComma=sComma, d=d)
    # --------------------------------------------------------------------------
    def SetResult(self, sResult, sParOpen, sName, sParClose):
        self.lResult = [sResult, sParOpen, sName, sParClose]
    # --------------------------------------------------------------------------
    def ToList(self, stylesheet, l):
        BasicStatement.ToList(self, stylesheet, l)
        for i in self.lType:
            if i.__class__==Type:
                i.ToList(stylesheet, l)
            else:
                l.append(stylesheet.sKeyword(i))
            l.indent(1)
        l.append(stylesheet.sKeyword(self.sFunc), nIndentNext=1)
        l.append(self.sName)
        if not self.sParOpen:
            return
        l.append(self.sParOpen)
        self.lArgs.ToList(stylesheet, l)
        l.append(self.sParClose)
        if self.lResult:
            l.indent(1)
            l.extend(self.lResult)
开发者ID:hiker,项目名称:stan,代码行数:51,代码来源:Function.py

示例6: ModuleProcedure

# 需要导入模块: from AOR.DoubleList import DoubleList [as 别名]
# 或者: from AOR.DoubleList.DoubleList import append [as 别名]
class ModuleProcedure(BasicStatement):
    def __init__(self, loc, sModule=None, sProcedure="PROCEDURE", nIndent=0):
        BasicStatement.__init__(self, None, loc, nIndent)
        self.sModule    = sModule
        self.sProcedure = sProcedure
        self.l          = DoubleList()
    # --------------------------------------------------------------------------
    def AddProcedure(self, obj, sComma=None): self.l.append(obj, sComma)
    # --------------------------------------------------------------------------
    def ToList(self, stylesheet, l):
        BasicStatement.ToList(self, stylesheet, l)
        if self.sModule:
            l.append(self.sModule,    nIndentNext=1)
            l.append(self.sProcedure, nIndentNext=1)
        else:
            l.append(self.sProcedure, nIndentNext=1)
        self.l.ToList(stylesheet, l)
开发者ID:hiker,项目名称:stan,代码行数:19,代码来源:Declaration.py

示例7: SubroutineStatement

# 需要导入模块: from AOR.DoubleList import DoubleList [as 别名]
# 或者: from AOR.DoubleList.DoubleList import append [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

示例8: DataStatementSet

# 需要导入模块: from AOR.DoubleList import DoubleList [as 别名]
# 或者: from AOR.DoubleList.DoubleList import append [as 别名]
class DataStatementSet(BasicRepr):
    def __init__(self, sComma=None):
        self.sComma     = sComma
        self.ObjectList = DoubleList()
        self.DataValue  = None
    # --------------------------------------------------------------------------
    def AddObject(self, obj, sComma=None): self.ObjectList.append(obj, sComma)
    # --------------------------------------------------------------------------
    def AddValueList(self, vl): self.DataValue = vl
    # --------------------------------------------------------------------------
    def AddSecondSlash(self, sSlash): self.sSlash2 = sSlash
    # --------------------------------------------------------------------------
    def ToList(self, stylesheet, l):
        if self.sComma:
            l.append(self.sComma, nIndentNext=1)
        self.ObjectList.ToList(stylesheet, l)
        self.DataValue.ToList(stylesheet,  l)
开发者ID:hiker,项目名称:stan,代码行数:19,代码来源:Declaration.py

示例9: Allocate

# 需要导入模块: from AOR.DoubleList import DoubleList [as 别名]
# 或者: from AOR.DoubleList.DoubleList import append [as 别名]
class Allocate(BasicStatement):

    # Stores a return statement.
    def __init__(self, sLabel=None, loc=None, sOp='ALLOCATE',sParOpen='(',
                 nIndent=0):
        BasicStatement.__init__(self, sLabel, loc, nIndent, isDeclaration=0)
        self.sOp             = sOp
        self.sParOpen        = sParOpen
        self.lVars           = DoubleList()
        self.lOptions        = DoubleList()
        self.sParClose       = ")"
    # --------------------------------------------------------------------------
    def SetParClose(self, sParClose): self.sParClose = sParClose
    # --------------------------------------------------------------------------
    # Adds a variable to allocate to the allocate statement. Parameters:
    #
    # var -- Variable to add
    #
    # sSeparator -- String which separates a variable from the next. Usual a
    #               comma, but the ')' is stored here as well.
    def AddVariable(self, var, sSeparator=None):
        self.lVars.append(var, sSeparator)
    # --------------------------------------------------------------------------
    # Appends an option (stat, errmsg, or source) to the statement. Parameters:
    #
    # sName -- Name of the option
    #
    # sEqual -- The '=' character
    #
    # obj -- A scalar int variable
    #
    # sSeparator -- String which separates an option from the next. Usual a
    #               comma, but the ')' can be stored here as well.
    def AddOption(self, sName, sEqual, obj, sSeparator=None):
        self.lOptions.append( OptionString(sName, sEqual, obj), sSeparator )
    # --------------------------------------------------------------------------
    # Creates a list of strings which represents this statement. Parameters:
    #
    # stylesheet -- The stylesheet to use during layout
    def ToList(self, stylesheet=None,l=[]):
        BasicStatement.ToList(self, stylesheet, l)
        l.extend([stylesheet.sKeyword(self.sOp), self.sParOpen]) # 'allocate', '('
        self.lVars.ToList(stylesheet, l)
        self.lOptions.ToList(stylesheet, l)
        l.append(self.sParClose)
开发者ID:hiker,项目名称:stan,代码行数:47,代码来源:Statements.py

示例10: Declaration

# 需要导入模块: from AOR.DoubleList import DoubleList [as 别名]
# 或者: from AOR.DoubleList.DoubleList import append [as 别名]
class Declaration(BasicStatement):
    def __init__(self, sType, sComma=None, loc=None, nIndent=0, var=None,
                 attribute=None):
        BasicStatement.__init__(self, None, loc, nIndent)
        self.sType        = sType
        self.sComma       = sComma
        self.lAttributes  = DoubleList()
        self.lColons      = []
        self.lVars        = DoubleList()
        if var:
            self.AppendVariable(var)
        if attribute:
            self.AddAttribute(attribute)
    # --------------------------------------------------------------------------
    # Add a variable or an array specification to the list of declaration
    def AddDeclaredVariable(self, var, sComma=None):
        self.lVars.append(var, sComma)
    # --------------------------------------------------------------------------
    # Add an attribute, like 'allocateable', ...
    def AddAttribute(self, sAtt, sComma=None):
        if len(self.lAttributes)==0 and not self.sComma:
            self.sComma=","
        self.lAttributes.append(sAtt, sComma)
    # --------------------------------------------------------------------------
    # Adds the optional double colon of a declaration. Parameters:
    # 
    # c1/c2 -- Each of the two colons (the scanner returns two colons for a ::)
    def AddDoubleColons(self, c1, c2): self.lColons=[c1,c2]
    # --------------------------------------------------------------------------
    # This function is used to construct new declaration statements:
    def AppendVariable(self, v):
        if len(self.lVars)==0:
            self.lColons=[":",":"]
            self.lVars.append(v)
        else:
            self.lVars.append(",", v)
    # --------------------------------------------------------------------------
    def GetAttributes(self):
        return self.lAttributes.GetMainList()
    # --------------------------------------------------------------------------
    def ToList(self, stylesheet, l):
        BasicStatement.ToList(self, stylesheet, l)
        stylesheet.ToList(self.sType, l)
        if self.sComma:
            l.append(self.sComma)
        l.indent(1)
        # The if is not really necessary, but without it two spaces
        # would be added in case of an empy attribute list
        if len(self.lAttributes.GetMainList())>0:
            self.lAttributes.ToList(stylesheet, l, bAddSpace=1)
            l.indent(1)
        if self.lColons:
            l.extend(self.lColons)
            l.indent(1)
        self.lVars.ToList(stylesheet, l, bAddSpace=1)
开发者ID:hiker,项目名称:stan,代码行数:57,代码来源:Declaration.py

示例11: Public

# 需要导入模块: from AOR.DoubleList import DoubleList [as 别名]
# 或者: from AOR.DoubleList.DoubleList import append [as 别名]
class Public(BasicStatement):
    # Stores a public statement declaration
    def __init__(self, loc, sPublic="PUBLIC", nIndent=0):
        BasicStatement.__init__(self, None, loc, nIndent)
        self.sPublic = sPublic
        self.lColons = None
        self.l       = DoubleList()
    # --------------------------------------------------------------------------
    def AddDoubleColons(self, c1, c2): self.lColons=[c1,c2]
    # --------------------------------------------------------------------------
    def AddObject(self, obj, sComma=None): self.l.append(obj, sComma)
    # --------------------------------------------------------------------------
    def ToList(self, stylesheet, l):
        BasicStatement.ToList(self, stylesheet, l)
        l.append(stylesheet.sKeyword(self.sPublic), nIndentNext=1)
        if self.lColons:
            l.extend(self.lColons)
        self.l.ToList(stylesheet, l)
开发者ID:hiker,项目名称:stan,代码行数:20,代码来源:Declaration.py

示例12: Intrinsic

# 需要导入模块: from AOR.DoubleList import DoubleList [as 别名]
# 或者: from AOR.DoubleList.DoubleList import append [as 别名]
class Intrinsic(BasicStatement):
    # Stores an intrinsic declaration
    def __init__(self, loc, sIntri="INTRINSIC", nIndent=0):
        BasicStatement.__init__(self, None, loc, nIndent)
        self.sIntri  = sIntri
        self.lColons = None
        self.l       = DoubleList()
    # --------------------------------------------------------------------------
    def AddDoubleColons(self, c1, c2): self.lColons=[c1,c2]
    # --------------------------------------------------------------------------
    def AddIntrinsic(self, obj, sComma=None): self.l.append(obj, sComma)
    # --------------------------------------------------------------------------
    def ToList(self, stylesheet, l):
        BasicStatement.ToList(self, stylesheet, l)
        l.append(stylesheet.sKeyword(self.sIntri),nIndentNext=1)
        if self.lColons:
            l.extend(self.lColons)
        self.l.ToList(stylesheet, l)
开发者ID:hiker,项目名称:stan,代码行数:20,代码来源:Declaration.py

示例13: Read

# 需要导入模块: from AOR.DoubleList import DoubleList [as 别名]
# 或者: from AOR.DoubleList.DoubleList import append [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

示例14: External

# 需要导入模块: from AOR.DoubleList import DoubleList [as 别名]
# 或者: from AOR.DoubleList.DoubleList import append [as 别名]
class External(BasicStatement):
   # Stores an external declaration
    def __init__(self, loc, sExternal="EXTERNAL", nIndent=0):
        BasicStatement.__init__(self, None, loc, nIndent)
        self.sExternal = sExternal
        self.lColon    = []
        self.l         = DoubleList()
    # --------------------------------------------------------------------------
    def AddDoubleColon(self, sCol1, sCol2): self.lColon=[sCol1,sCol2]
    # --------------------------------------------------------------------------
    def AddExternal(self, ext, sComma=None):
        self.l.append(ext, sComma)
    # --------------------------------------------------------------------------
    def ToList(self, stylesheet, l):
        BasicStatement.ToList(self, stylesheet, l)
        l.append(stylesheet.sKeyword(self.sExternal), nIndentNext=1)
        if self.lColon:
            l.extend(self.lColon)
        self.l.ToList(stylesheet, l)
开发者ID:hiker,项目名称:stan,代码行数:21,代码来源:Declaration.py

示例15: Equivalence

# 需要导入模块: from AOR.DoubleList import DoubleList [as 别名]
# 或者: from AOR.DoubleList.DoubleList import append [as 别名]
class Equivalence(BasicStatement):
    def __init__(self, loc, sEq="EQUIVALENCE", nIndent=0):
        BasicStatement.__init__(self, None, loc, nIndent)
        self.sEq       = sEq
        self.lObjects  = DoubleList()
    # --------------------------------------------------------------------------
    def AddObject(self, obj, sComma=None):
        self.lObjects.append(obj, sComma)
    # --------------------------------------------------------------------------    
    def GetAllUsedVariables(self):
        l=[]
        for i in self.lObjects.GetMainList():
            l.extend(i.GetAllUsedVariables())
        return l
    # --------------------------------------------------------------------------
    def ToList(self, stylesheet, l):
        BasicStatement.ToList(self, stylesheet, l)
        l.append(stylesheet.sKeyword(self.sEq))
        self.lObjects.ToList(stylesheet, l)
开发者ID:hiker,项目名称:stan,代码行数:21,代码来源:Declaration.py


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