# Path: Tools/Error.py
# class Error:
#     def __init__(self, sErrorMessage):
#         self.sErrorMessage = sErrorMessage
#     # ----------------------------------------------------
#     def sGetError(self):
#         return self.__str__()
#     # ----------------------------------------------------
#     def __str__(self):
#         return self.sErrorMessage
# 
# Path: AOR/Variable.py
# class Variable:
#     def __init__(self, sName, oVariableData=None):
#         self.sName    = sName                     # Potential an AttributeString
#         if oVariableData:
#             self.oVarData = oVariableData
#         else:
#             self.oVarData = VariableData(self.sName,{})
#     # --------------------------------------------------------------------------
#     # Forward this to the actual VariableData instance
#     def __getitem__(self, key): return self.oVarData[key]
#     # --------------------------------------------------------------------------
#     # Forward this to the actual VariableData instance
#     def __setitem__(self, key, value):
#         return self.oVarData.__setitem__(key, value)
#     # --------------------------------------------------------------------------
#     # Forward this to the actual VariableData instance
#     def __delitem__(self, key):
#         return self.oVarData.__delitem__(key)
#     # --------------------------------------------------------------------------
#     # This is necessary, since for example in a common block an expression
#     # like common /xx/ a, b(10) can be used. Now, to store the information
#     # that a common block is used, we need acces to the variable b (which is
#     # an ArrayRef). To avoid further tests, the same method is implemented
#     # for variables as well.
#     def oGetVariable(self): return self
#     # --------------------------------------------------------------------------
#     # Forward this to the actual VariableData instance
#     def GetDeclarationAsString(self, stylesheet):
#         return self.oVarData.GetDeclarationAsString(stylesheet)
#     # --------------------------------------------------------------------------
#     def GetAllUsedVariables(self):
#         l = self.oVarData.GetAllUsedVariables()
#         l.append(self)
#         return l
#     # --------------------------------------------------------------------------
#     # Sets an attributes for the variable. The attribute can be either
#     # a string (in which case the value is set to 1), or an object
#     # (e.g. dimension, type). This is forwarded to the respective VariableData
#     # instance.
#     def SetAttribute(self, att, value=1):
#         return self.oVarData.SetAttribute(att, value)
#     # --------------------------------------------------------------------------
#     # Returns a dictionary with all attributes of a variable.
#     def GetAttributes(self): return self.oVarData.GetAttributes()
#     # --------------------------------------------------------------------------
#     def sGetName(self): return self.oVarData.sGetName()
#     # --------------------------------------------------------------------------
#     def SetName(self, s) : self.oVarData.SetName(s)
#     # --------------------------------------------------------------------------
#     # Returns a string with the correct declaration of the variable, e.g.
#     # '(1:2, 3:, nlat_dyn+3, nlon_dyn,*)'. This is forwarded to the respective
#     # VariableData instance.
#     def GetDimensionAsString(self): return self.oVarData.GetDimensionAsString()
#     # --------------------------------------------------------------------------
#     def oCreateDeclarationStatement(self, nIndent=0, bUseInclude=1, bUseModule=1,
#                                     sNewName="", bAddInit=0):
#         return self.oVarData.oCreateDeclarationStatement(nIndent,
#                                                          bUseInclude=bUseInclude,
#                                                          bUseModule=bUseModule,
#                                                          sNewName=sNewName,
#                                                          bAddInit=bAddInit)
#     # --------------------------------------------------------------------------
#     def bTypeIs(self, sType):
#         return self["type"].bIsType(sType)
#     # --------------------------------------------------------------------------
#     def bIsArray(self): return self.oVarData.bIsArray()
#     # --------------------------------------------------------------------------
#     # Displays the variable name and all attributes. This is forwarded to the
#     # respective VariableData instance.
#     def DisplayAll(self): return self.oVarData.DisplayAll()
#     # --------------------------------------------------------------------------
#     # Needed for layout2d
#     def __len__(self): return len(self.sName)
#     # --------------------------------------------------------------------------
#     def ToList(self, stylesheet, l):
#         sCurrentName = self.oVarData.sGetName()
#         if string.lower(sCurrentName)==string.lower(self.sName):
#             l.append(stylesheet.sVariable(self.sName))
#             return
#         # The variable has been renamed. If the current name is a normal string,
#         # simply replace it with the new name:
#         if type(self.sName)==type(''):
#             self.sName=sCurrentName
#             l.append(sCurrentName)
#             return
#         # Otherwise sName is an AttributeString. Create a new instance of
#         # AttributeString
#         self.sName = self.sName.sCreateCopy(sCurrentName)
#         l.append(stylesheet.sVariable(self.sName))
#     # --------------------------------------------------------------------------
#     def __repr__(self): return self.sName
#     # --------------------------------------------------------------------------
# 
# Path: AOR/AttributeString.py
# class AttributeString(str):
#     def __init__(self, s):
#     def sCreateCopy(self, s):
#     def tSplitString(self, n):
#     def SetPrefixAttributes(self,  l) : self.lPrefix = l[:]
#     def SetPostfixAttributes(self, l) : self.lPostfix = l[:]
#     def AppendPrefix(self,  o):
#     def AppendPostfix(self, o):
#     def GetPrefixAttributes(self ): return self.lPrefix
#     def GetPostfixAttributes(self): return self.lPostfix
#     def GetString(self): return str.__str__(self)
#     def upper(self):
#     def lower(self):
#     def capitalize(self):
#     def ToList(self, stylesheet, l): return l.append(self)
#     def __repr__(self):


