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


Python DoubleList.DoubleList类代码示例

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


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

示例1: Implicit

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,代码行数:35,代码来源:Declaration.py

示例2: BasicIOList

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,代码行数:31,代码来源:IO.py

示例3: __init__

 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       = ")"
开发者ID:hiker,项目名称:stan,代码行数:8,代码来源:Statements.py

示例4: __init__

 def __init__(self, loc, sUse="USE", nIndent=0):
     BasicStatement.__init__(self, None, loc, nIndent)
     self.sUse        = sUse
     self.lNature     = []
     self.lColons     = []
     self.lOnly       = DoubleList()
     self.lOnlyString = ''
     self.lRename     = DoubleList()
     self.sComma      = None
     self.sName       = None
开发者ID:hiker,项目名称:stan,代码行数:10,代码来源:Declaration.py

示例5: CrayPointer

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,代码行数:13,代码来源:Declaration.py

示例6: DataValueList

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,代码行数:14,代码来源:Declaration.py

示例7: FunctionStatement

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,代码行数:49,代码来源:Function.py

示例8: SubroutineStatement

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,代码行数:46,代码来源:Subroutine.py

示例9: __init__

 def __init__(self, sLabel=None, loc=None, sCase='CASE',  nIndent=0):
     BasicStatement.__init__(self, sLabel, loc, nIndent, isDeclaration=0)
     self.sCase     = sCase
     self.sName     = None
     self.sDefault  = None           # for DEFAULT
     self.sParOpen  = None
     self.sParClose = None
     self.lSelector = DoubleList()
开发者ID:hiker,项目名称:stan,代码行数:8,代码来源:Select.py

示例10: __init__

 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)
开发者ID:hiker,项目名称:stan,代码行数:8,代码来源:IO.py

示例11: DataStatementSet

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,代码行数:17,代码来源:Declaration.py

示例12: __init__

 def __init__(self, sLabel=None, loc=None, sIf="IF", sParOpen='(',
              ifCond=None, sParClose=')', nIndent=0):
     BasicStatement.__init__(self, sLabel, loc, nIndent, isDeclaration=0)
     self.sIf       = sIf
     self.sParOpen  = sParOpen
     self.ifCond    = ifCond
     self.sParClose = sParClose
     self.lLabels   = DoubleList()
开发者ID:hiker,项目名称:stan,代码行数:8,代码来源:If.py

示例13: ModuleProcedure

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,代码行数:17,代码来源:Declaration.py

示例14: Allocate

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,代码行数:45,代码来源:Statements.py

示例15: Declaration

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,代码行数:55,代码来源:Declaration.py


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