from Tools.Error         import Error
from AOR.Variable        import Variable
from AOR.AttributeString import AttributeString, Comment, CommentLine, \
                                CompilerDirective, PreDirective, ContMarker
    from Grammar.Parser     import Parser
    from Scanner.Scanner    import ScannerFactory
#!/usr/bin/env python


class Layout:

    def __init__(self, sLine):
        self.nIndent  = 7             # Current indentation
        self.nCol     = self.nIndent  # Current column

# Path: Tools/Error.py
# class Error:
#     def __init__(self, sErrorMessage):
#         self.sErrorMessage = sErrorMessage
#     # ----------------------------------------------------
#     def sGetError(self):
#         return self.__str__()
#     # ----------------------------------------------------
#     def __str__(self):
#         return self.sErrorMessage
# 
# Path: AOR/Variable.py
# class Variable:
#     def __init__(self, sName, oVariableData=None):
#         self.sName    = sName                     # Potential an AttributeString
#         if oVariableData:
#             self.oVarData = oVariableData
#         else:
#             self.oVarData = VariableData(self.sName,{})
#     # --------------------------------------------------------------------------
#     # Forward this to the actual VariableData instance
#     def __getitem__(self, key): return self.oVarData[key]
#     # --------------------------------------------------------------------------
#     # Forward this to the actual VariableData instance
#     def __setitem__(self, key, value):
#         return self.oVarData.__setitem__(key, value)
#     # --------------------------------------------------------------------------
#     # Forward this to the actual VariableData instance
#     def __delitem__(self, key):
#         return self.oVarData.__delitem__(key)
#     # --------------------------------------------------------------------------
#     # This is necessary, since for example in a common block an expression
#     # like common /xx/ a, b(10) can be used. Now, to store the information
#     # that a common block is used, we need acces to the variable b (which is
#     # an ArrayRef). To avoid further tests, the same method is implemented
#     # for variables as well.
#     def oGetVariable(self): return self
#     # --------------------------------------------------------------------------
#     # Forward this to the actual VariableData instance
#     def GetDeclarationAsString(self, stylesheet):
#         return self.oVarData.GetDeclarationAsString(stylesheet)
#     # --------------------------------------------------------------------------
#     def GetAllUsedVariables(self):
#         l = self.oVarData.GetAllUsedVariables()
#         l.append(self)
#         return l
#     # --------------------------------------------------------------------------
#     # Sets an attributes for the variable. The attribute can be either
#     # a string (in which case the value is set to 1), or an object
#     # (e.g. dimension, type). This is forwarded to the respective VariableData
#     # instance.
#     def SetAttribute(self, att, value=1):
#         return self.oVarData.SetAttribute(att, value)
#     # --------------------------------------------------------------------------
#     # Returns a dictionary with all attributes of a variable.
#     def GetAttributes(self): return self.oVarData.GetAttributes()
#     # --------------------------------------------------------------------------
#     def sGetName(self): return self.oVarData.sGetName()
#     # --------------------------------------------------------------------------
#     def SetName(self, s) : self.oVarData.SetName(s)
#     # --------------------------------------------------------------------------
#     # Returns a string with the correct declaration of the variable, e.g.
#     # '(1:2, 3:, nlat_dyn+3, nlon_dyn,*)'. This is forwarded to the respective
#     # VariableData instance.
#     def GetDimensionAsString(self): return self.oVarData.GetDimensionAsString()
#     # --------------------------------------------------------------------------
#     def oCreateDeclarationStatement(self, nIndent=0, bUseInclude=1, bUseModule=1,
#                                     sNewName="", bAddInit=0):
#         return self.oVarData.oCreateDeclarationStatement(nIndent,
#                                                          bUseInclude=bUseInclude,
#                                                          bUseModule=bUseModule,
#                                                          sNewName=sNewName,
#                                                          bAddInit=bAddInit)
#     # --------------------------------------------------------------------------
#     def bTypeIs(self, sType):
#         return self["type"].bIsType(sType)
#     # --------------------------------------------------------------------------
#     def bIsArray(self): return self.oVarData.bIsArray()
#     # --------------------------------------------------------------------------
#     # Displays the variable name and all attributes. This is forwarded to the
#     # respective VariableData instance.
#     def DisplayAll(self): return self.oVarData.DisplayAll()
#     # --------------------------------------------------------------------------
#     # Needed for layout2d
#     def __len__(self): return len(self.sName)
#     # --------------------------------------------------------------------------
#     def ToList(self, stylesheet, l):
#         sCurrentName = self.oVarData.sGetName()
#         if string.lower(sCurrentName)==string.lower(self.sName):
#             l.append(stylesheet.sVariable(self.sName))
#             return
#         # The variable has been renamed. If the current name is a normal string,
#         # simply replace it with the new name:
#         if type(self.sName)==type(''):
#             self.sName=sCurrentName
#             l.append(sCurrentName)
#             return
#         # Otherwise sName is an AttributeString. Create a new instance of
#         # AttributeString
#         self.sName = self.sName.sCreateCopy(sCurrentName)
#         l.append(stylesheet.sVariable(self.sName))
#     # --------------------------------------------------------------------------
#     def __repr__(self): return self.sName
#     # --------------------------------------------------------------------------
# 
# Path: AOR/AttributeString.py
# class AttributeString(str):
#     def __init__(self, s):
#     def sCreateCopy(self, s):
#     def tSplitString(self, n):
#     def SetPrefixAttributes(self,  l) : self.lPrefix = l[:]
#     def SetPostfixAttributes(self, l) : self.lPostfix = l[:]
#     def AppendPrefix(self,  o):
#     def AppendPostfix(self, o):
#     def GetPrefixAttributes(self ): return self.lPrefix
#     def GetPostfixAttributes(self): return self.lPostfix
#     def GetString(self): return str.__str__(self)
#     def upper(self):
#     def lower(self):
#     def capitalize(self):
#     def ToList(self, stylesheet, l): return l.append(self)
#     def __repr__(self):


# Path: Analyser/Layout.py
from Tools.Error         import Error
from AOR.Variable        import Variable
from AOR.AttributeString import AttributeString, Comment, CommentLine, \
                                CompilerDirective, PreDirective, ContMarker
    from Grammar.Parser     import Parser
    from Scanner.Scanner    import ScannerFactory

#!/usr/bin/env python


class Layout:

    def __init__(self, sLine):
        self.nIndent  = 7             # Current indentation
        self.nCol     = self.nIndent  # Current column

        self.nLine    = 0             # Current line number